Esempio n. 1
0
    public void InitMembershipInfo(ListBox listBoxSelectedItems, ListBox listBoxExistingItems)
    {
        try
        {
            DataTable            tableSelectedItems = new DataTable();
            DataTable            tableExistingItems = new DataTable();
            DataRow              dataRow;
            Hashtable            hashSelected    = new Hashtable();
            List <Person>        personlist      = new List <Person>();
            List <JobPersonList> persononJoblist = new List <JobPersonList>();
            Collection <Person>  persons         = new Collection <Person>();
            personlist = SiteUtilities.GetAllPersonal();

            if (Request.QueryString["JobID"] != null)
            {
                persononJoblist = SiteUtilities.GetJobPersonal(new Guid(Request.QueryString["JobID"]));

                if (personlist != null)
                {
                    if (personlist.Count > 0)
                    {
                        tableSelectedItems.Columns.Add(new DataColumn("Name", typeof(string)));
                        tableSelectedItems.Columns.Add(new DataColumn("Id", typeof(Guid)));
                        foreach (JobPersonList person in persononJoblist)
                        {
                            dataRow    = tableSelectedItems.NewRow();
                            dataRow[0] = person.Firstname + " " + person.Lastname;
                            dataRow[1] = person.PersonId;
                            tableSelectedItems.Rows.Add(dataRow);
                            hashSelected.Add(person.PersonId, "isSelected");
                            c_hiddenSelectedItems.Value += person.PersonId.ToString() +
                                                           DELIMITER_LIST_BOX_SELECTION;
                        }
                        listBoxSelectedItems.DataTextField  = "Name";
                        listBoxSelectedItems.DataValueField = "Id";
                        listBoxSelectedItems.DataSource     = tableSelectedItems;
                        listBoxSelectedItems.DataBind();
                    }
                }



                // Existing Items, (all the persons that the job is not allready added to)
                tableExistingItems.Columns.Add(new DataColumn("Name", typeof(string)));
                tableExistingItems.Columns.Add(new DataColumn("Id", typeof(Guid)));
                foreach (Person person in personlist)
                {
                    AddPersons(tableExistingItems, hashSelected, person);
                }
                listBoxExistingItems.DataTextField  = "Name";
                listBoxExistingItems.DataValueField = "Id";
                listBoxExistingItems.DataSource     = tableExistingItems;
                listBoxExistingItems.DataBind();
            }
        }
        catch
        {
        }
    }
Esempio n. 2
0
    protected void GetAllJobs(object sender, EventArgs e)
    {
        Panel    panel    = sender as Panel;
        DateTime now      = System.DateTime.Now;
        String   daylabel = "";
        DateTime daytime  = new DateTime();

        if (Session["Week"] == null)
        {
            Session.Add("Week", week);
        }
        sessionweekObject = Session["Week"];
        if (sessionweekObject.ToString() == "0")
        {
            sessionweekObject = SiteUtilities.GetWeekNumber(DateTime.Now, 0);
        }
        List <JobList> jobLists = new List <JobList>();

        GetDate(now, jobLists);
        for (int i = 0; i < jobLists.Count; i++)
        {
            List <JobPersonList> personInJob = new List <JobPersonList>();
            var tmplist = SiteUtilities.GetJobsByDate(jobLists[i].Date);

            for (int j = 0; j < tmplist.Count; j++)
            {
                personInJob = SiteUtilities.GetJobPersonal(tmplist[j].JobId);

                for (int k = 0; k < personInJob.Count; k++)
                {
                    if (personInJob[k] != null)
                    {
                        string names = personInJob[k].Firstname + " " + personInJob[k].Lastname + " ";
                        tmplist[j].PersonsInThisJob += names;
                    }
                }
            }

            jobLists[i].Jobs = tmplist;
        }



        jobRepeater.DataSource = jobLists;
        jobRepeater.DataBind();
    }
Esempio n. 3
0
    protected void GetAllJobs(object sender, EventArgs e)
    {
        if (Session["Week"] == null)
        {
            Session.Add("Week", week);
        }
        sessionweekObject = Session["Week"];
        if (sessionweekObject.ToString() == "0")
        {
            sessionweekObject = SiteUtilities.GetWeekNumber(DateTime.Now, 0);
        }
        List <JobList> jobLists = new List <JobList>();

        GetDate(FirstDayofWeek, jobLists);
        for (int i = 0; i < jobLists.Count; i++)
        {
            //List<Job> tmplist = new List<Job>();
            var personInJob = new List <JobPersonList>();

            var tmplist = SiteUtilities.GetJobsByDate(jobLists[i].Date);

            for (int j = 0; j < tmplist.Count; j++)
            {
                personInJob = SiteUtilities.GetJobPersonal(tmplist[j].JobId);

                for (int k = 0; k < personInJob.Count; k++)
                {
                    if (personInJob[k] != null)
                    {
                        if (personInJob[k].Active)
                        {
                            string names = personInJob[k].Firstname + " " + personInJob[k].Lastname.Substring(0, 1) + " ";
                            tmplist[j].PersonsInThisJob += names;
                        }
                    }
                }
            }

            jobLists[i].Jobs = tmplist;
        }
        jobRepeater.DataSource = jobLists;
        jobRepeater.DataBind();
    }
Esempio n. 4
0
    protected void GetAllNewJobs(object sender, EventArgs e)
    {
        Panel  panel    = sender as Panel;
        String daylabel = "";

        if (Session["Week"] == null)
        {
            Session.Add("Week", week);
        }
        sessionweekObject = Session["Week"];
        if (sessionweekObject.ToString() == "0")
        {
            sessionweekObject = SiteUtilities.GetWeekNumber(DateTime.Now, 0);
        }

        if (panel != null && panel.ID == "NoDate")
        {
            List <JobPersonList> personInJob = new List <JobPersonList>();
            var jobslist = SiteUtilities.GetJobsByDate(DateTime.MaxValue);

            for (int i = 0; i < jobslist.Count; i++)
            {
                personInJob = SiteUtilities.GetJobPersonal(jobslist[i].JobId);

                for (int j = 0; j < personInJob.Count; j++)
                {
                    if (personInJob[j] != null)
                    {
                        if (personInJob[j].Active)
                        {
                            string names = personInJob[j].Firstname + " " + personInJob[j].Lastname + " ";
                            jobslist[i].PersonsInThisJob += names;
                        }
                    }
                }
            }

            NoDayRepeater.DataSource = jobslist;
            NoDayRepeater.DataBind();
            NoDateLabel.Text = daylabel;
        }
    }