protected void adde_create_Click(object sender, EventArgs e) { Controllers.Proyects.Proyects cP = Session["Proyect"] as Controllers.Proyects.Proyects; Controllers.Users.Users CU = Session["User"] as Controllers.Users.Users; if (adde_datestart.Text == "" || adde_datestart == null) { adde_error.InnerText = "Start date must be filled."; } else if (adde_datefinish.Text == "" || adde_datefinish.Text == null) { adde_error.InnerText = "Finish date must be filled."; } else { Controllers.Elements.Elements ne = new Controllers.Elements.Elements(adde_title.Text, adde_type.SelectedValue, adde_state.SelectedValue, adde_priority.SelectedValue, adde_assignedto.SelectedValue, adde_summary.Text, Convert.ToDateTime(adde_datestart.Text), Convert.ToDateTime(adde_datefinish.Text), cP); var nu = Controllers.Users.Users.uLTest.Single(a => a.Id == adde_assignedto.SelectedValue); Controllers.Email.Email.SendEmailElementNotification(Security.CryptoUtils.DecodeUsername(nu.Username), cP.Title, adde_title.Text, adde_summary.Text, adde_type.SelectedValue, adde_state.SelectedValue, adde_priority.SelectedValue, Security.CryptoUtils.DecodeUserString(nu.Name, nu) + " " + Security.CryptoUtils.DecodeUserString(nu.Surname, nu), ne.DateCreation.ToString(), adde_datestart.Text, adde_datefinish.Text, Security.CryptoUtils.DecodeUserString(nu.Name, nu) + " " + Security.CryptoUtils.DecodeUserString(nu.Surname, nu), CU.Name + " " + CU.Surname); /// Redirecto to dashboard string fullPATH = HttpContext.Current.Request.Url.AbsoluteUri; string[] splitnpu = fullPATH.Split('='); Response.Redirect("~/Views/Proyects/Proyects.aspx?id=" + splitnpu[1]); } }
protected void Page_Load(object sender, EventArgs e) { Controllers.Users.Users u = Session["User"] as Controllers.Users.Users; /// Load all values from profile to inputs user_username.Text = u.Username; user_surname.Text = u.Surname; user_skype.Text = u.Skype; user_name.Text = u.Name; user_linkedin.Text = u.Linkedin; user_googleplus.Text = u.Googleplus; user_gh.Text = u.Github; user_fb.Text = u.Facebook; user_cp.Text = u.PostalCode; user_country.Text = u.Country; user_city.Text = u.City; user_address.Text = u.Address; user_aboutme.Text = u.AboutMe; user_company.Text = "Not yet."; user_tw.Text = u.Twitter; /// Set the page title as your name pageTitle.Text = u.Name + " " + u.Surname + " - Lovis"; Master.cpTITLE = u.Name + " " + u.Surname; }
protected void Page_Load(object sender, EventArgs e) { /// Get current userç Controllers.Users.Users CU = Session["User"] as Controllers.Users.Users; /// Set error message to false adde_error.Visible = false; /// Get proyect from session Controllers.Proyects.Proyects cP = Session["Proyect"] as Controllers.Proyects.Proyects; if (cP == null) { Response.Redirect("~/Views/Dashboard/Dashboard.aspx"); } else { /// Set page title from session pagetitle.Text = cP.Title + " - Lovis"; /// Fill all the dropowns by backend /// Types adde_type.Items.Add(new ListItem("Bug", "Bug")); /// adde_type.Items.Add(new ListItem("Feature", "Feature")); /// adde_type.Items.Add(new ListItem("Support", "Support")); /// adde_type.Items.Add(new ListItem("Review", "Review")); // adde_type.Items.Add(new ListItem("Defect", "Defect")); /// adde_type.Items.Add(new ListItem("Patch", "Patch")); /// adde_type.Items.Add(new ListItem("Changes", "Changes")); /// adde_type.Items.Add(new ListItem("Documentation", "Documentation")); /// Priorities adde_priority.Items.Add(new ListItem("Low", "Low")); adde_priority.Items.Add(new ListItem("Normal", "Normal")); adde_priority.Items.Add(new ListItem("High", "High")); adde_priority.Items.Add(new ListItem("Critical", "Critical")); /// States /// adde_state.Items.Add(new ListItem("New", "New")); adde_state.Items.Add(new ListItem("Analysis", "Analysis")); adde_state.Items.Add(new ListItem("In-Progress", "In-Progress")); adde_state.Items.Add(new ListItem("Resolved", "Resolved")); adde_state.Items.Add(new ListItem("Test", "Test")); adde_state.Items.Add(new ListItem("Closed", "Closed")); /// Assigned /// Get the people from the proyect var query = (from lUL in Controllers.Users.Users.uLTest join UL in Controllers.UserLicense.UserLicense.lUL on lUL.Id equals UL.IdUser where UL.IdLicense == cP.IdLicense select lUL).Distinct().ToList(); foreach (Controllers.Users.Users u in query) { ListItem l = new ListItem(Security.CryptoUtils.DecodeUserString(u.Name, u) + " " + Security.CryptoUtils.DecodeUserString(u.Surname, u), u.Id); adde_assignedto.Items.Add(l); } } }
protected void addp_create_Click(object sender, EventArgs e) { // Get User Controllers.Users.Users CU = Session["User"] as Controllers.Users.Users; // Create proyect to license Controllers.Proyects.Proyects a = new Controllers.Proyects.Proyects(addp_title.Text, addp_summary.Text, addp_owner.Text, addp_webiste.Text, addp_repository.Text, addp_support.Text, CU); Controllers.Email.Email.SendEmailProjectNotification(CU.Username, addp_title.Text, addp_summary.Text, addp_owner.Text, addp_webiste.Text, addp_repository.Text, addp_support.Text, CU.Name + " " + CU.Surname); //Redirecto to dashboard Response.Redirect("~/Views/Proyects/Proyects.aspx?id=" + a.IdLicense); }
protected void Page_Load(object sender, EventArgs e) { pagetitle.Text = "Settings - Lovis"; Controllers.Users.Users DU = Session["User"] as Controllers.Users.Users; if (!IsPostBack) { /// Load user for User page information user_username.Text = DU.Username; user_name.Text = DU.Name; user_surname.Text = DU.Surname; user_city.Text = DU.City; user_country.Text = DU.Country; user_cp.Text = DU.PostalCode; user_address.Text = DU.Address; user_aboutme.Text = DU.AboutMe; user_fb.Text = DU.Facebook; user_tw.Text = DU.Twitter; user_gh.Text = DU.Github; user_skype.Text = DU.Skype; user_googleplus.Text = DU.Googleplus; user_linkedin.Text = DU.Linkedin; user_public.Checked = DU.isPublic; user_registerdate.Text = DU.DateRegister.ToString(); user_lastmodification.Text = DU.LastModification.ToString(); } if (UpdatedSuccess) { user_username.Text = DU.Username; user_name.Text = DU.Name; user_surname.Text = DU.Surname; user_city.Text = DU.City; user_country.Text = DU.Country; user_cp.Text = DU.PostalCode; user_address.Text = DU.Address; user_aboutme.Text = DU.AboutMe; user_fb.Text = DU.Facebook; user_tw.Text = DU.Twitter; user_gh.Text = DU.Github; user_skype.Text = DU.Skype; user_googleplus.Text = DU.Googleplus; user_linkedin.Text = DU.Linkedin; user_public.Checked = DU.isPublic; user_registerdate.Text = DU.DateRegister.ToString(); user_lastmodification.Text = DU.LastModification.ToString(); } user_error.Visible = false; }
protected void managep_btn_delete_Click(object sender, EventArgs e) { Controllers.Proyects.Proyects CP = Session["Proyect"] as Controllers.Proyects.Proyects; if (managep_name_delete.Text == CP.Title) { if (managep_checkbox_delete.Checked) { /// Build owner string Controllers.Users.Users CU = Session["User"] as Controllers.Users.Users; string c = CU.Name + " " + CU.Surname + " (" + CU.Username + ")"; if (CP.Owner == c) { /// Remove project elements Controllers.Elements.Elements.lE.RemoveAll(x => x.IdProyect == CP.Id); /// Remove project Controllers.Proyects.Proyects.lP.Remove(Controllers.Proyects.Proyects.lP.Single(a => a.Id == CP.Id)); /// Remove userlicense to this user Controllers.UserLicense.UserLicense.lUL.Remove(Controllers.UserLicense.UserLicense.lUL.Single(b => b.IdUser == CU.Id && b.IdLicense == CP.IdLicense)); /// Redirect to dashboard Response.Redirect("~/Views/Dashboard/dashboard.aspx"); } /// Not owner else { errorDiv.Visible = true; errorText.Text = "Only the owner can delete the project."; } } /// Not checked else { errorDiv.Visible = true; errorText.Text = "You have to check to delete."; } } /// Wrong project name else { errorDiv.Visible = true; errorText.Text = "Incorrect name introduced."; } }
protected void login_loginbtn_Click(object sender, EventArgs e) { try { /// Get user if is user in DB Controllers.Users.Users u = new Controllers.Users.Users().isUser(login_username.Text, login_password.Text); /// If not null means there is a user with username && password hashed if (u != null) { Controllers.Users.Users loginUser = new Controllers.Users.Users(); /// Fill session with user loginUser.Id = u.Id; loginUser.Username = Security.CryptoUtils.DecodeUsername(u.Username); loginUser.Name = Security.CryptoUtils.DecodeUserString(u.Name, u); loginUser.Surname = Security.CryptoUtils.DecodeUserString(u.Surname, u); loginUser.Address = Security.CryptoUtils.DecodeUserString(u.Address, u); loginUser.City = Security.CryptoUtils.DecodeUserString(u.City, u); loginUser.Country = Security.CryptoUtils.DecodeUserString(u.Country, u); loginUser.PostalCode = Security.CryptoUtils.DecodeUserString(u.PostalCode, u); loginUser.AboutMe = Security.CryptoUtils.DecodeUserString(u.AboutMe, u); loginUser.Facebook = Security.CryptoUtils.DecodeUserString(u.Facebook, u); loginUser.Twitter = Security.CryptoUtils.DecodeUserString(u.Twitter, u); loginUser.Github = Security.CryptoUtils.DecodeUserString(u.Github, u); loginUser.Skype = Security.CryptoUtils.DecodeUserString(u.Skype, u); loginUser.Linkedin = Security.CryptoUtils.DecodeUserString(u.Linkedin, u); loginUser.Googleplus = Security.CryptoUtils.DecodeUserString(u.Googleplus, u); loginUser.DateRegister = u.DateRegister; loginUser.LastModification = u.LastModification; loginUser.PasswordHash = u.PasswordHash; loginUser.RandomKey = u.RandomKey; loginUser.isPublic = u.isPublic; /// Set user Session["User"] = loginUser; /// Redirect Response.Redirect("~/Views/Dashboard/Dashboard.aspx"); } } catch (Exception) { /// Wrong user || password text isWrong = true; login_error.Visible = true; } }
protected void user_updatepasswordbtn_Click(object sender, EventArgs e) { /// Get current user Controllers.Users.Users DU = Session["User"] as Controllers.Users.Users; /// Filter user list with user var x = Controllers.Users.Users.uLTest.Single(u => u.Id == DU.Id); if (user_password.Text != "" && user_repeatpassword.Text != "") { if (Security.CryptoUtils.SHA256HashStringForUTF8String(user_currentpassword.Text) == x.PasswordHash) { if (user_password.Text == user_repeatpassword.Text) { x.PasswordHash = Security.CryptoUtils.SHA256HashStringForUTF8String(user_password.Text); Session.Clear(); Session.Abandon(); Response.Redirect("/Views/Login/Login.aspx"); } else { user_error.Visible = true; user_error.InnerText = "Passwords dont match."; } } else { user_error.Visible = true; user_error.InnerText = "Incorrect current password."; } } else { user_error.Visible = true; user_error.InnerText = "Password does not match."; } }
protected void managee_update_btn_Click(object sender, EventArgs e) { Controllers.Users.Users CU = Session["User"] as Controllers.Users.Users; /// Get the current proyect previously. Controllers.Proyects.Proyects cP = Session["Proyect"] as Controllers.Proyects.Proyects; /// Get ID from URL string fullPATH = HttpContext.Current.Request.Url.AbsoluteUri; string[] splitnpu = fullPATH.Split('='); /// Find the proyect where this current proyect id match some proyect ID var x = Controllers.Elements.Elements.lE.Single(a => a.Id == splitnpu[1]); /// Change everything and encode it again. x.Title = Security.CryptoUtils.EncodeElementString(cP, managee_title.Text); x.Summary = Security.CryptoUtils.EncodeElementString(cP, managee_summary.Text); x.Type = Security.CryptoUtils.EncodeElementString(cP, managee_type.SelectedValue); x.State = Security.CryptoUtils.EncodeElementString(cP, managee_state.SelectedValue); x.Priority = Security.CryptoUtils.EncodeElementString(cP, managee_priority.SelectedValue); x.DateFinish = Convert.ToDateTime(managee_datefinish.Text); var nu = Controllers.Users.Users.uLTest.Single(a => a.Id == managee_assignedto.SelectedValue); if (managee_assignedto.SelectedValue != Security.CryptoUtils.DecodeElementString(cP, x.AssignedTo)) { x.AssignedTo = Security.CryptoUtils.EncodeElementString(cP, managee_assignedto.Text); Controllers.Email.Email.SendEmailElementNotification(Security.CryptoUtils.DecodeUsername(nu.Username), cP.Title, managee_title.Text, managee_summary.Text, managee_type.SelectedValue, managee_state.SelectedValue, managee_priority.SelectedValue, Security.CryptoUtils.DecodeUserString(nu.Name, nu) + " " + Security.CryptoUtils.DecodeUserString(nu.Surname, nu), x.DateCreation.ToString(), managee_datestart.Text, managee_datefinish.Text, Security.CryptoUtils.DecodeUserString(nu.Name, nu) + " " + Security.CryptoUtils.DecodeUserString(nu.Surname, nu), CU.Name + " " + CU.Surname); } Response.Redirect("~/Views/Proyects/Proyects.aspx?id=" + cP.IdLicense); }
public void BuildCounters() { int newCounter = 0; int analysisCounter = 0; int inprogressCounter = 0; int resolvedCounter = 0; int testCounter = 0; int closedCounter = 0; Session["Proyect"] = null; Controllers.Users.Users CU = Session["User"] as Controllers.Users.Users; /// Get proyects from user to build sidebar List <Controllers.Proyects.Proyects> CuLP = new List <Controllers.Proyects.Proyects>(); foreach (Controllers.UserLicense.UserLicense UL in Controllers.UserLicense.UserLicense.lUL) { /// Find Userlicenses of user if (UL.IdUser == CU.Id) { try { /// Finde License of UserLicense var x = Controllers.License.License.lL.Single(l => l.IdLicense == UL.IdLicense); /// Filter proyects for Licenses of user foreach (Controllers.Proyects.Proyects P in Controllers.Proyects.Proyects.lP) { /// If userlicense and proyect licenese are == that means is our proyect if (P.IdLicense == x.IdLicense) { CuLP.Add(P); } } } catch (Exception) { } } } foreach (Controllers.Proyects.Proyects p in CuLP) { try { var y = Controllers.Proyects.Proyects.lP.Single(a => a.IdLicense == p.IdLicense); var query3 = (from a in Controllers.Elements.Elements.lE where a.IdProyect == y.Id select a).OrderByDescending(d => d.DateCreation).ToList(); foreach (Controllers.Elements.Elements ep in query3) { string a = Security.CryptoUtils.DecodeElementString(p, ep.State); switch (a) { case "New": newCounter++; break; case "Analysis": analysisCounter++; break; case "In-Progress": inprogressCounter++; break; case "Resolved": resolvedCounter++; break; case "Test": testCounter++; break; case "Closed": closedCounter++; break; } } } catch (Exception) { } } /// Set values to counters in dashboard newTaskCounter.Text = newCounter.ToString(); analysisTaskCounter.Text = analysisCounter.ToString(); inprogressTaskCounter.Text = inprogressCounter.ToString(); resolvedTaskCounter.Text = resolvedCounter.ToString(); testTaskCounter.Text = testCounter.ToString(); closedTaskCounter.Text = closedCounter.ToString(); //BuildInfoSquares(CuLP); }
protected void user_update_Click(object sender, EventArgs e) { if (user_name.Text != "" && user_surname.Text != "") { /// Get current user Controllers.Users.Users DU = Session["User"] as Controllers.Users.Users; /// Filter user list with user var x = Controllers.Users.Users.uLTest.Single(u => u.Id == DU.Id); /// Set new variables x.Name = Security.CryptoUtils.EncodeUserString(x, user_name.Text); x.Surname = Security.CryptoUtils.EncodeUserString(x, user_surname.Text); x.Address = Security.CryptoUtils.EncodeUserString(x, user_address.Text); x.City = Security.CryptoUtils.EncodeUserString(x, user_city.Text); x.Country = Security.CryptoUtils.EncodeUserString(x, user_country.Text); x.PostalCode = Security.CryptoUtils.EncodeUserString(x, user_cp.Text); x.AboutMe = Security.CryptoUtils.EncodeUserString(x, user_aboutme.Text); x.Facebook = Security.CryptoUtils.EncodeUserString(x, user_fb.Text); x.Twitter = Security.CryptoUtils.EncodeUserString(x, user_tw.Text); x.Github = Security.CryptoUtils.EncodeUserString(x, user_gh.Text); x.Skype = Security.CryptoUtils.EncodeUserString(x, user_skype.Text); x.Googleplus = Security.CryptoUtils.EncodeUserString(x, user_googleplus.Text); x.Linkedin = Security.CryptoUtils.EncodeUserString(x, user_linkedin.Text); x.isPublic = user_public.Checked; x.LastModification = DateTime.Now; Controllers.Users.Users loginUser = new Controllers.Users.Users(); /// Set new User for Session loginUser.Id = x.Id; loginUser.Username = Security.CryptoUtils.DecodeUsername(x.Username); loginUser.Name = Security.CryptoUtils.DecodeUserString(x.Name, x); loginUser.Surname = Security.CryptoUtils.DecodeUserString(x.Surname, x); loginUser.Address = Security.CryptoUtils.DecodeUserString(x.Address, x); loginUser.City = Security.CryptoUtils.DecodeUserString(x.City, x); loginUser.Country = Security.CryptoUtils.DecodeUserString(x.Country, x); loginUser.PostalCode = Security.CryptoUtils.DecodeUserString(x.PostalCode, x); loginUser.AboutMe = Security.CryptoUtils.DecodeUserString(x.AboutMe, x); loginUser.Facebook = Security.CryptoUtils.DecodeUserString(x.Facebook, x); loginUser.Twitter = Security.CryptoUtils.DecodeUserString(x.Twitter, x); loginUser.Github = Security.CryptoUtils.DecodeUserString(x.Github, x); loginUser.Skype = Security.CryptoUtils.DecodeUserString(x.Skype, x); loginUser.Googleplus = Security.CryptoUtils.DecodeUserString(x.Googleplus, x); loginUser.Linkedin = Security.CryptoUtils.DecodeUserString(x.Linkedin, x); loginUser.DateRegister = x.DateRegister; loginUser.LastModification = x.LastModification; loginUser.RandomKey = x.RandomKey; loginUser.PasswordHash = x.PasswordHash; loginUser.isPublic = x.isPublic; /// Clear Session Session.Clear(); /// Create new Session Session["User"] = loginUser; UpdatedSuccess = true; /// Set error message and show it user_error.Attributes.Add("class", "text-success text-center"); user_error.InnerHtml = "Profile updated."; user_error.Visible = true; Response.Redirect(Request.RawUrl); } /// Passwords do not match else if (user_name.Text == "" || user_surname.Text == "") { user_error.Visible = true; user_error.InnerText = "First and last name have to be filled."; } /// Some error else { user_error.Visible = true; user_error.InnerText = "There was an error."; } }
protected void Page_Load(object sender, EventArgs e) { Controllers.Users.Users CU = Session["User"] as Controllers.Users.Users; addp_owner.Text = CU.Name + " " + CU.Surname + " (" + CU.Username + ")"; }
protected void Page_Load(object sender, EventArgs e) { Controllers.Users.Users CU = Session["User"] as Controllers.Users.Users; /// Someone tried to access this web without the correct id /// Get ID from URL string fullPATH = HttpContext.Current.Request.Url.AbsoluteUri; string[] splitnpu = fullPATH.Split('='); proyect_manage.NavigateUrl = "~/Views/Proyects/ManageProyect.aspx?id=" + splitnpu[1]; /// Get project from ID Controllers.Proyects.Proyects cP = new Controllers.Proyects.Proyects(); try { /// Get userlicence in common of this proyect and this user var query2 = (from lUL in Controllers.UserLicense.UserLicense.lUL where lUL.IdUser == CU.Id && lUL.IdLicense == splitnpu[1] select lUL).First(); try { /// If they are equal ( just in case someone paste another proyectID var x = Controllers.Proyects.Proyects.lP.Single(a => a.IdLicense == splitnpu[1] && a.IdLicense == query2.IdLicense); cP.Id = x.Id; cP.IdLicense = x.IdLicense; cP.Title = x.Title; cP.Summary = x.Summary; cP.Owner = x.Owner; cP.Website = x.Website; cP.Repository = x.Repository; cP.Support = x.Support; cP.Title = Security.CryptoUtils.DecodeElementString(cP, cP.Title); cP.Summary = Security.CryptoUtils.DecodeElementString(cP, cP.Summary); cP.Owner = Security.CryptoUtils.DecodeElementString(cP, cP.Owner); cP.Website = Security.CryptoUtils.DecodeElementString(cP, cP.Website); cP.Repository = Security.CryptoUtils.DecodeElementString(cP, cP.Repository); cP.Support = Security.CryptoUtils.DecodeElementString(cP, cP.Support); /// If everything works lets save Session Session["Proyect"] = cP as Controllers.Proyects.Proyects; Master.cpTITLE = cP.Title; } catch (Exception) { /// GTFO Session.Abandon(); Session.Clear(); Response.Redirect("/Views/Login/Login.aspx"); } } catch (Exception) { Response.Redirect("/Views/Error/404.aspx"); } /// Get current Proyect from the Session["Proyect"] //Controllers.Proyects.Proyects CP = Session["Proyect"] as Controllers.Proyects.Proyects; /// Set the summary on the view proyect_summary.InnerText = cP.Summary; proyect_website.Text = cP.Website; proyect_repository.Text = cP.Repository; proyect_support.Text = cP.Support; proyect_website.NavigateUrl = "http://" + cP.Website; proyect_repository.NavigateUrl = "http://github.com/" + cP.Repository; proyect_support.NavigateUrl = "mailto:" + cP.Support; proyect_newtask.NavigateUrl = "/Views/Element/AddElement.aspx?id=" + splitnpu[1]; pagetitle.Text = cP.Title + " - Lovis"; /// Get the people from the proyect var query = (from lUL in Controllers.Users.Users.uLTest join UL in Controllers.UserLicense.UserLicense.lUL on lUL.Id equals UL.IdUser where UL.IdLicense == cP.IdLicense select lUL).Distinct().ToList(); StringBuilder sb = new StringBuilder(); foreach (Controllers.Users.Users pU in query) { Controllers.Users.Users ppU = new Controllers.Users.Users(); ppU.Username = Security.CryptoUtils.DecodeUsername(pU.Username); ppU.Name = Security.CryptoUtils.DecodeUserString(pU.Name, pU); ppU.Surname = Security.CryptoUtils.DecodeUserString(pU.Surname, pU); sb.AppendFormat("{0} {1}, ", ppU.Name, ppU.Surname); } sb.Remove(sb.Length - 2, 2); proyect_people.InnerText = sb.ToString(); /// Elements load bugPanel.Text = BuildElement("Bug", splitnpu[1], cP, 1); defectPanel.Text = BuildElement("Defect", splitnpu[1], cP, 1); patchesPanel.Text = BuildElement("Patch", splitnpu[1], cP, 1); changesPanel.Text = BuildElement("Changes", splitnpu[1], cP, 1); featurePanel.Text = BuildElement("Feature", splitnpu[1], cP, 1); supportPanel.Text = BuildElement("Support", splitnpu[1], cP, 1); reviewPanel.Text = BuildElement("Review", splitnpu[1], cP, 1); documentationPanel.Text = BuildElement("Documentation", splitnpu[1], cP, 1); closedPanel.Text = BuildElement("", splitnpu[1], cP, 2); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Controllers.Users.Users CU = Session["User"] as Controllers.Users.Users; /// Someone tried to access this web without the correct id /// Get ID from URL string fullPATH = HttpContext.Current.Request.Url.AbsoluteUri; string[] splitnpu = fullPATH.Split('='); /// Get project from ID Controllers.Proyects.Proyects cP = new Controllers.Proyects.Proyects(); try { /// Get userlicence in common of this proyect and this user var query2 = (from lUL in Controllers.UserLicense.UserLicense.lUL where lUL.IdUser == CU.Id && lUL.IdLicense == splitnpu[1] select lUL).First(); try { /// If they are equal (just in case someone paste another proyectID) var x = Controllers.Proyects.Proyects.lP.Single(a => a.IdLicense == splitnpu[1] && a.IdLicense == query2.IdLicense); cP.Id = x.Id; cP.IdLicense = x.IdLicense; cP.Title = x.Title; cP.Summary = x.Summary; cP.Owner = x.Owner; cP.Website = x.Website; cP.Repository = x.Repository; cP.Support = x.Support; cP.Title = Security.CryptoUtils.DecodeElementString(cP, cP.Title); cP.Summary = Security.CryptoUtils.DecodeElementString(cP, cP.Summary); cP.Owner = Security.CryptoUtils.DecodeElementString(cP, cP.Owner); cP.Website = Security.CryptoUtils.DecodeElementString(cP, cP.Website); cP.Repository = Security.CryptoUtils.DecodeElementString(cP, cP.Repository); cP.Support = Security.CryptoUtils.DecodeElementString(cP, cP.Support); /// If everything works lets save Session Session["Proyect"] = cP as Controllers.Proyects.Proyects; Master.cpTITLE = cP.Title; } catch (Exception) { /// GTFO Session.Abandon(); Session.Clear(); Response.Redirect("/Views/Login/Login.aspx"); } } catch (Exception) { Response.Redirect("/Views/Error/404.aspx"); } /// Get current Proyect from the Session["Proyect"] /// Set the summary on the view managep_summary.Text = cP.Summary; managep_webiste.Text = cP.Website; managep_owner.Text = cP.Owner; managep_title.Text = cP.Title; managep_support.Text = cP.Support; managep_repository.Text = cP.Repository; Master.cpTITLE = cP.Title; /// Get the people from the proyect var query = (from lUL in Controllers.Users.Users.uLTest join UL in Controllers.UserLicense.UserLicense.lUL on lUL.Id equals UL.IdUser where UL.IdLicense == cP.IdLicense select lUL).ToList(); StringBuilder sb = new StringBuilder(); /// Build the string with all the contributors foreach (Controllers.Users.Users pU in query) { Controllers.Users.Users ppU = new Controllers.Users.Users(); ppU.Username = Security.CryptoUtils.DecodeUsername(pU.Username); ppU.Name = Security.CryptoUtils.DecodeUserString(pU.Name, pU); ppU.Surname = Security.CryptoUtils.DecodeUserString(pU.Surname, pU); sb.AppendFormat("{0} {1}, ", ppU.Name, ppU.Surname); } /// Remove last , sb.Remove(sb.Length - 2, 2); /// Set it proyect_people.InnerText = sb.ToString(); errorDiv.Visible = false; } pagetitle.Text = managep_title.Text + " - Lovis"; }
protected void Page_Load(object sender, EventArgs e) { CuLPP.Clear(); if (Session["User"] == null) { Session.Abandon(); Session.Clear(); Response.Redirect("/Views/Login/Login.aspx"); } else { //////////////////////////////////////////////////////////////////////////////////////////////////////// /// /// GLOBAL VARIABLES TO USE IN MASTERPAGE /// //////////////////////////////////////////////////////////////////////////////////////////////////////// #region GLOBAL VARIALBES Controllers.Users.Users CU = Session["User"] as Controllers.Users.Users; string url = HttpContext.Current.Request.Url.AbsolutePath; #endregion //////////////////////////////////////////////////////////////////////////////////////////////////////// /// /// HANDLE 404 ERROR /// //////////////////////////////////////////////////////////////////////////////////////////////////////// #region HANDLE 404 ERRO if (Response.TrySkipIisCustomErrors == true || Response.Status == "404 Not Found" || Response.StatusCode == 404) { Response.Redirect("~/Views/Error/404.aspx"); } #endregion //////////////////////////////////////////////////////////////////////////////////////////////////////// /// /// START BUILD SIDEBAR /// //////////////////////////////////////////////////////////////////////////////////////////////////////// #region BUILD SIDEBAR /// Get proyects from user to build sidebar List <Controllers.Proyects.Proyects> CuLP = new List <Controllers.Proyects.Proyects>(); foreach (Controllers.UserLicense.UserLicense UL in Controllers.UserLicense.UserLicense.lUL) { /// Find Userlicenses of user if (UL.IdUser == CU.Id) { /// Finde License of UserLicense var x = Controllers.License.License.lL.Single(l => l.IdLicense == UL.IdLicense); /// Filter proyects for Licenses of user foreach (Controllers.Proyects.Proyects P in Controllers.Proyects.Proyects.lP) { /// If userlicense and proyect licenese are == that means is our proyect if (P.IdLicense == x.IdLicense) { CuLP.Add(P); } } } } foreach (Controllers.Proyects.Proyects DP in CuLP) { Controllers.Proyects.Proyects dP = new Controllers.Proyects.Proyects(); dP.Id = DP.Id; dP.IdLicense = DP.IdLicense; dP.Title = Security.CryptoUtils.DecodeElementString(DP, DP.Title); dP.Summary = Security.CryptoUtils.DecodeElementString(DP, DP.Summary); CuLPP.Add(dP); } GenerateSidebar(HttpContext.Current.Request.Url.AbsolutePath); #endregion //////////////////////////////////////////////////////////////////////////////////////////////////////// /// /// BUILD TOP BAR /// //////////////////////////////////////////////////////////////////////////////////////////////////////// #region TOPNAME if (url == "~/Views/Proyects/Proyects.aspx") { Master_pagetitle.InnerText = "Lovis > Projects > " + cpTITLE; } else { /// Else its normal path string[] splitedurl = url.Split('/'); string[] splitpath = splitedurl.Last().Split('.'); Master_pagetitle.InnerText = splitpath[0]; /// Some fixes if (splitpath[0] == "AddProyect") { Master_pagetitle.InnerText = "Lovis > Proyects > Add project"; } if (splitpath[0] == "User") { Master_pagetitle.InnerText = "Lovis > Account > Manage"; } if (splitpath[0] == "404") { Master_pagetitle.InnerText = "Page not found"; } if (splitpath[0] == "Dashboard" || splitpath[0] == "dashboard") { Master_pagetitle.InnerText = "Lovis > Dashboard"; } if (splitpath[0] == "AddElement") { Master_pagetitle.InnerText = "Lovis > " + cpTITLE + " > Add task"; } if (splitpath[0] == "ManageProyect") { Master_pagetitle.InnerText = "Lovis > " + cpTITLE + " > Manage"; } if (splitpath[0] == "ManageElement") { Master_pagetitle.InnerText = "Lovis > " + cpTITLE + " > Manage task"; } if (splitpath[0] == "Proyects") { Master_pagetitle.InnerText = "Lovis > " + cpTITLE; } if (splitpath[0] == "Profile") { Master_pagetitle.InnerText = "Lovis > " + cpTITLE; } if (splitpath[0] == "YourProjects") { Master_pagetitle.InnerText = "Lovis > My projects"; } } #endregion #region BUILD TOPBAR /// Set name in account dropdown master_username.InnerText = CU.Name; #endregion } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { managee_error.Visible = false; Controllers.Users.Users CU = Session["User"] as Controllers.Users.Users; /// Someone tried to access this web without the correct id /// Get ID from URL string fullPATH = HttpContext.Current.Request.Url.AbsoluteUri; string[] splitnpu = fullPATH.Split('='); /// Get project from ID Controllers.Proyects.Proyects cP = Session["Proyect"] as Controllers.Proyects.Proyects; if (cP == null) { Response.Redirect("~/Views/Dashboard/dashboard.aspx"); } else { /// Fill all the dropowns by backend /// Types managee_type.Items.Add(new ListItem("Bug", "Bug")); /// 1 managee_type.Items.Add(new ListItem("Feature", "Feature")); /// 5 managee_type.Items.Add(new ListItem("Support", "Support")); /// 6 managee_type.Items.Add(new ListItem("Review", "Review")); /// 7 managee_type.Items.Add(new ListItem("Defect", "Defect")); ///2 managee_type.Items.Add(new ListItem("Patch", "Patch")); /// 3 managee_type.Items.Add(new ListItem("Changes", "Changes")); /// 4 managee_type.Items.Add(new ListItem("Documentation", "Documentation")); /// 8 /// Priorities managee_priority.Items.Add(new ListItem("Low", "Low")); managee_priority.Items.Add(new ListItem("Normal", "Normal")); managee_priority.Items.Add(new ListItem("High", "High")); managee_priority.Items.Add(new ListItem("Critical", "Critical")); /// States managee_state.Items.Add(new ListItem("New", "New")); managee_state.Items.Add(new ListItem("Analysis", "Analysis")); managee_state.Items.Add(new ListItem("In-Progress", "In-Progress")); managee_state.Items.Add(new ListItem("Resolved", "Resolved")); managee_state.Items.Add(new ListItem("Test", "Test")); managee_state.Items.Add(new ListItem("Closed", "Closed")); /// Assigned /// Get the people from the proyect var query = (from lUL in Controllers.Users.Users.uLTest join UL in Controllers.UserLicense.UserLicense.lUL on lUL.Id equals UL.IdUser where UL.IdLicense == cP.IdLicense select lUL).Distinct().ToList(); foreach (Controllers.Users.Users u in query) { ListItem l = new ListItem(Security.CryptoUtils.DecodeUserString(u.Name, u) + " " + Security.CryptoUtils.DecodeUserString(u.Surname, u), u.Id); managee_assignedto.Items.Add(l); } /// Check if user has access to this task by checking if the user itself has access to this PROJECT foreach (Controllers.UserLicense.UserLicense UL in Controllers.UserLicense.UserLicense.lUL) { /// Find Userlicenses of user if (UL.IdUser == CU.Id) { /// Find License of UserLicense var y = Controllers.License.License.lL.Single(l => l.IdLicense == UL.IdLicense); /// Filter proyects for Licenses of user foreach (Controllers.Proyects.Proyects P in Controllers.Proyects.Proyects.lP) { /// If userlicense and proyect licenese are == that means is our proyect if (P.IdLicense == y.IdLicense) { try { var x = Controllers.Elements.Elements.lE.Single(a => a.Id == splitnpu[1] && a.IdProyect == cP.Id); managee_title.Text = Security.CryptoUtils.DecodeElementString(cP, x.Title); managee_summary.Text = Security.CryptoUtils.DecodeElementString(cP, x.Summary); managee_type.SelectedValue = Security.CryptoUtils.DecodeElementString(cP, x.Type); managee_state.SelectedValue = Security.CryptoUtils.DecodeElementString(cP, x.State); managee_priority.SelectedValue = Security.CryptoUtils.DecodeElementString(cP, x.Priority); managee_datestart.Text = x.DateStart.ToString(); managee_datefinish.Text = x.DateFinish.ToString(); managee_assignedto.SelectedValue = Security.CryptoUtils.DecodeElementString(cP, x.AssignedTo); } catch (Exception) { Response.Redirect("~/Views/Dashboard/dashboard.aspx"); } } } } } pagetitle.Text = managee_title.Text + " - Lovis"; } } }