protected override void AddObject() { T_Customer newcustomer = new T_Customer(); newcustomer.customerno = txt_cpno.Text; newcustomer.customername = txt_copname.Text; newcustomer.simplename = txt_copsname.Text; newcustomer.country = txt_country.Text; newcustomer.website = txt_website.Text; newcustomer.companyaddress = txt_address.Text; newcustomer.city = txt_city.Text; newcustomer.customerdesc = txt_customerdesc.Text; newcustomer.email = txt_email.Text; newcustomer.accountname = txt_cw_accountname.Text; newcustomer.accountno = txt_cw_accountno.Text; newcustomer.invoiceaddress = txt_cw_address.Text; newcustomer.bank = txt_cw_bank.Text; newcustomer.taxcode = txt_cw_taxcode.Text; newcustomer.fax = txt_fax.Text; newcustomer.postcode = txt_postcode.Text; newcustomer.productinfo = txt_productinfo.Text; newcustomer.phone = txt_phone.Text; newcustomer.province = txt_province.Text; newcustomer.remarks = txt_remark.Text; newcustomer.customertype = cmb_customertype.SelectedText; newcustomer.companytype = cmb_companytype.SelectedText; newcustomer.profession = cmb_profession.SelectedText; var client = new CRMServiceClient(); client.AddNewCustomer(newcustomer); saveAddress(); saveContact(); base.AddObject(); }
internal void addNewCustomer(T_Customer newcustomer) { using (MEMSContext db = new MEMSContext()) { db.T_Customer.Add(newcustomer); db.SaveChanges(); } }
internal void delCustomer(T_Customer customer) { using (MEMSContext db = new MEMSContext()) { //db.T_Customer.Remove(customer); var entityentry = db.Entry(customer); entityentry.State = EntityState.Deleted; db.SaveChanges(); } }
public void AddNewCustomer(T_Customer newcustomer) { try { ch = new CustomerHelper(); ch.addNewCustomer(newcustomer); } catch (Exception ex) { throw ex; } }
public void EditCustomer(T_Customer customer) { try { ch = new CustomerHelper(); ch.editCustomer(customer); } catch (Exception ex) { throw ex; } }
public void DeleteCustomer(T_Customer customer) { try { ch = new CustomerHelper(); ch.delCustomer(customer); } catch (Exception ex) { throw ex; } }
internal void editCustomer(T_Customer customer) { using (MEMSContext db = new MEMSContext()) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); } }
private void SetData(T_Customer customer) { txt_cpno.Text = customer.customerno; txt_copname.Text = customer.customername; txt_copsname.Text = customer.simplename; txt_country.Text = customer.country; txt_website.Text = customer.website; txt_address.Text = customer.companyaddress; txt_city.Text = customer.city; txt_customerdesc.Text = customer.customerdesc; txt_email.Text = customer.email; txt_cw_accountname.Text = customer.accountname; txt_cw_accountno.Text = customer.accountno; txt_cw_address.Text = customer.invoiceaddress; txt_cw_bank.Text = customer.bank; txt_cw_taxcode.Text = customer.taxcode; txt_fax.Text = customer.fax; txt_postcode.Text = customer.postcode; txt_productinfo.Text = customer.productinfo; txt_phone.Text = customer.phone; txt_province.Text = customer.province; txt_remark.Text = customer.remarks; cmb_companytype.SelectedText = customer.companytype; cmb_customertype.SelectedText = customer.customertype; cmb_profession.SelectedText = customer.profession; }
protected override void FormLoad() { base.FormLoad(); var client = new CRMServiceClient(); if (this.formmode == frmmodetype.edit) { m_customer = client.getCustomerbyid(m_cid); SetData(m_customer); } else if (formmode == frmmodetype.delete) { m_customer = client.getCustomerbyid(m_cid); SetData(m_customer); readonlytxtbox(this.Controls, true); } var comtypelst = client.getCpytypeList(); foreach (var comtype in comtypelst) { this.cmb_companytype.Properties.Items.Add(comtype.typename); } var custypelst = client.getCtmtypeList(); foreach (var custype in custypelst) { this.cmb_customertype.Properties.Items.Add(custype.typename); } var proflst = client.getProfList(); foreach (var prof in proflst) { this.cmb_profession.Properties.Items.Add(prof.professionname); } List<T_Customer_address> addresslst = client.getCustomerAddressList(m_cid); this.gcaddress.DataSource = addresslst; List<T_Customer_contacts> contactlst = client.getCustomerContactList(m_cid); this.gccontacts.DataSource = contactlst; //this.btn_addressdel.Visible = false; //this.btn_contactdel.Visible = false; }