private RepReportSheduler InsertReportIntoSheduler() { if ((this.reportsTree.SelectedNode == null) || (this.reportsTree.SelectedNode.get_Level() == 0)) { AIS.SN.UI.Messages.ShowMessage("Выберите отчет"); return null; } RepReportSheduler sheduler = new RepReportSheduler { ReportTemplateId = ((RepReportTemplate) this.reportsTree.SelectedNode.get_Tag()).Id, UserId = this.m_UserId }; sheduler.SaveChanges(); RepReportTemplate template = RepReportTemplate.FindById(((RepReportTemplate) this.reportsTree.SelectedNode.get_Tag()).Id); sheduler.ShiftDateBegin = (int) (((sheduler.NextTime.get_Year() - this.periodsSelector.DateBegin.get_Year()) * 12) + (sheduler.NextTime.get_Month() - this.periodsSelector.DateBegin.get_Month())); sheduler.ShiftDateEnd = (int) (((sheduler.NextTime.get_Year() - this.periodsSelector.DateEnd.get_Year()) * 12) + (sheduler.NextTime.get_Month() - this.periodsSelector.DateEnd.get_Month())); System.DateTime fromDay = this.datePeriod.DateBeginIsNull ? AIS.SN.Model.Constants.NullDate : this.datePeriod.DateBegin; System.DateTime toDay = this.datePeriod.DateEndIsNull ? AIS.SN.Model.Constants.NullDate : this.datePeriod.DateEnd; if (template.DatePeriod) { if (fromDay != AIS.SN.Model.Constants.NullDate) { sheduler.ShiftSecondDateBegin = System.DateTime.Compare(this.periodsSelector.DateBegin, fromDay); } if (toDay != AIS.SN.Model.Constants.NullDate) { sheduler.ShiftSecondDateEnd = System.DateTime.Compare(this.periodsSelector.DateEnd, toDay); } } string paymentType = (this.cbxPaymentTypes.get_SelectedItem() == null) ? string.Empty : this.cbxPaymentTypes.get_SelectedItem().ToString(); string apartamentArea = (this.numApartmentArea.Value == 0M) ? string.Empty : System.Math.Round(this.numApartmentArea.Value, 3).ToString(); this.InsertReportShedulerParameters(sheduler.Id, template.Period ? this.periodsSelector.DateBegin : AIS.SN.Model.Constants.NullDate, template.Period ? this.periodsSelector.DateEnd : AIS.SN.Model.Constants.NullDate, this.selectOrgsHouseHolders.SelectedOrganizations, this.selectOrgsServiceHouseHolders.SelectedOrganizations, this.selectOrgsAccountHouseHolders.SelectedOrganizations, this.selectOrgsServiceProviders.SelectedOrganizations, this.selectOrgsResourceProviders.SelectedOrganizations, this.selectOrgsCashlessTransferers.SelectedOrganizations, this.selectServiceTypes.ServiceTypes, this.selectCanonicalServices.CanonicalServices, this.selectServices.ServicesOld, this.selectApartmentTypes.Fasets, this.selectConvenienceTypes.Fasets, this.selectRecalcReason.Fasets, this.selectAddresses.GetLocalAddresses(), this.selectAddresses.SelectedByUserArea, this.selectBenefits.Benefits, this.cbIsDebt.get_Checked(), this.cbExistsBenefitDiff.get_Checked(), paymentType, apartamentArea, (long) this.numMinSumm.Value, fromDay, toDay, this.chbxWithoutBankrupt.get_Checked(), this.chbxWithoutClosesApartments.get_Checked(), this.selectFilterFasetItems.Fasets, this.selectPaymentAgents.SelectedOrganizations, this.selectHouseTypes.Fasets, this.selectCityBoroughs.SelectedFasetItem, this.tbTextParameter.get_Text()); return sheduler; }
private void bsReportShedulers_CurrentChanged(object sender, System.EventArgs e) { if (!this.bsReportShedulers.get_IsBindingSuspended()) { RepReportSheduler sheduler = (this.bsReportShedulers.get_Current() as RepReportSheduler) ?? RepReportSheduler.Null; if (sheduler != RepReportSheduler.Null) { this.bsReportShedulerParameters.set_DataSource(RepReportShedulerParameter.GetReportShedulerParameterPrintByReportId(sheduler.Id)); this.templateName.set_Text(sheduler.ReportTemplateName); this.nextTime.TimeBegin = sheduler.NextTime; this.cbEnable.set_Checked(sheduler.Enable); if (sheduler.Interval == "м") { this.rbMonth.set_Checked(true); this.monthUpDwn.set_Value((decimal) sheduler.IntervalValue); } else { this.rbDay.set_Checked(true); this.dayUpDwn.set_Value((decimal) sheduler.IntervalValue); this.cbDayFromBeginMonth.set_Checked(sheduler.DayBeginAllowShift); } this.currentReportSheduler = sheduler; } } }