private void SaveSoleVendorSupplier(SoleVendorSupplier Supplier)
 {
     try
     {
         if (Supplier.Id <= 0)
         {
             _presenter.SaveOrUpdateSoleVendorSupplier(Supplier);
             Master.ShowMessage(new AppMessage("Supplier saved", RMessageType.Info));
             //_presenter.CancelPage();
         }
         else
         {
             _presenter.SaveOrUpdateSoleVendorSupplier(Supplier);
             Master.ShowMessage(new AppMessage("Supplier Updated", RMessageType.Info));
             // _presenter.CancelPage();
         }
     }
     catch (Exception ex)
     {
         Master.ShowMessage(new AppMessage(ex.Message, RMessageType.Error));
     }
 }
        protected void dgSupplier_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            int id = (int)dgSupplier.DataKeys[e.Item.ItemIndex];
            SoleVendorSupplier Supplier = _presenter.GetSoleVendorSupplierById(id);

            try
            {
                DropDownList ddlSuppliertype = e.Item.FindControl("ddlEdtSupplierType") as DropDownList;
                Supplier.SupplierType = _presenter.GetSupplierTypeById(Convert.ToInt32(ddlSuppliertype.SelectedValue));
                TextBox txtName = e.Item.FindControl("txtSupplierName") as TextBox;
                Supplier.SupplierName = txtName.Text;
                TextBox txtSupplierAddress = e.Item.FindControl("txtSupplierAddress") as TextBox;
                Supplier.SupplierAddress = txtSupplierAddress.Text;
                TextBox txtSupplierContact = e.Item.FindControl("txtSupplierContact") as TextBox;
                Supplier.SupplierContact = txtSupplierContact.Text;
                TextBox txtSupplierphoneContact = e.Item.FindControl("txtSupplierphoneContact") as TextBox;
                Supplier.ContactPhone = txtSupplierphoneContact.Text;
                TextBox txtFSupplierEmail = e.Item.FindControl("txtSupplierEmail") as TextBox;
                Supplier.Email = txtFSupplierEmail.Text;
                TextBox txtEdtStartingDate = e.Item.FindControl("txtEdtStartingDate") as TextBox;
                Supplier.StartingDate = Convert.ToDateTime(txtEdtStartingDate.Text);
                TextBox txtEdtEndDate = e.Item.FindControl("txtEdtEndDate") as TextBox;
                Supplier.EndDate = Convert.ToDateTime(txtEdtEndDate.Text);
                DropDownList ddlStatus = e.Item.FindControl("ddlStatus") as DropDownList;
                Supplier.Status = ddlStatus.SelectedValue;

                _presenter.SaveOrUpdateSoleVendorSupplier(Supplier);
                Master.ShowMessage(new AppMessage("Sole Vendor Supplier  Updated Successfully.", Chai.WorkflowManagment.Enums.RMessageType.Info));
                dgSupplier.EditItemIndex = -1;
                BindSoleVendorSupplier();
            }
            catch (Exception ex)
            {
                Master.ShowMessage(new AppMessage("Error: Unable to Update Sole Vendor Supplier. " + ex.Message, Chai.WorkflowManagment.Enums.RMessageType.Error));
            }
        }
 public void DeleteSoleVendorSupplier(SoleVendorSupplier SoleVendorSupplier)
 {
     _controller.DeleteEntity(SoleVendorSupplier);
 }
 public void SaveOrUpdateSoleVendorSupplier(SoleVendorSupplier SoleVendorSupplier)
 {
     _controller.SaveOrUpdateEntity(SoleVendorSupplier);
 }