public ServiceTypeGroupConditionAddChangeForm() { this.m_serviceTypeGroup = ServiceTypeGroup.Null; this.m_serviceTypeGroupCondition = ServiceTypeGroupCondition.Null; this.m_serviceTypeGroups = new ObjectList<ServiceTypeGroup>(); this.InitializeComponent(); if (!Manager.DesignMode) { this.set_Font(Manager.WindowFont); } }
public static ServiceTypeGroupCondition FindByServiceTypeGroupIdOrCreateNew(long serviceTypeGroupId) { ServiceTypeGroupCondition condition = Mappers.ServiceTypeGroupConditionMapper.FindByServiceTypeGroupId(serviceTypeGroupId); if (condition == null) { condition = new ServiceTypeGroupCondition { GroupId = serviceTypeGroupId }; } return condition; }
public ServiceTypeGroupConditionAddChangeForm(ObjectList<ServiceTypeGroup> serviceTypeGroups) : this() { this.m_serviceTypeGroups = serviceTypeGroups; this.set_Text("Изменение свойств группировки - " + this.GetServiceTypeGroup_ParentName()); this.btnOk.set_Text("Изменить"); this.tbxPrintNames.set_Text(""); foreach (ServiceTypeGroup group in this.m_serviceTypeGroups) { if (this.tbxPrintNames.get_Text() == "") { this.tbxPrintNames.set_Text(group.ChildShortName); } else { this.tbxPrintNames.set_Text(this.tbxPrintNames.get_Text() + ", " + group.ChildShortName); } } this.sfRate.Faset = FasetsEnum.AggregationFunction; this.sfRate.RefreshValuesWithNull(); this.sfNormRate.Faset = FasetsEnum.AggregationFunction; this.sfNormRate.RefreshValuesWithNull(); this.sfResurce.Faset = FasetsEnum.AggregationFunction; this.sfResurce.RefreshValuesWithNull(); FasetItem fasetItem = null; FasetItem @null = null; FasetItem item3 = null; bool splitByPeriod = false; foreach (ServiceTypeGroup group2 in this.m_serviceTypeGroups) { this.m_serviceTypeGroupCondition = ServiceTypeGroupCondition.FindByServiceTypeGroupIdOrCreateNew(group2.Id); if (fasetItem == null) { splitByPeriod = this.m_serviceTypeGroupCondition.SplitByPeriod; } else if (splitByPeriod != this.m_serviceTypeGroupCondition.SplitByPeriod) { splitByPeriod = false; } if (fasetItem == null) { fasetItem = Register.GetFasetItem(FasetsEnum.AggregationFunction, this.m_serviceTypeGroupCondition.RuleRateId); } else if (fasetItem != Register.GetFasetItem(FasetsEnum.AggregationFunction, this.m_serviceTypeGroupCondition.RuleRateId)) { fasetItem = FasetItem.Null; } if (@null == null) { @null = Register.GetFasetItem(FasetsEnum.AggregationFunction, this.m_serviceTypeGroupCondition.RuleNormRateId); } else if (@null != Register.GetFasetItem(FasetsEnum.AggregationFunction, this.m_serviceTypeGroupCondition.RuleNormRateId)) { @null = FasetItem.Null; } if (item3 == null) { item3 = Register.GetFasetItem(FasetsEnum.AggregationFunction, this.m_serviceTypeGroupCondition.RuleResurceId); } else if (item3 != Register.GetFasetItem(FasetsEnum.AggregationFunction, this.m_serviceTypeGroupCondition.RuleResurceId)) { item3 = FasetItem.Null; } } this.sfRate.SelectedFasetItem = fasetItem; this.sfNormRate.SelectedFasetItem = @null; this.sfResurce.SelectedFasetItem = item3; this.cb_splitByPeriod.set_Checked(splitByPeriod); }
private void btnOk_Click(object sender, System.EventArgs e) { foreach (ServiceTypeGroup group in this.m_serviceTypeGroups) { this.m_serviceTypeGroupCondition = ServiceTypeGroupCondition.FindByServiceTypeGroupIdOrCreateNew(group.Id); this.m_serviceTypeGroupCondition.BeginEdit(); this.m_serviceTypeGroupCondition.RuleRateId = this.sfRate.SelectedFasetItem.Id; this.m_serviceTypeGroupCondition.RuleNormRateId = this.sfNormRate.SelectedFasetItem.Id; this.m_serviceTypeGroupCondition.RuleResurceId = this.sfResurce.SelectedFasetItem.Id; this.m_serviceTypeGroupCondition.SplitByPeriod = this.cb_splitByPeriod.get_Checked(); this.m_serviceTypeGroupCondition.SaveChanges(); this.m_serviceTypeGroupCondition.EndEdit(); } base.set_DialogResult(System.Windows.Forms.DialogResult.Yes); }