public void Delete(Customer customer) { using (DbManager db = new DbManager()) { Accessor.Query.Delete(db, customer); } }
protected void btnAddtoList_Click(object sender, EventArgs e) { foreach (GridViewRow row in gvSelectedCustomers.Rows) { Customer cust = new Customer(); cust = FM.GetCustomerByCustomerId(long.Parse(row.Cells[0].Text)); SelectedCustomers.Add(cust); } foreach (GridViewRow row in gvCustomers.Rows) { CheckBox chkCustomer = (CheckBox)row.FindControl("chkCustomer"); if (chkCustomer.Checked == true) { Customer NEW_CUSTOMER = new Customer(); // Image imgID = (Image)row.FindControl("imgID"); NEW_CUSTOMER = FM.GetCustomerByCustomerId(long.Parse(chkCustomer.ToolTip)); SelectedCustomers.Add(NEW_CUSTOMER); } } gvSelectedCustomers.DataSource = SelectedCustomers; gvSelectedCustomers.DataBind(); gvCustomers.SelectRow(-1); }
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(); }
public void Save(Customer customer) { customer.AccountCode = account.AccountCode; customer.BranchCode = branch.BranchCode; customer.BrandCode = brand.BrandCode; //TEMPORARY DATE AND USER SAVING customer.DateCreated = DateTime.Now; customer.CreatedBy = "SYSTEM"; customer.ModifiedBy = "SYSTEM"; customer.DateModified = DateTime.Now; //TEMPORARY DATE AND USER SAVING using (DbManager db = new DbManager()) { try { if (customer.RecordNo != 0) { Accessor.Query.Update(db, customer); } else { Accessor.Query.Insert(db, customer); } } catch (Exception except) { throw new System.ArgumentException(except.Message); } } }