コード例 #1
0
 public HouseCounterAddChangeForm(long houseId, HouseCounter hc, HouseCounterIndication hciFrom, HouseCounterIndication hciTo)
     : this()
 {
     this.m_HouseId = houseId;
     this.m_HouseCounter = hc;
     this.m_HouseCounterFromIndication = (hciFrom == HouseCounterIndication.Null) ? new HouseCounterIndication() : hciFrom;
     this.m_HouseCounterToIndication = (hciTo == HouseCounterIndication.Null) ? new HouseCounterIndication() : hciTo;
     if (this.m_HouseCounter != HouseCounter.Null)
     {
         this.cbStatusASKUPE.Faset = FasetsEnum.StatusASKUPE;
         this.cbStatusASKUPE.RefreshValuesWithNull();
         this.cbStatusASKUPE.set_SelectedItem(FasetItem.FindById(hc.StatusAscupe));
         this.selectType.Faset = FasetsEnum.CounterTypes;
         this.selectType.RefreshValues();
         this.selectType.set_Text(this.m_HouseCounter.TypeCounterName);
         this.tbCounterName.set_Text(this.m_HouseCounter.CounterName);
         this.tbCounterNumber.set_Text(this.m_HouseCounter.CounterNumber);
         this.tbNote.set_Text(this.m_HouseCounter.Note);
         this.tbCodeASKUPE.set_Text(this.m_HouseCounter.PointAccounting);
         this.nudCapacity.set_Value((decimal) this.m_HouseCounter.Capacity);
         this.cbMark.set_DataSource(CounterMark.FindAll());
         foreach (CounterMark mark in this.cbMark.Items)
         {
             if (mark.Id == this.m_HouseCounter.MarkId)
             {
                 this.cbMark.set_SelectedItem(mark);
             }
         }
         this.chbIsInternal.set_Checked(this.m_HouseCounter.IsInternal);
         this.dbFromDate.Value = this.m_HouseCounter.FromDate;
         this.dbToDate.Value = this.m_HouseCounter.ToDate;
         this.nudFactor.set_Value(this.m_HouseCounter.Factor);
         this.btnAddChange.set_Text("Изменить");
     }
 }
コード例 #2
0
 public HouseCounterAddChangeForm()
 {
     this.m_HouseCounter = HouseCounter.Null;
     this.m_HouseCounterFromIndication = HouseCounterIndication.Null;
     this.m_HouseCounterToIndication = HouseCounterIndication.Null;
     this.InitializeComponent();
     this.set_Font(Manager.WindowFont);
 }
コード例 #3
0
 public HouseCounterAddChangeForm(long houseId)
     : this()
 {
     this.m_HouseId = houseId;
     this.cbStatusASKUPE.Faset = FasetsEnum.StatusASKUPE;
     this.cbStatusASKUPE.RefreshValuesWithNull();
     this.cbStatusASKUPE.SelectedFasetItem = FasetItem.Null;
     this.selectType.Faset = FasetsEnum.CounterTypes;
     this.selectType.RefreshValues();
     this.cbMark.set_DataSource(CounterMark.FindAll());
     this.cbMark.set_SelectedItem(CounterMark.Null);
     this.m_HouseCounterFromIndication = new HouseCounterIndication();
     this.m_HouseCounterToIndication = new HouseCounterIndication();
     this.btnAddChange.set_Text("Добавить");
 }
コード例 #4
0
 public HomeCountersIndicationAddChangeForm(HouseCounter counter, HouseCounterIndication indication)
     : this()
 {
     this.m_counter = counter;
     this.m_indication = indication;
     this.btnAddChange.set_Text("Изменить");
     this.set_Text("Изменение показаний счетчика");
     this.tbVal.set_Text(this.m_indication.Val.ToString());
     this.tbValInfo.set_Text(this.m_indication.ValInfo.ToString());
     this.dbValDate.Value = this.m_indication.ValDate;
     this.tbValDop.set_Text(this.m_indication.ValDop.ToString());
     this.tbSquare.set_Text(this.m_indication.HouseSquare.ToString());
     this.selectValType.set_Text(this.m_indication.ValTypeName);
     this.typeName.set_Text(this.m_indication.TypeName);
     this.cbNegative.set_Checked(this.m_indication.IsUseNegativeValue);
     this.tbLimit.set_Text(this.m_indication.LimitFactor.ToString());
     this.tbNote.set_Text(this.m_indication.Note);
 }
