Пример #1
0
        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]);
            }
        }
Пример #2
0
        protected void managep_addcollaborators_Click(object sender, EventArgs e)
        {
            /// Get the current proyect previously.
            Controllers.Proyects.Proyects CP = Session["Proyect"] as Controllers.Proyects.Proyects;

            string[] cb       = managep_invitepeople.Text.Split(' ');
            string   fullPATH = HttpContext.Current.Request.Url.AbsoluteUri;

            string[] splitnpu = fullPATH.Split('=');

            foreach (string t in cb)
            {
                try
                {
                    var x = Controllers.Users.Users.uLTest.Single(a => Security.CryptoUtils.DecodeUsername(a.Username) == t);

                    Controllers.UserLicense.Confirmation.Confirmation c = new Controllers.UserLicense.Confirmation.Confirmation(x.Id, splitnpu[1], 1);
                    c.Add();

                    string user        = Security.CryptoUtils.DecodeUsername(x.Username);
                    string name        = Security.CryptoUtils.DecodeUserString(x.Name, x);
                    string surname     = Security.CryptoUtils.DecodeUserString(x.Surname, x);
                    string owner       = CP.Owner;
                    string projectname = CP.Title;

                    Controllers.Email.Email.SendEmailInvitationProject(user, owner, c.Token, name, surname, projectname, c.DateExpiration);
                }
                catch (Exception)
                {
                    break;
                }
            }

            Response.Redirect("~/Views/Proyects/Proyects.aspx?id=" + splitnpu[1]);
        }
Пример #3
0
        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);
                }
            }
        }
Пример #4
0
        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);
        }
Пример #5
0
        protected void managep_update_Click(object sender, EventArgs e)
        {
            /// Get the current proyect previously.
            Controllers.Proyects.Proyects CP = Session["Proyect"] as Controllers.Proyects.Proyects;

            /// Find the proyect where this current proyect id match some proyect ID
            var x = Controllers.Proyects.Proyects.lP.Single(a => a.Id == CP.Id);

            /// Change everything and encode it again.
            x.Title      = Security.CryptoUtils.EncodeElementString(x, managep_title.Text);
            x.Summary    = Security.CryptoUtils.EncodeElementString(x, managep_summary.Text);
            x.Owner      = Security.CryptoUtils.EncodeElementString(x, managep_owner.Text);
            x.Website    = Security.CryptoUtils.EncodeElementString(x, managep_webiste.Text);
            x.Repository = Security.CryptoUtils.EncodeElementString(x, managep_repository.Text);
            x.Support    = Security.CryptoUtils.EncodeElementString(x, managep_support.Text);
        }
Пример #6
0
        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.";
            }
        }
Пример #7
0
        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);
        }
Пример #8
0
        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);
        }
