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

            ChurchERP.CoreDomain.Setting.Holiday Holiday = _presenter.GetHolidayById(id);
            try
            {
                _presenter.DeleteHoliday(Holiday);
                _presenter.SaveOrUpdateHoliday(Holiday);
                BindHoliday();

                Master.ShowMessage(new AppMessage("Holiday was Removed Successfully", ChurchERP.Enums.RMessageType.Info));
            }
            catch (Exception ex)
            {
                Master.ShowMessage(new AppMessage("Error: Unable to delete Holiday. " + ex.Message, ChurchERP.Enums.RMessageType.Error));
            }
        }
Example #2
0
        protected void dgHoliday_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            int id = (int)dgHoliday.DataKeys[e.Item.ItemIndex];

            ChurchERP.CoreDomain.Setting.Holiday Holiday = _presenter.GetHolidayById(id);

            try
            {
                TextBox txtName = e.Item.FindControl("txtHolidayName") as TextBox;
                Holiday.HolidayName = txtName.Text;
                TextBox txtDate = e.Item.FindControl("txtDate") as TextBox;
                Holiday.Date = Convert.ToDateTime(txtDate.Text);
                SaveHoliday(Holiday);
                dgHoliday.EditItemIndex = -1;
                BindHoliday();
            }
            catch (Exception ex)
            {
                Master.ShowMessage(new AppMessage("Error: Unable to Update Holiday. " + ex.Message, ChurchERP.Enums.RMessageType.Error));
            }
        }
Example #3
0
 private void SaveHoliday(ChurchERP.CoreDomain.Setting.Holiday Holiday)
 {
     try
     {
         if (Holiday.Id <= 0)
         {
             _presenter.SaveOrUpdateHoliday(Holiday);
             Master.ShowMessage(new AppMessage("Holiday saved", RMessageType.Info));
             //_presenter.CancelPage();
         }
         else
         {
             _presenter.SaveOrUpdateHoliday(Holiday);
             Master.ShowMessage(new AppMessage("Holiday Updated", RMessageType.Info));
             // _presenter.CancelPage();
         }
     }
     catch (Exception ex)
     {
         Master.ShowMessage(new AppMessage(ex.Message, RMessageType.Error));
     }
 }
Example #4
0
        protected void dgHoliday_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            ChurchERP.CoreDomain.Setting.Holiday Holiday = new ChurchERP.CoreDomain.Setting.Holiday();
            if (e.CommandName == "AddNew")
            {
                try
                {
                    TextBox txtFHolidayName = e.Item.FindControl("txtFHolidayName") as TextBox;
                    Holiday.HolidayName = txtFHolidayName.Text;
                    TextBox txtFDate = e.Item.FindControl("txtFDate") as TextBox;
                    Holiday.Date = Convert.ToDateTime(txtFDate.Text);

                    SaveHoliday(Holiday);
                    dgHoliday.EditItemIndex = -1;
                    BindHoliday();
                }
                catch (Exception ex)
                {
                    Master.ShowMessage(new AppMessage("Error: Unable to Add Holiday " + ex.Message, ChurchERP.Enums.RMessageType.Error));
                }
            }
        }