コード例 #5
0
 public HomeCountersIndicationAddChangeForm(HouseCounter counter, HouseCounterIndication indication, bool fix)
     : this(counter, indication)
 {
     if (fix)
     {
         this.m_Fix = (this.m_indication.ValTypeName == "Конечное") ? ((bool) true) : ((bool) (this.m_indication.ValTypeName == "Начальное"));
         if (this.m_Fix)
         {
             this.selectValType.set_Enabled(false);
             this.dbValDate.set_Enabled(false);
             this.btnCancel.set_Enabled(false);
         }
         if (indication.IsNew)
         {
             this.btnAddChange.set_Text("Добавить");
             this.set_Text("Добавление показаний счетчика");
         }
         else
         {
             this.btnAddChange.set_Text("Изменить");
             this.set_Text("Изменение показаний счетчика");
         }
     }
 }
コード例 #6
0
 private void btnAddChange_Click(object sender, System.EventArgs e)
 {
     if (this.selectValType.SelectedFasetItem == FasetItem.Null)
     {
         BalloonWindow.Show(this.btnAddChange, "Тип показаний не определен");
     }
     else
     {
         decimal num;
         decimal num2;
         decimal num3;
         decimal num4;
         try
         {
             num = decimal.Parse(this.tbVal.get_Text());
         }
         catch
         {
             BalloonWindow.Show(this.btnAddChange, "В значение должно быть введено число.");
             return;
         }
         try
         {
             num2 = decimal.Parse(this.tbValInfo.get_Text());
         }
         catch
         {
             BalloonWindow.Show(this.btnAddChange, "В значение должно быть введено число.");
             return;
         }
         try
         {
             num3 = decimal.Parse(this.tbValDop.get_Text());
         }
         catch
         {
             BalloonWindow.Show(this.btnAddChange, "В значение должно быть введено число.");
             return;
         }
         try
         {
             num4 = decimal.Parse(this.tbSquare.get_Text());
         }
         catch
         {
             BalloonWindow.Show(this.btnAddChange, "В значение должно быть введено число.");
             return;
         }
         if (!this.dbValDate.IsNull)
         {
             bool flag = false;
             for (int i = 0; i < this.typeName.Items.get_Count(); i = (int) (i + 1))
             {
                 if (this.typeName.get_Text() == this.typeName.Items.get_Item(i).ToString())
                 {
                     flag = true;
                 }
             }
             if (!flag && (this.typeName.get_Text() != ""))
             {
                 BalloonWindow.Show(this.btnAddChange, "Допускается значение только из списка или пустое.");
             }
             else
             {
                 decimal num6;
                 string str;
                 try
                 {
                     num6 = decimal.Parse(this.tbLimit.get_Text());
                     if (num6 < 0M)
                     {
                         BalloonWindow.Show(this.btnAddChange, "Значение коэффициента должно быть положительным числом.");
                         return;
                     }
                 }
                 catch
                 {
                     BalloonWindow.Show(this.btnAddChange, "В значение должно быть введено число.");
                     return;
                 }
                 if (this.m_indication == null)
                 {
                     this.m_indication = new HouseCounterIndication();
                     this.m_indication.CounterId = this.m_counter.Id;
                 }
                 else if (((this.selectValType.get_Text() == "Конечное") || (this.selectValType.get_Text() == "Начальное")) && (this.m_indication.ValDate != this.dbValDate.Value))
                 {
                     BalloonWindow.Show(this.btnAddChange, "Для изменения даты в конечном и начальном показаний\n установите значения в свойствах счетчика.");
                     return;
                 }
                 if (!this.ValidateIndication(out str))
                 {
                     BalloonWindow.Show(this.btnAddChange, str);
                 }
                 else
                 {
                     this.m_indication.ValDate = this.dbValDate.Value;
                     this.m_indication.Val = num;
                     this.m_indication.ValTypeId = this.selectValType.SelectedFasetItem.Id;
                     this.m_indication.ValInfo = num2;
                     this.m_indication.ValDop = num3;
                     this.m_indication.TypeId = this.typeName.SelectedFasetItem.Id;
                     this.m_indication.IsUseNegativeValue = this.cbNegative.get_Checked();
                     this.m_indication.LimitFactor = num6;
                     this.m_indication.HouseSquare = num4;
                     this.m_indication.UserId = User.CurrentUser.Id;
                     this.m_indication.Note = this.tbNote.get_Text().ToString();
                     this.m_indication.SaveChanges();
                     base.set_DialogResult(System.Windows.Forms.DialogResult.OK);
                 }
             }
         }
         else
         {
             BalloonWindow.Show(this.btnAddChange, "Не введена дата.");
         }
     }
 }