private static void saveReport(IBackgroundContext context, ReestrDdParams args, string insurerName, Account smpBill, Workbook newDoc) { if (!string.IsNullOrEmpty(args.DirName) && Directory.Exists(args.DirName)) { if (!string.IsNullOrEmpty(insurerName)) { var dirName = Path.Combine(args.DirName, insurerName); if (!Directory.Exists(dirName)) { Directory.CreateDirectory(dirName); } var fileName = Path.Combine(dirName, "Реестр " + Enum.GetName(typeof (AccountType), smpBill.AccountType) + " к счету №" + smpBill.Number + " от " + smpBill.SettleDate.ToString("ddMMyy") + " " + insurerName); try { if (File.Exists(fileName)) File.Delete(fileName); newDoc.SaveAs(fileName); } catch (Exception e) { context.ReportError("Ошибка сохранения файла {0}: {1}", fileName, e.Message); } } } }
private static void afterFill(IBackgroundContext context, ReestrDdParams args, VistaMedDataContext dataConext, Account smpBill, Workbook newDoc, List<ReestrTotals> totals, List<IGrouping<Event, AccountItem>> eventGroups, List<ErrorZeroSum> errors, List<string> zeroFioList) { var insurer = (from o in dataConext.VistaMed.Organisations where o.Id == smpBill.Contract.PayerId select o).FirstOrDefault(); if (insurer != null) { string insurerName = ""; if (insurer.MiacCode == "67002") insurerName = "СОГАЗ"; else if (insurer.MiacCode == "67003") insurerName = "МАКС"; else if (insurer.MiacCode == "67004") insurerName = "РГС"; else if (insurer.MiacCode == "67005") insurerName = "СПВ"; if (string.IsNullOrEmpty(insurerName)) { insurerName = new string(insurer.ShortName.ToArray() .Except(Path.GetInvalidFileNameChars()).ToArray()); } saveReport(context, args, insurerName, smpBill, newDoc); totals.Add(new ReestrTotals() { AccountType = smpBill.AccountType, InsurerName = insurerName, Kol = eventGroups.Count }); errors.AddRange(zeroFioList.Select(x => new ErrorZeroSum() {AccountType = smpBill.AccountType, Fio = x, Insurer = insurerName})); } }
private void attach_Accounts_ModifyPersonId(Account entity) { this.SendPropertyChanging("Accounts_ModifyPersonId"); entity.Person_ModifyPersonId = this; }
private void detach_Accounts(Account entity) { this.SendPropertyChanging("Accounts"); entity.Contract = null; }
private void detach_Accounts_CreatePersonId(Account entity) { this.SendPropertyChanging("Accounts_CreatePersonId"); entity.Person_CreatePersonId = null; }