Exemplo n.º 1
0
        public static void UpdateData(this T_Customer oldcustomer,T_Customer newcustomer)
        {
            try
            {
                //oldcustomer.customerno = oldcustomer.customerno == newcustomer.customerno ? oldcustomer.customerno : newcustomer.customerno;
                if (!oldcustomer.customerno.Equals(newcustomer.customerno))
                    oldcustomer.customerno = newcustomer.customerno;
                if (!oldcustomer.customername.Equals(newcustomer.customername))
                    oldcustomer.customername = newcustomer.customername;
                if (!oldcustomer.simplename.Equals(newcustomer.simplename))
                    oldcustomer.simplename = newcustomer.simplename;
                if (!oldcustomer.accountname.Equals(newcustomer.accountname))
                    oldcustomer.accountname = newcustomer.accountname;
                if (!oldcustomer.accountno.Equals(newcustomer.accountno))
                    oldcustomer.accountno = newcustomer.accountno;
                if (!oldcustomer.bank.Equals(newcustomer.bank))
                    oldcustomer.bank = newcustomer.bank;
                if (!oldcustomer.city.Equals(newcustomer.city))
                    oldcustomer.city = newcustomer.city;
                if (!oldcustomer.companyaddress.Equals(newcustomer.companyaddress))
                    oldcustomer.companyaddress = newcustomer.companyaddress;
                if (oldcustomer.companytype != newcustomer.companytype)
                    oldcustomer.companytype = newcustomer.companytype;
                if (!oldcustomer.country.Equals(newcustomer.country))
                    oldcustomer.country = newcustomer.country;
                if (!oldcustomer.customerdesc.Equals(newcustomer.customerdesc))
                    oldcustomer.customerdesc = newcustomer.customerdesc;
                if (!oldcustomer.email.Equals(newcustomer.email))
                    oldcustomer.email = newcustomer.email;
                if (oldcustomer.customertype != newcustomer.customertype)
                    oldcustomer.customertype = newcustomer.customertype;
                if (!oldcustomer.fax.Equals(newcustomer.fax))
                    oldcustomer.fax = newcustomer.fax;
                if (!oldcustomer.invoiceaddress.Equals(newcustomer.invoiceaddress))
                    oldcustomer.invoiceaddress = newcustomer.invoiceaddress;
                if (!oldcustomer.phone.Equals(newcustomer.phone))
                    oldcustomer.phone = newcustomer.phone;
                if (!oldcustomer.postcode.Equals(newcustomer.postcode))
                    oldcustomer.postcode = newcustomer.postcode;
                if (!oldcustomer.productinfo.Equals(newcustomer.productinfo))
                    oldcustomer.productinfo = newcustomer.productinfo;
                if (oldcustomer.profession != newcustomer.profession)
                    oldcustomer.profession = newcustomer.profession;
                if (!oldcustomer.province.Equals(newcustomer.province))
                    oldcustomer.province = newcustomer.province;
                if (!oldcustomer.remarks.Equals(newcustomer.remarks))
                    oldcustomer.remarks = newcustomer.remarks;
                if (!oldcustomer.source.Equals(newcustomer.source))
                    oldcustomer.source = newcustomer.source;
                if (!oldcustomer.taxcode.Equals(newcustomer.taxcode))
                    oldcustomer.taxcode = newcustomer.taxcode;
                if (!oldcustomer.website.Equals(newcustomer.website))
                    oldcustomer.website = newcustomer.website;

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
 internal void editCustomer(T_Customer customer)
 {
     using (MEMSEntities db = new MEMSEntities())
     {                
         db.Entry(customer).State = System.Data.EntityState.Modified;  
         db.SaveChanges();
     }
 }
Exemplo n.º 3
0
 internal void addNewCustomer(T_Customer newcustomer)
 {
     using (MEMSEntities db = new MEMSEntities())
     {
         db.T_Customer.Add(newcustomer);
         db.SaveChanges();
     }
 }
Exemplo n.º 4
0
 internal void delCustomer(T_Customer customer)
 {
     using (MEMSEntities db = new MEMSEntities())
     {
         //db.T_Customer.Remove(customer);
         var entityentry = db.Entry(customer);
         entityentry.State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Exemplo n.º 5
0
 public void DeleteCustomer(T_Customer customer)
 {
     try
     {
         ch = new CustomerHelper();
         ch.delCustomer(customer);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 6
0
 public void EditCustomer(T_Customer customer)
 {
     try
     {
         ch = new CustomerHelper();
         ch.editCustomer(customer);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 7
0
 public void AddNewCustomer(T_Customer newcustomer)
 {
     try
     {
         ch = new CustomerHelper();
         ch.addNewCustomer(newcustomer);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }