protected override System.Data.DataSet MakeDataSource(DoWorkEventArgs e) { if (base.m_Period.DateEndIsNull || base.m_Period.DateBeginIsNull) { Messages.ShowMessage("Заполните период"); return null; } Area area = new Area(); if (this.groupAdressesView.GetSelectedAddresses().get_Count() != 0) { area.SaveChanges(); area.SaveAddresses(this.groupAdressesView.GetSelectedAddresses()); area.SaveChanges(); } ObjectList<Organization> selectedOrganizations = this.selectOrgs1.SelectedOrganizations; ObjectList<ServiceTypeOld> serviceTypes = this.selectServiceTypes1.ServiceTypes; System.DateTime fromPeriod = base.m_Period.DateBeginIsNull ? Constants.NullDate : base.m_Period.DateBegin; System.DateTime toPeriod = base.m_Period.DateEndIsNull ? Constants.NullDate : base.m_Period.DateEnd; if ((fromPeriod == Constants.MinDate) || (toPeriod == Constants.MinDate)) { Messages.ShowMessage("Не заданы даты!"); return null; } System.Data.DataSet set = Mappers.SimpleReportMapper.GetJnReportByChargeVacations(area.Id, selectedOrganizations, serviceTypes, fromPeriod, toPeriod); set.Tables.get_Item(0).set_TableName("tuning"); set.Tables.get_Item(1).set_TableName("crit"); set.Tables.get_Item(2).set_TableName("data"); area.DeleteWithRelations(); return set; }
private void btnSave_Click(object sender, System.EventArgs e) { ServiceTypeSubQualityPercent percent = (this.bsServiceTypeSuspensionTypePercent.get_Current() as ServiceTypeSubQualityPercent) ?? ServiceTypeSubQualityPercent.Null; ServiceTypeSubQualityAcceptableDuration duration = (this.bsServiceTypeSuspensionTypeAcceptableDurations.get_Current() as ServiceTypeSubQualityAcceptableDuration) ?? ServiceTypeSubQualityAcceptableDuration.Null; OrgDocument doc = this.selectOrgDocument.SelectedOrgDocument ?? OrgDocument.Null; ObjectList<LocalAddress> addresses = new ObjectList<LocalAddress>(); string text = string.Empty; if (this.m_AccountServiceSubQuality == AccountServiceSubQuality.Null) { addresses = ((OperationGroupForm) base.Parent.Parent.Parent.Parent.Parent).GetSelectedAddresses(); } if (percent == ServiceTypeSubQualityPercent.Null) { text = text + "Выберите процент снятия" + System.Environment.get_NewLine(); } if ((duration == ServiceTypeSubQualityAcceptableDuration.Null) && this.cbxServiceTypeSuspensionTypeAcceptableDurations.get_Enabled()) { text = text + "Выберите нормативные параметры" + System.Environment.get_NewLine(); } if (doc == OrgDocument.Null) { text = text + "Выберите документ" + System.Environment.get_NewLine(); } if (!this.dateTimePeriod.IsInsideOnePeriod()) { text = text + "Даты периода недопоставки должны лежать в одном месяце" + System.Environment.get_NewLine(); } if (text != string.Empty) { BalloonWindow.Show(this.btnSave, text); } else { this.m_AccountServiceSubQuality.StsqpId = percent.Id; if (this.cbxServiceTypeSuspensionTypeAcceptableDurations.get_Enabled()) { this.m_AccountServiceSubQuality.StsqadId = duration.Id; } this.m_AccountServiceSubQuality.PressureDeviation = this.numPressureDeviation.Value; this.m_AccountServiceSubQuality.SquareRooms = this.numSquareRooms.Value; this.m_AccountServiceSubQuality.DayTemperature = this.numDayTemperature.Value; this.m_AccountServiceSubQuality.NightTemperature = this.numNightTemperature.Value; this.m_AccountServiceSubQuality.FromDate = this.dateTimePeriod.TimeBegin; this.m_AccountServiceSubQuality.ToDate = this.dateTimePeriod.TimeEnd; this.m_AccountServiceSubQuality.ExceptAcceptableDuration = this.chbxExeptAcceptableDuration.get_Checked(); this.m_AccountServiceSubQuality.ReasonId = this.sfdReasons.SelectedFasetItem.Id; if ((this.m_AccountServiceSubQuality != AccountServiceSubQuality.Null) && !this.m_AccountServiceSubQuality.IsNew) { this.m_AccountServiceSubQuality.StsqpId = percent.Id; this.m_AccountServiceSubQuality.SaveChanges(); if (this.OnAddAccountServiceSubQuality != null) { this.OnAddAccountServiceSubQuality(); } } else { Area area = new Area(); area.SaveChanges(); area.SaveAddresses(addresses); GroupOperation.AddAccountServiceSubQualities(area, this.m_AccountServiceSubQuality, doc, this.chbxRunRecalc.get_Checked()); area.DeleteWithRelations(); if (this.OnAddAccountServiceSubQuality != null) { this.OnAddAccountServiceSubQuality(); } else { Messages.ShowMessage("Операция выполнена"); } } } }
private void tsAddress_Click(object sender, System.EventArgs e) { AreaAddressesForm form; User user = ((User) this.bsUsers.get_Current()) ?? User.Null; Area area = new Area(); this.addresses = LocalAddress.GetByUserId(user); area.SaveChanges(); area.SaveAddresses(this.addresses); if (this.addresses.get_Count() == 0) { form = new AreaAddressesForm(this.addressesSource, this.addressesDest); } else { form = new AreaAddressesForm(area); } if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { this.addressesDest = form.GetAddressesDest(); foreach (LocalAddress address in this.addressesDest) { if (!this.addresses.Contains(address)) { new UserAddress { UserId = user.Id, AdrId = address.Id }.SaveChanges(); } } foreach (LocalAddress address3 in this.addresses) { if (!this.addressesDest.Contains(address3)) { UserAddress.DeleteByUserAndAddress(address3, user); } } area.DeleteWithRelations(); this.addresses.Clear(); this.addressesDest.Clear(); this.addressesSource.Clear(); } }
private void btnChangeService_Click(object sender, System.EventArgs e) { string text = string.Empty; ObjectList<ServiceOld> selectedServices = this.vwServiceSearch.SelectedServices; if (selectedServices.get_Count() == 0) { text = text + "Выберите услуги" + System.Environment.get_NewLine(); } if (this.selectServices.SelectedServices.get_Count() == 0) { text = text + "Выберите услугу открытия" + System.Environment.get_NewLine(); } ServiceOld old = new ServiceOld(); if (this.selectServices.SelectedServices.get_Count() != 0) { old = this.selectServices.SelectedServices.get_Item(0); } ObjectList<LocalAddress> selectedAddresses = ((OperationGroupForm) base.Parent.Parent.Parent.Parent.Parent).GetSelectedAddresses(); OrgDocument selectedOrgDocument = this.selectOrgDocument.SelectedOrgDocument; if (this.dbxOpenDate.IsNull) { text = text + "Введите дату открытия" + System.Environment.get_NewLine(); } if (this.dbxCloseDate.IsNull) { text = text + "Введите дату закрытия" + System.Environment.get_NewLine(); } if ((!this.dbxOpenDate.IsNull && !this.dbxCloseDate.IsNull) && (this.dbxOpenDate.Value < this.dbxCloseDate.Value.AddDays((double) 1.0))) { text = text + "Дата открытия должна быть не раньше чем следующий день после даты закрытия" + System.Environment.get_NewLine(); } if (text != string.Empty) { BalloonWindow.Show(this.btnChangeService, text); } else { string str2 = string.Empty; if (selectedAddresses.get_Count() == 0) { str2 = str2 + "Вы не выбрали адреса!\nОперация будет произведена для всего адресного плана.\n"; } if (this.dbxOpenDate.Value != this.dbxCloseDate.Value.AddDays((double) 1.0)) { str2 = str2 + "Указанная дата открытия более чем на один день позже, чем дата закрытия.\n"; } if ((str2 == string.Empty) || (Messages.QuestionYesNo(this, str2 + "Вы уверены, что хотите продолжить?") == System.Windows.Forms.DialogResult.Yes)) { Area area = new Area(); area.SaveChanges(); area.SaveAddresses(selectedAddresses); string str3 = GroupOperation.CheckAccountJointServices(area.Id, selectedServices); if (str3 != string.Empty) { Messages.ShowMessage("Операция не может быть проведена,т.к. на перечисленных ниже адресах открыто более одной из выбранных услуг: " + str3); area.DeleteWithRelations(); } else if (Messages.QuestionYesNo(this, "Все выбранные услуги будут сменены на выбранную,операция необратима,продолжить?") == System.Windows.Forms.DialogResult.Yes) { bool avanceTransfer = this.cbAdvancesMove.get_Checked() ? ((bool) true) : ((bool) false); bool debtTransfer = this.chDebtTransfer.get_Checked() ? ((bool) true) : ((bool) false); bool opServicesTransfer = this.chOpServicesTransfer.get_Checked() ? ((bool) true) : ((bool) false); bool connectionCounter = this.chConnectionCounter.get_Checked() ? ((bool) true) : ((bool) false); bool connectionEquipment = this.chConnectionEquipment.get_Checked() ? ((bool) true) : ((bool) false); Organization organization = this.selectHouseHolder.SelectedOrganizationOld ?? Organization.Null; Organization organization2 = this.selectAccountHouseHolder.SelectedOrganizationOld ?? Organization.Null; foreach (ServiceOld old2 in selectedServices) { int? selectedEnumValue = this.enumDebt.SelectedEnumValue; int? nullable2 = this.enumAvance.SelectedEnumValue; GroupOperation.CloseOpenAccountService(old2.Id, old.Id, this.dbxCloseDate.Value, this.dbxOpenDate.Value, avanceTransfer, debtTransfer, selectedOrgDocument, selectedAddresses, organization.Id, organization2.Id, !this.cbxIsCharge.get_Checked(), opServicesTransfer, connectionCounter, connectionEquipment, true, true, selectedEnumValue.get_HasValue() ? selectedEnumValue.GetValueOrDefault() : ((int) 0), nullable2.get_HasValue() ? nullable2.GetValueOrDefault() : ((int) 0)); } Messages.ShowMessage("Групповая операция по смене услуги выполнена"); } } } }
private void btnChangeService_Click(object sender, System.EventArgs e) { string text = string.Empty; ObjectList<ServiceOld> selectedServices = this.vwServiceSearch.SelectedServices; if (selectedServices.get_Count() == 0) { text = text + "Выберите услуги" + System.Environment.get_NewLine(); } ServiceOld old = (ServiceOld) this.bsServiceOpen.get_Current(); ObjectList<LocalAddress> selectedAddresses = ((OperationGroupForm) base.Parent.Parent.Parent.Parent.Parent).GetSelectedAddresses(); OrgDocument selectedOrgDocument = this.selectOrgDocument.SelectedOrgDocument; if ((old == ServiceOld.Null) || (old == null)) { text = text + "Выберите услугу открытия" + System.Environment.get_NewLine(); } if (this.dbxOpenDate.IsNull) { text = text + "Введите дату открытия" + System.Environment.get_NewLine(); } if (this.dbxCloseDate.IsNull) { text = text + "Введите дату закрытия" + System.Environment.get_NewLine(); } if ((!this.dbxOpenDate.IsNull && !this.dbxCloseDate.IsNull) && (this.dbxOpenDate.Value < this.dbxCloseDate.Value.AddDays((double) 1.0))) { text = text + "Дата открытия должна быть не раньше чем следующий день после даты закрытия" + System.Environment.get_NewLine(); } if (text != string.Empty) { BalloonWindow.Show(this.btnChangeService, text); } else { string str2 = string.Empty; if (selectedAddresses.get_Count() == 0) { str2 = str2 + "Вы не выбрали адреса!\nОперация будет произведена для всего адресного плана.\n"; } if (this.dbxOpenDate.Value != this.dbxCloseDate.Value.AddDays((double) 1.0)) { str2 = str2 + "Указанная дата открытия более чем на один день позже, чем дата закрытия.\n"; } if ((str2 == string.Empty) || (Messages.QuestionYesNo(this, str2 + "Вы уверены, что хотите продолжить?") == System.Windows.Forms.DialogResult.Yes)) { Area area = new Area(); area.SaveChanges(); area.SaveAddresses(selectedAddresses); string str3 = GroupOperation.CheckAccountJointServices(area.Id, selectedServices); if (str3 != string.Empty) { Messages.ShowMessage("Операция не может быть проведена,т.к. на перечисленных ниже адресах открыто более одной из выбранных услуг: " + str3); area.DeleteWithRelations(); } else if (Messages.QuestionYesNo(this, "Все выбранные услуги будут сменены на выбранную,операция необратима,продолжить?") == System.Windows.Forms.DialogResult.Yes) { Messages.ShowMessage("Групповая операция по смене услуги выполнена"); } } } }
private void btnOK_Click(object sender, System.EventArgs e) { OrgDocument doc = this.selectOrgDocument.SelectedOrgDocument ?? OrgDocument.Null; string text = string.Empty; ServiceTypeOld sourceServiceType = ((ServiceTypeOld) this.bsSourceServiceTypes.get_Current()) ?? ServiceTypeOld.Null; ServiceTypeOld destServiceType = ((ServiceTypeOld) this.bsDestServiceTypes.get_Current()) ?? ServiceTypeOld.Null; if (sourceServiceType == ServiceTypeOld.Null) { text = text + "Выберите тип услуг, с которого нужно перенести средства" + System.Environment.get_NewLine(); } if (destServiceType == ServiceTypeOld.Null) { text = text + "Выберите тип услуг, на который нужно перенести средства" + System.Environment.get_NewLine(); } if (!this.chbxDebtTransfer.get_Checked() && !this.chbxAdvancesMove.get_Checked()) { text = text + "Выберите операцию"; } if (text != string.Empty) { BalloonWindow.Show(this.btnOK, text); } else if ((this.m_addresses.get_Count() != 0) || (Messages.QuestionYesNo(this, "Вы не выбрали адреса!\nОперация будет произведена для всего адресного плана.\nВы уверены, что хотите продолжить?") == System.Windows.Forms.DialogResult.Yes)) { Area area = new Area(); area.SaveChanges(); area.SaveAddresses(this.m_addresses); if (!this.chbxUseOnlyOpenService.get_Checked()) { int? selectedEnumValue = this.enumDebt.SelectedEnumValue; int? nullable2 = this.enumAvance.SelectedEnumValue; GroupOperation.TransferAvanceAccountServicesByServiceTypes(area, doc, this.chbxAdvancesMove.get_Checked(), this.chbxDebtTransfer.get_Checked(), sourceServiceType, destServiceType, this.chbxWithBankrupt.get_Checked(), selectedEnumValue.get_HasValue() ? selectedEnumValue.GetValueOrDefault() : ((int) 0), nullable2.get_HasValue() ? nullable2.GetValueOrDefault() : ((int) 0)); } else { int? nullable3 = this.enumDebt.SelectedEnumValue; int? nullable4 = this.enumAvance.SelectedEnumValue; GroupOperation.TransferAvanceAccountServicesByServiceTypesUseOpenAccountService(area, doc, sourceServiceType, destServiceType, this.chbxAvanceTransferFull.get_Checked(), nullable3.get_HasValue() ? nullable3.GetValueOrDefault() : ((int) 0), nullable4.get_HasValue() ? nullable4.GetValueOrDefault() : ((int) 0)); } area.DeleteWithRelations(); Messages.ShowMessage("Выравнивание остатков выполнено"); } }
private void bSave_Click(object sender, System.EventArgs e) { ObjectList<LocalAddress> selectedAddresses = ((OperationGroupForm) base.Parent.Parent.Parent.Parent.Parent).GetSelectedAddresses(); if (selectedAddresses.get_Count() <= 0) { Messages.ShowWarning("Не выбраны адреса. Групповая операция не будет выполнена."); } else { Area area = new Area(); area.SaveChanges(); area.SaveAddresses(selectedAddresses); if (this.selectOrgsHouseHolder.SelectedOrganizations != null) { if (this.dbFromDateHH.Value == Constants.NullDate) { BalloonWindow.Show(this.dbFromDateHH, "Укажите дату начала срока действия"); return; } if ((this.dbToDateHH.Value != Constants.NullDate) && (this.dbToDateHH.Value <= this.dbFromDateHH.Value)) { BalloonWindow.Show(this.dbToDateHH, "Дата начала срока действия должна быть раньше даты окончания срока действия"); return; } } if (this.selectOrganizationServiceProviders.SelectedOrganization != Organization.Null) { if (this.selectServiceTypesServiceProviders.ServiceTypes.get_Count() <= 0) { BalloonWindow.Show(this.selectServiceTypesServiceProviders, "Выберите тип услуг"); return; } if (this.dbFromDateSP.Value == Constants.NullDate) { BalloonWindow.Show(this.dbFromDateSP, "Укажите дату начала срока действия"); return; } if ((this.dbToDateSP.Value != Constants.NullDate) && (this.dbToDateSP.Value <= this.dbFromDateSP.Value)) { BalloonWindow.Show(this.dbToDateSP, "Дата начала срока действия должна быть раньше даты окончания срока действия"); return; } } if (this.selectOrganizationResourceProvider.SelectedOrganization != Organization.Null) { if (this.selectServiceTypesResourceProvider.ServiceTypes.get_Count() <= 0) { BalloonWindow.Show(this.selectServiceTypesResourceProvider, "Выберите тип услуг"); return; } if (this.dbFromDateRP.Value == Constants.NullDate) { BalloonWindow.Show(this.dbFromDateRP, "Укажите дату начала срока действия"); return; } if ((this.dbToDateRP.Value != Constants.NullDate) && (this.dbToDateRP.Value <= this.dbFromDateRP.Value)) { BalloonWindow.Show(this.dbToDateRP, "Дата начала срока действия должна быть раньше даты окончания срока действия"); return; } } bool flag = false; if (this.selectOrgsHouseHolder.SelectedOrganizations != null) { GroupOperation.AddHouseHouseHolder(area, this.selectOrgsHouseHolder.SelectedOrganizations, this.dbFromDateHH.Value, this.dbToDateHH.Value); flag = true; } if (this.selectOrganizationServiceProviders.SelectedOrganization != Organization.Null) { GroupOperation.AddHouseServiceProviders(area, this.selectOrganizationServiceProviders.SelectedOrganization, this.selectServiceTypesServiceProviders.ServiceTypes, this.dbFromDateSP.Value, this.dbToDateSP.Value); flag = true; } if (this.selectOrganizationResourceProvider.SelectedOrganization != Organization.Null) { GroupOperation.AddHouseResourceProviders(area, this.selectOrganizationResourceProvider.SelectedOrganization, this.selectServiceTypesResourceProvider.ServiceTypes, this.dbFromDateRP.Value, this.dbToDateRP.Value); flag = true; } area.DeleteWithRelations(); if (flag) { Messages.ShowMessage("Групповая операция успешно выполнена"); } else { Messages.ShowMessage("Уточните параметры групповой операции"); } } }