public AccountCashlessAverageConsumptionManualChangeForm(ApartmentCounter ac)
     : this()
 {
     this.set_Font(Manager.WindowFont);
     this.m_ApartmentCounter = ac;
     this.bsApartmentCounter.set_DataSource(this.m_ApartmentCounter);
     this.m_ApartmentCounter.BeginEdit();
 }
 public ApartmentCounterAddChangeForm()
 {
     this.m_ApartmentCounter = ApartmentCounter.Null;
     this.m_ToDate = Constants.NullDate;
     this.m_FromDate = Constants.NullDate;
     this.m_SelectedAccountServiceCounters = new ObjectList<AccountServiceCounter>();
     this.m_act = true;
     this.InitializeComponent();
 }
 public void Fill(ApartmentCounter apartmentCounter)
 {
     this.m_ApartmentCounter = apartmentCounter;
     if (this.IsForProvider)
     {
         this.tsbdgvCounterValueDelete.set_Enabled(false);
     }
     this.UpdateBindingSourceCounterIndications();
 }
 public ApartmentCounterCheckIntervalAddChangeForm(ApartmentCounter apartmentCounter, ApartmentCounterCheckInterval checkInterval)
     : this()
 {
     this.m_CheckInterval = checkInterval;
     this.set_Text(this.m_CheckInterval.IsNew ? ((string) "Добавление нового поверочного интервала") : ((string) "Изменение поверочного интервала"));
     this.btOk.set_Text(this.m_CheckInterval.IsNew ? ((string) "Добавить") : ((string) "Изменить"));
     this.m_CheckInterval.BeginEdit();
     this.m_ApartmentCounter = apartmentCounter;
     this.m_ApartmentCounter.BeginEdit();
 }
 public ApartmentCounterIndicationAddChangeForm(ApartmentCounter apartmentCounter, bool addBeginIndInd, bool addEndIndInd, bool isMaddleType)
     : this()
 {
     this.lSquare.set_Text("Показание: (от 0 до " + (decimal.op_Decrement(System.Convert.ToDecimal(System.Math.Pow(10.0, (double) apartmentCounter.CounterSize))) + 0.999M) + ")");
     this.udValue.Select(0, this.udValue.get_Text().get_Length());
     this.dbBegin.Select(0, this.dbBegin.get_Text().get_Length());
     this.m_AddBeginInd = addBeginIndInd;
     this.m_AddEndInd = addEndIndInd;
     this.m_isMaddleType = isMaddleType;
     this.m_ApartmentCounter = apartmentCounter;
 }
 public ApartmentCounterAddChangeForm(ApartmentCounter ac)
     : this()
 {
     this.set_Font(Manager.WindowFont);
     this.m_ApartmentCounter = ac;
     this.m_ToDate = this.m_ApartmentCounter.ToDate;
     this.m_FromDate = this.m_ApartmentCounter.FromDate;
     this.set_Text(this.m_ApartmentCounter.IsNew ? ((string) "Добавление нового прибора учета") : ((string) "Изменение сведений по прибору учета"));
     this.btOk.set_Text(this.m_ApartmentCounter.IsNew ? ((string) "Добавить") : ((string) "Изменить"));
     this.bsApartmentCounter.set_DataSource(this.m_ApartmentCounter);
     this.m_ApartmentCounter.BeginEdit();
     if (this.m_ApartmentCounter.IsNew)
     {
         this.btnSelectServices.set_Visible(true);
         this.m_ApartmentCounter.Factor = 1M;
     }
 }
Exemplo n.º 7
0
 private void btnCountersAdd_Click(object sender, System.EventArgs e)
 {
     if (this.m_Apartment != Apartment.Null)
     {
         ApartmentCounter ac = new ApartmentCounter {
             ApartmentId = this.m_Apartment.Id
         };
         ApartmentCounterAddChangeForm form = new ApartmentCounterAddChangeForm(ac);
         if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
         {
             this.bsApartmentCounters.Add(ac);
             this.bsApartmentCounters.set_Sort(this.bsApartmentCounters.get_Sort());
             this.bsApartmentCounters.set_Position(this.bsApartmentCounters.IndexOf(ac));
         }
     }
 }
 public void Fill(ApartmentCounter apartmentCounter)
 {
     this.tsCounterCheckIntervals.set_Enabled(User.IsMemberOf(RightsEnum.АРМБухгалтерЛСПриборыУчётаЗаведениеПоказаний));
     this.m_ApartmentCounter = apartmentCounter;
     this.UpdateBindingSourceCounterCheckIntervals();
 }
