コード例 #1
0
 /// <summary>
 /// Genrate return bill number. -An
 /// </summary>
 /// <param name="returnBillNumber">pass pos bill number</param>
 /// <returns></returns>
 private string GetReturnBillNumber(string billNumber)
 {
     try
     {
         CompanyConfiguration companyConfiguration = _iCompanyRepository.GetCompanyConfigurationByCompanyId(MerchantContext.CompanyDetails.Id);
         if (companyConfiguration != null && MerchantContext.UserDetails.BranchId != null)
         {
             POSBill posBill = _iReturnBillRepository.GetPOSBillByBillNumber(billNumber, Convert.ToInt32(MerchantContext.UserDetails.BranchId));
             if (posBill != null)
             {
                 List <POSReturnBill> listOfPOSReturnBill = _iReturnBillRepository.GetListOfPOSRetunBill();
                 if (listOfPOSReturnBill.Any())
                 {
                     //genrate return bill numnber.
                     string newReturnNumber = ((billNumber) + (listOfPOSReturnBill.Count() + 1).ToString());
                     return(companyConfiguration.ReturnInvoiceNo + newReturnNumber);
                 }
                 else
                 {
                     return(companyConfiguration.ReturnInvoiceNo + "" + billNumber + "" + 1);
                 }
             }
         }
         return(string.Empty);
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
コード例 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            companyManager = new CompanyManager(this);
            companyConfigurationUpdated = new CompanyConfiguration();

            companyConfigurationUpdated.CopyPropertiesFrom(Company.CompanyConfiguration);

            companyConfigurationUpdated.PrinterFooter = txtPrinterFooter.Text;
            companyManager.UpdateCompanyConfiguration(Company.CompanyConfiguration, companyConfigurationUpdated);
        }
コード例 #3
0
 protected override void OnModelCreating(ModelBuilder modelBuilder)
 {
     base.OnModelCreating(modelBuilder);
     // Create EF entities and relations
     _ = new CompanyConfiguration(modelBuilder.Entity <Company>());
     _ = new EmployeeConfiguration(modelBuilder.Entity <Employee>());
     _ = new EmployeeAddressConfiguration(modelBuilder.Entity <EmployeeAddress>());
     _ = new DepartmentConfiguration(modelBuilder.Entity <Department>());
     _ = new UserConfiguration(modelBuilder.Entity <User>());
 }
コード例 #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            companyManager = new CompanyManager(this);
            companyConfigurationUpdated = new CompanyConfiguration();

            companyConfigurationUpdated.CopyPropertiesFrom(Company.CompanyConfiguration);

            companyConfigurationUpdated.PrinterFooter = txtPrinterFooter.Text;
            companyManager.UpdateCompanyConfiguration(Company.CompanyConfiguration, companyConfigurationUpdated);


        }
コード例 #5
0
        public PremierAPIResponse GetPremierServiceCharge(PremierAPIRequest request)
        {
            var serviceChargeList = CompanyConfiguration.LoadServiceChargeData(CompanyName.Premier);

            var chargeRequest = _mapper.Map <ServiceChargeRequest>(request);

            var charge = GetServiceCharge(chargeRequest, serviceChargeList);

            return(new PremierAPIResponse {
                Quote = charge
            });
        }
コード例 #6
0
        public FedXAPIResponse GetFedXServiceCharge(FedXAPIRequest request)
        {
            var serviceChargeList = CompanyConfiguration.LoadServiceChargeData(CompanyName.FedX);

            var chargeRequest = _mapper.Map <ServiceChargeRequest>(request);

            var charge = GetServiceCharge(chargeRequest, serviceChargeList);

            return(new FedXAPIResponse
            {
                Amount = charge
            });
        }
コード例 #7
0
        public RX2GoAPIResponse GetRX2GoServiceCharge(RX2APIRequest request)
        {
            var serviceChargeList = CompanyConfiguration.LoadServiceChargeData(CompanyName.RX2Go);

            var chargeRequest = _mapper.Map <ServiceChargeRequest>(request);

            var charge = GetServiceCharge(chargeRequest, serviceChargeList);

            return(new RX2GoAPIResponse
            {
                Total = charge
            });
        }
