示例#1
0
 private void Save()
 {
     if (Helpers.CheckEmpty(errorProvider1, txtCustomerName, txtGender, txtAddress, lblOtherContact))
     {
         return;
     }
     else
     {
         SaveCompleted = true;
         errorProvider1.Clear();
         //string text = StringCipher.Encrypt
         CustomerEntity customerEntity = new CustomerEntity();
         customerEntity.CustomerName = txtCustomerName.Text;
         customerEntity.Gender       = txtGender.Text;
         customerEntity.Address      = txtAddress.Text;
         customerEntity.Photo        = picCustomer.GetByteArrayFromBrowse();
         customerEntity.Active       = chkActive.Checked;
         customerEntity.MemberShipID = (Guid)cboMemberShip.SelectedValue;
         customerEntity.OtherContact = txtOtherContact.Text;
         if (CustomerID != Guid.Empty)
         {
             customerEntity.ID = CustomerID;
             customerEntity.Update(USER.UserName);
             CustomerDao.Update(customerEntity);
         }
         else
         {
             customerEntity.ID = Guid.NewGuid();
             customerEntity.Create(USER.UserName);
             CustomerDao.Insert(customerEntity);
         }
     }
 }