Пример #1
0
        protected void btnAddDivChair_Click(object sender, EventArgs e)
        {
            errorBox.Visible = false;
            try
            {
                //dc.DivisionName = ddlDivision.SelectedItem.Text.ToString();
                //dc.CRPDivisionID = Int32.Parse(ddlDivision.SelectedValue.ToString());
                //dc.IDNO = Int32.Parse(txtIDNO.Text);
                //dc.AddRecord();

                //Response.Redirect("addDivChair.aspx");
                using (MasterScheduleDataContext db = new MasterScheduleDataContext())
                {
                    MeetingCenterContact newContact = new MeetingCenterContact();
                    newContact.MeetingCenter = ddlDivision.SelectedValue;
                    newContact.ContactIDNO   = int.Parse(txtIDNO.Text);

                    db.MeetingCenterContacts.InsertOnSubmit(newContact);
                    db.SubmitChanges();
                }
                Response.Redirect("~/Users/managecampuscontacts.aspx");
            }
            catch
            {
                errorBox.Visible = true;
            }
        }
Пример #2
0
        protected void btnDeleteMe_Click(object sender, EventArgs e)
        {
            Button Sender       = (Button)sender;
            string sRowToRemove = Sender.CommandArgument;

            int iRowToRemove = int.Parse(sRowToRemove);

            using (MasterScheduleDataContext db = new MasterScheduleDataContext())
            {
                db.MeetingCenterContacts.DeleteOnSubmit(db.MeetingCenterContacts.Where(X => X.MeetingCenterContactID == iRowToRemove).First());
                db.SubmitChanges();
            }
            Response.Redirect("~/Users/managecampuscontacts.aspx");
        }
    protected void btnAddNewCourse_Click(object sender, EventArgs e)
    {
        string courseInfo = getCourseInfo();

        try
        {
            log.SectionsId = Int32.Parse(Request.QueryString["SectionsID"]);
        }
        catch
        {
            log.SectionsId = 0;
        }
        log.SubmittedBy   = Session["deltaid"].ToString();
        log.DepartmentsId = SectionDetails1.GetDepartmentsID();
        log.Change        = getCourseInfo();
        log.AddRecord();

        // section.DeleteRecord();
        // this.mvSubmissionForm.ActiveViewIndex = 1;
        List <ClsChangeLog> logs = new List <ClsChangeLog>();

        logs.Add(log);
        gvPendingChanges.DataSource = logs;
        gvPendingChanges.DataBind();

        using (MasterScheduleDataContext db = new MasterScheduleDataContext())
        {
            foreach (string sLocation in hidRooms.Value.TrimEnd(",".ToCharArray()).Split(",".ToCharArray()).ToList().Distinct())
            {
                SendMessageOnLogApproval thisItem = new SendMessageOnLogApproval();

                thisItem.LogID       = log.LogId;
                thisItem.CampusID    = sLocation;
                thisItem.DateCreated = DateTime.Now;
                db.SendMessageOnLogApprovals.InsertOnSubmit(thisItem);
            }

            db.SubmitChanges();
        }

        DivChairEmail = Helpers.GetDivisionEmailByDepartmentsId(log.DepartmentsId, Session["deltaid"].ToString());
        /* Send email upon submission */
        sendNotification(Session["deltaid"].ToString());

        Response.Redirect("~/RequestSubmitted.aspx");
    }
