Example #1
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            if (EndDate.IsEmpty)
            {
                EndDateValid.Text = string.Empty;
                EndDateRequired.Validate();
                EndDateValid.Text = "1";
            }
            else
            {
                Bll.Job job = new Job();
                int grade; int.TryParse(Grade.SelectedValue, out grade);
                int subtype; int.TryParse(Subtype.SelectedValue, out subtype);

                DateTime start = new DateTime(StartDate.SelectedDate.Value.Year, StartDate.SelectedDate.Value.Month, StartDate.SelectedDate.Value.Day, StartTimePicker.SelectedDate.Value.Hour, StartTimePicker.SelectedDate.Value.Minute, 0);
                DateTime end = new DateTime(EndDate.SelectedDate.Value.Year, EndDate.SelectedDate.Value.Month, EndDate.SelectedDate.Value.Day, EndTimePicker.SelectedDate.Value.Hour, EndTimePicker.SelectedDate.Value.Minute, 0);

                if (start > end)
                    end = start;

                job.Insert(start, end, lblLocationId.Text, Note.Text, Room.Text, subtype, Teacher.Text, 0, Subject.Text, grade);

                Response.Redirect("Worksheet.aspx");
            }
        }
Example #2
0
        protected void JobDataSource_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
        {
            Job job = new Job();
            lblJobId.Text = e.ReturnValue.ToString();
            JobFormView.DataSource = job.LoadByPrimaryKey(Convert.ToInt32(e.ReturnValue)).DataView;
            JobFormView.DataBind();

            lblAvailSubs.Visible = true;
            SubstituteList.Visible = true;
            SubstituteList.DataBind();
        }
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        Miami.Substitute.Bll.Job job = new Miami.Substitute.Bll.Job(JobId);
        Miami.Substitute.Bll.Substitute substitute = new Miami.Substitute.Bll.Substitute(job.m_substituteId);

        Miami.Substitute.Dal.User user = new Miami.Substitute.Dal.User();
        DataView userView = user.LoadForMain(Micajah.Common.Security.UserContext.Current.UserId);

        string confirmNote = String.Format("Confirmed by Clerk {0} on {1} {2}", userView[0]["FirstName"].ToString().Trim() + " " + userView[0]["LastName"].ToString().Trim(), DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString());
        job.ConfirmJob(JobId, substitute.SubstituteId, 2, confirmNote + " " + Notes.Text);

        ClientScript.RegisterStartupScript(Page.GetType(), "WorksheetCloseAndRebindScript", "CloseAndRebind();", true);
    }
