private void workerProcess_DoWork(object sender, DoWorkEventArgs e) { object[] objArray = e.get_Argument() as object[]; e.set_Result(null); try { GroupOperation.AccountChangeHouseHolder(objArray[0] as Organization, objArray[1] as Organization, this.dbFromDate.Value, objArray[2] as ObjectList<LocalAddress>, this.tbAccountNumberSufix.get_Text().Trim(), this.cbMoveDebtChangeHH.get_Checked(), this.cbMoveAvansChangeHH.get_Checked(), this.cbMoveTimeOffChangeHH.get_Checked(), this.dt, (this.selectOrgDoc.SelectedOrgDocument == null) ? ((long) 0L) : this.selectOrgDoc.SelectedOrgDocument.Id); } catch (System.Exception exception) { e.set_Result(exception); } }
private void bwArea_DoWork(object sender, DoWorkEventArgs e) { if (this.addressesSelectControl1.getChecked) { if (e.get_Argument() is Area) { Area area = (Area) e.get_Argument(); object[] objArray = new object[] { area.GetLocalAddresses(), area.GetInversedCollapsedAddresses() }; e.set_Result(objArray); } else if (e.get_Argument() is AreaGroup) { AreaGroup group = (AreaGroup) e.get_Argument(); object[] objArray2 = new object[] { group.GetLocalAddresses(), group.GetInversedCollapsedAddresses() }; e.set_Result(objArray2); } } else { e.set_Result(e.get_Argument()); } }
private void bwProcess_DoWork(object sender, DoWorkEventArgs e) { ObjectList<PayRequestGate> list = (ObjectList<PayRequestGate>) e.get_Argument(); foreach (PayRequestGate gate in list) { gate.ProcessRequestGate(); } }
private void workerCompareServices_DoWork(object sender, DoWorkEventArgs e) { ObjectList<Service> list; ObjectList<Service> list2; object[] objArray = e.get_Argument() as object[]; GroupOperation.GetNotExistsServicesByHouseHolder((objArray[0] as Area).Id, objArray[1] as Organization, objArray[2] as Organization, out list, out list2, this.dbFromDate.Value); object[] objArray2 = new object[] { list, list2 }; e.set_Result(objArray2); (objArray[0] as Area).DeleteWithRelations(); }
private void m_WorkerFind_DoWork(object sender, DoWorkEventArgs e) { object[] objArray = (object[]) e.get_Argument(); Account account = objArray[0] as Account; System.DateTime fromDate = (System.DateTime) objArray[1]; System.DateTime toDate = (System.DateTime) objArray[2]; FasetItem typeOperation = objArray[3] as FasetItem; FasetItem typeRecalc = objArray[4] as FasetItem; FasetItem typeAgent = objArray[5] as FasetItem; bool loadSumm = (bool) ((bool) objArray[6]); ObjectList<GroupOperation> list = GroupOperation.FindByAccountPeriodCreated(typeOperation, typeRecalc, typeAgent, account, fromDate, toDate, loadSumm); e.set_Result(list); }
private void bwLoadAddresses_DoWork(object sender, DoWorkEventArgs e) { e.set_Result(((Area) e.get_Argument()).GetAddresses()); }
private void m_CalcWorker_DoWork(object sender, DoWorkEventArgs e) { if ((e.get_Argument() == null) || (e.get_Argument() == Area.Null)) { GroupOperation.InitialCalculation(0L); } else { GroupOperation.InitialCalculation(((Area) e.get_Argument()).Id); ((Area) e.get_Argument()).DeleteWithRelations(); } }
private void m_RequestWorker_DoWork(object sender, DoWorkEventArgs e) { this.m_Request = ObjectWithId.FindById<PayRequest>(this.m_Request.Id); Organization organization = ((Organization) this.m_HouseHoldersSource.get_Current()) ?? Organization.Null; this.m_Request.HouseHolderId = organization.Id; this.m_Request.Period = (System.DateTime) e.get_Argument(); this.m_Request.PaidSumm = 0M; this.m_Request.UseBankrupt = this.chbxUseAccountServiceBankrupts.get_Checked(); this.m_Request.PaymentOrderDate = this.m_OrderDate; this.m_Request.NeedServiceCollapse = Settings.Default.NeedServiceCollapse; this.m_Request.SubService = this.m_subService; this.m_Request.IsManualReturn = Settings.Default.CashierReturnMode; this.m_Request.DebtActionId = this.m_DebtActionId; this.m_Request.PaymentDate = this.m_PaymentDate; this.m_Request.SaveChanges(); foreach (PayRequestServicePayAmount amount in this.m_Request.GetRequestServicePayAmounts()) { amount.Delete(); } ObjectList<PayRequestService> requestServices = this.m_ServicesSource.get_DataSource() as ObjectList<PayRequestService>; if ((requestServices != null) && !this.m_HouseHolderChanged) { this.FillPayRequestServicePayAmount(requestServices); } this.m_Request.ProcessRequest_Cash(this.m_IsFirstRequest); requestServices = this.m_ServicesSource.get_DataSource() as ObjectList<PayRequestService>; if ((requestServices != null) && this.m_HouseHolderChanged) { this.FillPayRequestServicePayAmount(requestServices); this.m_HouseHolderChanged = false; } this.m_Request = ObjectWithId.FindById<PayRequest>(this.m_Request.Id); }
private void workerNotices_DoWork(object sender, DoWorkEventArgs e) { object[] objArray = e.get_Argument() as object[]; if (objArray != null) { NoticeNotice.GenerateNotices((System.DateTime) objArray[0], (long) ((long) objArray[1]), (ObjectList<Organization>) objArray[2], (bool?) objArray[3], (bool) ((bool) objArray[4]), false); } }
private void workerExportPdf_DoWork(object sender, DoWorkEventArgs e) { char[] chArray2; int num12; int num13; object obj2; char[] invalidFileNameChars = System.IO.Path.GetInvalidFileNameChars(); BackgroundWorker worker = sender as BackgroundWorker; NoticeExportPdfParams @params = e.get_Argument() as NoticeExportPdfParams; ObjectList<NoticeNotice> notices = @params.Notices; int num = 0; if (this.rbExportAccountNotices.get_Checked()) { foreach (NoticeNotice notice in notices) { if (worker.get_CancellationPending()) { e.set_Cancel(true); break; } string str2 = string.IsNullOrEmpty(notice.HouseHolderName) ? ((string) "Неизвестная УК") : notice.HouseHolderName; chArray2 = invalidFileNameChars; num12 = 0; while (num12 < chArray2.Length) { char ch = chArray2[num12]; str2 = str2.Replace(ch, ' '); num12 = (int) (num12 + 1); } str2 = str2.Trim(); System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(System.IO.Path.Combine(@params.PeriodDirectory.get_FullName(), str2)); if (!info.get_Exists()) { info.Create(); } ObjectList<NoticeNotice> list2 = new ObjectList<NoticeNotice>(); list2.Add(notice); try { using (System.Data.DataTable table = NoticeNotice.GetHeader(list2, this.cbHideClosedAccounts.get_Checked(), this.cbNoticeInformation.get_Checked())) { table.set_TableName("header"); using (System.Data.DataSet set = NoticeNotice.GetReport(list2, @params.NoticeTemplate.Sql)) { if ((set.Tables.get_Count() < 2) || (set.Tables.get_Item(0).Rows.get_Count() == 0)) { continue; } bool flag = false; foreach (System.Data.DataRow row in table.Rows) { if (System.Convert.ToInt64(row.get_Item("id")) == notice.Id) { foreach (System.Data.DataRow row2 in set.Tables.get_Item(0).Rows) { if (System.Convert.ToInt64(row2.get_Item("id")) == notice.Id) { flag = true; break; } } } } if (!flag) { continue; } set.Tables.get_Item(0).set_TableName("pays"); set.Tables.get_Item(1).set_TableName("counter"); for (int i = 2; i < set.Tables.get_Count(); i = (int) (i + 1)) { num13 = (int) (i - 1); set.Tables.get_Item(i).set_TableName("data" + ((int) num13).ToString()); } if (@params.NoticeTemplate.IdentityName == "Счет на оплату Ульяновск вариант 3") { if (set.Tables.get_Count() > 2) { set.Tables.get_Item(2).set_TableName("organizations"); } if (set.Tables.get_Count() > 3) { set.Tables.get_Item(3).set_TableName("rates"); } } using (StiReport report = new StiReport()) { report.LoadFromString(@params.NoticeTemplate.Template); report.ReportCacheMode = StiReportCacheMode.Off; report.Compile(); foreach (System.Data.DataTable table2 in set.Tables) { report.RegData(table2.get_TableName(), (System.Data.DataTable) table2); } report.RegData("header", (System.Data.DataTable) table); string accountNumber = notice.AccountNumber; string str5 = System.IO.Path.Combine(info.get_FullName(), accountNumber); if (System.IO.File.Exists(str5 + ".pdf")) { int num5 = 1; num5 = 1; while (System.IO.File.Exists(str5 + "(" + ((int) num5).ToString() + ").pdf")) { num5 = (int) (num5 + 1); } obj2 = str5; str5 = string.Concat((object[]) new object[] { obj2, "(", ((int) num5), ")" }); } report.ReportCacheMode = StiReportCacheMode.Off; report.Compile(); report.Render(false); new StiPdfExportService().ExportPdf(report, str5 + ".pdf"); } } } } catch (System.Exception exception) { string message = string.Format("[{0}] Ошибка при выгрузке в PDF: Адрес: {4}, ЛС {3}{1}{2}{1}", new object[] { System.DateTime.Now.ToShortTimeString(), System.Environment.get_NewLine(), exception.get_Message(), notice.AccountNumber, notice.AddressName }); this.AddMessageToLogFile(info.get_FullName(), message, "errors"); continue; } int num6 = (int) (((num = (int) (num + 1)) * 100) / notices.get_Count()); worker.ReportProgress(num6, (int) num); } } else { BoundaryCollection<long> boundarys = null; System.Collections.Generic.Dictionary<long, int[]> dictionary = null; foreach (System.Collections.Generic.KeyValuePair<string, System.Collections.Generic.IList<NoticeNotice>> pair in @params.HouseHolderNotices) { boundarys = new BoundaryCollection<long>(@params.MaxNoticesPerDocument, @params.MinHouseCount); dictionary = new System.Collections.Generic.Dictionary<long, int[]>(); foreach (NoticeNotice notice2 in pair.Value) { num = (int) (num + 1); long num7 = (notice2.AddressLevel == 40) ? notice2.ParentAddrId : notice2.AddrId; if (!dictionary.ContainsKey(num7)) { dictionary.Add(num7, new int[] { 1, notice2.AddressLevel }); } else { dictionary[num7][0] += 1; } } int num8 = (int) ((num * 100) / notices.get_Count()); worker.ReportProgress(num8, (int) num); foreach (System.Collections.Generic.KeyValuePair<long, int[]> pair2 in dictionary) { boundarys.Add(pair2.Key, pair2.Value[0]); } System.Collections.Generic.Dictionary<string, int> dictionary2 = new System.Collections.Generic.Dictionary<string, int>(); foreach (BoundaryCollectionNode<long> node in boundarys.Lists) { if (node.Items.get_Count() > 0) { if (worker.get_CancellationPending()) { e.set_Cancel(true); break; } ObjectList<NoticeNotice> list3 = new ObjectList<NoticeNotice>(); string str7 = null; System.Text.StringBuilder builder = new System.Text.StringBuilder(); foreach (long num9 in node.Items) { foreach (NoticeNotice notice3 in notices) { if (dictionary[num9][1] == 40) { if (notice3.ParentAddrId == num9) { if (str7 == null) { str7 = string.IsNullOrEmpty(notice3.HouseHolderName) ? AIS.SN.Model.Constants.ObjectNotChoosedCaption : notice3.HouseHolderName; if (!dictionary2.ContainsKey(str7)) { dictionary2.Add(str7, 1); } } builder.AppendLine(notice3.AddressName); list3.Add(notice3); } } else if (notice3.AddrId == num9) { if (str7 == null) { str7 = string.IsNullOrEmpty(notice3.HouseHolderName) ? AIS.SN.Model.Constants.ObjectNotChoosedCaption : notice3.HouseHolderName; if (!dictionary2.ContainsKey(str7)) { dictionary2.Add(str7, 1); } } builder.AppendLine(notice3.AddressName); list3.Add(notice3); } } } string str8 = str7; chArray2 = invalidFileNameChars; num12 = 0; while (num12 < chArray2.Length) { char ch2 = chArray2[num12]; str8 = str8.Replace(ch2, ' '); num12 = (int) (num12 + 1); } str8 = str8.Trim(); System.IO.DirectoryInfo info2 = new System.IO.DirectoryInfo(System.IO.Path.Combine(@params.PeriodDirectory.get_FullName(), str8)); if (!info2.get_Exists()) { info2.Create(); } using (System.Data.DataTable table3 = NoticeNotice.GetHeader(list3, this.cbHideClosedAccounts.get_Checked(), this.cbNoticeInformation.get_Checked())) { table3.set_TableName("header"); using (System.Data.DataSet set2 = NoticeNotice.GetReport(list3, @params.NoticeTemplate.Sql)) { if ((set2.Tables.get_Count() >= 2) && (set2.Tables.get_Item(0).Rows.get_Count() != 0)) { set2.Tables.get_Item(0).set_TableName("pays"); set2.Tables.get_Item(1).set_TableName("counter"); for (int j = 2; j < set2.Tables.get_Count(); j = (int) (j + 1)) { num13 = (int) (j - 1); set2.Tables.get_Item(j).set_TableName("data" + ((int) num13).ToString()); } if (@params.NoticeTemplate.IdentityName == "Счет на оплату Ульяновск вариант 3") { if (set2.Tables.get_Count() > 2) { set2.Tables.get_Item(2).set_TableName("organizations"); } if (set2.Tables.get_Count() > 3) { set2.Tables.get_Item(3).set_TableName("rates"); } } using (StiReport report2 = new StiReport()) { System.Collections.Generic.Dictionary<string, int> dictionary3; string str16; report2.LoadFromString(@params.NoticeTemplate.Template); report2.ReportCacheMode = StiReportCacheMode.Off; report2.Compile(); foreach (System.Data.DataTable table4 in set2.Tables) { report2.RegData(table4.get_TableName(), (System.Data.DataTable) table4); } report2.RegData("header", (System.Data.DataTable) table3); report2.Compile(); (dictionary3 = dictionary2).set_Item(str16 = str7, (num13 = dictionary3[str16]) + 1); string str10 = string.Format("{0} {1}", str7, (int) num13); chArray2 = invalidFileNameChars; for (num12 = 0; num12 < chArray2.Length; num12 = (int) (num12 + 1)) { char ch3 = chArray2[num12]; str10 = str10.Replace(ch3, ' '); } string str11 = System.IO.Path.Combine(info2.get_FullName(), str10); if (System.IO.File.Exists(str11 + ".pdf")) { int num11 = 1; num11 = 1; while (System.IO.File.Exists(str11 + "(" + ((int) num11).ToString() + ").pdf")) { num11 = (int) (num11 + 1); } obj2 = str11; str11 = string.Concat((object[]) new object[] { obj2, "(", ((int) num11), ")" }); } try { report2.Render(false); new StiPdfExportService().ExportPdf(report2, str11 + ".pdf"); System.IO.File.WriteAllText(str11 + ".txt", builder.ToString()); } catch (System.IO.IOException exception2) { string str12 = string.Format("[{0}] Ошибка при записи в каталог.{1}{2}{1}", System.DateTime.Now.ToShortTimeString(), System.Environment.get_NewLine(), exception2.get_Message()); string str13 = string.Format("[{0}] {1}{2}{1}", System.DateTime.Now.ToShortTimeString(), System.Environment.get_NewLine(), builder.ToString()); this.AddMessageToLogFile(info2.get_FullName(), str12, "errors"); this.AddMessageToLogFile(info2.get_FullName(), str13, "невыгруженные_адреса"); } catch (System.Exception exception3) { string str14 = string.Format("[{0}] Ошибка при выгрузке в PDF..{1}{2}{1}", System.DateTime.Now.ToShortTimeString(), System.Environment.get_NewLine(), exception3.get_Message()); string str15 = string.Format("[{0}] {1}{2}{1}", System.DateTime.Now.ToShortTimeString(), System.Environment.get_NewLine(), builder.ToString()); this.AddMessageToLogFile(info2.get_FullName(), str14, "errors"); this.AddMessageToLogFile(info2.get_FullName(), str15, "невыгруженные_адреса"); } } } } } } } } } }
private void bwLoadAddressesAndCounters_DoWork(object sender, DoWorkEventArgs e) { e.set_Result(e.get_Argument()); }