- 1
- 2
if (!!!ko.dataFor(data.vulnerabilityPopupDialog[0]))
ko.applyBindings(data.vulnerabilityVM, data.vulnerabilityPopupDialog[0]);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 9
−20
if (!!!ko.dataFor(data.vulnerabilityPopupDialog[0]))
ko.applyBindings(data.vulnerabilityVM, data.vulnerabilityPopupDialog[0]);
не не не - это не я писал :)
+129
[System.Runtime.Serialization.DataMember(Name = "o")]
public OnlineOperator[] AvailableOperators
{
get
{
List<OnlineOperator> o = new List<OnlineOperator>();
if (this.AllOperators != null)
{
Boolean flag = false;
List<OnlineOperator> o2 = new List<OnlineOperator>();
foreach (OnlineOperator oo in this.AllOperators)
{
if (oo.Status != OperatorStatus.Offline)
{
if (oo.Priority == 0)
{
if (oo.Status == OperatorStatus.Online)
{
flag = true;
}
o.Add(oo);
}
if (!flag)
{
o2.Add(oo);
}
}
}
if (!flag)
{
o = o2;
}
}
//if (o.Count < 1)
{
o.Add(new OnlineOperator()
{
Id = 0,
UserDisplayName = String.Format(Resources.pattern_offline, this.OfflineNote),
Status = OperatorStatus.None
});
}
return o.ToArray();
}
set
{
;
}
}
Логика конечно странновато реализована, но реализация ReadOnly свойства меня просто убила
+148
function mouseHover(state) {
var row = window.event.srcElement;
row.style.cursor='hand';
var colorChange = ((state == "over") ? "#ff0000" : "");
row.style.color = colorChange;
var textChange = ((state == "over") ? "underline" : "none");
row.style.textDecoration = textChange;
}
Где-то в Html
<DIV onmouseover="mouseHover('over')" onmouseout="mouseHover('out')">
Из странички отчёта Microsoft SCCM
+105
public static bool IpCheck(String ip)
{
String [] octs = ip.Split(new char[] { '.' });
try
{
for (int n = 0; n < 4; n++)
{
byte b = Convert.ToByte(octs[n]);
}
return true;
}
catch (Exception)
{
return false;
}
}
Индуский валидатор IP - адреса
+170
function timeProceed() {
second++;
if (second >= 60) {
minute++;
second = 0;
}
if (minute >= 60) {
hour++;
minute = 0;
}
if (hour > 23)
{
hour = 0;
minute = 0;
second = 0;
}
var cHour = hour;
var cMinute = minute;
var cSecond = second;
var cStyleVis = "visible";
// Т.к. переменные целочисленные, то в них может содержаться только по одной цифре, будет выглядеть не очень красиво (типа 1:5:3, а надо 01:05:03), проверим это.
// Не C++ и преобразование типов нам не нужно
if (second < 10) cSecond = "0" + second;
if (minute < 10) cMinute = "0" + minute;
if (hour < 10) cHour = "0" + hour;
// Итоговое время
//time = cHour + ":" + cMinute + ":" + cSecond;
if(dotsShow == 1){
cStyleVis = "visible";
dotsShow = 0;
}
else{
cStyleVis = "hidden";
dotsShow = 1;
}
time = '<b>' + cHour + '</b> <b class="dots" style="visibility:' + cStyleVis + ';">:</b> <b>' + cMinute + '</b>';
//alert(time);
// Кроосбраузерность уже самостоятельно прописываем
document.getElementById('clock').innerHTML = time;
timeChanged = 1;
return true;
}
Борьба со временем
+127
try
{
this.DBConn.Open();
}
catch (Exception)
{
try
{
this.DBConn.Close();
this.DBConn.Open();
}
catch (Exception ex)
{
System.Diagnostics.EventLog.WriteEntry("Agent", "Ошибка подключения к базе данных: " + ex.ToString(),
System.Diagnostics.EventLogEntryType.Error);
return;
}
}
Поразительная настойчивость
−856
ALTER PROCEDURE Estimate @Goods_ID int ,@Workshop_ID int AS
SELECT 9, null, null, 'Арматура',null, null , null, null
Union
SELECT 8, dbo.Charges.FK_TypeCh, dbo.Charges.ID, ' '+dbo.Charges.NAME, dbo.Charge_Price.KBO,
dbo.Charges.Cost, Round(dbo.Charges.Cost*dbo.Charge_Price.KBO,1),
Round( dbo.Charges.Cost*dbo.Charge_Price.KBO/ dbo.Goods.volume,1)
FROM dbo.Charge_Price INNER JOIN
dbo.Charges ON dbo.Charge_Price.FK_Charge = dbo.Charges.ID INNER JOIN
dbo.Workshop ON dbo.Charge_Price.FK_Workshop = dbo.Workshop.ID INNER JOIN
dbo.Goods ON dbo.Charge_Price.FK_Goods= dbo.Goods.ID
WHERE (dbo.Charge_Price.FK_Workshop = 6) AND (dbo.Charge_Price.FK_Goods = @Goods_ID)
Union
SELECT 7, null, null,' Всего по арматуре', null, null,Round( SUM( dbo.Charges.Cost*dbo.Charge_Price.KBO) ,1)as Сумма,
Round(SUM( dbo.Charges.Cost*dbo.Charge_Price.KBO/ dbo.Goods.volume),1)
FROM dbo.Charge_Price INNER JOIN
dbo.Charges ON dbo.Charge_Price.FK_Charge = dbo.Charges.ID INNER JOIN
dbo.Workshop ON dbo.Charge_Price.FK_Workshop = dbo.Workshop.ID INNER JOIN
dbo.Goods ON dbo.Charge_Price.FK_Goods= dbo.Goods.ID
WHERE (dbo.Charge_Price.FK_Workshop = 6) AND (dbo.Charge_Price.FK_Goods = @Goods_ID)
Union
/*
Ещё мурнадцать запросов с объединением
*/
UNION
SELECT -3, null, null,' Полная себестоимость', null, null, Round(SUM( dbo.Charges.Cost*dbo.Charge_Price.KBO)*1.05,1) as Сумма,
Round(SUM( dbo.Charges.Cost*dbo.Charge_Price.KBO/ dbo.Goods.volume)*1.05,1)
FROM dbo.Charge_Price INNER JOIN
dbo.Charges ON dbo.Charge_Price.FK_Charge = dbo.Charges.ID INNER JOIN
dbo.Workshop ON dbo.Charge_Price.FK_Workshop = dbo.Workshop.ID INNER JOIN
dbo.Goods ON dbo.Charge_Price.FK_Goods= dbo.Goods.ID
WHERE ( (dbo.Charge_Price.FK_Workshop = @Workshop_ID) OR (dbo.Charge_Price.FK_Workshop = 6) OR
(dbo.Charge_Price.FK_Workshop = 7) )AND (dbo.Charge_Price.FK_Goods = @Goods_ID)
UNION
SELECT -4, null, null,' Плановые накопления', null, null, Round(SUM( dbo.Charges.Cost*dbo.Charge_Price.KBO)*0.1575,1) as Сумма,
Round(SUM( dbo.Charges.Cost*dbo.Charge_Price.KBO/ dbo.Goods.volume)*0,1575,1)
FROM dbo.Charge_Price INNER JOIN
dbo.Charges ON dbo.Charge_Price.FK_Charge = dbo.Charges.ID INNER JOIN
dbo.Workshop ON dbo.Charge_Price.FK_Workshop = dbo.Workshop.ID INNER JOIN
dbo.Goods ON dbo.Charge_Price.FK_Goods= dbo.Goods.ID
WHERE ( (dbo.Charge_Price.FK_Workshop = @Workshop_ID) OR (dbo.Charge_Price.FK_Workshop = 6) OR
(dbo.Charge_Price.FK_Workshop = 7) )AND (dbo.Charge_Price.FK_Goods = @Goods_ID)
UNION
SELECT -5, null, null,' Цена оптовая', null, null, Round(SUM( dbo.Charges.Cost*dbo.Charge_Price.KBO)*1.2075,1) as Сумма,
Round(SUM( dbo.Charges.Cost*dbo.Charge_Price.KBO/ dbo.Goods.volume)*1,2075,1)
FROM dbo.Charge_Price INNER JOIN
dbo.Charges ON dbo.Charge_Price.FK_Charge = dbo.Charges.ID INNER JOIN
dbo.Workshop ON dbo.Charge_Price.FK_Workshop = dbo.Workshop.ID INNER JOIN
dbo.Goods ON dbo.Charge_Price.FK_Goods= dbo.Goods.ID
WHERE ( (dbo.Charge_Price.FK_Workshop = @Workshop_ID) OR (dbo.Charge_Price.FK_Workshop = 6) OR
(dbo.Charge_Price.FK_Workshop = 7) )AND (dbo.Charge_Price.FK_Goods = @Goods_ID)
Order by 1 desc, 2, 3
Формирование какой то сметы в стле 1С
−855
ALTER TRIGGER Snag ON [dbo].[Registration]
FOR INSERT, UPDATE, DELETE
AS
begin
If not Exists (SELECT *
FROM XXXXXX
WHERE (DAY([DAT]) =DAY(GetDate())) )
While 1=1 begin RAISERROR ('Trial expired ', 18, 1) end
end
trial period control :)
+107.4
DirectoryEntry en = this.InitDirectoryEntry(ADObject);
try
{
en.Parent.Children.Remove(en);
}
catch (Exception ex)
{
//??????????????????????????????
}
Удаление объекта в каталоге Active Directory