コード例 #8
0
    private static CompanyConfiguration ReadCompany(XmlNode xCompany)
    {
        var company = new CompanyConfiguration();

        if (!((XmlElement)xCompany).HasAttribute("name"))
        {
            throw new ConfigurationErrorsException("Company node must have name attribute", xCompany);
        }
        company.Name = ((XmlElement)xCompany).GetAttribute("name");
        var codes = (XmlElement)xCompany.SelectSingleNode("Codes");

        company.Codes = ReadCodes(codes);
        return(company);
    }
コード例 #9
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            companyManager = new CompanyManager(this);
            companyConfigurationUpdated = new CompanyConfiguration();
            companyConfigurationUpdated.CopyPropertiesFrom(Company.CompanyConfiguration);


            companyConfigurationUpdated.ContractAdditionalValue1Name = txtContractAdicionalValue1Name.Text;
            companyConfigurationUpdated.ContractAdditionalValue2Name = txtContractAdicionalValue2Name.Text;
            companyConfigurationUpdated.ContractAdditionalValue3Name = txtContractAdicionalValue3Name.Text;
            companyConfigurationUpdated.ContractAdditionalValue4Name = txtContractAdicionalValue4Name.Text;
            companyConfigurationUpdated.ContractAdditionalValue5Name = txtContractAdicionalValue5Name.Text;

            companyManager.UpdateCompanyConfiguration(Company.CompanyConfiguration, companyConfigurationUpdated);
        }
コード例 #10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            companyConfigurationUpdated = new CompanyConfiguration();
            companyManager = new CompanyManager(this);
            companyConfigurationUpdated.CopyPropertiesFrom(Company.CompanyConfiguration);

            companyConfigurationUpdated.ReportFooter       = txtFooter.Value;
            companyConfigurationUpdated.ReportHeader       = txtHeader.Value;
            companyConfigurationUpdated.ReportMarginTop    = txtReportUp.Text;
            companyConfigurationUpdated.ReportMarginRight  = txtReportRight.Text;
            companyConfigurationUpdated.ReportMarginLeft   = txtReportLeft.Text;
            companyConfigurationUpdated.ReportMargimBottom = txtReportBottom.Text;

            companyManager.UpdateCompanyConfiguration(Company.CompanyConfiguration, companyConfigurationUpdated);
        }
コード例 #11
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            companyManager = new CompanyManager(this);
            companyConfigurationUpdated = new CompanyConfiguration();
            companyConfigurationUpdated.CopyPropertiesFrom(Company.CompanyConfiguration);


            companyConfigurationUpdated.ContractAdditionalValue1Name = txtContractAdicionalValue1Name.Text;
            companyConfigurationUpdated.ContractAdditionalValue2Name = txtContractAdicionalValue2Name.Text;
            companyConfigurationUpdated.ContractAdditionalValue3Name = txtContractAdicionalValue3Name.Text;
            companyConfigurationUpdated.ContractAdditionalValue4Name = txtContractAdicionalValue4Name.Text;
            companyConfigurationUpdated.ContractAdditionalValue5Name = txtContractAdicionalValue5Name.Text;

            companyManager.UpdateCompanyConfiguration(Company.CompanyConfiguration, companyConfigurationUpdated);

        }
コード例 #12
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            companyManager = new CompanyManager(this);
            companyConfigurationUpdated = new CompanyConfiguration();

            companyConfigurationUpdated.CopyPropertiesFrom(Company.CompanyConfiguration);

            companyConfigurationUpdated.UnitPrice1Name = txtUnitPrice1Name.Text;

            companyConfigurationUpdated.UnitPrice2Name = txtUnitPrice2Name.Text;
            companyConfigurationUpdated.UnitPrice3Name = txtUnitPrice3Name.Text;
            companyConfigurationUpdated.UnitPrice4Name = txtUnitPrice4Name.Text;
            companyConfigurationUpdated.UnitPrice5Name = txtUnitPrice5Name.Text;


            companyManager.UpdateCompanyConfiguration(Company.CompanyConfiguration, companyConfigurationUpdated);
        }