Example #4
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        Miami.Substitute.Bll.Job        job        = new Miami.Substitute.Bll.Job(JobId);
        Miami.Substitute.Bll.Substitute substitute = new Miami.Substitute.Bll.Substitute(job.m_substituteId);

        Miami.Substitute.Dal.User user = new Miami.Substitute.Dal.User();
        DataView userView = user.LoadForMain(Micajah.Common.Security.UserContext.Current.UserId);

        string confirmNote = String.Format("Confirmed by Clerk {0} on {1} {2}", userView[0]["FirstName"].ToString().Trim() + " " + userView[0]["LastName"].ToString().Trim(), DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString());

        job.ConfirmJob(JobId, substitute.SubstituteId, 2, confirmNote + " " + Notes.Text);

        ClientScript.RegisterStartupScript(Page.GetType(), "WorksheetCloseAndRebindScript", "CloseAndRebind();", true);
    }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MagicForm.ApplyColorScheme(AddJobPanelTable, WebApplicationSettings.DefaultColorScheme);

            if (!IsPostBack)
            {
                if (Page.Request.QueryString["JobId"] != null)
                    lblJobId.Text = Page.Request.QueryString["JobId"];

                Miami.Substitute.Dal.User user = new Miami.Substitute.Dal.User();
                DataView dv = user.LoadForMain(Micajah.Common.Security.UserContext.Current.UserId);
                lblLocationId.Text = dv[0]["LocationId"].ToString();

                Job job = new Job();
                //job.m_statusId
                job.LoadByPrimaryKeyBase(Convert.ToInt32(Page.Request.QueryString["JobId"]));
                Subtype.SelectedValue = job.DalJob.SubtypeId.ToString();
                Grade.SelectedValue = job.DalJob.GradeId.ToString();
                StartDate.SelectedDate = job.DalJob.DatetimeStart;
                EndDate.SelectedDate = job.DalJob.DatetimeEnd;
                StartTimePicker.SelectedDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, job.DalJob.DatetimeStart.Hour, job.DalJob.DatetimeStart.Minute, 0);
                EndTimePicker.SelectedDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, job.DalJob.DatetimeEnd.Hour, job.DalJob.DatetimeEnd.Minute, 0);
                Room.Text = job.DalJob.Room;
                Teacher.Text = job.DalJob.Teacher;
                Subject.Text = job.DalJob.Subject;
                Note.Text = job.DalJob.Note;
                StartDateValid.Text = "1";
                EndDateValid.Text = "1";

                EndDate.MinDate = StartDate.SelectedDate.Value;

                EditButton.Enabled
                    = Subtype.Enabled
                    = Grade.Enabled
                    = StartDate.Enabled
                    = EndDate.Enabled
                    = Room.Enabled
                    = Teacher.Enabled
                    = Subject.Enabled
                    = Note.Enabled
                    = job.m_statusId < 2;
            }
        }
        protected void SubstituteList_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "Select")
            {
                int substituteId = Convert.ToInt32(e.CommandArgument);
                int jobId = Convert.ToInt32(lblJobId.Text);
                Job job = new Job();
                ArrayList jobOverLaps = job.GetOverlap(jobId, substituteId);
                if (jobOverLaps.Count > 0)
                {
                    for (int i = 0; i < jobOverLaps.Count; i++)
                        job.DeleteSubstituteFromJob(Convert.ToInt32(jobOverLaps[i]), substituteId);
                }

                job.SetSubstitute(jobId, substituteId, 3);
                Miami.Substitute.Bll.Substitute substitute = new Miami.Substitute.Bll.Substitute(substituteId);

                NoticeSystem noticeSystem = new NoticeSystem(jobId, NoticeSystem.NoticeType.JobAcceptedByClerk, substitute.UserId, Micajah.Common.Security.UserContext.Current.UserId);
                noticeSystem.Send();
                Response.Redirect("Worksheet.aspx", true);
            }
        }
Example #7
0
 protected void JobList_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
 {
     if (e.CommandName != "Sort")
     {
         int jobId; int.TryParse(((System.Data.DataRowView)(e.Item.DataItem)).Row["JobId"].ToString(), out jobId);
         if (e.CommandName == "EditJob")
             Response.Redirect("EditJob.aspx?JobId=" + jobId.ToString());
         else if (e.CommandName == "Delete")
         {
             Miami.Substitute.Bll.Job job = new Miami.Substitute.Bll.Job();
             job.LoadByPrimaryKeyBase(jobId);
             if (job.m_substituteId > 0)
             {
                 Miami.Substitute.Bll.Substitute substitute = new Miami.Substitute.Bll.Substitute(job.m_substituteId);
                 Miami.Substitute.Bll.NoticeSystem noticeSystem = new Miami.Substitute.Bll.NoticeSystem(jobId, Miami.Substitute.Bll.NoticeSystem.NoticeType.AcceptedJobDeletedByClerk, substitute.UserId, Micajah.Common.Security.UserContext.Current.UserId);
                 noticeSystem.Send();
             }
             job.DeleteJob(jobId);
             Response.Redirect("Worksheet.aspx");
         }
     }
 }
