- 1
- 2
- 3
- 4
code = _factorCodeMax[factorUnid];
code++;
_factorCodeMax[factorUnid] = code;
return code;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+138
code = _factorCodeMax[factorUnid];
code++;
_factorCodeMax[factorUnid] = code;
return code;
+139
var priorities = Repository.Get<IIncidentPriority>().Query().OrderBy(x => x.Priority)
.Select(x => new InputItem { Id = x.Id.ToString(CultureInfo.InvariantCulture), Value = x.LocalizationValue })
.ToList();
priorities.Add(new InputItem { Id = "-1", Value = Localizator.Get("X4.Incident.Undefined") });
priorities.Reverse();
тру хацкеры презирают метод Insert )
+134
private void LettersOnChanged(object sender, EventArgs eventArgs)
{
this._lettersBinding.Clear();
this._lettersBinding.AddRange(this._letters);
this.MailAgentGridControl.ResetBindings();
this.MailAgentGridControl.RefreshDataSource();
_bindingSourceLetters.ResetCurrentItem();
_bindingSourceLetters.ResetBindings(false);
int pos = _bindingSourceLetters.Position;
this.MailAgentGridControl.DataSource = null;
this.MailAgentGridControl.DataSource = _bindingSourceLetters;
if (_bindingSourceLetters.Current == null)
{
_guiCtrl.CurrentLetter = null;
return;
}
if (pos > _bindingSourceLetters.Count - 1)
pos = _bindingSourceLetters.Count - 1;
if (pos < 0)
return;
_bindingSourceLetters.Position = pos;
MailAgentGridControlTableView.UnselectRow(MailAgentGridControlTableView.GetRowHandle(0));
MailAgentGridControlTableView.SelectRow(pos);
}
Все ради того,чтоб при изменении датабинда в гриде менялась строка выделения.
+131
if (Cache[articlesRssData] != null)
{
return Cache[articlesRssData] as ArticleRssData?;
}
return null;
+137
private static Tag GetTopic(Guid tagId)
{
var tag = DataService.PerThread.TagSet.SingleOrDefault(x => x.Id == tagId);
if (tag == null && tag.GroupId != null)
return null;
if (tag.TopicState != (byte)TopicState.GroupTopic)
return null;
return tag;
}
+142
while (true)
{
try
{
ProductService.Invoke(method);
return;
}
catch(Exception ex)
{
if (ex is System.ServiceModel.CommunicationException)
{
if (currentRetryCount == RetryCount)
throw new CommunicationException(CommunicationFailureMessage, ex);
System.Threading.Thread.Sleep(RetryWait);
currentRetryCount++;
}
}
}
+140
FileInfo file = new FileInfo(fileName);
FileSecurity fSecurity = File.GetAccessControl(fileName);
foreach (FileSystemAccessRule permissions in fSecurity.GetAccessRules(true, true, typeof(NTAccount)))
{
string login = permissions.IdentityReference.Translate(typeof(NTAccount)).Value.ToString();
string permiss = permissions.FileSystemRights.ToString();
if ((login != "логин") && (login != "логин") && (login != "логин"))
{
fSecurity.SetAccessRuleProtection(true, false);
fSecurity.RemoveAccessRule(new FileSystemAccessRule(login, permissions.FileSystemRights, AccessControlType.Allow));
}
fSecurity.AddAccessRule(new FileSystemAccessRule("логин", FileSystemRights.FullControl, AccessControlType.Allow));
fSecurity.AddAccessRule(new FileSystemAccessRule("логин", FileSystemRights.FullControl, AccessControlType.Allow));
}
File.SetAccessControl(fileName, fSecurity);
+141
foreach (var item in text.Split(' ')) {
if (!string.IsNullOrEmpty(item)) {
text = item;
break;
}
}
переменная text всегда содержит несколько пробелов и затем идентификатор.
+106
IDictionary activeProcesses = (IDictionary)(new Hashtable());
По мотивам
http://govnokod.ru/11512
Код встречен в книге http://tinyurl.com/eai-patterns
Можно объяснить человеку, не знакомому с тонкостями C#, зачем это нужно, если Hashtable : IDictionary?
+137
model = (IModel)Activator.CreateInstance("DataModel", type).Unwrap() as IModel;