public CustomerList() { InitializeComponent(); _organizationService = DiConfig.Resolve <IOrganizationService>(); _worker.DoWork += WorkerOnDoWork; _worker.RunWorkerCompleted += WorkerOnRunWorkerCompleted; // Create de Command. var changedIndex = new RoutedUICommand("ChangedIndex", "ChangedIndex", typeof(CustomerList)); // Assing the command to PagingControl Command. GridPaging1.ChangedIndexCommand = changedIndex; // Binding Command var binding = new CommandBinding { Command = changedIndex }; // Binding Handler to executed. binding.Executed += OnChangeIndexCommandHandler; CommandBindings.Add(binding); _worker.RunWorkerAsync(); }
public IList <ContractReportSection5ReportModel> GetSectionReport5Models(ContractFilterModel model) { var contractService = DiConfig.Resolve <IContractService>(); var contractModels = contractService.Report5Filter(model); return(contractModels); }
public CustomerForm(int id) { _organizationService = DiConfig.Resolve <IOrganizationService>(); var organization = _organizationService.GetById(id); CustomerModel = new OrganizationUIViewModel { Id = organization.Id, AccountNumber = organization.AccountNumber, Okohx = organization.Okohx, Name = organization.Name, Inn = organization.Inn, BankName1 = organization.BankName1, Mfo1 = organization.Mfo1, BankName2 = organization.BankName2, Mfo2 = organization.Mfo2, BankName3 = organization.BankName3, Mfo3 = organization.Mfo3, PhoneNumbers = organization.PhoneNumbers, Position = organization.Position, Chief = organization.Chief, KS = organization.KS, LS = organization.LS, Foundation = organization.Foundation, Postcode = organization.Postcode, TypeOwnership = organization.TypeOwnership, LegalAddress = organization.LegalAddress }; InitializeComponent(); }
public ContractList() { _contractService = DiConfig.Resolve <IContractService>(); InitializeComponent(); // Create de Command. var changedIndex = new RoutedUICommand("ChangedIndex", "ChangedIndex", typeof(ExportControl)); // Assing the command to PagingControl Command. GridPaging1.ChangedIndexCommand = changedIndex; // Binding Command var binding = new CommandBinding { Command = changedIndex }; // Binding Handler to executed. binding.Executed += OnChangeIndexCommandHandler; CommandBindings.Add(binding); ExecuteQuery(); }
public static string DoExportReport4(ContractFilterModel model) { try { var contractService = DiConfig.Resolve <IContractService>(); var contractModels = contractService.Report4Filter(model); var file = new MemoryStream(Resources.template4); var wb = new XLWorkbook(file); var ws = wb.Worksheets.Worksheet(1); var filePath = Path.Combine(Path.GetTempPath(), Path.ChangeExtension(Path.GetRandomFileName(), "xlsx")); var topRowIndex = 9; //rows ws.Range(topRowIndex + 1, 1, contractModels.Count + topRowIndex, 10) .InsertRowsAbove(contractModels.Count, true); ws.Cell(5, 8).Value = DateTime.Now; ws.Cell(5, 8).Style.DateFormat.Format = "dd/MM/yyyy"; for (var i = 0; i < contractModels.Count; i++) { ws.Cell(topRowIndex + i, 1).Value = i + 1; ws.Cell(topRowIndex + i, 2).Value = contractModels[i].Client; ws.Cell(topRowIndex + i, 3).Value = contractModels[i].Object; ws.Cell(topRowIndex + i, 4).SetValue(contractModels[i].Number); ws.Cell(topRowIndex + i, 5).Value = contractModels[i].Col27; ws.Cell(topRowIndex + i, 5).Style.DateFormat.Format = "dd/MM/yyyy"; ws.Cell(topRowIndex + i, 6).Value = contractModels[i].Col28; ws.Cell(topRowIndex + i, 6).Style.DateFormat.Format = "dd/MM/yyyy"; ws.Cell(topRowIndex + i, 7).Value = contractModels[i].Col31; ws.Cell(topRowIndex + i, 7).Style.DateFormat.Format = "dd/MM/yyyy"; ws.Cell(topRowIndex + i, 8).Value = contractModels[i].Date; ws.Cell(topRowIndex + i, 8).Style.DateFormat.Format = "dd/MM/yyyy"; ws.Cell(topRowIndex + i, 9).Value = contractModels[i].Amount; ws.Cell(topRowIndex + i, 9).Style.NumberFormat.Format = "#,##0.00"; ws.Cell(topRowIndex + i, 10).Value = contractModels[i].Paid; ws.Cell(topRowIndex + i, 10).Style.NumberFormat.Format = "#,##0.00"; } FitToColumns(ws, contractModels.Count); //save wb.SaveAs(filePath); return(filePath); } catch (Exception e) { throw e; } }
public CustomerForm() { _organizationService = DiConfig.Resolve <IOrganizationService>(); CustomerModel = new OrganizationUIViewModel(); InitializeComponent(); CustomerModel.Validate(); }
public ClientControl() { _clientService = DiConfig.Resolve <IClientService>(); InitializeComponent(); UCClientGrid.DataGridDoubleClick += DataGrid_MouseDoubleClick; UCClientForm.ButtonSaveClick += Button_Save; UCClientForm.ButtonDeleteClick += Button_Delete; }
public ProductControl() { _productService = DiConfig.Resolve <IProductService>(); InitializeComponent(); UCProductGrid.DataGridDoubleClick += DataGrid_MouseDoubleClick; UCProductForm.ButtonSaveClick += Button_Save; UCProductForm.ButtonDeleteClick += Button_Delete; }
public FolderControl() { _folderService = DiConfig.Resolve <IFolderService>(); InitializeComponent(); UCFolderGrid.DataGridDoubleClick += DataGrid_MouseDoubleClick; UCFolderForm.ButtonSaveClick += Button_Save; UCFolderForm.ButtonDeleteClick += Button_Delete; }
public EmployeeControl() { _employeeService = DiConfig.Resolve <IEmployeeService>(); InitializeComponent(); UCEmployeeGrid.DataGridDoubleClick += DataGrid_MouseDoubleClick; UCEmployeeForm.ButtonSaveClick += Button_Save; UCEmployeeForm.ButtonDeleteClick += Button_Delete; }
public CategoryControl() { _categoryService = DiConfig.Resolve <ICategoryService>(); InitializeComponent(); UCCategoryGrid.DataGridDoubleClick += DataGrid_MouseDoubleClick; UCCategoryForm.ButtonSaveClick += Button_Save; UCCategoryForm.ButtonDeleteClick += Button_Delete; }
public static string ContractExport(int contractId) { var contractService = DiConfig.Resolve <IContractService>(); var organizationService = DiConfig.Resolve <IOrganizationService>(); var workPaymentService = DiConfig.Resolve <IContractWorkPaymentService>(); var workTypeService = DiConfig.Resolve <IWorkTypeService>(); var actInvoiceService = DiConfig.Resolve <IActInvoiceService>(); var categoryService = DiConfig.Resolve <ICategoryService>(); var branchService = DiConfig.Resolve <IBranchService>(); var contractModel = contractService.GetById(contractId); var actInvoiceModel = actInvoiceService.Get(a => a.ContractId == contractId); var organizationModel = organizationService.GetById(contractModel.OrganizationId.GetValueOrDefault()); var workTypes = workPaymentService.GetAll(a => a.ContractId == contractId); var categoryModel = categoryService.GetById(contractModel.CategoryId ?? 0); var branchModel = branchService.GetById(contractModel.BranchId ?? 0); var resourceKey = String.Format("contract_template{0}_{1}", (int)branchModel.Code, (int)categoryModel.Code); var resource = Resources.ResourceManager.GetObject(resourceKey); MemoryStream file = null; if (resource is byte[]) { file = new MemoryStream((byte[])resource); } else { throw new InvalidCastException("The specified resource is not a binary resource."); } var filePath = Path.Combine(Path.GetTempPath(), Path.ChangeExtension(Path.GetRandomFileName(), "docx")); using (var document = DocX.Load(file)) { document.ReplaceText(ExportConfig.KEYS.CONTRACT_NUMBER, contractModel.ContractNumber ?? "", false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.OBJECT_NAME, contractModel.ObjectName ?? "", false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.ORGANIZATION_NAME, organizationModel.Name ?? "", false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.CONTRACT_DATE, contractModel.ContractDate.GetValueOrDefault(DateTime.Now).ToShortDateString(), false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.CONTRACT_TOTAL_PRICE, contractModel.ContractAmount.GetValueOrDefault(0).ToString("N"), false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.CONTRACT_TOTAL_PRICE_STR, contractModel.ContractAmount.GetValueOrDefault(0).Speach(), false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.ORGANIZATION_ACCOUNT_NUMBER, organizationModel.AccountNumber ?? "", false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.ORGANIZATION_ADDRESS, organizationModel.LegalAddress ?? "", false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.ORGANIZATION_INN, organizationModel.Inn ?? "", false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.ORGANIZATION_MFO1, organizationModel.Mfo1 ?? "", false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.ORGANIZATION_OKOHX, organizationModel.Okohx ?? "", false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.ORGANIZATION_PHONE_NUMBER, organizationModel.PhoneNumbers ?? "", false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.CONTRACT_WORK_TYPE, String.Join(",", workTypes.Select(s => workTypeService.GetById(s.WorkTypeId.GetValueOrDefault(0)).Descrption)), false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.CONTRACT_WORK_TOTAL_AMOUNT, workTypes.Sum(s => s.Amount.GetValueOrDefault(0)).ToString("N"), false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.CONTRACT_WORK_TOTAL_AMOUNT_STR, workTypes.Sum(s => s.Amount).GetValueOrDefault(0).Speach(), false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.ACTINVOICE_DATE, DateTime.Now.ToShortDateString(), false, RegexOptions.IgnoreCase); document.ReplaceText(ExportConfig.KEYS.ACTINVOICE_NUMBER, actInvoiceModel.Number ?? "", false, RegexOptions.IgnoreCase); document.SaveAs(filePath); } return(filePath); }
public NakladnoyList() { _contractService = DiConfig.Resolve <IContractService>(); InitializeComponent(); _worker.WorkerReportsProgress = true; _worker.DoWork += WorkerOnDoWork; _worker.ProgressChanged += WorkerOnProgressChanged; _worker.RunWorkerCompleted += WorkerOnRunWorkerCompleted; }
public ProductFormControl() { _productService = DiConfig.Resolve <IProductService>(); _categoryService = DiConfig.Resolve <ICategoryService>(); InitializeComponent(); ComboBoxCategory.ItemsSource = _categoryService.GetAll(); ComboBoxCategory.DisplayMemberPath = "Name"; ComboBoxCategory.SelectedValuePath = "Id"; }
public CategoryFormControl() { _categoryService = DiConfig.Resolve <ICategoryService>(); _folderService = DiConfig.Resolve <IFolderService>(); InitializeComponent(); ComboBoxFolder.ItemsSource = _folderService.GetAll(); ComboBoxFolder.DisplayMemberPath = "Name"; ComboBoxFolder.SelectedValuePath = "Id"; }
public ClientFormControl() { _clientService = DiConfig.Resolve <IClientService>(); _clientTypeService = DiConfig.Resolve <IClientTypeService>(); InitializeComponent(); ComboBoxClientType.ItemsSource = _clientTypeService.GetAll(); ComboBoxClientType.DisplayMemberPath = "Name"; ComboBoxClientType.SelectedValuePath = "Id"; }
public ClientTypeGridControl() { _clientTypeService = DiConfig.Resolve <IClientTypeService>(); InitializeComponent(); DataContext = new Data { ClientTypeItems = _clientTypeService.GetAll() }; ClientTypeDataGrid.MouseDoubleClick += DataGrid_MouseDoubleClick; }
public CategoryGridControl() { _categoryService = DiConfig.Resolve <ICategoryService>(); InitializeComponent(); DataContext = new Data { CategoryItems = _categoryService.GetAll() }; CategoryDataGrid.MouseDoubleClick += DataGrid_MouseDoubleClick; }
public ProductGridControl() { _productService = DiConfig.Resolve <IProductService>(); InitializeComponent(); DataContext = new Data { ProductItems = _productService.GetAll() }; ProductDataGrid.MouseDoubleClick += DataGrid_MouseDoubleClick; }
public EmployeeGridControl() { _employeeService = DiConfig.Resolve <IEmployeeService>(); InitializeComponent(); DataContext = new Data { EmployeeItems = _employeeService.GetAll() }; EmployeeDataGrid.MouseDoubleClick += DataGrid_MouseDoubleClick; }
public FolderGridControl() { _folderService = DiConfig.Resolve <IFolderService>(); InitializeComponent(); DataContext = new Data { FolderItems = _folderService.GetAll() }; FolderDataGrid.MouseDoubleClick += DataGrid_MouseDoubleClick; }
public ContractForm() { _contractService = DiConfig.Resolve <IContractService>(); _categoryService = DiConfig.Resolve <ICategoryService>(); _workPaymentService = DiConfig.Resolve <IContractWorkPaymentService>(); _paymentService = DiConfig.Resolve <IPaymentService>(); _nakladnoyService = DiConfig.Resolve <INakladnoyService>(); _actInvoiceService = DiConfig.Resolve <IActInvoiceService>(); _organizationService = DiConfig.Resolve <IOrganizationService>(); ContractModel = new ContractUIViewModel(); InitializeComponent(); ContractModel.Validate(); Grid1.DataContext = ContractModel; }
public DepartmentService() { var dbContext = DiConfig.Resolve <RepositoryContextBase>(); Repository = dbContext.GetRepository <Department>(); }
public ImportStatus DoImportModel(ImportModel model) { ImportStatus status; try { /* * Service */ var organizationService = DiConfig.Resolve <IOrganizationService>(); var contractService = DiConfig.Resolve <IContractService>(); var contractPaymentService = DiConfig.Resolve <IContractWorkPaymentService>(); var workTypeService = DiConfig.Resolve <IWorkTypeService>(); var paymentService = DiConfig.Resolve <IPaymentService>(); var contractDepartmentService = DiConfig.Resolve <IContractDepartmentService>(); var departmentService = DiConfig.Resolve <IDepartmentService>(); var actInvoiceService = DiConfig.Resolve <IActInvoiceService>(); var nakladService = DiConfig.Resolve <INakladnoyService>(); var categoryService = DiConfig.Resolve <ICategoryService>(); var branchService = DiConfig.Resolve <IBranchService>(); /* * Data */ var workItems = new Dictionary <WorkTypeCode, double?> { { WorkTypeCode.Col13, model.V13 }, { WorkTypeCode.Col14, model.V14 }, { WorkTypeCode.Col15, model.V15 }, { WorkTypeCode.Col16, model.V16 }, { WorkTypeCode.Col17, model.V17 }, { WorkTypeCode.Col18, model.V18 }, { WorkTypeCode.Col19, model.V19 }, { WorkTypeCode.Col20, model.V20 }, { WorkTypeCode.Col21, model.V21 }, { WorkTypeCode.Col22, model.V22 }, { WorkTypeCode.Col23, model.V23 }, { WorkTypeCode.Col24, model.V24 } }; var departmentItems = new Dictionary <DepartmentCode, DateTime?> { { DepartmentCode.Col27, model.V27 }, { DepartmentCode.Col28, model.V28 }, { DepartmentCode.Col29, model.V29 }, { DepartmentCode.Col30, model.V30 }, { DepartmentCode.Col31, model.V31 } }; /* * Model */ var organizationModel = organizationService.Get(viewModel => viewModel.Inn.Equals(model.V4, StringComparison.InvariantCultureIgnoreCase)); /* * Organization */ if (organizationModel == null) { organizationModel = new OrganizationViewModel { Inn = model.V4, Name = model.V2, BankName1 = model.V9, AccountNumber = model.V5, Mfo1 = model.V6, Okohx = model.V7, PhoneNumbers = model.V8 }; organizationModel.Id = organizationService.CreateOrUpdate(organizationModel); } else { organizationModel.Name = model.V2; organizationModel.BankName1 = model.V9; organizationModel.AccountNumber = model.V5; organizationModel.Mfo1 = model.V6; organizationModel.Okohx = model.V7; organizationModel.PhoneNumbers = model.V8; organizationService.CreateOrUpdate(organizationModel); } /* * Contract */ var contractModel = contractService.Get(contract => contract.OrganizationId == organizationModel.Id && contract.ContractNumber == model.V10); var categoryModel = categoryService.Get(a => a.Code == model.Category); var branchModel = branchService.Get(a => a.Code == model.Branch); if (contractModel == null) { #region Create contractModel = new ContractViewModel { ContractAmount = model.V12, ContractDate = model.V11, ContractNumber = model.V10, ObjectName = model.V3, DeadlinesContract = model.V32, DeadlinesFact = model.V33, Limitation = model.V38, CategoryId = categoryModel.Id, BranchId = branchModel.Id, OrganizationId = organizationModel.Id }; contractModel.Id = contractService.CreateOrUpdate(contractModel); /* * Contract & Payment */ foreach (var workItem in workItems) { var workName = Enum.GetName(typeof(WorkTypeCode), workItem.Key); var workType = workTypeService.Get(type => type.Name.Equals(workName, StringComparison.InvariantCultureIgnoreCase)); if (workType == null) { continue; } var contractPaymentModel = new ContractWorkPaymentViewModel { Amount = workItem.Value, ContractId = contractModel.Id, WorkTypeId = workType.Id }; contractPaymentService.CreateOrUpdate(contractPaymentModel); } /* * Payment */ var peymentModel = new PaymentViewModel { ContractId = contractModel.Id, Amount = model.V26, Date = model.V25 }; paymentService.CreateOrUpdate(peymentModel); /* * Contract & Department */ foreach (var departmentItem in departmentItems) { var departmentName = Enum.GetName(typeof(DepartmentCode), departmentItem.Key); var department = departmentService.Get(department1 => department1.Name.Equals(departmentName, StringComparison.InvariantCultureIgnoreCase)); if (department == null) { continue; } var contractDepartmentModel = new ContractDepartmentViewModel { ContractId = contractModel.Id, DepartmentId = department.Id, Date = departmentItem.Value, Code = departmentItem.Key }; contractDepartmentService.CreateOrUpdate(contractDepartmentModel); } /* * Act Invoice */ var actInvoiceModel = new ActInvoiceViewModel { ContractId = contractModel.Id, Number = model.V34 }; actInvoiceService.CreateOrUpdate(actInvoiceModel); /* * Nakladnoy */ var nakladModel = new NakladnoyViewModel { ContractId = contractModel.Id, Date = model.V37, Number = model.V36 }; nakladService.CreateOrUpdate(nakladModel); #endregion status = ImportStatus.Created; } else { #region Update contractModel.ContractAmount = model.V12; contractModel.ContractDate = model.V11; contractModel.ObjectName = model.V3; contractModel.DeadlinesContract = model.V32; contractModel.DeadlinesFact = model.V33; contractModel.Limitation = model.V38; contractModel.CategoryId = categoryModel.Id; contractModel.BranchId = branchModel.Id; contractService.CreateOrUpdate(contractModel); /* * Contract & Payment */ foreach (var workItem in workItems) { var workName = Enum.GetName(typeof(WorkTypeCode), workItem.Key); var workType = workTypeService.Get(type => type.Name.Equals(workName, StringComparison.InvariantCultureIgnoreCase)); if (workType == null) { continue; } var contractPaymentModel = contractPaymentService.Get(g => g.WorkTypeId == workType.Id && g.ContractId == contractModel.Id); if (contractPaymentModel == null) { continue; } contractPaymentModel.Amount = workItem.Value; contractPaymentService.CreateOrUpdate(contractPaymentModel); } /* * Contract & Department */ foreach (var departmentItem in departmentItems) { var departmentName = Enum.GetName(typeof(DepartmentCode), departmentItem.Key); var department = departmentService.Get(department1 => department1.Name.Equals(departmentName, StringComparison.InvariantCultureIgnoreCase)); if (department == null) { continue; } var contractDepartmentModel = contractDepartmentService.Get(g => g.ContractId == contractModel.Id && g.DepartmentId == department.Id); if (contractDepartmentModel == null) { continue; } contractDepartmentModel.Date = departmentItem.Value; contractDepartmentModel.Code = departmentItem.Key; contractDepartmentService.CreateOrUpdate(contractDepartmentModel); } /* * Act Invoice */ var actInvoiceModel = actInvoiceService.Get(invoice => invoice.ContractId == contractModel.Id && invoice.Number.Equals(model.V34, StringComparison.InvariantCultureIgnoreCase)); if (actInvoiceModel != null) { actInvoiceService.CreateOrUpdate(actInvoiceModel); } /* * Nakladnoy */ var nakladModel = nakladService.Get(nakladnoy => nakladnoy.ContractId == contractModel.Id && nakladnoy.Number.Equals(model.V36, StringComparison.InvariantCultureIgnoreCase)); if (nakladModel != null) { nakladModel.Date = model.V37; nakladService.CreateOrUpdate(nakladModel); } #endregion status = ImportStatus.Updated; } } catch (Exception exp) { Trace.TraceError(exp.Message); status = ImportStatus.Failed; } return(status); }
public IList <ExportModel> GetExportModels(ContractFilterModel model) { var contractService = DiConfig.Resolve <IContractService>(); var contracts = contractService.Repository.Include ( a => a.Organization, a => a.ActInvoices, a => a.Nakladnoys, a => a.Payments, a => a.ContractWorkPayments.Select(s => s.WorkType), a => a.ContractWorkPayments.Select(s => s.Period), a => a.ContractDepartments.Select(s => s.Department) ); var exportModels = new List <ExportModel>(); contractService.DoFilter(ref contracts, model); contracts = contracts.Where(w => w.Organization != null && w.ActInvoices.Any() && w.Nakladnoys.Any() && w.Payments.Any() && w.ContractDepartments.Any(a => a.Department != null) && w.ContractWorkPayments.Any(a => a.WorkType != null)); foreach (var contract in contracts) { var exportModel = new ExportModel { Id = contract.Id }; /* * client */ exportModel.V2 = contract.Organization.Name; exportModel.V4 = contract.Organization.Inn; exportModel.V5 = contract.Organization.AccountNumber; exportModel.V6 = contract.Organization.Mfo1; exportModel.V7 = contract.Organization.Okohx; exportModel.V8 = contract.Organization.PhoneNumbers; exportModel.V9 = contract.Organization.BankName1; /* * contract */ exportModel.V3 = contract.ObjectName; exportModel.V10 = contract.ContractNumber; exportModel.V11 = contract.ContractDate; exportModel.V12 = contract.ContractAmount; exportModel.V38 = contract.Limitation; exportModel.V32 = contract.DeadlinesContract; exportModel.V33 = contract.DeadlinesFact; /* * work payment type */ exportModel.V13 = contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col13).Amount; exportModel.V14 = contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col14).Amount; exportModel.V15 = contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col15).Amount; exportModel.V16 = contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col16).Amount; exportModel.V17 = contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col17).Amount; exportModel.V18 = contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col18).Amount; exportModel.V19 = contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col19).Amount; exportModel.V20 = contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col20).Amount; exportModel.V21 = contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col21).Amount; exportModel.V22 = contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col22).Amount; exportModel.V23 = contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col23).Amount; exportModel.V24 = contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col24).Amount; /* * contract department */ exportModel.V27 = contract.ContractDepartments.FindOrDefault(f => f.Department.Code == DepartmentCode.Col27).Date; exportModel.V28 = contract.ContractDepartments.FindOrDefault(f => f.Department.Code == DepartmentCode.Col28).Date; exportModel.V29 = contract.ContractDepartments.FindOrDefault(f => f.Department.Code == DepartmentCode.Col29).Date; exportModel.V30 = contract.ContractDepartments.FindOrDefault(f => f.Department.Code == DepartmentCode.Col30).Date; exportModel.V31 = contract.ContractDepartments.FindOrDefault(f => f.Department.Code == DepartmentCode.Col31).Date; /* * act invoice */ exportModel.V34 = contract.ActInvoices.FindOrDefault().Number; /* * contract payment */ exportModel.V25 = contract.Payments.FindOrDefault().Date; exportModel.V26 = contract.Payments.FindOrDefault().Amount; /* * nakladnoy */ exportModel.V36 = contract.Nakladnoys.FindOrDefault().Number; exportModel.V37 = contract.Nakladnoys.FindOrDefault().Date; exportModels.Add(exportModel); } return(exportModels); }
public FolderFormControl() { _folderService = DiConfig.Resolve <IFolderService>(); InitializeComponent(); }
public NakladnoyService() { var dbContext = DiConfig.Resolve <RepositoryContextBase>(); Repository = dbContext.GetRepository <Nakladnoy>(); }
public ContractWorkPaymentService() { var dbContext = DiConfig.Resolve <RepositoryContextBase>(); Repository = dbContext.GetRepository <ContractWorkPayment>(); }
public EmployeeFormControl() { _employeeService = DiConfig.Resolve <IEmployeeService>(); InitializeComponent(); }
public ContractForm(int id) { _contractService = DiConfig.Resolve <IContractService>(); _workPaymentService = DiConfig.Resolve <IContractWorkPaymentService>(); _paymentService = DiConfig.Resolve <IPaymentService>(); _nakladnoyService = DiConfig.Resolve <INakladnoyService>(); _actInvoiceService = DiConfig.Resolve <IActInvoiceService>(); _organizationService = DiConfig.Resolve <IOrganizationService>(); var model = _contractService.GetById(id); var organization = _organizationService.GetById(model.OrganizationId ?? 0); var workTypes = _workPaymentService.GetAll(a => a.ContractId == model.Id); ContractModel = new ContractUIViewModel { Id = id, BranchId = model.BranchId, CategoryId = model.CategoryId, ContractAmount = model.ContractAmount, ContractDate = model.ContractDate, ContractNumber = model.ContractNumber, HasActInvoice = model.ActInvoices.Count > 0, HasNakladnoy = model.Nakladnoys.Count > 0, IsTreaguare = model.IsTriguare, ObjectName = model.ObjectName, Organization = new OrganizationUIViewModel { Id = organization.Id, AccountNumber = organization.AccountNumber, Okohx = organization.Okohx, Name = organization.Name, Inn = organization.Inn, BankName1 = organization.BankName1, Mfo1 = organization.Mfo1, BankName2 = organization.BankName2, Mfo2 = organization.Mfo2, BankName3 = organization.BankName3, Mfo3 = organization.Mfo3, PhoneNumbers = organization.PhoneNumbers, Position = organization.Position, Chief = organization.Chief, KS = organization.KS, LS = organization.LS, Foundation = organization.Foundation, Postcode = organization.Postcode, TypeOwnership = organization.TypeOwnership, LegalAddress = organization.LegalAddress }, WorkTypeId1 = workTypes[0].WorkTypeId, Amount1 = workTypes[0].Amount, PeriodId1 = workTypes[0].PeriodId, WorkTypeId2 = workTypes[1].WorkTypeId, Amount2 = workTypes[1].Amount, PeriodId2 = workTypes[1].PeriodId, WorkTypeId3 = workTypes[2].WorkTypeId, Amount3 = workTypes[2].Amount, PeriodId3 = workTypes[2].PeriodId, WorkTypeId4 = workTypes[3].WorkTypeId, Amount4 = workTypes[3].Amount, PeriodId4 = workTypes[3].PeriodId, WorkTypeId5 = workTypes[4].WorkTypeId, Amount5 = workTypes[4].Amount, PeriodId5 = workTypes[4].PeriodId }; InitializeComponent(); ContractModel.Validate(); Grid1.DataContext = ContractModel; ContractTreaguare.IsEnabled = false; }