Пример #4
0
    protected void gvNeedsApproval_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string registrarComments = string.Empty;

        if (e.CommandName != "Page")
        {
            log.LogId = int.Parse(e.CommandArgument.ToString());
            log.GetRecord();

            string to = Helpers.GetDeltaEmail(log.SubmittedBy);
            //Get division chair email address
            string        DivChairEmail = log.UpdatedBy.ToString() + "@delta.edu";
            StringBuilder sbCourseInfo  = new StringBuilder(string.Empty);

            if (e.CommandName == "approve")
            {
                StringBuilder sb1 = new StringBuilder(log.Change);
                sb1.Append("<ul><br>Registrar: ");
                foreach (GridViewRow row in gvNeedsApproval.Rows)
                {
                    if (row.FindControl <HiddenField>("LOGID").Value == log.LogId.ToString())
                    {
                        registrarComments = row.FindControl <TextBox>("RegisCommentsTextBox").Text;
                        if (string.IsNullOrEmpty(registrarComments))
                        {
                            registrarComments = "<b>No comments.</b>";
                        }
                    }
                }
                sb1.Append(registrarComments);
                sb1.Append("</ul>");

                log.ProcessGroup = "final";
                log.UpdatedBy    = User.Identity.Name;
                log.Change       = sb1.ToString();
                log.UpdateRecord();

                this.UpdateCurrentProcess("approved");

                //Add the additional processing screens.

                string[] sendTo = GetNextProcessGroups();
                for (int i = 0; i < sendTo.Length; i++)
                {
                    AddProcess(sendTo[i], "last");
                }

                StringBuilder sb = new StringBuilder();
                if (log.SectionsId > 0)
                {
                    ClsSections section = new ClsSections("MasterSchedule");
                    section.SectionsId = log.SectionsId;
                    section.GetRecord();
                    ClsCourses course = new ClsCourses("MasterSchedule");
                    course.CoursesId = section.CoursesId;
                    course.GetRecord();
                    ClsTerms term = new ClsTerms("MasterSchedule");
                    term.TermsId = section.TermsId;
                    term.GetRecord();
                    sbCourseInfo.Append(term.Term + " " + course.CourseNumber + " " + section.SectionNumber + ":<br/><br/>");
                    sb.Append("<br /> Please make the following change to " + term.Term + " " + course.CourseNumber + " " + section.SectionNumber + ":<br/><br/>");
                }
                if (sbCourseInfo.Length > 1)
                {
                    sb.Append("<h4>Add Course:</h4><br/><br/>");
                }
                sb.Append(log.Change);
                sbCourseInfo.Append(log.Change);

                Helpers.SendEmail("Master Schedule change approved", sb.ToString(), GetNextProcessEmails(), log.SectionsId);
                // 3/23/16 - mgm - changed richardzeien to michaelmccloskey
                Helpers.SendEmail("Master Schedule change approved.", "Email sending to: " + GetNextProcessEmails() + "<br />" + sb.ToString(), "*****@*****.**", log.SectionsId);
                using (MasterScheduleDataContext db = new MasterScheduleDataContext())
                {
                    List <SendMessageOnLogApproval> messagesToSend = db.SendMessageOnLogApprovals.Where(X => X.LogID == log.LogId).ToList();

                    foreach (SendMessageOnLogApproval thisMessage in messagesToSend)
                    {
                        var results = db.GetMeetingCenterEmail(thisMessage.CampusID).ToList();
                        if (results.Count() > 0)
                        {
                            StringBuilder emailsToSend = new StringBuilder();

                            results.ForEach(X => emailsToSend.Append(X.DeltaEmail + ";"));

                            Helpers.SendEmail("Master Schedule change approved", sb.ToString(), emailsToSend.ToString().TrimEnd(";".ToCharArray()), log.SectionsId);
                        }
                        thisMessage.DateCompleted = DateTime.Now;
                        db.SubmitChanges();
                    }
                }

                if (to != "")
                {
                    Helpers.SendEmail("Master Schedule change approved", "Records and Registration has <b>approved</b> your schedule change. <br />Registrar Comments: " + registrarComments + "<br /><br /><b>Course Info:</b><br/>" + sbCourseInfo.ToString(), to, log.SectionsId);
                }

                Helpers.SendEmail("Master Schedule change approved.", "This email will be sent to:  " + DivChairEmail + "Records and Registration has <b>approved</b> the schedule change. <br />Registrar Comments: " + registrarComments + "<br /><br /><b>Course Info:</b><br/>" + sbCourseInfo.ToString(), "*****@*****.**", log.SectionsId);
                if (DivChairEmail != "")
                {
                    /*Commented out for testing.. Cyrus */
                    Helpers.SendEmail("Master Schedule change approved", "Records and Registration has <b>approved</b> the schedule change. <br />Registrar Comments: " + registrarComments + "<br /><br /><b>Course Info:</b><br/>" + sbCourseInfo.ToString(), DivChairEmail, log.SectionsId);
                }
                else
                {
                }
            }
            if (e.CommandName == "ignore")
            {
                StringBuilder sb2 = new StringBuilder(log.Change);
                sb2.Append("<ul><br>Registrar: ");
                foreach (GridViewRow row in gvNeedsApproval.Rows)
                {
                    if (row.FindControl <HiddenField>("LOGID").Value == log.LogId.ToString())
                    {
                        registrarComments = row.FindControl <TextBox>("RegistrarDenyTextBox").Text;
                        if (string.IsNullOrEmpty(registrarComments))
                        {
                            registrarComments = "<b>No comments.</b>";
                        }
                    }
                }
                sb2.Append(registrarComments);
                sb2.Append("</ul>");

                sbCourseInfo.Append(log.Change);
                log.Status       = "ignored";
                log.ProcessGroup = "complete";
                log.Change       = sb2.ToString();
                log.UpdateRecord();

                this.UpdateCurrentProcess("ignored");

                if (to != "")
                {
                    Helpers.SendEmail("Master Schedule change denied", "Your schedule change has been <b>denied</b> by Records and Registration. <br />Registrar Comments: " + registrarComments + "<br /><br /><b>Course Info:</b><br/>" + sbCourseInfo.ToString(), to, log.SectionsId);
                }

                if (DivChairEmail != "")
                {
                    /*Commented out for testing.. Cyrus */
                    Helpers.SendEmail("Master Schedule change denied", "The schedule change has been <b>denied</b> by Records and Registration. <br />Registrar Comments: " + registrarComments + "<br /><br /><b>Course Info:</b><br/>" + sbCourseInfo.ToString(), DivChairEmail, log.SectionsId);
                }
            }
            DataSet ds = new DataSet();
            rowFilter = string.Empty;
            BindGvNeedsApproval(ds);
            BindLists(ds);
        }
    }