예제 #1
0
 protected void dgSupplier_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     Chai.WorkflowManagment.CoreDomain.Setting.Supplier supplier = new Chai.WorkflowManagment.CoreDomain.Setting.Supplier();
     if (e.CommandName == "AddNew")
     {
         try
         {
             DropDownList ddlSuppliertype = e.Item.FindControl("ddlSupplierType") as DropDownList;
             supplier.SupplierType = _presenter.GetSupplierTypeById(Convert.ToInt32(ddlSuppliertype.SelectedValue));
             TextBox txtFSupplierName = e.Item.FindControl("txtFSupplierName") as TextBox;
             supplier.SupplierName = txtFSupplierName.Text;
             TextBox txtFSupplierAddress = e.Item.FindControl("txtFSupplierAddress") as TextBox;
             supplier.SupplierAddress = txtFSupplierAddress.Text;
             TextBox txtFSupplierContact = e.Item.FindControl("txtFSupplierContact") as TextBox;
             supplier.SupplierContact = txtFSupplierContact.Text;
             TextBox txtFSupplierphoneContact = e.Item.FindControl("txtFSupplierphoneContact") as TextBox;
             supplier.ContactPhone = txtFSupplierphoneContact.Text;
             TextBox txtFSupplierEmail = e.Item.FindControl("txtFSupplierEmail") as TextBox;
             supplier.Email            = txtFSupplierEmail.Text;
             supplier.SupplierNameType = String.Format(supplier.SupplierName + "--" + supplier.SupplierType.SupplierTypeName);
             supplier.Status           = "Active";
             SaveSupplier(supplier);
             dgSupplier.EditItemIndex = -1;
             BindSupplier();
         }
         catch (Exception ex)
         {
             Master.ShowMessage(new AppMessage("Error: Unable to Add Supplier " + ex.Message, Chai.WorkflowManagment.Enums.RMessageType.Error));
         }
     }
 }
예제 #2
0
        protected void dgSupplier_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            int id = (int)dgSupplier.DataKeys[e.Item.ItemIndex];

            Chai.WorkflowManagment.CoreDomain.Setting.Supplier Supplier = _presenter.GetSupplierById(id);
            try
            {
                Supplier.Status = "InActive";
                _presenter.SaveOrUpdateSupplier(Supplier);

                BindSupplier();

                Master.ShowMessage(new AppMessage("Supplier was Removed Successfully", Chai.WorkflowManagment.Enums.RMessageType.Info));
            }
            catch (Exception ex)
            {
                Master.ShowMessage(new AppMessage("Error: Unable to delete Supplier. " + ex.Message, Chai.WorkflowManagment.Enums.RMessageType.Error));
            }
        }
예제 #3
0
 private void SaveSupplier(Chai.WorkflowManagment.CoreDomain.Setting.Supplier Supplier)
 {
     try
     {
         if (Supplier.Id <= 0)
         {
             _presenter.SaveOrUpdateSupplier(Supplier);
             Master.ShowMessage(new AppMessage("Supplier saved", RMessageType.Info));
             //_presenter.CancelPage();
         }
         else
         {
             _presenter.SaveOrUpdateSupplier(Supplier);
             Master.ShowMessage(new AppMessage("Supplier Updated", RMessageType.Info));
             // _presenter.CancelPage();
         }
     }
     catch (Exception ex)
     {
         Master.ShowMessage(new AppMessage(ex.Message, RMessageType.Error));
     }
 }