Esempio n. 1
0
        protected void dgProject_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            ChurchERP.CoreDomain.Setting.Project project = new ChurchERP.CoreDomain.Setting.Project();
            if (e.CommandName == "AddNew")
            {
                try
                {
                    TextBox txtFProjectDescription = e.Item.FindControl("txtFProjectDescription") as TextBox;
                    project.ProjectDescription = txtFProjectDescription.Text;
                    TextBox txtFProjectCode = e.Item.FindControl("txtFProjectCode") as TextBox;
                    project.ProjectCode = txtFProjectCode.Text;
                    TextBox txtStartingDate = e.Item.FindControl("txtStartingDate") as TextBox;
                    project.StartingDate = Convert.ToDateTime(txtStartingDate.Text);
                    TextBox txtEndDate = e.Item.FindControl("txtEndDate") as TextBox;
                    project.EndDate = Convert.ToDateTime(txtEndDate.Text);
                    TextBox txtFTotalBudget = e.Item.FindControl("txtFTotalBudget") as TextBox;
                    project.TotalBudget = txtFTotalBudget.Text != "" ? Convert.ToDecimal(txtFTotalBudget.Text) : 0;
                    TextBox txtFRemainingBudget = e.Item.FindControl("txtFRemainingBudget") as TextBox;
                    project.RemainingBudget = txtFRemainingBudget.Text != "" ? Convert.ToDecimal(txtFRemainingBudget.Text) : 0;
                    DropDownList ddlProgramManager = e.Item.FindControl("ddlProgramManager") as DropDownList;
                    project.AppUser = _presenter.GetUser(Convert.ToInt32(ddlProgramManager.SelectedValue));
                    DropDownList ddlStatus = e.Item.FindControl("ddlFStatus") as DropDownList;
                    project.Status = ddlStatus.SelectedValue;


                    SaveProject(project);
                    dgProject.EditItemIndex = -1;
                    BindProjects();
                }
                catch (Exception ex)
                {
                    Master.ShowMessage(new AppMessage("Error: Unable to Add Project " + ex.Message, ChurchERP.Enums.RMessageType.Error));
                }
            }
        }
Esempio n. 2
0
        protected void dgProject_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            int id = (int)dgProject.DataKeys[e.Item.ItemIndex];

            ChurchERP.CoreDomain.Setting.Project project = _presenter.GetProject(id);
            try
            {
                project.Status = "InActive";
                _presenter.SaveOrUpdateProject(project);
                BindProjects();

                Master.ShowMessage(new AppMessage("Project was Removed Successfully", ChurchERP.Enums.RMessageType.Info));
            }
            catch (Exception ex)
            {
                Master.ShowMessage(new AppMessage("Error: Unable to delete Project. " + ex.Message, ChurchERP.Enums.RMessageType.Error));
            }
        }
Esempio n. 3
0
 private void SaveProject(ChurchERP.CoreDomain.Setting.Project project)
 {
     try
     {
         if (project.Id <= 0)
         {
             _presenter.SaveOrUpdateProject(project);
             Master.ShowMessage(new AppMessage("project saved", RMessageType.Info));
             //_presenter.CancelPage();
         }
         else
         {
             _presenter.SaveOrUpdateProject(project);
             Master.ShowMessage(new AppMessage("project Updated", RMessageType.Info));
             // _presenter.CancelPage();
         }
     }
     catch (Exception ex)
     {
         Master.ShowMessage(new AppMessage(ex.Message, RMessageType.Error));
     }
 }