private void btnSave_Click(object sender, EventArgs e)
 {
     if (BaseValidator.IsFormValid(this.components))
     {
         String imageName = Guid.NewGuid().ToString() + Path.GetExtension(pcCustomer.ImageLocation);
         String path      = Application.StartupPath + "/Images/";
         if (!Directory.Exists(path))
         {
             Directory.CreateDirectory(path);
         }
         pcCustomer.Image.Save(path + imageName);
         DataLayer.Customers customer = new DataLayer.Customers()
         {
             Fullname      = txtFullname.Text,
             Address       = txtAddress.Text,
             Mobile        = txtMobile.Text,
             Email         = txtEmail.Text,
             CustomerImage = imageName
         };
         if (customerId == 0)
         {
             db.CustomerRepository.InsertCustomer(customer);
         }
         else
         {
             customer.CustomerID = customerId;
             db.CustomerRepository.UpdateCustomer(customer);
         }
         db.Save();
         DialogResult = DialogResult.OK;
     }
 }
Esempio n. 2
0
 public void Update(DataLayer.Customers entity)
 {
     _uow.Customers.Update(entity);
 }
Esempio n. 3
0
 public void Insert(DataLayer.Customers entity)
 {
     _uow.Customers.Insert(entity);
 }