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 btnJobs_Click(object sender, EventArgs e) { Miami.Substitute.Bll.Job job = new Miami.Substitute.Bll.Job(); JobList.DataSource = job.SearchOpenJobs(drJobs.DateStart, drJobs.DateEnd, tbJobs.Value); JobList.DataBind(); Highlight(); }
protected void Page_Load(object sender, EventArgs e) { Miami.Substitute.Bll.Preferred preferred = new Miami.Substitute.Bll.Preferred(); VisibleControls(preferred.IsPreferredExists); Miami.Substitute.Bll.Job job = new Miami.Substitute.Bll.Job(); lblLegend.Text = String.Empty; JobList.DataSource = job.SearchOpenJobs(drJobs.DateStart, drJobs.DateEnd, tbJobs.Value); JobList.DataBind(); Highlight(); }
protected void lbApply_Click(object sender, EventArgs e) { Miami.Substitute.Bll.Job job = new Miami.Substitute.Bll.Job(); job.AddSubstituteToJob(jobId, substituteId); lbApply.Enabled = false; Miami.Substitute.Bll.NoticeSystem noticeSystem = new Miami.Substitute.Bll.NoticeSystem(jobId, Miami.Substitute.Bll.NoticeSystem.NoticeType.JobAppliedForBySubstitute, Micajah.Common.Security.UserContext.Current.UserId, 0); noticeSystem.Send(); Response.Redirect("SearchOpenJobs.aspx"); }
protected void JobList_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { int jobId; int.TryParse(JobList.DataKeys[e.RowIndex].Value.ToString(), out jobId); Miami.Substitute.Bll.Job job = new Miami.Substitute.Bll.Job(); Miami.Substitute.Bll.Substitute substitute = new Miami.Substitute.Bll.Substitute(); substitute.LoadByUserId(); job.DeleteSubstituteFromJob(jobId, substitute.SubstituteId); Miami.Substitute.Bll.NoticeSystem noticeSystem = new Miami.Substitute.Bll.NoticeSystem(jobId, Miami.Substitute.Bll.NoticeSystem.NoticeType.AcceptedJobCancelledBySubstitute, Micajah.Common.Security.UserContext.Current.UserId, 0); noticeSystem.Send(); Response.Redirect("Default.aspx"); }
private void FillCalendar() { Miami.Substitute.Bll.Substitute substitute = new Miami.Substitute.Bll.Substitute(); substitute.LoadByUserId(Micajah.Common.Security.UserContext.Current.UserId); ((DropDownList)AvailabilityForm.FindControl("availabilityTimeStart")).SelectedValue = substitute.AvailabilityTimeStart; ((DropDownList)AvailabilityForm.FindControl("availabilityTimeEnd")).SelectedValue = substitute.AvailabilityTimeEnd; Miami.Substitute.Bll.SubstituteExceptions subExceptions = new Miami.Substitute.Bll.SubstituteExceptions(); DataView dv = subExceptions.LoadAllByUserId(); if (dv != null) { foreach (DataRowView drv in dv) { if (substitute.AvailabilityWeekDays.Contains((((int)(Convert.ToDateTime(drv["DateStart"]).DayOfWeek)) + 1).ToString())) { RadCalendarExceptions.SelectedDates.Add(new Telerik.WebControls.RadDate(Convert.ToDateTime(drv["DateStart"]))); } } } DateTime curDate = DateTime.Now.AddDays(-(DateTime.Now.Day - 1)); Bll.Job job = new Miami.Substitute.Bll.Job(); acceptedJobs = job.SearchOpenJobs(DateTime.Now, DateTime.Now.AddYears(10), 2); while (curDate < DateTime.Now.AddYears(1)) { Telerik.WebControls.RadCalendarDay radCalendarDay = new Telerik.WebControls.RadCalendarDay(); radCalendarDay.Date = curDate; if (IsOverlapDay(curDate)) { radCalendarDay.ItemStyle.CssClass = "overlap"; radCalendarDay.IsSelectable = false; } else if (curDate >= DateTime.Now && substitute.AvailabilityWeekDays.Contains((((int)(curDate.DayOfWeek)) + 1).ToString())) { radCalendarDay.ItemStyle.ForeColor = System.Drawing.Color.Green; radCalendarDay.IsSelectable = true; radCalendarDay.IsDisabled = false; } else { radCalendarDay.IsSelectable = false; radCalendarDay.IsDisabled = true; } RadCalendarExceptions.SpecialDays.Add(radCalendarDay); curDate = curDate.AddDays(1); } }
protected void lbCancel_Click(object sender, EventArgs e) { Miami.Substitute.Bll.Job job = new Miami.Substitute.Bll.Job(); job.LoadByPrimaryKeyBase(jobId); if (job.m_statusId == 2) { Miami.Substitute.Bll.NoticeSystem noticeSystem = new Miami.Substitute.Bll.NoticeSystem(jobId, Miami.Substitute.Bll.NoticeSystem.NoticeType.AcceptedJobCancelledBySubstitute, Micajah.Common.Security.UserContext.Current.UserId, 0); noticeSystem.Send(); } job.DeleteSubstituteFromJob(jobId, substituteId); lbApply.Enabled = true; Response.Redirect("SearchOpenJobs.aspx"); }
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 Page_Load(object sender, EventArgs e) { if (Request.QueryString["pageid"] != null) { return; } Miami.Substitute.Bll.Job job = new Miami.Substitute.Bll.Job(); JobList.DataSource = job.SearchOpenJobs(DateTime.Now.Date.AddDays(-1), DateTime.Now.AddYears(10), 2); JobList.DataBind(); DataView dv = job.SearchOpenJobs(DateTime.Now.Date.AddDays(-1), DateTime.Now.AddYears(10), 3); if (dv != null && dv.Count > 0) { ResponseGridView.DataSource = dv; ResponseGridView.DataBind(); } else { ResponseGridView.Visible = false; lblResponseTitle.Visible = false; } Miami.Substitute.Dal.User user = new Miami.Substitute.Dal.User(); dv = user.LoadForMain(Micajah.Common.Security.UserContext.Current.UserId); if (Session["IsCounted"] == null || Convert.ToInt32(Session["IsCounted"]) == 0) { user.InsertUsage(2, Convert.ToInt32(dv[0]["LocationId"].ToString())); Session["IsCounted"] = 1; } dv.Table.Columns.Add("FullName", Type.GetType("System.String")); dv[0]["FullName"] = dv[0]["FirstName"] + " " + dv[0]["MiddleName"] + (String)(dv[0]["MiddleName"].ToString().Length > 0 ? ". " : "") + dv[0]["LastName"]; dv.Table.Columns.Add("ContactInfo", Type.GetType("System.String")); dv[0]["ContactInfo"] = dv[0]["Address"] + "<br>" + dv[0]["Address2"] + "<br>" + dv[0]["Phone"] + "<br>" + dv[0]["EmailProfile"]; dv.Table.Columns.Add("JobCode", Type.GetType("System.String")); dv[0]["JobCode"] = dv[0]["JobPosition"] + " / " + dv[0]["JobAssignmentDescription"]; if (user.FirstName.Length > 0) { lblName.Text = "Hi, " + Convert.ToString(user.FirstName[0].ToString().ToUpper() + user.FirstName.ToLower().Substring(1, user.FirstName.Length - 1)).TrimEnd(' '); } dv.Table.Columns.Add("SubjectLevel", Type.GetType("System.String")); dv[0]["SubjectLevel"] = "<table border='0' cellspacing='0' cellpadding='0'>"; //DataView dvCoverage = user.LoadCoverage(Micajah.Common.Security.UserContext.Current.UserId); //if (dvCoverage != null && dvCoverage.Table != null && dvCoverage.Table.Rows.Count > 0) //{ // foreach (DataRow dr in dvCoverage.Table.Rows) // { // if (!dr.IsNull("SubjectName") && !dr.IsNull("LevelName") && !dr.IsNull("ExpireYear") != null) // dv[0]["SubjectLevel"] += "<tr><td><b>" + dr["SubjectName"].ToString() + "</b></td><td><b> / </b></td><td><b>" + dr["LevelName"].ToString() + "</b></td><td><b> / </b></td><td><b>" + dr["ExpireYear"].ToString() + "</b></td></tr>"; // } //} dv[0]["SubjectLevel"] += "</table>"; ViewProfile.DataSource = dv; ViewProfile.DataBind(); Master.VisibleLeftArea = false; Master.VisibleMainMenu = false; Master.VisiblePageTitle = false; Master.VisibleBreadCrumbs = false; }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["pageid"] != null) return; Miami.Substitute.Bll.Job job = new Miami.Substitute.Bll.Job(); JobList.DataSource = job.SearchOpenJobs(DateTime.Now.Date.AddDays(-1), DateTime.Now.AddYears(10), 2); JobList.DataBind(); DataView dv = job.SearchOpenJobs(DateTime.Now.Date.AddDays(-1), DateTime.Now.AddYears(10), 3); if (dv != null && dv.Count > 0) { ResponseGridView.DataSource = dv; ResponseGridView.DataBind(); } else { ResponseGridView.Visible = false; lblResponseTitle.Visible = false; } Miami.Substitute.Dal.User user = new Miami.Substitute.Dal.User(); dv = user.LoadForMain(Micajah.Common.Security.UserContext.Current.UserId); if (Session["IsCounted"] == null || Convert.ToInt32(Session["IsCounted"]) == 0) { user.InsertUsage(2, Convert.ToInt32(dv[0]["LocationId"].ToString())); Session["IsCounted"] = 1; } dv.Table.Columns.Add("FullName", Type.GetType("System.String")); dv[0]["FullName"] = dv[0]["FirstName"] + " " + dv[0]["MiddleName"] + (String)(dv[0]["MiddleName"].ToString().Length > 0 ? ". " : "") + dv[0]["LastName"]; dv.Table.Columns.Add("ContactInfo", Type.GetType("System.String")); dv[0]["ContactInfo"] = dv[0]["Address"] + "<br>" + dv[0]["Address2"] + "<br>" + dv[0]["Phone"] + "<br>" + dv[0]["EmailProfile"]; dv.Table.Columns.Add("JobCode", Type.GetType("System.String")); dv[0]["JobCode"] = dv[0]["JobPosition"] + " / " + dv[0]["JobAssignmentDescription"]; if (user.FirstName.Length > 0) lblName.Text = "Hi, " + Convert.ToString(user.FirstName[0].ToString().ToUpper() + user.FirstName.ToLower().Substring(1, user.FirstName.Length - 1)).TrimEnd(' '); dv.Table.Columns.Add("SubjectLevel", Type.GetType("System.String")); dv[0]["SubjectLevel"] = "<table border='0' cellspacing='0' cellpadding='0'>"; //DataView dvCoverage = user.LoadCoverage(Micajah.Common.Security.UserContext.Current.UserId); //if (dvCoverage != null && dvCoverage.Table != null && dvCoverage.Table.Rows.Count > 0) //{ // foreach (DataRow dr in dvCoverage.Table.Rows) // { // if (!dr.IsNull("SubjectName") && !dr.IsNull("LevelName") && !dr.IsNull("ExpireYear") != null) // dv[0]["SubjectLevel"] += "<tr><td><b>" + dr["SubjectName"].ToString() + "</b></td><td><b> / </b></td><td><b>" + dr["LevelName"].ToString() + "</b></td><td><b> / </b></td><td><b>" + dr["ExpireYear"].ToString() + "</b></td></tr>"; // } //} dv[0]["SubjectLevel"] += "</table>"; ViewProfile.DataSource = dv; ViewProfile.DataBind(); Master.VisibleLeftArea = false; Master.VisibleMainMenu = false; Master.VisiblePageTitle = false; Master.VisibleBreadCrumbs = false; }
private void FillCalendar() { Miami.Substitute.Bll.Substitute substitute = new Miami.Substitute.Bll.Substitute(); substitute.LoadByUserId(Micajah.Common.Security.UserContext.Current.UserId); ((DropDownList)AvailabilityForm.FindControl("availabilityTimeStart")).SelectedValue = substitute.AvailabilityTimeStart; ((DropDownList)AvailabilityForm.FindControl("availabilityTimeEnd")).SelectedValue = substitute.AvailabilityTimeEnd; Miami.Substitute.Bll.SubstituteExceptions subExceptions = new Miami.Substitute.Bll.SubstituteExceptions(); DataView dv = subExceptions.LoadAllByUserId(); if (dv != null) foreach (DataRowView drv in dv) if (substitute.AvailabilityWeekDays.Contains((((int)(Convert.ToDateTime(drv["DateStart"]).DayOfWeek)) + 1).ToString())) RadCalendarExceptions.SelectedDates.Add(new Telerik.WebControls.RadDate(Convert.ToDateTime(drv["DateStart"]))); DateTime curDate = DateTime.Now.AddDays(-(DateTime.Now.Day - 1)); Bll.Job job = new Miami.Substitute.Bll.Job(); acceptedJobs = job.SearchOpenJobs(DateTime.Now, DateTime.Now.AddYears(10), 2); while (curDate < DateTime.Now.AddYears(1)) { Telerik.WebControls.RadCalendarDay radCalendarDay = new Telerik.WebControls.RadCalendarDay(); radCalendarDay.Date = curDate; if (IsOverlapDay(curDate)) { radCalendarDay.ItemStyle.CssClass= "overlap"; radCalendarDay.IsSelectable = false; } else if (curDate >= DateTime.Now && substitute.AvailabilityWeekDays.Contains((((int)(curDate.DayOfWeek))+1).ToString())) { radCalendarDay.ItemStyle.ForeColor = System.Drawing.Color.Green; radCalendarDay.IsSelectable = true; radCalendarDay.IsDisabled = false; } else { radCalendarDay.IsSelectable = false; radCalendarDay.IsDisabled = true; } RadCalendarExceptions.SpecialDays.Add(radCalendarDay); curDate = curDate.AddDays(1); } }