Exemplo n.º 9
0
 private void tsbChangingCounters_Click(object sender, System.EventArgs e)
 {
     if (this.m_Apartment != Apartment.Null)
     {
         ApartmentCounter currentCounter = this.GetCurrentCounter();
         if (currentCounter != ApartmentCounter.Null)
         {
             ApartmentCounterIndication indication = new ApartmentCounterIndication {
                 CounterId = currentCounter.Id,
                 ValType = FasetItem.FindByName(FasetsEnum.CounterIndicationType, "Конечное").Id
             };
             ApartmentCounterIndicationAddChangeForm form = new ApartmentCounterIndicationAddChangeForm(currentCounter, indication, false, false, false);
             form.cbTypeValue.set_Enabled(false);
             if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
             {
                 ApartmentCounter ac = new ApartmentCounter {
                     ApartmentId = currentCounter.ApartmentId,
                     CounterName = currentCounter.CounterName,
                     CounterTypeId = currentCounter.CounterTypeId,
                     CounterTypeName = currentCounter.CounterTypeName,
                     PointAccounting = currentCounter.PointAccounting,
                     CounterSize = currentCounter.CounterSize,
                     MaddleTypeId = currentCounter.MaddleTypeId,
                     MaddleTypeName = currentCounter.MaddleTypeName,
                     PlaceId = currentCounter.PlaceId,
                     PlaceName = currentCounter.PlaceName,
                     TypeScaleCounterId = currentCounter.TypeScaleCounterId,
                     TypeScaleCounterName = currentCounter.TypeScaleCounterName,
                     CounterServiceTypeId = currentCounter.CounterServiceTypeId,
                     CounterServiceTypeName = currentCounter.CounterServiceTypeName,
                     FromDate = indication.ValDate.AddDays((double) 1.0)
                 };
                 ApartmentCounterAddChangeForm form2 = new ApartmentCounterAddChangeForm(ac, true);
                 if (form2.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                 {
                     foreach (AccountServiceCounter counter3 in AccountServiceCounter.FindByApartmentCounterId(currentCounter.Id))
                     {
                         if (counter3.ToDate == currentCounter.ToDate)
                         {
                             counter3.Id = -1L;
                             counter3.CounterId = ac.Id;
                             counter3.FromDate = ac.FromDate;
                             counter3.ToDate = ac.ToDate;
                             counter3.SaveChanges();
                         }
                         else if (counter3.ToDate > currentCounter.ToDate)
                         {
                             counter3.ToDate = currentCounter.ToDate;
                             counter3.SaveChanges();
                         }
                     }
                     foreach (ApartmentEquipmentCounter counter4 in ApartmentEquipmentCounter.FindByApartmentIdCounterId(currentCounter.ApartmentId, currentCounter.Id))
                     {
                         if (counter4.Datee == Constants.NullDate)
                         {
                             counter4.Datee = currentCounter.ToDate;
                             counter4.SaveChanges();
                             counter4.Id = -1L;
                             counter4.CounterId = ac.Id;
                             counter4.Dateb = ac.FromDate;
                             counter4.Datee = ac.ToDate;
                             counter4.SaveChanges();
                         }
                         else if (counter4.Datee > currentCounter.ToDate)
                         {
                             counter4.Datee = currentCounter.ToDate;
                             counter4.SaveChanges();
                         }
                     }
                     this.UpdateBindingSourceApartmentCounters();
                     this.bsApartmentCounters.set_Sort(this.bsApartmentCounters.get_Sort());
                     this.bsApartmentCounters.set_Position(this.bsApartmentCounters.IndexOf(ac));
                 }
             }
         }
     }
 }
 public ApartmentCounterCheckIntervalsView()
 {
     this.m_ApartmentCounter = ApartmentCounter.Null;
     this.m_act = true;
     this.InitializeComponent();
 }
 public ApartmentCounterCheckIntervalsView(ApartmentCounter apartmentCounter)
     : this()
 {
     this.m_ApartmentCounter = apartmentCounter;
 }
 public void Fill(ApartmentCounter apartmentCounter)
 {
     this.tstCounterHousekeepings.set_Enabled(User.IsMemberOf(RightsEnum.АРМБухгалтерЛСПриборыУчётаЗаведениеПоказаний));
     this.m_ApartmentCounter = apartmentCounter;
     this.UpdateBindingSourceApartmentCounterEquipments();
 }
 public ApartmentCounterAddLinkingForm(ApartmentCounter ac)
     : this()
 {
     this.set_Font(Manager.WindowFont);
     this.m_ApartmentCounter = ac;
     this.m_Apartment = ac.GetApartment();
     this.selectAddresses1.OnAddressesSelected += new AddressesHandler(this.selectAddresses1_OnAddressesSelected);
     Area area = new Area {
         StatusTemporary = 1
     };
     area.SaveChanges();
     area.SaveAddresses(this.m_Apartment.AdrId);
     this.selectAddresses1.SelectedArea = area;
 }
Exemplo n.º 14
0
 public bool Validation(ApartmentCounter apartmentCounter)
 {
     bool flag = true;
     this.ValidationMessage = "";
     if (this.m_ValType <= 0)
     {
         this.ValidationMessage = this.ValidationMessage + "Не указан тип показаний" + System.Environment.get_NewLine();
         flag = false;
     }
     if (this.m_ValDate == Constants.NullDate)
     {
         this.ValidationMessage = this.ValidationMessage + "Не указанa дата начала" + System.Environment.get_NewLine();
         flag = false;
     }
     if (this.m_Val >= System.Convert.ToDecimal(System.Math.Pow(10.0, (double) apartmentCounter.CounterSize)))
     {
         this.ValidationMessage = this.ValidationMessage + "Разрядность показания не соответствует разрядности прибора учета" + System.Environment.get_NewLine();
         flag = false;
     }
     if ((!base.IsNew & (this.Created < CalcPeriod.GetFromDateLastPeriods())) && !User.IsMemberOf(RightsEnum.ИзменениеУдалениеПоказанийЗаПредыдущиеПериоды))
     {
         this.ValidationMessage = this.ValidationMessage + "У вас нет права для измненеия показаний за предыдущие периоды" + System.Environment.get_NewLine();
     }
     if ((this.ValTypeName == "Конечное") && (this.ValDate <= apartmentCounter.FromDate))
     {
         this.ValidationMessage = this.ValidationMessage + "Дата конечных показаний не может быть меньше даты начала действия прибора учета";
     }
     return flag;
 }
 public ApartmentCounterIndicationAddChangeForm(ApartmentCounter apartmentCounter, AIS.SN.Model.DomainObjects.ApartmentCounterIndication in_ci, bool isBegin, bool isEnd, bool isMaddleType)
     : this(apartmentCounter, isBegin, isEnd, isMaddleType)
 {
     this.m_ci = in_ci;
     this.list = Mappers.ApartmentCounterIndicationMapper.GetNextAndPrevious(this.m_ApartmentCounter.Id, this.m_ci.Created);
 }
 public ApartmentCounterAccountServicesView(ApartmentCounter apartmentCounter)
     : this()
 {
     this.m_ApartmentCounter = apartmentCounter;
 }
 public void Fill(ApartmentCounter apartmentCounter)
 {
     this.m_ApartmentCounter = apartmentCounter;
     this.UpdateBindingSourceApartmentServices();
 }
 public ApartmentCounterAccountServicesView()
 {
     this.m_ApartmentCounter = ApartmentCounter.Null;
     this.InitializeComponent();
 }
Exemplo n.º 19
0
 public static ObjectList<ApartmentCounterSeal> FindByCounterId(ApartmentCounter counter)
 {
     return Mappers.ApartmentCounterSealMapper.FindByCounterId(counter.Id);
 }
Exemplo n.º 20
0
 private void tsbGetCountersByOrganizations_Click(object sender, System.EventArgs e)
 {
     Area area = new Area();
     area.SaveChanges();
     area.SaveAddresses(this.selectAddresses1.GetLocalAddresses());
     area.SaveChanges();
     ApartmentCounter counter = new ApartmentCounter();
     if (this.selectOrganization1.SelectedOrganizationOld != null)
     {
         this.bsApartmentCounter.SuspendBinding();
         this.bsApartmentCounter.set_DataSource(counter.GetCountersByOrganizations(this.selectOrganization1.SelectedOrganizationOld.Id, area.Id));
         this.bsApartmentCounter.ResumeBinding();
         if (this.bsApartmentCounter.get_Count() == 0)
         {
             this.bsApartmentCounter_CurrentChanged(sender, e);
         }
     }
     else
     {
         this.bsApartmentCounter.set_DataSource(null);
         this.bsApartmentCounter_CurrentChanged(sender, e);
         System.Windows.Forms.MessageBox.Show("Необходимо выбрать адрес и организацию!");
     }
 }
 public ApartmentCounterEquipmentView()
 {
     this.m_ApartmentCounter = ApartmentCounter.Null;
     this.InitializeComponent();
 }
Exemplo n.º 22
0
 private void btnCountersAdd_Click(object sender, System.EventArgs e)
 {
     if (System.Windows.Forms.Application.OpenForms.get_Item(0).GetType().ToString() == "AIS.SN.UI.Provider.ProviderMainForm")
     {
         string valueByName = Setting.GetValueByName("Работа с приборами учета", "Диапазон в который разрешено редактирование в Поставщике");
         if ((System.Convert.ToInt32(valueByName.Substring(0, valueByName.IndexOf('-'))) > System.DateTime.Now.get_Day()) || (System.Convert.ToInt32(valueByName.Substring((int) (valueByName.IndexOf('-') + 1), (int) ((valueByName.get_Length() - valueByName.IndexOf('-')) - 1))) < System.DateTime.Now.get_Day()))
         {
             System.Windows.Forms.MessageBox.Show(string.Concat((string[]) new string[] { "Вам разрешено редактирование данных только с ", valueByName.Substring(0, valueByName.IndexOf('-')), " по ", valueByName.Substring((int) (valueByName.IndexOf('-') + 1), (int) ((valueByName.get_Length() - valueByName.IndexOf('-')) - 1)), " числа месяца" }), "Редактирование запрещено", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
             return;
         }
     }
     if (this.m_Apartment != Apartment.Null)
     {
         ApartmentCounter ac = new ApartmentCounter {
             ApartmentId = this.m_Apartment.Id
         };
         ApartmentCounterAddChangeForm form = new ApartmentCounterAddChangeForm(ac) {
             m_act = this.m_act
         };
         if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
         {
             this.bsApartmentCounters.Add(ac);
             this.bsApartmentCounters.set_Sort(this.bsApartmentCounters.get_Sort());
             this.bsApartmentCounters.set_Position(this.bsApartmentCounters.IndexOf(ac));
         }
     }
 }
 public ApartmentCounterEquipmentView(ApartmentCounter apartmentCounter)
     : this()
 {
     this.m_ApartmentCounter = apartmentCounter;
 }
 public ApartmentCounterIndicationsView(ApartmentCounter apartmentCounter)
     : this()
 {
     this.m_ApartmentCounter = apartmentCounter;
 }
 public AccountCashlessAverageConsumptionManualChangeForm()
 {
     this.m_ApartmentCounter = ApartmentCounter.Null;
     this.InitializeComponent();
     this.set_Font(Manager.WindowFont);
 }
 private void btOk_Click(object sender, System.EventArgs e)
 {
     this.dtpBeginDate.set_Value(new System.DateTime(this.dtpBeginDate.Value.get_Year(), this.dtpBeginDate.Value.get_Month(), this.dtpBeginDate.Value.get_Day()));
     this.dtpEndDate.set_Value(new System.DateTime(this.dtpEndDate.Value.get_Year(), this.dtpEndDate.Value.get_Month(), this.dtpEndDate.Value.get_Day()));
     this.m_ApartmentCounter = ApartmentCounter.FindById(this.m_ApartmentCounter.Id);
     this.m_ApartmentCounter.UserId = User.CurrentUser.Id;
     this.m_ApartmentCounter.SessionId = Session.CurrentSessionId;
     this.m_ApartmentCounter.Act = this.m_act ? ((byte) ((byte) 2)) : ((byte) ((byte) 1));
     if (this.m_CheckInterval.IsNew)
     {
         if (this.m_ApartmentCounter.ExistsUnclosedCheckInterval())
         {
             Messages.ShowError("Существует незакрытый поверочный интервал для данного счётчика.\nСоздание нового поверочного интервала невозможно.");
             base.Close();
         }
         if (this.m_ApartmentCounter.LastCheckIntervalToDate > this.dtpBeginDate.Value)
         {
             BalloonWindow.Show(this.dtpBeginDate, "Существует более ранний поверочный интервал(" + this.m_ApartmentCounter.LastCheckIntervalToDate.ToShortDateString() + ").");
             return;
         }
         if (((this.numBeginIndication.Value > 0M) && this.chbStartIndications.get_Checked()) && (this.m_ApartmentCounter.LastCheckIntervalToIndication > this.numBeginIndication.Value))
         {
             BalloonWindow.Show(this.numBeginIndication, "Показания последнего поверочного интервала превышают указанные (" + this.m_ApartmentCounter.LastCheckIntervalToIndication + ").");
             return;
         }
         if (this.cbIsClosed.get_Checked())
         {
             if (this.dtpBeginDate.Value > this.dtpEndDate.Value)
             {
                 BalloonWindow.Show(this.dtpEndDate, "Конечная дата раньше начальной!");
                 return;
             }
             if ((this.chbStartIndications.get_Checked() && this.chbEndIndications.get_Checked()) && (((this.numBeginIndication.Value > this.numEndIndication.Value) || (this.numBeginIndication.Value == 0M)) || (this.numEndIndication.Value == 0M)))
             {
                 BalloonWindow.Show(this.numEndIndication, "Конечные показания меньше начальных!");
                 return;
             }
         }
     }
     else
     {
         ApartmentCounterCheckInterval previousCheckInterval = this.m_CheckInterval.GetPreviousCheckInterval();
         if (((previousCheckInterval != null) && (previousCheckInterval != ApartmentCounterCheckInterval.Null)) && (previousCheckInterval.ToDate > this.dtpBeginDate.Value))
         {
             BalloonWindow.Show(this.dtpBeginDate, "Дата окончания предыдущего проверочного интервала(" + previousCheckInterval.ToDate.ToShortDateString() + ") больше, чем указанная дата начала интервала.");
             return;
         }
         if (((previousCheckInterval != null) && (previousCheckInterval != ApartmentCounterCheckInterval.Null)) && (this.chbStartIndications.get_Checked() && (previousCheckInterval.ToIndicationValue > this.numBeginIndication.Value)))
         {
             BalloonWindow.Show(this.numBeginIndication, "Показания предыдущего проверочного интервала(" + previousCheckInterval.ToIndicationValue + ") больше, чем указанные начальные показания.");
             return;
         }
         if (this.m_CheckInterval.ToDate <= this.dtpEndDate.MinDate)
         {
             if (this.cbIsClosed.get_Checked())
             {
                 if (this.dtpBeginDate.Value > this.dtpEndDate.Value)
                 {
                     BalloonWindow.Show(this.dtpEndDate, "Конечная дата раньше начальной!");
                     return;
                 }
                 if ((this.chbStartIndications.get_Checked() && this.chbEndIndications.get_Checked()) && (((this.numBeginIndication.Value > this.numEndIndication.Value) || (this.numBeginIndication.Value == 0M)) || (this.numEndIndication.Value == 0M)))
                 {
                     BalloonWindow.Show(this.numEndIndication, "Конечные показания меньше начальных!");
                     return;
                 }
             }
         }
         else if (this.m_ApartmentCounter.LastCheckIntervalId != this.m_CheckInterval.Id)
         {
             if (!this.cbIsClosed.get_Checked())
             {
                 Messages.ShowError("Невозможно открыть НЕпоследний поверочный интервал!");
                 return;
             }
             if (this.dtpBeginDate.Value > this.dtpEndDate.Value)
             {
                 BalloonWindow.Show(this.dtpEndDate, "Конечная дата раньше начальной!");
                 return;
             }
             if ((this.chbStartIndications.get_Checked() && this.chbEndIndications.get_Checked()) && (((this.numBeginIndication.Value > this.numEndIndication.Value) || (this.numBeginIndication.Value == 0M)) || (this.numEndIndication.Value == 0M)))
             {
                 BalloonWindow.Show(this.numEndIndication, "Конечные показания меньше начальных!");
                 return;
             }
             ApartmentCounterCheckInterval nextCheckInterval = this.m_CheckInterval.GetNextCheckInterval();
             if (((nextCheckInterval != null) && (nextCheckInterval != ApartmentCounterCheckInterval.Null)) && (nextCheckInterval.FromDate < this.dtpEndDate.Value))
             {
                 BalloonWindow.Show(this.dtpEndDate, "Дата начала следующего поверочного интервала(" + nextCheckInterval.FromDate.ToShortDateString() + ") меньше, чем указанная дата окончания");
                 return;
             }
             if ((this.chbEndIndications.get_Checked() && (nextCheckInterval != null)) && ((nextCheckInterval != ApartmentCounterCheckInterval.Null) && (nextCheckInterval.FromIndicationValue < this.numEndIndication.Value)))
             {
                 BalloonWindow.Show(this.dtpEndDate, "Начальные показания следующего поверочного интервала(" + nextCheckInterval.FromIndicationValue + ") меньше, чем указанные конечные показания");
                 return;
             }
         }
         else if (this.cbIsClosed.get_Checked())
         {
             if (this.dtpBeginDate.Value > this.dtpEndDate.Value)
             {
                 BalloonWindow.Show(this.dtpEndDate, "Конечная дата раньше начальной!");
                 return;
             }
             if ((this.chbStartIndications.get_Checked() && this.chbEndIndications.get_Checked()) && (((this.numBeginIndication.Value > this.numEndIndication.Value) || (this.numBeginIndication.Value == 0M)) || (this.numEndIndication.Value == 0M)))
             {
                 BalloonWindow.Show(this.numEndIndication, "Конечные показания меньше начальных!");
                 return;
             }
         }
     }
     this.m_CheckInterval.FromDate = this.dtpBeginDate.Value;
     this.m_CheckInterval.FromIndicationValue = this.chbStartIndications.get_Checked() ? this.numBeginIndication.Value : 0M;
     if (this.cbIsClosed.get_Checked())
     {
         this.m_CheckInterval.ToDate = this.dtpEndDate.Value;
         this.m_CheckInterval.ToIndicationValue = this.chbEndIndications.get_Checked() ? this.numEndIndication.Value : 0M;
     }
     else
     {
         this.m_CheckInterval.ToDate = System.DateTime.MinValue;
         this.m_CheckInterval.ToIndicationValue = 0M;
     }
     this.m_CheckInterval.SaveChanges();
     base.set_DialogResult(System.Windows.Forms.DialogResult.OK);
     base.Close();
 }
Exemplo n.º 27
0
 private void tsbChangingCounters_Click(object sender, System.EventArgs e)
 {
     if (System.Windows.Forms.Application.OpenForms.get_Item(0).GetType().ToString() == "AIS.SN.UI.Provider.ProviderMainForm")
     {
         string valueByName = Setting.GetValueByName("Работа с приборами учета", "Диапазон в который разрешено редактирование в Поставщике");
         if ((System.Convert.ToInt32(valueByName.Substring(0, valueByName.IndexOf('-'))) > System.DateTime.Now.get_Day()) || (System.Convert.ToInt32(valueByName.Substring((int) (valueByName.IndexOf('-') + 1), (int) ((valueByName.get_Length() - valueByName.IndexOf('-')) - 1))) < System.DateTime.Now.get_Day()))
         {
             System.Windows.Forms.MessageBox.Show(string.Concat((string[]) new string[] { "Вам разрешено редактирование данных только с ", valueByName.Substring(0, valueByName.IndexOf('-')), " по ", valueByName.Substring((int) (valueByName.IndexOf('-') + 1), (int) ((valueByName.get_Length() - valueByName.IndexOf('-')) - 1)), " числа месяца" }), "Редактирование запрещено", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
             return;
         }
     }
     if (this.m_Apartment != Apartment.Null)
     {
         ApartmentCounter currentCounter = this.GetCurrentCounter();
         if (currentCounter != ApartmentCounter.Null)
         {
             ApartmentCounterIndication indication = new ApartmentCounterIndication {
                 CounterId = currentCounter.Id,
                 ValType = FasetItem.FindByName(FasetsEnum.CounterIndicationType, "Конечное").Id
             };
             ApartmentCounterIndicationAddChangeForm form = new ApartmentCounterIndicationAddChangeForm(currentCounter, indication, false, false, false);
             form.cbTypeValue.set_Enabled(false);
             if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
             {
                 ApartmentCounter ac = new ApartmentCounter {
                     ApartmentId = currentCounter.ApartmentId,
                     CounterName = currentCounter.CounterName,
                     CounterTypeId = currentCounter.CounterTypeId,
                     CounterTypeName = currentCounter.CounterTypeName,
                     PointAccounting = currentCounter.PointAccounting,
                     CounterSize = currentCounter.CounterSize,
                     MaddleTypeId = currentCounter.MaddleTypeId,
                     MaddleTypeName = currentCounter.MaddleTypeName,
                     PlaceId = currentCounter.PlaceId,
                     PlaceName = currentCounter.PlaceName,
                     TypeScaleCounterId = currentCounter.TypeScaleCounterId,
                     TypeScaleCounterName = currentCounter.TypeScaleCounterName,
                     FromDate = indication.ValDate.AddDays((double) 1.0)
                 };
                 ApartmentCounterAddChangeForm form2 = new ApartmentCounterAddChangeForm(ac);
                 if (form2.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                 {
                     foreach (AccountServiceCounter counter3 in AccountServiceCounter.FindByApartmentCounterId(currentCounter.Id))
                     {
                         if (counter3.ToDate == Constants.NullDate)
                         {
                             counter3.ToDate = currentCounter.ToDate;
                             counter3.SaveChanges();
                             counter3.Id = -1L;
                             counter3.CounterId = ac.Id;
                             counter3.FromDate = ac.FromDate;
                             counter3.ToDate = ac.ToDate;
                             counter3.SaveChanges();
                         }
                         else if (counter3.ToDate > currentCounter.ToDate)
                         {
                             counter3.ToDate = currentCounter.ToDate;
                             counter3.SaveChanges();
                         }
                     }
                     foreach (ApartmentEquipmentCounter counter4 in ApartmentEquipmentCounter.FindByApartmentIdCounterId(currentCounter.ApartmentId, currentCounter.Id))
                     {
                         if (counter4.Datee == Constants.NullDate)
                         {
                             counter4.Datee = currentCounter.ToDate;
                             counter4.SaveChanges();
                             counter4.Id = -1L;
                             counter4.CounterId = ac.Id;
                             counter4.Dateb = ac.FromDate;
                             counter4.Datee = ac.ToDate;
                             counter4.SaveChanges();
                         }
                         else if (counter4.Datee > currentCounter.ToDate)
                         {
                             counter4.Datee = currentCounter.ToDate;
                             counter4.SaveChanges();
                         }
                     }
                     this.UpdateBindingSourceApartmentCounters();
                     this.bsApartmentCounters.set_Sort(this.bsApartmentCounters.get_Sort());
                     this.bsApartmentCounters.set_Position(this.bsApartmentCounters.IndexOf(ac));
                 }
             }
         }
     }
 }
 public ApartmentCounterAccountServiceSelectionForNewCounterForm(ApartmentCounter apartmentCounter, ObjectList<AccountServiceCounter> selectedAccountServiceCounters)
     : this()
 {
     this.m_ApartmentCounter = apartmentCounter;
     this.m_SelectedAccountServiceCounters = selectedAccountServiceCounters;
 }
Exemplo n.º 29
0
 public ApartmentCounterLinkageForm(ApartmentCounter ap)
     : this()
 {
     this.m_ApartmentCounter = ap;
     this.bsApartmentCounterLinkage.set_DataSource(Mappers.ApartmentCounterMapper.FindAllById(this.m_ApartmentCounter.Id));
     this.dgwApartmentCounterLinkage.set_DataSource(null);
     this.dgwApartmentCounterLinkage.set_DataSource(this.bsApartmentCounterLinkage);
     this.dgwApartmentCounterLinkage.Sort(this.dgwApartmentCounterLinkage.Columns.get_Item("type"), ListSortDirection.Ascending);
     this.bsApartmentCounterLinkage.set_Position(this.bsApartmentCounterLinkage.Find("apartmentId", (long) this.m_ApartmentCounter.ApartmentId));
 }
 public ApartmentCounterIndicationsView()
 {
     this.m_ApartmentCounter = ApartmentCounter.Null;
     this.m_act = true;
     this.InitializeComponent();
 }