コード例 #13
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            companyManager = new CompanyManager(this);
            companyConfigurationUpdated = new CompanyConfiguration();

            companyConfigurationUpdated.CopyPropertiesFrom(Company.CompanyConfiguration);

            companyConfigurationUpdated.UnitPrice1Name = txtUnitPrice1Name.Text;

            companyConfigurationUpdated.UnitPrice2Name = txtUnitPrice2Name.Text;
            companyConfigurationUpdated.UnitPrice3Name = txtUnitPrice3Name.Text;
            companyConfigurationUpdated.UnitPrice4Name = txtUnitPrice4Name.Text;
            companyConfigurationUpdated.UnitPrice5Name = txtUnitPrice5Name.Text;
            

            companyManager.UpdateCompanyConfiguration(Company.CompanyConfiguration, companyConfigurationUpdated);

        }
コード例 #14
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            companyConfigurationUpdated = new CompanyConfiguration();
            companyManager = new CompanyManager(this);
            companyConfigurationUpdated.CopyPropertiesFrom(Company.CompanyConfiguration);

            companyConfigurationUpdated.ReportFooter = txtFooter.Value;
            companyConfigurationUpdated.ReportHeader = txtHeader.Value;
            companyConfigurationUpdated.ReportMarginTop = txtReportUp.Text;
            companyConfigurationUpdated.ReportMarginRight = txtReportRight.Text;
            companyConfigurationUpdated.ReportMarginLeft = txtReportLeft.Text;
            companyConfigurationUpdated.ReportMargimBottom = txtReportBottom.Text;

            companyManager.UpdateCompanyConfiguration(Company.CompanyConfiguration, companyConfigurationUpdated);



        }
コード例 #15
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            companyManager = new CompanyManager(this);
            companyConfigurationUpdated = new CompanyConfiguration();

            companyConfigurationUpdated.CopyPropertiesFrom(Company.CompanyConfiguration);

            string file = txtImageUpload.PostedFile.FileName;
            string fileExtension = Path.GetExtension(file);

            companyConfigurationUpdated.WelcomeText = txtWelcomeText.Value;
            
            if (fileExtension.ToUpper() != ".GIF" && fileExtension.ToUpper() != ".JPG" && fileExtension.ToUpper() != ".PNG")
                companyConfigurationUpdated.Logo = Company.CompanyConfiguration.Logo;
            else
                companyConfigurationUpdated.Logo = resizeImage(txtImageUpload, 183, 51);
                        
            companyManager.UpdateCompanyConfiguration(Company.CompanyConfiguration, companyConfigurationUpdated);
        }
コード例 #16
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            companyManager = new CompanyManager(this);
            companyConfigurationUpdated = new CompanyConfiguration();

            companyConfigurationUpdated.CopyPropertiesFrom(Company.CompanyConfiguration);

            string file          = txtImageUpload.PostedFile.FileName;
            string fileExtension = Path.GetExtension(file);

            companyConfigurationUpdated.WelcomeText = txtWelcomeText.Value;

            if (fileExtension.ToUpper() != ".GIF" && fileExtension.ToUpper() != ".JPG" && fileExtension.ToUpper() != ".PNG")
            {
                companyConfigurationUpdated.Logo = Company.CompanyConfiguration.Logo;
            }
            else
            {
                companyConfigurationUpdated.Logo = resizeImage(txtImageUpload, 183, 51);
            }

            companyManager.UpdateCompanyConfiguration(Company.CompanyConfiguration, companyConfigurationUpdated);
        }
