Exemplo n.º 1
0
 protected void dgSupplier_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     ChurchERP.CoreDomain.Setting.Supplier supplier = new ChurchERP.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.Status = "Active";
             SaveSupplier(supplier);
             dgSupplier.EditItemIndex = -1;
             BindSupplier();
         }
         catch (Exception ex)
         {
             Master.ShowMessage(new AppMessage("Error: Unable to Add Supplier " + ex.Message, ChurchERP.Enums.RMessageType.Error));
         }
     }
 }
Exemplo n.º 2
0
        protected void dgSupplier_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            int id = (int)dgSupplier.DataKeys[e.Item.ItemIndex];

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

                BindSupplier();

                Master.ShowMessage(new AppMessage("Supplier was Removed Successfully", ChurchERP.Enums.RMessageType.Info));
            }
            catch (Exception ex)
            {
                Master.ShowMessage(new AppMessage("Error: Unable to delete Supplier. " + ex.Message, ChurchERP.Enums.RMessageType.Error));
            }
        }
Exemplo n.º 3
0
 private void SaveSupplier(ChurchERP.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));
     }
 }