コード例 #1
0
 public void Delete(CustomerPriceAgreement PriceAgreement)
 {
     using (DbManager db = new DbManager())
     {
         Accessor.Query.Delete(db, PriceAgreement);
     }
 }
コード例 #2
0
        public void Save(CustomerPriceAgreement PriceAgreement)
        {
            PriceAgreement.AccountCode = account.AccountCode;
            PriceAgreement.BranchCode = branch.BranchCode;
            PriceAgreement.BrandCode = brand.BrandCode;

            //TEMPORARY DATE AND USER SAVING
            PriceAgreement.DateCreated = DateTime.Now;
            PriceAgreement.CreatedBy = "SYSTEM";
            PriceAgreement.ModifiedBy = "SYSTEM";
            PriceAgreement.DateModified = DateTime.Now;
            //TEMPORARY DATE AND USER SAVING

            using (DbManager db = new DbManager())
            {
                try
                {
                    if (PriceAgreement.RecordNo != 0)
                    {
                        Accessor.Query.Update(db, PriceAgreement);
                    }
                    else
                    {
                        Accessor.Query.Insert(db, PriceAgreement);
                    }
                }
                catch (Exception except)
                {
                    throw new System.ArgumentException(except.Message);
                }
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            GetObjectsFromDropList();
            var customer = new Customer
            {
                ArrangementCode = this.dlArrangeType.SelectedValue,
                CompanyCode = this.dlUnderCompany.SelectedValue,
                CreditLimit = float.Parse(this.txtCreditLimit.Text),
                GroupCode = this.dlCustomerGroup.SelectedValue,
                DateStart = Convert.ToDateTime(this.txtDateStart.Text),
                Terms = txtTerms.Text
            };

            var priceAgreement = new CustomerPriceAgreement
            {
                AreaGroupCode = dlAreaGroup.SelectedValue,
                CoordinatorName = txtAreaCoordinator.Text,
                PriceGroupMarkdown = dlPriceGroupMDown.SelectedValue,
                PriceGroupRegular = dlPriceGroupReg.SelectedValue,
                SubAreaGroupCode = dlSubAreaGroup.SelectedValue
            };

            var contractTerm = new CustomerContractTerm
            {
                ActivationStatus = 2,
                CommissionAdditional = float.Parse(txtCommAdditional.Text),
                CommisssionCharge = float.Parse(txtCommCharge.Text),
                InsuredAmount = float.Parse(txtAmountInsured.Text),
                LiquidationStatus = Convert.ToInt32(rdioLiquidationStatus.SelectedValue),
                MarkdownCommAboveFifty = float.Parse(txtCommMdownAboveFifty.Text),
                MarkdownCommBelowFifty = float.Parse(txtCommMdownLessFifty.Text),
                MarkdownCommission = float.Parse(txtCommissionMarkdown.Text),
                RegularCommAboveFifty = float.Parse(txtCommRegAboveFifty.Text),
                RegularCommBelowFifty = float.Parse(txtCommRegLessFifty.Text),
                RegularCommission = float.Parse(txtCommisionRegular.Text),
                StockRoomFee = float.Parse(txtStockRoomFee.Text),
                UtilitiesFee = float.Parse(txtUtilitiesFee.Text)
            };

            try
            {
                CM.Save(customer);
                CPAM.Save(priceAgreement);
                CCTM.Save(contractTerm);
            }
            catch (Exception except)
            {
                throw new System.ArgumentException(except.Message);
            }
            ResetTextControl();
            LoadDroplistControls();
            LoadAllAccounts();
            LoadAllBrands();
            LoadCustomerList();
        }