コード例 #1
0
    private void WebsiteJobs(Sling Sling, DateTime dtBeg, DateTime dtEnd)
    {
        string Sql = string.Format(
            "Select JobRno, SlingShiftId, JobDate, Crew " +
            "From mcJobs " +
            "Where JobDate Between {0} and {1} " +
            "And IsNull(Crew, '') <> '' " +
            "And IsNull(ProposalFlg, 0) = 0 " +
            "Order By JobDate",
            DB.Put(dtBeg),
            DB.Put(dtEnd.AddDays(1).AddSeconds(-1)));

        try
        {
            StringBuilder sbHtml = new StringBuilder();
            sbHtml.AppendLine("<tr><td colspan=\"4\"><h2 class=\"section\">Jobs Missing Sling Shift</h2></td></tr>");
            sbHtml.AppendFormat("<tr><th>Date</th><th>Job #</th><th>Sling Shift</th><th>Add Shift</th><td><label class=\"TextLink All Jobs\">All</label>&nbsp;&nbsp;<label class=\"TextLink None Jobs\">None</label></td></tr>\n");

            int       i  = 0;
            DataTable dt = db.DataTable(Sql);
            foreach (DataRow dr in dt.Rows)
            {
                Int32    JobRno       = DB.Int32(dr["JobRno"]);
                string   SlingShiftId = DB.Str(dr["SlingShiftId"]);
                DateTime JobDt        = DB.DtTm(dr["JobDate"]);

                MarvellJobs.Add(JobRno, SlingShiftId);

                Sling.CalendarEvent Shift = null;
                if (SlingShiftId.Length > 0)
                {
                    Shift = Sling.FindShift(SlingShiftId);
                }
                if (Shift == null)
                {
                    sbHtml.AppendFormat("<tr><td>{0}</td><td><a href='Job.aspx?JobRno={1}' target='Job'>{1}</a></td><td>{2}</td><td class=\"checkbox\"><input type=checkbox name=\"JobId_{3}\" value=\"{1}\" checked=\"checked\" class=\"Job\"></td></tr>\n", JobDt.ToShortDateString(), JobRno, SlingShiftId, ++i);
                }
            }
            ltlData.Text = sbHtml.ToString();

            hfNumJobsIDs.Value = i.ToString();
        }
        catch (Exception Ex)
        {
            Err Err = new Err(Ex, Sql);
            Response.Write(Err.Html());
        }
    }