Example #8
0
 protected void JobList_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
 {
     if (e.CommandName != "Sort")
     {
         int jobId; int.TryParse(((System.Data.DataRowView)(e.Item.DataItem)).Row["JobId"].ToString(), out jobId);
         if (e.CommandName == "EditJob")
         {
             Response.Redirect("EditJob.aspx?JobId=" + jobId.ToString());
         }
         else if (e.CommandName == "Delete")
         {
             Miami.Substitute.Bll.Job job = new Miami.Substitute.Bll.Job();
             job.LoadByPrimaryKeyBase(jobId);
             if (job.m_substituteId > 0)
             {
                 Miami.Substitute.Bll.Substitute   substitute   = new Miami.Substitute.Bll.Substitute(job.m_substituteId);
                 Miami.Substitute.Bll.NoticeSystem noticeSystem = new Miami.Substitute.Bll.NoticeSystem(jobId, Miami.Substitute.Bll.NoticeSystem.NoticeType.AcceptedJobDeletedByClerk, substitute.UserId, Micajah.Common.Security.UserContext.Current.UserId);
                 noticeSystem.Send();
             }
             job.DeleteJob(jobId);
             Response.Redirect("Worksheet.aspx");
         }
     }
 }
Example #9
0
        public NoticeSystem(int jobId, NoticeType noticeType, int substituteUserId, int clerkUserId)
        {
            try
            {
                JobId = jobId;
                type = noticeType;
                SubstituteUserId = substituteUserId;

                Substitute substitute = new Substitute();
                substitute.LoadByUserId(SubstituteUserId);
                SubstituteId = substitute.SubstituteId;

                Job job = new Job(jobId);
                jobView = job.LoadByPrimaryKey(jobId);
                substituteView = (new Miami.Substitute.Dal.User()).LoadForMain(SubstituteUserId)[0];

                int.TryParse(jobView["LocationId"].ToString(), out LocationId);
                DataView dv = (new Dal.Job()).GetEmployee(LocationId);
                if (clerkUserId > 0)
                    ClerkUserId = clerkUserId;
                else if (dv.Count > 0)
                    ClerkUserId = Convert.ToInt32(dv[0]["Employee_Number"]);

                clerkView = (new Miami.Substitute.Dal.User()).LoadForMain(ClerkUserId)[0];

                switch (type)
                {
                    case NoticeType.AcceptedJobCancelledBySubstitute: // Send to Clerks
                    case NoticeType.JobAppliedForBySubstitute:
                        from = new MailAddress(substituteView["Email"].ToString());

                        if (substituteView["Email"].ToString().Trim().Length > 0)
                            to.Add(new MailAddress(clerkView["Email"].ToString()));

                        if (dv != null)
                            foreach (DataRow dr in dv.Table.Rows)
                                cc.Add(new MailAddress(dr["Employee_email_address"].ToString()));
                        break;

                    case NoticeType.AcceptedJobDeletedByClerk: // Send to Substitute
                    case NoticeType.JobAcceptedByClerk:
                    case NoticeType.JobConfirmedBySubstitute:
                    case NoticeType.JobDeclinedBySubstitute:
                        from = new MailAddress(clerkView["Email"].ToString());
                        if (substituteView["Email"].ToString().Trim().Length > 0)
                            to.Add(new MailAddress(substituteView["Email"].ToString()));

                        if (dv != null)
                            foreach (DataRow dr in dv.Table.Rows)
                            {
                                if (type != NoticeType.JobAcceptedByClerk)
                                    cc.Add(new MailAddress(dr["Employee_email_address"].ToString()));

                                if (from.Address.Length == 0)
                                    from = new MailAddress(dr["Employee_email_address"].ToString());
                            }
                        break;
                }
            }
            catch { }
        }
Example #10
0
 protected void SubstituteList_Action(object sender, CommonGridViewActionEventArgs e)
 {
     Job job = new Job();
     job.SetSubstitute(Convert.ToInt32(lblJobId.Text), Convert.ToInt32(((System.Web.UI.WebControls.GridView)(sender)).SelectedValue), 3);
     Response.Redirect("Default.aspx");
 }