示例#1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.txtBox_suppName.Text.Trim() == "")
            {
                MessageBox.Show("Please insert 'Item Name' ", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtBox_suppName.Focus();
            }
            else if (this.txtBox_suppAddress.Text.Trim() == "")
            {
                MessageBox.Show("Please insert 'Address' ", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtBox_suppAddress.Focus();
            }
            else
            {
                if (editMode == true)
                {
                    dao.EditSupplier(GetTxtBoxData(), supp);
                }
                else
                {
                    dao.AddNewSupplier(GetTxtBoxData());
                }

                this.Close();
            }
        }
        public ActionResult EditSupplier(Supplier supp)
        {
            SupplierDAO suppDAO = new SupplierDAO();

            Supplier supplier = suppDAO.EditSupplier(supp.Id);

            ViewData["supplier"] = supplier;
            return(View());
        }
示例#3
0
 public ActionResult Edit([Bind(Include = "supplierId,supplierName,contactName,phone,fax,address,email,gstNo")] Supplier supplier)
 {
     try
     {
         if (ModelState.IsValid)
         {
             SupplierDAO.EditSupplier(supplier);
             return(RedirectToAction("Index"));
         }
         return(View(supplier));
     }
     catch (Exception e)
     {
         return(View("~/Views/Shared/Error.cshtml"));
     }
 }