protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["JobId"] != null) { jobId = Convert.ToInt32(Request.QueryString["JobId"]); } Dal.SubstituteExceptions substituteExceptions = new Miami.Substitute.Dal.SubstituteExceptions(); Miami.Substitute.Bll.Substitute substitute = new Miami.Substitute.Bll.Substitute(); substitute.LoadByUserId(); substituteId = substitute.SubstituteId; Miami.Substitute.Bll.Job job = new Miami.Substitute.Bll.Job(); job.LoadByPrimaryKeyBase(jobId); bool isApplied = job.LoadSubstituteJob(jobId, substituteId); lbApply.Visible = !isApplied; lblApplyHelpText.Visible = isApplied; bool overlap = job.IsOverlap(jobId, substituteId); bool overlapExceptions = substituteExceptions.IsOverlapped(substitute.UserId, job.DatetimeStart.Date, job.DatetimeEnd.Date); OverlapLabel.Visible = overlap; lblApplyHelpText.Visible = lblApplyHelpText.Visible & !overlap; lbApply.Enabled = lbApply.Enabled & !overlap; lbCancel.Visible = isApplied; if (overlapExceptions && lbApply.Enabled) { lbApply.OnClientClick = (string)GetLocalResourceObject("OverlapConfirmText"); } orLiteral.Visible = ReturnJobsListLinkButton.Visible = lbApply.Visible; }
protected void Highlight() { Miami.Substitute.Dal.SubstituteExceptions DalSubstitute = new Miami.Substitute.Dal.SubstituteExceptions(); Miami.Substitute.Bll.Job job = new Miami.Substitute.Bll.Job(); Label appliedLabel = new Label(); appliedLabel.Text = " (Applied)"; appliedLabel.Font.Bold = true; appliedLabel.ForeColor = System.Drawing.Color.Green; foreach (GridViewRow gvr in JobList.Rows) { int overlap = Convert.ToInt32(((System.Data.DataView)(JobList.DataSource)).Table.Rows[gvr.RowIndex]["Overlap"]); if (overlap == 0) { int jobId = Convert.ToInt32(JobList.DataKeys[gvr.RowIndex].Value); if (job.LoadSubstituteJob(jobId)) gvr.Cells[0].Controls.Add(appliedLabel); } else { gvr.Cells[0].BackColor = System.Drawing.Color.FromArgb(255, 111, 111); } if (DalSubstitute.IsOverlapped(Micajah.Common.Security.UserContext.Current.UserId, Convert.ToDateTime(gvr.Cells[1].Text), Convert.ToDateTime(gvr.Cells[2].Text))) { ((System.Web.UI.WebControls.WebControl)(gvr.Cells[0].Controls[0])).ToolTip = GetLocalResourceObject("ToolTip_Availability").ToString(); ((System.Web.UI.WebControls.WebControl)(gvr.Cells[1])).ForeColor = System.Drawing.Color.DarkOrange; ((System.Web.UI.WebControls.WebControl)(gvr.Cells[2])).ForeColor = System.Drawing.Color.DarkOrange; if (lblLegend.Text.Length == 0) lblLegend.Text = gvr.Cells[1].Text + GetLocalResourceObject("ToolTip_Highlighted").ToString(); } } }
protected void Highlight() { Miami.Substitute.Dal.SubstituteExceptions DalSubstitute = new Miami.Substitute.Dal.SubstituteExceptions(); Miami.Substitute.Bll.Job job = new Miami.Substitute.Bll.Job(); Label appliedLabel = new Label(); appliedLabel.Text = " (Applied)"; appliedLabel.Font.Bold = true; appliedLabel.ForeColor = System.Drawing.Color.Green; foreach (GridViewRow gvr in JobList.Rows) { int overlap = Convert.ToInt32(((System.Data.DataView)(JobList.DataSource)).Table.Rows[gvr.RowIndex]["Overlap"]); if (overlap == 0) { int jobId = Convert.ToInt32(JobList.DataKeys[gvr.RowIndex].Value); if (job.LoadSubstituteJob(jobId)) { gvr.Cells[0].Controls.Add(appliedLabel); } } else { gvr.Cells[0].BackColor = System.Drawing.Color.FromArgb(255, 111, 111); } if (DalSubstitute.IsOverlapped(Micajah.Common.Security.UserContext.Current.UserId, Convert.ToDateTime(gvr.Cells[1].Text), Convert.ToDateTime(gvr.Cells[2].Text))) { ((System.Web.UI.WebControls.WebControl)(gvr.Cells[0].Controls[0])).ToolTip = GetLocalResourceObject("ToolTip_Availability").ToString(); ((System.Web.UI.WebControls.WebControl)(gvr.Cells[1])).ForeColor = System.Drawing.Color.DarkOrange; ((System.Web.UI.WebControls.WebControl)(gvr.Cells[2])).ForeColor = System.Drawing.Color.DarkOrange; if (lblLegend.Text.Length == 0) { lblLegend.Text = gvr.Cells[1].Text + GetLocalResourceObject("ToolTip_Highlighted").ToString(); } } } }