コード例 #17
0
        /// <summary>
        /// Used to fetch ReturnBill
        /// </summary>
        /// <param name="posBill"></param>
        /// <returns></returns>
        private IHttpActionResult GetReturnBill(POSBill posBill)
        {
            ReturnBillDetailAc returnBillDetailAC;

            if (posBill != null)
            {
                CompanyConfiguration companyConfiguration = _iCompanyRepository.GetCompanyConfigurationByCompanyId(MerchantContext.CompanyDetails.Id);
                if (companyConfiguration?.ValidNumberOfDaysForReturnItem != null)
                {
                    DateTime allowDate = posBill.BillDate.AddDays(Convert.ToInt32(companyConfiguration.ValidNumberOfDaysForReturnItem));
                    if (DateTime.UtcNow <= allowDate)
                    {
                        returnBillDetailAC = GetReturnBillDetailAC(posBill);
                        return(Ok(new { isResult = returnBillDetailAC }));
                    }
                    else
                    {
                        return(Ok(new { isResult = companyConfiguration.ValidNumberOfDaysForReturnItem }));
                    }
                }
                return(Ok(new { isResult = false }));
            }
            return(Ok(new { isResult = "NotExists" }));
        }
コード例 #18
0
 public static void Seed(IEventStore eventStore)
 {
     UserConfiguration.Seed(eventStore);
     CompanyConfiguration.Seed(eventStore);
 }
コード例 #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var cManager = new CompanyManager(this);
                CompanyConfiguration cSettings = Company.CompanyConfiguration;

                if (cSettings != null)
                {
                    lblHeader.Text = cSettings.ReportHeader;
                    lblFooter.Text = cSettings.ReportFooter;
                }
            }

            var purchaseOrder        = new PurchaseOrder();
            var purchaseOrderManager = new PurchaseOrderManager(this);
            var supplierManager      = new SupplierManager(this);

            rptProduct.DataSource = Session["_productList"];
            rptProduct.DataBind();

            //
            // Este bloco formata os dados de endereço do cliente
            //

            #region Endereço

            lblLocalDate.Text = "Rio de Janeiro " + DateTime.Now.ToLongDateString();
            if (Session["SupplierId"] != null)
            {
                Supplier supplier = supplierManager.GetSupplier((int)Session["SupplierId"], (int)Company.MatrixId);

                if (supplier != null)
                {
                    if (supplier.LegalEntityProfile != null)
                    {
                        lblSupplierAddress.Text = supplier.LegalEntityProfile.Address.Name
                                                  + " " + supplier.LegalEntityProfile.AddressNumber
                                                  + " " + supplier.LegalEntityProfile.AddressComp;

                        lblSupplierLocalization.Text = supplier.LegalEntityProfile.Address.City
                                                       + " - " + supplier.LegalEntityProfile.Address.Neighborhood
                                                       + ", " + supplier.LegalEntityProfile.Address.StateId;

                        lblPostalCode.Text = "CEP: " + supplier.LegalEntityProfile.Address.PostalCode;

                        lblSupplierPhone.Text = "Tel: " + supplier.LegalEntityProfile.Phone.Replace("(__)____-____", "") ??
                                                supplier.LegalEntityProfile.Phone.Replace("(__)____-____", "");
                        lblCNPJ_CPF.Text = supplier.LegalEntityProfile.CNPJ ?? supplier.LegalEntityProfile.CNPJ;

                        lblSupplierName.Text = supplier.LegalEntityProfile.CompanyName + "/";
                    }
                    else
                    {
                        lblSupplierAddress.Text = supplier.Profile.Address.Name
                                                  + " " + supplier.Profile.AddressNumber
                                                  + " " + supplier.Profile.AddressComp;

                        lblSupplierLocalization.Text = supplier.Profile.Address.City
                                                       + " - " + supplier.Profile.Address.Neighborhood
                                                       + ", " + supplier.Profile.Address.StateId;

                        lblPostalCode.Text = "CEP: " + supplier.Profile.Address.PostalCode;

                        lblSupplierPhone.Text = "Tel: " + supplier.Profile.Phone.Replace("(__)____-____", "") ??
                                                supplier.Profile.Phone.Replace("(__)____-____", "");
                        lblCNPJ_CPF.Text = supplier.Profile.CPF ?? supplier.Profile.CPF;

                        lblSupplierName.Text = supplier.Profile.Name + "/";
                    }

                    #endregion

                    lblFooter.Text =
                        @"<p align=center>Sem mais para o momento e no aguardo de um contato, 
                antecipamos agradecimentos<br><br>Atenciosamente,<br><br>____________________________________
                <br>" +
                        Company.LegalEntityProfile.CompanyName +
                        @"<br><br><br><strong>DE ACORDO COM AS CONDIÇÕES DA PROPOSTA,
                <br><br></strong>" +
                        "Rio de Janeiro,&nbsp;" + DateTime.Now.ToLongDateString() +
                        @"<br><br>____________________________________<br>";
                    if (supplier != null)
                    {
                        if (supplier.Profile != null)
                        {
                            lblFooter.Text += supplier.Profile.Name + "</p>";
                        }
                    }
                    else
                    {
                        lblFooter.Text += supplier.LegalEntityProfile.CompanyName + "</p>";
                    }
                }
            }
        }
