Beispiel #1
0
        public void LoadProjects()
        {
            DataTable dt = GetProjects();

            ProjectRepeater.DataSource = dt;
            ProjectRepeater.DataBind();
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["UserID"] == null)
                {
                    Response.Redirect("HomePage.aspx", true);
                }
                string         dateS            = "04/11/2018 10:10:01";
                DateTime       datetime         = Convert.ToDateTime(dateS);
                List <Project> projectsShowcase = Project.ShowProjects((int)Session["UserID"], 0, datetime, 0, int.Parse(ShownProjectsIndex.Value));
                Session["ShownProjects"]   = projectsShowcase;
                ProjectRepeater.DataSource = projectsShowcase;
                ProjectRepeater.DataBind();
                try
                {
                    Label LastProjID = (Label)ProjectRepeater.Controls[ProjectRepeater.Items.Count - 1].FindControl("ProjectID");
                    if (LastProjID != null)
                    {
                        ShownProjectsIndex.Value = LastProjID.Text;
                    }
                }
                catch
                {
                }
            }
            DropDownAgeFilter.DataSource = Enumerable.Range(12, 19).ToList();

            if (!Page.IsPostBack)
            {
                DropDownAgeFilter.DataBind();
                DropDownAgeFilter.Items.Insert(0, new ListItem("none", "0"));
            }
        }
Beispiel #3
0
        void InitializeDataSources()
        {
            List <Project> projects = Project.FindAll();

            ProjectRepeater.DataSource = projects;
            ProjectRepeater.DataBind();
        }
Beispiel #4
0
        protected void ClosePopUp_Click(object sender, EventArgs e)
        {
            List <Project> sessionProjects = (List <Project>)Session["ShownProjects"];

            ProjectRepeater.DataSource = sessionProjects;
            ProjectRepeater.DataBind();
            PopUp.Visible    = false;
            backDrop.Visible = false;
        }
Beispiel #5
0
        protected void ProfilePic_Click(object sender, EventArgs e)
        {
            ImageButton currentbutton = (ImageButton)sender;

            if (currentbutton.AlternateText != "1")
            {
                Response.Redirect($"Profile.aspx?UserID={currentbutton.AlternateText}&section=0", true);
            }
            else
            {
                ProjectRepeater.DataSource = Session["ShownProjects"];
                ProjectRepeater.DataBind();
            }
        }
Beispiel #6
0
    protected void ProjectRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        int projectId = 0;

        try
        {
            projectId = Convert.ToInt32(e.CommandArgument);
        }
        catch (Exception ex)
        {
            log.Error("Error getting object id", ex);
        }
        if (projectId <= 0)
        {
            SystemMessages.DisplaySystemErrorMessage(Resources.Organization.MessageNoComplete);
            return;
        }

        if (e.CommandName == "Restore")
        {
            try
            {
                TrashBLL.RestoreTrash(ProjectHF.Value, projectId);
            }
            catch (Exception ex)
            {
                SystemMessages.DisplaySystemErrorMessage(ex.Message);
                return;
            }
            ProjectRepeater.DataBind();
        }
        if (e.CommandName == "DeleteProject")
        {
            try
            {
                ProjectBLL.DeletePermanently(projectId);
            }
            catch (Exception ex)
            {
                SystemMessages.DisplaySystemErrorMessage(ex.Message);
                return;
            }
            ProjectRepeater.DataBind();
        }
    }
Beispiel #7
0
        protected void OpenPopUp_Click(object sender, EventArgs e)
        {
            PopUp.Visible    = true;
            backDrop.Visible = true;
            List <Project> sessionProjects = (List <Project>)Session["ShownProjects"];

            ProjectRepeater.DataSource = sessionProjects;
            ProjectRepeater.DataBind();
            backDrop.Attributes.Add("onclick", "ClosePopUp();");
            Project ChosenProject = new Project(int.Parse(PostProjID.Value), true);
            var     projectText   = new HtmlDocument();

            projectText.LoadHtml(ChosenProject.ProjectContent);
            string projectShortDesc = projectText.DocumentNode.SelectSingleNode("//div[@class='SubHeader_container']").OuterHtml;

            projectShortDesc = projectShortDesc.Replace("contenteditable=\"true\"", "contenteditable=\"false\"");
            string projectShortDesc_string = projectShortDesc;

            ShortSummaryDesc_wrap.InnerHtml = projectShortDesc_string;
            PositionsRepeater.DataSource    = ChosenProject.ProjectPositions;
            PositionsRepeater.DataBind();
        }
Beispiel #8
0
        protected void SearchProject_Click(object sender, EventArgs e)
        {
            if (LoadMoreProjB.Visible == false)
            {
                LoadMoreProjB.Visible = true;
            }
            Session["ShownProjects"] = null;
            List <Project> projectsShowcase;

            ShownProjectsIndex.Value = "0";
            if (DropDownFiltered.SelectedValue == "1")
            {
                string   dateS    = "04/11/2018 10:10:01";
                DateTime datetime = Convert.ToDateTime(dateS); //30
                projectsShowcase = Project.ShowProjects((int)Session["UserID"], 0, datetime, 0, int.Parse(ShownProjectsIndex.Value));
            }
            else
            {
                int      AgeFilter  = int.Parse(DropDownAgeFilter.SelectedValue);
                int      RateFilter = int.Parse(DropDownRateFilter.SelectedValue);
                DateTime DateFilter = new DateTime();
                switch (int.Parse(DropDownDateFilter.SelectedValue))
                {
                case 0:
                    string dateS = "04/11/2018 10:10:01";
                    DateFilter = Convert.ToDateTime(dateS);
                    break;

                case 1:
                    DateFilter = DateTime.Today;
                    break;

                case 2:
                    DateFilter = DateTime.Now;
                    TimeSpan TimeS = new TimeSpan(7, 0, 0, 0);
                    DateFilter = DateFilter - TimeS;
                    break;

                case 3:
                    DateFilter = DateTime.Now;
                    TimeSpan TimeS2 = new TimeSpan(30, 0, 0, 0);
                    DateFilter = DateFilter - TimeS2;
                    break;

                case 4:
                    DateFilter = DateTime.Now;
                    TimeSpan TimeS3 = new TimeSpan(365, 0, 0, 0);
                    DateFilter = DateFilter - TimeS3;
                    break;
                }
                projectsShowcase = Project.ShowProjects((int)Session["UserID"], AgeFilter, DateFilter, RateFilter, int.Parse(ShownProjectsIndex.Value));
            }
            List <Project> sessionProjects;

            //if (session["shownprojects"] projectsShowcase != null)
            //{
            //    sessionProjects = (List<Project>)Session["ShownProjects"];
            //    sessionProjects.AddRange(projectsShowcase);
            //}
            //else
            //{
            Session["ShownProjects"] = projectsShowcase;
            //}
            sessionProjects            = (List <Project>)Session["ShownProjects"];
            ProjectRepeater.DataSource = sessionProjects;
            ProjectRepeater.DataBind();
            if (projectsShowcase.Count != 0)
            {
                Label LastProjID = (Label)ProjectRepeater.Controls[ProjectRepeater.Items.Count - 1].FindControl("ProjectID");
                if (LastProjID != null)
                {
                    ShownProjectsIndex.Value = LastProjID.Text;
                }
            }
            if (projectsShowcase.Count < 10)
            {
                LoadMoreProjB.Visible = false;
            }
        }