Пример #9
0
        private string BuildElement(string type, string splitnpu, Controllers.Proyects.Proyects cP, int state)
        {
            string res = "";

            var y = Controllers.Proyects.Proyects.lP.Single(a => a.IdLicense == splitnpu);

            var query3 = (from a in Controllers.Elements.Elements.lE
                          where a.IdProyect == y.Id
                          select a).OrderByDescending(d => d.DateCreation).ToList();

            StringBuilder sb = new StringBuilder();

            if (query3.Count > 0)
            {
                foreach (Controllers.Elements.Elements ea in query3)
                {
                    string a = Security.CryptoUtils.DecodeElementString(cP, ea.Type);
                    string b = Security.CryptoUtils.DecodeElementString(cP, ea.State);
                    string c = Security.CryptoUtils.DecodeElementString(cP, ea.Title);
                    string d = Security.CryptoUtils.DecodeElementString(cP, ea.Priority);
                    string f = Security.CryptoUtils.DecodeElementString(cP, ea.AssignedTo);

                    var u = Controllers.Users.Users.uLTest.Single(s => s.Id == f);
                    f = Security.CryptoUtils.DecodeUserString(u.Name, u) + " " + Security.CryptoUtils.DecodeUserString(u.Surname, u);

                    switch (state)
                    {
                    case 1:
                        if (a == type && b != "Closed")
                        {
                            sb.AppendFormat(@"<tr>");

                            /// Title
                            sb.AppendFormat(@"<td class=""project-table"">{0}</td>", c);

                            /// Type
                            if (a == "Bug" || a == "Defect")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-danger"">{0}</span></td>", a);
                                if (a == "Bug")
                                {
                                    iBug++;
                                }
                                else
                                {
                                    iDefect++;
                                }
                            }
                            else if (a == "Changes" || a == "Patch")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-warning"">{0}</span></td>", a);
                                if (a == "Changes")
                                {
                                    iChanges++;
                                }
                                else
                                {
                                    iPatch++;
                                }
                            }
                            else if (a == "Review" || a == "Feature")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-info"">{0}</span></td>", a);
                                if (a == "Review")
                                {
                                    iReview++;
                                }
                                else
                                {
                                    iFeature++;
                                }
                            }
                            else if (a == "Support" || a == "Documentation")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-success"">{0}</span></td>", a);
                                if (a == "Support")
                                {
                                    iSupport++;
                                }
                                else
                                {
                                    iDocumentation++;
                                }
                            }

                            /// State
                            if (b == "New")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-danger"">{0}</span></td>", b);
                            }
                            else if (b == "Analysis")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-default"">{0}</span></td>", b);
                            }
                            else if (b == "In-Progress")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-primary"">{0}</span></td>", b);
                            }
                            else if (b == "Resolved")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-info"">{0}</span></td>", b);
                            }
                            else if (b == "Test")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-warning"">{0}</span></td>", b);
                            }
                            else if (b == "Closed")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-success"">{0}</span></td>", b);
                            }

                            /// Priority
                            if (d == "Low")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-info"">{0}</span></td>", d);
                            }
                            else if (d == "Normal")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-primary"">{0}</span></td>", d);
                            }
                            else if (d == "High")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-warning"">{0}</span></td>", d);
                            }
                            else if (d == "Critical")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-danger"">{0}</span></td>", d);
                            }

                            /// Assignation
                            sb.AppendFormat(@"<td class=""project-table"">{0}</td>", f);

                            /// Dates
                            sb.AppendFormat(@"<td class=""project-table"">{0}</td>", ea.DateCreation);
                            sb.AppendFormat(@"<td class=""project-table"">{0}</td>", ea.DateStart);
                            sb.AppendFormat(@"<td class=""project-table"">{0}</td>", ea.DateFinish);

                            /// Button
                            sb.AppendFormat(@"<td class=""project-table"" style=""width:1%;"">");
                            sb.AppendFormat(@"<a href=""/Views/Element/ManageElement.aspx?id={0}"" class=""btn btn-primary btn-simple btn-xs"">", ea.Id);
                            sb.AppendFormat(@"<i class=""material-icons"">edit</i>");
                            sb.AppendFormat(@"</button>");
                            sb.AppendFormat(@"</td>");

                            sb.AppendFormat(@"</tr>");

                            res = sb.ToString();
                        }
                        break;

                    case 2:
                        if (b == "Closed")
                        {
                            sb.AppendFormat(@"<tr>");

                            /// Title
                            sb.AppendFormat(@"<td class=""project-table"">{0}</td>", c);

                            /// Type
                            if (a == "Bug" || a == "Defect")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-danger"">{0}</span></td>", a);
                            }
                            else if (a == "Changes" || a == "Patch")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-warning"">{0}</span></td>", a);
                            }
                            else if (a == "Review" || a == "Feature")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-info"">{0}</span></td>", a);
                            }
                            else if (a == "Support" || a == "Documentation")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-success"">{0}</span></td>", a);
                            }

                            /// State
                            if (b == "New")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-danger"">{0}</span></td>", b);
                            }
                            else if (b == "In-Progress")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-primary"">{0}</span></td>", b);
                            }
                            else if (b == "Resolved")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-info"">{0}</span></td>", b);
                            }
                            else if (b == "Test")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-warning"">{0}</span></td>", b);
                            }
                            else if (b == "Closed")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-success"">{0}</span></td>", b);
                            }

                            /// Priority
                            if (d == "Low")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-info"">{0}</span></td>", d);
                            }
                            else if (d == "Normal")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-primary"">{0}</span></td>", d);
                            }
                            else if (d == "High")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-warning"">{0}</span></td>", d);
                            }
                            else if (d == "Critical")
                            {
                                sb.AppendFormat(@"<td class=""project-table""><span class=""label label-danger"">{0}</span></td>", d);
                            }

                            /// Assignation
                            sb.AppendFormat(@"<td class=""project-table"">{0}</td>", f);

                            /// Dates
                            sb.AppendFormat(@"<td class=""project-table"">{0}</td>", ea.DateCreation);
                            sb.AppendFormat(@"<td class=""project-table"">{0}</td>", ea.DateStart);
                            sb.AppendFormat(@"<td class=""project-table"">{0}</td>", ea.DateFinish);

                            /// Button
                            sb.AppendFormat(@"<td class=""project-table"">");
                            sb.AppendFormat(@"<a href=""/Views/Element/ManageElement.aspx?id={0}"" class=""btn btn-primary btn-simple btn-xs"">", ea.Id);
                            sb.AppendFormat(@"<i class=""material-icons"">edit</i>");
                            sb.AppendFormat(@"</button>");
                            sb.AppendFormat(@"</td>");


                            sb.AppendFormat(@"</tr>");

                            iClosed++;
                            res = sb.ToString();
                        }
                        break;
                    }
                }
            }

            // Error message shown when theres is not task or whatever
            string txterror = @"<p class=""text-center"" style=""margin: 0 0 0 0;"">No task or issues found for this category.</p>";

            /*
             * if (iBug == 0)
             * {
             *  divBug.InnerHtml = "";
             *  txtBug.Text = txterror;
             *  divBug.Visible = false;
             * }
             * if (iDefect == 0)
             * {
             *  txtDefect.Text = txterror;
             *  divDefect.InnerHtml = "";
             *  divDefect.Visible = false;
             * }
             * if (iChanges == 0)
             * {
             *  divChanges.InnerHtml = "";
             *  txtChanges.Text = txterror;
             *  divChanges.Visible = false;
             * }
             * if (iPatch == 0)
             * {
             *  divPatches.InnerHtml = "";
             *  txtPatches.Text = txterror;
             *  divPatches.Visible = false;
             * }
             * if (iReview == 0)
             * {
             *  divReview.InnerHtml = "";
             *  txtReview.Text = txterror;
             *  divReview.Visible = false;
             * }
             * if (iFeature == 0)
             * {
             *  divFeatures.InnerHtml = "";
             *  txtFeature.Text = txterror;
             *  divFeatures.Visible = false;
             * }
             * if (iSupport == 0)
             * {
             *  divSupport.InnerHtml = "";
             *  txtSupport.Text = txterror;
             *  divSupport.Visible = false;
             * }
             * if (iDocumentation == 0)
             * {
             *  divDocumentation.InnerHtml = "";
             *  txtDocumentation.Text = txterror;
             *  divDocumentation.Visible = false;
             * }
             * if (iClosed == 0)
             * {
             *  divClosed.InnerHtml = "";
             *  txtClosed.Text = txterror;
             *  divClosed.Visible = false;
             * }*/

            return(res);
        }
Пример #10
0
        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";
        }
Пример #11
0
        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
            }
        }
Пример #12
0
        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";
                }
            }
        }