示例#1
0
    protected void JobDateInit(object sender, EventArgs e)
    {
        if (Request.QueryString["JobID"] != null)
        {
            try
            {
                Guid jobid = new Guid(Request.QueryString["JobID"]);

                var jobslist = SiteUtilities.GetJobsByJobId(jobid);
                var tmplist  = SiteUtilities.GetCloneJobsByJobId(jobslist[0].JobId);


                if (tmplist.Count == 0 && jobslist[0].ParentJobID == Guid.Empty)
                {
                    if (jobslist[0].Type == SiteUtilities.CONSTRUCTION)
                    {
                        Button1.Visible = false;
                    }
                }

                if (jobslist[0].ParentJobID == Guid.Empty)
                {
                }
                else if (jobslist[0].ParentJobID != Guid.Empty)
                {
                    if (jobslist[0].Type == SiteUtilities.CONSTRUCTION || jobslist[0].Type == SiteUtilities.DESTRUCTION)
                    {
                        JobDate.Visible           = false;
                        JobDateEnd.Visible        = false;
                        JobDateSet.Visible        = false;
                        FreeWeeksOfRental.Visible = false;
                        JobName.Enabled           = false;
                        JobAddress.Enabled        = false;
                    }
                }
                else if (jobslist[0].Type == SiteUtilities.CONSTRUCTIONFINNISHED || jobslist[0].Type == SiteUtilities.DESTRUCTIONFINNISHED)
                {
                    JobDate.Visible           = false;
                    JobDateEnd.Visible        = false;
                    JobDateSet.Visible        = false;
                    FreeWeeksOfRental.Visible = false;
                    JobName.Enabled           = false;
                    JobAddress.Enabled        = false;
                }

                if (jobslist[0].JobStartDate.ToShortDateString() == "9999-12-31")
                {
                    JobDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
                    if (jobslist[0].JobEndDate.ToShortDateString() == "9999-12-31")
                    {
                        JobDateEnd.Text = DateTime.Now.ToString("yyyy-MM-dd");
                    }
                }
                else
                {
                    JobDate.Text = jobslist[0].JobStartDate.ToShortDateString();
                    if (jobslist[0].JobEndDate.ToShortDateString() != "9999-12-31")
                    {
                        JobDateEnd.Text = jobslist[0].JobEndDate.ToShortDateString();
                    }
                }


                JobContact.Text  = jobslist[0].ContactName;
                JobName.Text     = jobslist[0].JobName;
                JobAddress.Text  = jobslist[0].Address;
                JobComments.Text = jobslist[0].Comments;

                FreeWeekOfRental();
            }
            catch
            {
            }
        }
    }