コード例 #1
0
        public bool updateCustomer(DTO.ST_customer customer)
        {
            try
            {
                var updateCustomer = db.ST_customers.Where(p => p.customer_id.Equals(customer.customer_id)).SingleOrDefault();

                updateCustomer.customer_name = customer.customer_name;
                updateCustomer.custome_bank_account_number = customer.custome_bank_account_number;
                updateCustomer.custome_date_of_birth       = customer.custome_date_of_birth;
                updateCustomer.custome_gender        = customer.custome_gender;
                updateCustomer.custome_phone         = customer.custome_phone;
                updateCustomer.custome_tax_code      = customer.custome_tax_code;
                updateCustomer.customer_address      = customer.customer_address;
                updateCustomer.customer_created_date = customer.customer_created_date;
                updateCustomer.customer_description  = customer.customer_description;
                updateCustomer.customer_email        = customer.customer_email;
                updateCustomer.customer_liabilities  = customer.customer_liabilities;
                updateCustomer.employee_created      = customer.employee_created;
                updateCustomer.customer_group_id     = customer.customer_group_id;
                updateCustomer.customer_image        = customer.customer_image;
                db.SubmitChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #2
0
        public void updateCustomer()
        {
            DTO.ST_customer updateCustomer = new DTO.ST_customer();
            updateCustomer.customer_id   = customerId;
            updateCustomer.customer_name = txt_CustomerName.Text;
            updateCustomer.custome_bank_account_number = txt_BankAccountNumber.Text;
            if (date_BirthDay.Text != "")
            {
                DateTime date = Convert.ToDateTime(date_BirthDay.Text);
                date.ToString("yy/MM/dd");
                updateCustomer.custome_date_of_birth = date;
            }
            var gender = cbb_Gender.SelectedItem;

            if (gender == "Nam")
            {
                updateCustomer.custome_gender = true;
            }
            else
            {
                updateCustomer.custome_gender = false;
            }

            updateCustomer.custome_phone         = txt_PhoneNumber.Text;
            updateCustomer.custome_tax_code      = txt_Fax.Text;
            updateCustomer.customer_address      = txt_Address.Text;
            updateCustomer.customer_created_date = DateTime.Now;
            updateCustomer.customer_description  = txt_Description.Text;
            updateCustomer.customer_email        = txt_Email.Text;
            updateCustomer.customer_liabilities  = txt_Liabilities.Text;
            updateCustomer.employee_created      = 1;


            // get value lookup edit customer group

            updateCustomer.customer_group_id = Convert.ToInt64(lke_CustomerGroup.EditValue);

            //get value picter customer pricter
            if (pic_Logo.Image != null)
            {
                byte[] fileByte = converImageToBirany(pic_Logo.Image);
                System.Data.Linq.Binary fileBinary = new System.Data.Linq.Binary(fileByte);
                updateCustomer.customer_image = fileBinary;
            }

            bool boolUpdateCustomer = customerBus.updateCustomer(updateCustomer);

            if (boolUpdateCustomer == true)
            {
                messeage.success("Chĩnh Sửa Thành Công!");
            }
            else
            {
                messeage.error("Không Thể Chĩnh Sửa!");
            }
        }
コード例 #3
0
 public bool insertCustomer(DTO.ST_customer customer)
 {
     try
     {
         db.ST_customers.InsertOnSubmit(customer);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #4
0
 public bool updateCustomer(DTO.ST_customer customer)
 {
     return(customerDao.updateCustomer(customer));
 }
コード例 #5
0
 public bool insertCustomer(DTO.ST_customer customer)
 {
     return(customerDao.insertCustomer(customer));
 }