Пример #1
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);
            }
        }
        protected void DisplayProjects(object sender, EventArgs e)
        {
            PanelEmbedReport.Visible = false;
            loading.Visible          = false;
            dummy.Visible            = false;
            projectcondiv.Visible    = true;
            var userName       = (string)Session[SessionConstants.LoggedInUser];
            var builderDaoImpl = new BuilderDAOImpl();
            var projects       = builderDaoImpl.GetBuilderProjects(userName);

            try {
                if (projects == null)
                {
                    projectcondiv.InnerHtml = "<p> No content to display.</p>";
                    return;
                }
                var htmlStr = string.Empty;
                foreach (var project in projects)
                {
                    htmlStr += AppendToHtmlProject(project.ProjectName, project.PbiReportName);
                }
                projectcondiv.InnerHtml = htmlStr;
            }
            catch (Exception ex) {
                var exStr = string.Format(ex.Message + "\\nRoot Cause :\\n" + ex.GetBaseException().Message);
                ClientScript.RegisterStartupScript(this.GetType(), "javascript", "errorFunc(\"" + exStr + "\");", true);
            }
        }
Пример #3
0
        protected void ManageUser(object sender, EventArgs e)
        {
            try
            {
                builderTableDiv.Visible  = false;
                addBuilderBtn.Visible    = false;
                builderManageDiv.Visible = true;
                var builderId      = hidden.Value;
                var builderDaoImpl = new BuilderDAOImpl();
                var builder        = builderDaoImpl.ManageBuilder(DBConstants.BuilderId, builderId);
                if (builder == null)
                {
                    return;
                }

                builderLbl.Text         = builder.Name.Trim();
                edit_builderidTxt.Value = builder.BuilderId.Trim();
                edit_nameTxt.Value      = builder.Name.Trim();
                edit_loginnameTxt.Value = builder.UserName.Trim();
                Session[SessionConstants.OldBuilderLoginName] = builder.UserName.Trim();
                Session[SessionConstants.OldBuilderId]        = builder.BuilderId.Trim();
                edit_mailTxt.Value     = builder.EmailId.Trim();
                edit_passwordTxt.Value = builder.Password.Trim();
                edit_orgnameTxt.Value  = builder.Organisation.Trim();
                edit_phoneTxt.Value    = builder.Contact.Trim();
                edit_cityTxt.Value     = builder.City.Trim();
                edit_stateTxt.Value    = builder.State.Trim();
                edit_countryTxt.Value  = builder.Country.Trim();
            }
            catch (Exception ex) {
                var exStr = string.Format(ex.Message + "\\nRoot Cause :\\n" + ex.GetBaseException().Message);
                ClientScript.RegisterStartupScript(this.GetType(), "javascript", "errorFunc(\"" + exStr + "\");", true);
            }
        }
 public static bool IsUserNamePresent(string loginName)
 {
     try {
         var builderDaoImpl = new BuilderDAOImpl();
         return(builderDaoImpl.IsUserNamePresent(loginName));
     }
     catch (Exception e) {
         throw new Exception("Exception occurred while checking if username already present in database or not.", e);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     try {
         var builderDaoImpl = new BuilderDAOImpl();
         var builder        = builderDaoImpl.ManageBuilder(DBConstants.UserName, (string)Session[SessionConstants.LoggedInUser]);
         buildernamelbl.InnerText = builder.Name.Trim();
         signinlbltxt.InnerText   = builder.UserName.Trim();
         orglbltxt.InnerText      = builder.Organisation.Trim();
     }
     catch (Exception ex) {
         var exStr = string.Format(ex.Message + "\\nRoot Cause :\\n" + ex.GetBaseException().Message);
         ClientScript.RegisterStartupScript(this.GetType(), "javascript", "errorFunc(\"" + exStr + "\");", true);
     }
 }
Пример #6
0
 private IEnumerable <Builder> GetBuildersList()
 {
     try
     {
         var builderDaoImpl = new BuilderDAOImpl();
         return(builderDaoImpl.GetBuildersList());
     }
     catch (Exception ex)
     {
         var exStr = string.Format(ex.Message + "\\nRoot Cause :\\n" + ex.GetBaseException().Message);
         ClientScript.RegisterStartupScript(this.GetType(), "javascript", "errorFunc(\"" + exStr + "\");", true);
     }
     return(null);
 }
Пример #7
0
 protected void DeleteUser(object sender, EventArgs e)
 {
     confirmPanel.Visible = false;
     try {
         var builderId      = hidden.Value;
         var builderDaoImpl = new BuilderDAOImpl();
         builderDaoImpl.DeleteBuilder(builderId);
         ClientScript.RegisterStartupScript(this.GetType(), "javascript",
                                            "deleteSuccess(\"User\");", true);
     }
     catch (Exception ex) {
         var exStr = string.Format(ex.Message + "\\nRoot Cause :\\n" + ex.GetBaseException().Message);
         ClientScript.RegisterStartupScript(this.GetType(), "javascript", "errorFunc(\"" + exStr + "\");", true);
     }
 }
Пример #8
0
 private void UpdateBuilderInfoInDb(string newBuilderId)
 {
     try {
         var builder = new Builder(newBuilderId, edit_loginnameTxt.Value, edit_passwordTxt.Value,
                                   edit_mailTxt.Value, edit_phoneTxt.Value,
                                   edit_cityTxt.Value, edit_stateTxt.Value, edit_countryTxt.Value, edit_nameTxt.Value,
                                   edit_orgnameTxt.Value);
         var builderDaoImpl = new BuilderDAOImpl();
         builderDaoImpl.UpdateBuilder((string)Session[SessionConstants.OldBuilderId], builder);
     }
     catch (Exception ex) {
         var exStr = string.Format(ex.Message + "\\nRoot Cause :\\n" + ex.GetBaseException().Message);
         ClientScript.RegisterStartupScript(this.GetType(), "javascript", "errorFunc(\"" + exStr + "\");", true);
     }
 }