コード例 #20
0
        public static void PopulateDataBase(ApplicationDbContext context)
        {
            //CompanyConfiguration
            CompanyConfiguration companyConfiguration = new CompanyConfiguration();

            context.CompanyConfiguration.Add(companyConfiguration);
            //OpenedDays
            context.Add(new OpenedDay(DayOfWeek.Monday));
            context.Add(new OpenedDay(DayOfWeek.Tuesday));
            context.Add(new OpenedDay(DayOfWeek.Wednesday));
            context.Add(new OpenedDay(DayOfWeek.Thursday));
            context.Add(new OpenedDay(DayOfWeek.Friday));
            context.Add(new OpenedDay(DayOfWeek.Saturday, false));
            context.Add(new OpenedDay(DayOfWeek.Sunday, false));
            context.SaveChanges();
            //Range
            foreach (var openedDay in context.OpenedDays)
            {
                context.Add(new TimeRange()
                {
                    OpenedDay = openedDay, OpenType = OpenType.Open
                });
                context.Add(new TimeRange()
                {
                    OpenedDay = openedDay, OpenType = OpenType.Delivery
                });
                context.Add(new TimeRange()
                {
                    OpenedDay = openedDay, OpenType = OpenType.PickUp
                });
            }
            //Tax
            context.Add(new VAT()
            {
                Tax = 0
            });
            context.Add(new VAT()
            {
                Tax = 0.055m
            });
            context.Add(new VAT()
            {
                Tax = 0.1m
            });
            context.Add(new VAT()
            {
                Tax = 0.2m
            });
            //Tags
            context.Add(new Tag()
            {
                Name = "Chaud", Description = "Ce plat peut être consommé chaud", Color = "#ff3333"
            });
            context.Add(new Tag()
            {
                Name = "Froid", Description = "Ce plat peut être consommé froid", Color = "#3385ff"
            });
            context.Add(new Tag()
            {
                Name = "Carné", Description = "Contient de la viande", Color = "#ff0000"
            });
            context.Add(new Tag()
            {
                Name = "Végé", Description = "Ce plat est végétarien", Color = "#5cd65c"
            });
            context.Add(new Tag()
            {
                Name = "Vegan", Description = "Ce plat est végan", Color = "#adebad"
            });
            context.Add(new Tag()
            {
                Name = "0 lactose", Description = "Ce plat est sans lactose", Color = "#99c2ff"
            });
            context.Add(new Tag()
            {
                Name = "0 gluten", Description = "Ce plat est sans gluten", Color = "#ffd699"
            });
            context.Add(new Tag()
            {
                Name = "bio", Description = "Est issue de l'agriculture biologique", Color = "#33cc33"
            });
            context.Add(new Tag()
            {
                Name = "local", Description = "Est un produit local", Color = "#ff3333"
            });
            context.Add(new Tag()
            {
                Name = "Français", Description = "Produit Français par Toutatis !", Color = "#0066ff"
            });
            context.Add(new Tag()
            {
                Name = "Ardèche", Description = "Ardechio Merveillous Païs", Color = "#c2d6d6"
            });
            //Save
            context.SaveChanges();
        }
コード例 #21
0
 /// <summary>
 /// Update a CompanyConfiguration
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="original_entity"></param>
 public void UpdateCompanyConfiguration(CompanyConfiguration original_entity, CompanyConfiguration entity)
 {
     original_entity = GetCompanyConfiguration(original_entity.CompanyConfigurationId);
     original_entity.CopyPropertiesFrom(entity);
     DbContext.SubmitChanges();
 }
