Exemplo n.º 1
0
 protected void ValidateAndUpdateProjectToDb(object sender, EventArgs e)
 {
     try {
         var     projectName    = projupdatenametxt.Value;
         var     projectId      = Utility.GenerateProjectId(projectName);
         var     oldProjId      = (string)Session[SessionConstants.OldProjectId];
         var     projectDaoImpl = new ProjectDAOImpl();
         var     builderId      = projectDaoImpl.GetBuilderinfo(oldProjId).BuilderId;
         Project project        = null;
         if (!projectName.Trim().Equals(Session[SessionConstants.OldProjectName]))
         {
             project = new Project(projectName, projectId)
             {
                 PbiReportName = projreporttxt.Value
             };
             if (projectDaoImpl.IsProjectNameForBuilderPresent(builderId, projectName))
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "javascript", "projectNameExists();", true);
                 return;
             }
         }
         project = new Project(projectName, oldProjId)
         {
             PbiReportName = projreporttxt.Value
         };
         projectDaoImpl.UpdateProjectToDb(oldProjId, project);
         UpdateProjectDiv.Visible = false;
         disbaleBackDiv.Visible   = false;
         ClientScript.RegisterStartupScript(this.GetType(), "javascript", "projectUpdated();", true);
     }
     catch (Exception ex) {
         var exStr = string.Format(ex.Message + "\\nRoot Cause :\\n" + ex.GetBaseException().Message);
         ClientScript.RegisterStartupScript(this.GetType(), "javascript", "errorFunc(\"" + exStr + "\");", true);
     }
 }
Exemplo n.º 2
0
        protected void AddProjectToDb(object sender, EventArgs e)
        {
            try
            {
                var projectName      = projaddnametxt.Value;
                var builderInfo      = projaddbuilderlist.SelectedValue.Split(',');
                var builderLoginName = builderInfo[1].Trim();
                var builderId        = BuilderDAOImpl.GetBuilderIdFromBuilderName(builderLoginName);
                var projectId        = Utility.GenerateProjectId(projectName);
                var linkId           = Utility.GenerateLinkId();
                var projectDaoImpl   = new ProjectDAOImpl();
                var project          = new Project(projectName, projectId);

                if (projectDaoImpl.IsProjectNameForBuilderPresent(builderId, projectName))
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "javascript", "projectNameExists();", true);
                }
                else
                {
                    projectDaoImpl.AddProjectToDb(builderId, linkId, project);
                    AddProjectDiv.Visible  = false;
                    disbaleBackDiv.Visible = false;
                    ClientScript.RegisterStartupScript(this.GetType(), "javascript", "projectAdded();", true);
                }
            }
            catch (Exception ex)
            {
                var exStr = string.Format(ex.Message + "\\nRoot Cause :\\n" + ex.GetBaseException().Message);
                ClientScript.RegisterStartupScript(this.GetType(), "javascript", "errorFunc(\"" + exStr + "\");", true);
            }
        }