Пример #1
0
 private int AddUpdateSupplier()
 {
     if (supplier != null && supplier.Id > 0)
     {
         supplier.Id        = supplier.Id;
         supplier.Name      = txtName.Text;
         supplier.Mobile    = txtMobile.Text;
         supplier.Email     = txtEmail.Text;
         supplier.IsActive  = chkActive.Checked;
         supplier.UpdatedBy = userId;
         return(SupplierDataAccess.UpdateSupplier(supplier));
     }
     else
     {
         var supplierDto = new SupplierDTO()
         {
             Name      = txtName.Text,
             Email     = txtEmail.Text,
             Mobile    = txtMobile.Text,
             IsActive  = chkActive.Checked,
             CreatedBy = userId
         };
         return(SupplierDataAccess.AddSupplier(supplierDto));
     }
 }
Пример #2
0
        public ActionResult UpdateSupplier(SupplierPO supplierToMap)
        {
            // pass the supplier through the mapper to the method and then to the DAL
            _supplierDataAccess.UpdateSupplier(_mapper.Map(supplierToMap));

            // return the user to the list of suppliers
            return(RedirectToAction("ViewSuppliers"));
        }
Пример #3
0
        private void UpdateSupplier(Model.Supplier.Supplier supplier)
        {
            if (supplier == null)
            {
                throw new ArgumentNullException("supplier", "Supplier");
            }

            _supplierDataAccess.UpdateSupplier(supplier);
        }
Пример #4
0
 private void iconButtonOK_Click(object sender, EventArgs e)
 {
     if (CheckInfo())
     {
         try
         {
             SupplierDataAccess.UpdateSupplier(SupplierInfo.supplier.Id, textBoxRealName.Text, textBoxPhoneNumber.Text, textBoxEmailAddress.Text);
             SupplierInfo.UpdateInfo();
             MessageBox.Show("修改成功");
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }