private void GetResponse()
 {
     this.Response.Clear();
     this.Response.Write(AdminUtils.StandardDateFormat(AdminUtils.EmployeeDate(DateTime.UtcNow, curEmployee), false));
     //this.Response.End();
     HttpContext.Current.ApplicationInstance.CompleteRequest();
 }
Пример #2
0
        private string SegmentsTable()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<table class=\"openJobs\">");
            sb.Append("<tr>");
            sb.Append("<th>Employee</th>");
            sb.Append("<th>Start</th>");
            sb.Append("<th>Stop</th>");
            sb.Append("<th>Notes</th>");
            sb.Append("<th></th>");
            sb.Append("</tr>");

            foreach (JobSegment segment in curSegments)
            {
                string segmentEmployee = segment.Employee.FirstName.Substring(0, 1) + ". "
                                         + segment.Employee.LastName;
                DateTime segmentStart = AdminUtils.EmployeeDate(segment.StartDate, curEmployee);

                bool     isOpenSegment = segment.EndDate == DateTime.MinValue;
                DateTime segmentStop   = DateTime.MinValue;
                if (!isOpenSegment)
                {
                    segmentStop = AdminUtils.EmployeeDate(segment.EndDate, curEmployee);
                }

                sb.Append("<tr");
                if (isOpenSegment)
                {
                    sb.Append(" class=\"openJobSegment\"");
                }
                sb.Append(">");

                sb.Append("<td>" + segmentEmployee + "</td>");
                sb.Append("<td>" + AdminUtils.StandardDateFormat(segmentStart, true) + "</td>");
                sb.Append("<td>");
                if (!isOpenSegment)
                {
                    sb.Append(AdminUtils.StandardDateFormat(segmentStop, true));
                }
                sb.Append("</td>");

                sb.Append("<td>" + SiteUtils.SurroundTextBlocksWithHtmlTags(segment.Notes, "div", null) + "</td>");

                sb.Append("<td>");
                if (isOpenSegment && segment.Employee.Equals(curEmployee))
                {
                    sb.Append("<a href=\"\" id=\"hlStopWork\">Stop</a>");
                }
                sb.Append("</td>");

                sb.Append("</tr>");
            }

            sb.Append("</table>");

            return(sb.ToString());
        }
Пример #3
0
        public Invoice CreateCurrentInvoice(Client client, Employee curAdmin)
        {
            IList <Job> uninvoicedJobs = Job.UninvoicedJobsForClient(client);

            if (uninvoicedJobs.Count == 0)
            {
                return(null);
            }

            DateTime nowForAdmin = AdminUtils.EmployeeDate(DateTime.UtcNow, curAdmin);

            DateTime invoiceDate = new DateTime(nowForAdmin.Year, nowForAdmin.Month, 1, 0, 0, 0); // first day of month
            DateTime dueDate     = invoiceDate.AddMonths(1);

            return(CreateInvoice(client, invoiceDate, dueDate, uninvoicedJobs));
        }
Пример #4
0
        //protected string DateFormat(DateTime dt)
        //{
        //    return dt.ToString("M/d/yyyy" + "<br />") + dt.ToString("h:mm tt");
        //}

        protected DateTime AdminDate(DateTime utcDate)
        {
            return(AdminUtils.EmployeeDate(utcDate, curEmployee));
        }
Пример #5
0
 protected DateTime DateForEmployee(DateTime dt)
 {
     return(AdminUtils.EmployeeDate(dt, curEmployee));
 }
Пример #6
0
        private void SetControls()
        {
            // link to job
            this.pnlViewJob.Controls.Add(new LiteralControl("<a href=\"/admin/JobAdmin.aspx?jobId=" + curJob.JobId.ToString() + "\">View job details</a>"));

            // files
            if (filesChanged)
            {
                SetFileLists(); // we called this earlier on page_load, so only do it again if
            }
            // added or deleted a file.

            // segments
            if (curSegments != null)
            {
                phSegments.Controls.Add(new LiteralControl(SegmentsTable()));
            }

            // job no.
            this.lblHeadingJobNumber.Text = curJob.JobId.ToString();

            // client
            this.lblClient.Text = this.Server.HtmlEncode(curJob.Client.FirstName + " " + curJob.Client.LastName);

            // status
            this.lblStatus.Text = curJob.JobStatus.Name;

            // date submitted
            DateTime dateSubmitted = AdminUtils.EmployeeDate(curJob.DateSubmitted, curEmployee);                   this.lblDateSubmitted.Text = dateSubmitted.ToString("M/d/yyyy h:mm tt");

            // date due
            DateTime dateDue = AdminUtils.EmployeeDate(curJob.DateDue, curEmployee);

            this.lblDateDue.Text = dateDue.ToString("M/d/yyyy h:mm tt");

            // completed "at _______"
            if (curJob.JobStatus.IsAClosedStatus())
            {
                DateTime dateCompleted = AdminUtils.EmployeeDate(curJob.DateCompleted, curEmployee);                   this.lblStatus.Text += " at " + dateCompleted.ToString("M/d/yyyy h:mm tt");
            }

            // job type
            this.lblJobType.Text = curJob.JobType.Name;

            // instructions
            this.phInstructions.Controls.Add(
                new LiteralControl(SiteUtils.SurroundTextBlocksWithHtmlTags(curJob.Instructions, "div", null)));

            // buttons
            if (isWorkingNow)
            {
                pnlStart.Visible = false;
                DateTime startTimeForEe = AdminUtils.EmployeeDate(curSegment.StartDate, curEmployee);                  this.txtTimeStarted.Text = AdminUtils.StandardDateFormat(startTimeForEe, false);
            }
            else
            {
                pnlStart.Visible = true;
            }

            // job status dropdown
            this.ddStatuses.SelectedValue = curJob.JobStatus.JobStatusId.ToString();
        }