Example #1
0
        protected void dgGrant_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            int id = (int)dgGrant.DataKeys[e.Item.ItemIndex];

            ChurchERP.CoreDomain.Setting.Grant grant = _presenter.GetGrantById(id);
            try
            {
                grant.Status = "InActive";
                _presenter.SaveOrUpdateGrant(grant);

                BindGrant();

                Master.ShowMessage(new AppMessage("Grant was Removed Successfully", ChurchERP.Enums.RMessageType.Info));
            }
            catch (Exception ex)
            {
                Master.ShowMessage(new AppMessage("Error: Unable to delete Grant. " + ex.Message, ChurchERP.Enums.RMessageType.Error));
            }
        }
Example #2
0
 private void SaveGrant(ChurchERP.CoreDomain.Setting.Grant grant)
 {
     try
     {
         if (grant.Id <= 0)
         {
             _presenter.SaveOrUpdateGrant(grant);
             Master.ShowMessage(new AppMessage("Grant saved", RMessageType.Info));
             //_presenter.CancelPage();
         }
         else
         {
             _presenter.SaveOrUpdateGrant(grant);
             Master.ShowMessage(new AppMessage("Grant Updated", RMessageType.Info));
             // _presenter.CancelPage();
         }
     }
     catch (Exception ex)
     {
         Master.ShowMessage(new AppMessage(ex.Message, RMessageType.Error));
     }
 }
Example #3
0
        protected void dgGrant_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            int id = (int)dgGrant.DataKeys[e.Item.ItemIndex];

            ChurchERP.CoreDomain.Setting.Grant grant = _presenter.GetGrantById(id);

            try
            {
                TextBox txtName = e.Item.FindControl("txtGrantName") as TextBox;
                grant.GrantName = txtName.Text;
                TextBox txtCode = e.Item.FindControl("txtGrantCode") as TextBox;
                grant.GrantCode = txtCode.Text;
                TextBox txtDonor = e.Item.FindControl("txtDonor") as TextBox;
                grant.Donor = txtDonor.Text;
                SaveGrant(grant);
                dgGrant.EditItemIndex = -1;
                BindGrant();
            }
            catch (Exception ex)
            {
                Master.ShowMessage(new AppMessage("Error: Unable to Update Grant. " + ex.Message, ChurchERP.Enums.RMessageType.Error));
            }
        }
Example #4
0
 protected void dgGrant_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     ChurchERP.CoreDomain.Setting.Grant grant = new ChurchERP.CoreDomain.Setting.Grant();
     if (e.CommandName == "AddNew")
     {
         try
         {
             TextBox txtFGrantName = e.Item.FindControl("txtFGrantName") as TextBox;
             grant.GrantName = txtFGrantName.Text;
             TextBox txtFGrantCode = e.Item.FindControl("txtFGrantCode") as TextBox;
             grant.GrantCode = txtFGrantCode.Text;
             TextBox txtFDonor = e.Item.FindControl("txtFDonor") as TextBox;
             grant.Donor  = txtFDonor.Text;
             grant.Status = "Active";
             SaveGrant(grant);
             dgGrant.EditItemIndex = -1;
             BindGrant();
         }
         catch (Exception ex)
         {
             Master.ShowMessage(new AppMessage("Error: Unable to Add Grant " + ex.Message, ChurchERP.Enums.RMessageType.Error));
         }
     }
 }