コード例 #22
0
        /// <summary>
        /// Insert a CompanyConfiguration
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="companyId"></param>
        public void InsertCompanyConfiguration(CompanyConfiguration configuration, Company company)
        {
            DbContext.CompanyConfigurations.InsertOnSubmit(configuration);
            DbContext.SubmitChanges();

            company.CompanyConfigurationId = configuration.CompanyConfigurationId;
            DbContext.SubmitChanges();
        }
コード例 #23
0
        /// <summary>
        /// add new company details
        /// </summary>
        /// <param name="companyDetail">company detailAC with company details</param>
        /// <returns>object of company detail</returns>
        public CompanyDetailAC AddCompanyDetail(CompanyDetailAC companyDetail, string userId)
        {
            try
            {
                //its check company name already exist or not.
                int companyCount = _companyDataRepository.Fetch(x => x.Name == companyDetail.Name).Count();
                if (companyCount != 0)
                {
                    throw new ArgumentException("Company name already exists.");
                }

                //its check company created or not.
                int multipleCount = _companyDataRepository.Fetch(x => x.UserId == userId).Count();
                if (multipleCount != 0)
                {
                    throw new ArgumentException("User can not create multiple company.");
                }


                //save the company basic details
                var companyDetails = new CompanyDetail
                {
                    Name            = companyDetail.Name,
                    Location        = companyDetail.Location,
                    Email           = companyDetail.Email,
                    Zipcode         = companyDetail.Zipcode,
                    PhoneNumber     = companyDetail.PhoneNumber,
                    CreatedDateTime = DateTime.UtcNow,
                    UserId          = userId,
                    NameSL          = companyDetail.NameSL
                };
                _companyDataRepository.Add(companyDetails);
                _companyDataRepository.SaveChanges();

                //save the company custom cinfiguration.
                var companyCongig = new CompanyConfiguration
                {
                    CompanyId                      = companyDetails.Id,
                    NormalBarcodeFrom              = companyDetail.NormalBarcodeFrom,
                    NormalBarcodeTo                = companyDetail.NormalBarcodeTo,
                    PriceStartFrom                 = companyDetail.PriceStartFrom,
                    PriceDigitLength               = companyDetail.PriceDigitLength,
                    CreditCardPayment              = companyDetail.CreditCardPayment,
                    DebitCardPayment               = companyDetail.DebitCardPayment,
                    ChequePayment                  = companyDetail.ChequePayment,
                    CoupanPayment                  = companyDetail.CoupanPayment,
                    CreditAccountPayment           = companyDetail.CreditAccountPayment,
                    AllowCreditAccountLimit        = companyDetail.AllowCreditAccountLimit,
                    CPODownPaymentDiscount         = companyDetail.CPODownPaymentDiscount,
                    ReturnItem                     = companyDetail.ReturnItem,
                    InvoiceNo                      = companyDetail.InvoiceNo,
                    ReturnInvoiceNo                = companyDetail.ReturnInvoiceNo,
                    CPOInvoiceNo                   = companyDetail.CPOInvoiceNo,
                    ValidNumberOfDaysForReturnItem = companyDetail.ValidNumberOfDaysForReturnItem,
                    SPOInvoiceNo                   = companyDetail.SPOInvoiceNo,
                    ItemDestructionNo              = companyDetail.ItemDestructionNo,
                    SupplierReturnNo               = companyDetail.SupplierReturnNo,
                    ProfitMargin                   = companyDetail.ProfitMargin,
                    LanguageId                     = companyDetail.LanguageId,
                    CreatedDateTime                = DateTime.UtcNow,
                    CashPayment                    = companyDetail.CashPayment,
                    CurrencyId                     = companyDetail.CurrencyId,
                    UpperBound                     = companyDetail.UpperBound,
                    LowerBound                     = companyDetail.LowerBound
                };

                _companyConfigurationContext.Add(companyCongig);
                _companyConfigurationContext.SaveChanges();

                #region Added Barcode Details

                #region Company Barcode Details
                companyDetail.CompanyId = companyDetails.Id;
                AddCompanyBarcodeConfigurationDetail(companyDetail);
                #endregion

                #region Balance Barcode Details
                AddedBalanceBarcode(companyDetail);
                #endregion

                #endregion

                var cpoConfigurationList = new List <AdditionalService>();
                companyDetail.CPOConfigurations.ForEach(x =>
                {
                    var cpoConfiguration = new AdditionalService
                    {
                        Name      = x.AdditionalCostType,
                        CompanyId = companyDetails.Id
                    };
                    cpoConfigurationList.Add(cpoConfiguration);
                });

                if (cpoConfigurationList.Any())
                {
                    _cpoConfigurationContext.AddRange(cpoConfigurationList);
                    _cpoConfigurationContext.SaveChanges();
                }

                companyDetail.CompanyId       = companyDetails.Id;
                companyDetail.CompanyConfigId = companyCongig.Id;

                return(companyDetail);
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }
コード例 #24
0
        private async Task <int> CreateCompanyConfiguration(string companyId, CompanyConfiguration companyCreation)
        {
            int newCompanyId;

            newCompanyId = await _companyCreationRepository.CreateCompanySetup(companyId, companyCreation.CompanySetup);

            if (companyCreation.InvoiceSetup != null)
            {
                await _companyCreationRepository.CreateInvoiceSetup(companyId, companyCreation.InvoiceSetup);
            }

            if (companyCreation.InterfaceSetup != null && companyCreation.InterfaceSetup.Count() > 0)
            {
                IEnumerable <InterfaceSetup> interfaceSetup = companyCreation.InterfaceSetup.Where(item => item.InterfaceTypeId != null).ToList();

                if (interfaceSetup != null && interfaceSetup.Count() > 0)
                {
                    await _companyCreationRepository.CreateInterfaceSetup(companyId, interfaceSetup);
                }
            }

            if (companyCreation.InterCoNoInterCoEmailSetup != null)
            {
                await _companyCreationRepository.AddUpdateIntercoEmailAsync(companyId, companyCreation.InterCoNoInterCoEmailSetup);
            }

            if (companyCreation.DefaultAccountingSetup != null)
            {
                await _companyCreationRepository.CreateAccountingSetup(companyId, companyCreation.DefaultAccountingSetup);
            }

            if (companyCreation.MainAccountingFieldSetup != null && companyCreation.MainAccountingFieldSetup.Count() > 0)
            {
                await _companyCreationRepository.CreateMainAccountingFieldSetupAsync(companyId, companyCreation.MainAccountingFieldSetup);
            }

            int tradeSetUpId = await _companyCreationRepository.CreateTradeSetUp(companyId, companyCreation.TradeConfiguration);

            if (companyCreation.AllocationSetUp != null)
            {
                await _companyCreationRepository.CreateAllocationSetUpAsync(companyId, companyCreation.AllocationSetUp, tradeSetUpId);
            }

            if (companyCreation.MandatoryTradeApprovalImageSetup != null)
            {
                await _companyCreationRepository.CreateTradeFieldSetupAsync(companyId, companyCreation.MandatoryTradeApprovalImageSetup);

                await _companyCreationRepository.CreateTradeImageFieldSetupAsync(companyId, companyCreation.MandatoryTradeApprovalImageSetup);

                await _companyCreationRepository.CreateTradeUnapprovedStatusFieldsSetup(companyId, companyCreation.MandatoryTradeApprovalImageSetup);
            }

            if (companyCreation.AccountingParameters != null && companyCreation.AccountingParameters.Any())
            {
                await _companyCreationRepository.CreateAccountingParameterSetUpAsync(companyId, companyCreation.AccountingParameters);
            }

            if (companyCreation.RetentionPolicy != null)
            {
                await _companyCreationRepository.CreateRetentionPolicyAsync(companyId, companyCreation.RetentionPolicy);
            }

            if (companyCreation.TradeParameters != null && companyCreation.TradeParameters.Any())
            {
                await _companyCreationRepository.CreateTradeParameterSetUpAsync(companyId, companyCreation.TradeParameters, tradeSetUpId);
            }

            await _companyCreationRepository.CreateGridConfiguration(companyId);

            return(newCompanyId);
        }