Exemplo n.º 1
0
        public async Task <ActionResult> DropOutEndorsement([Bind(Include = "FormID")]
                                                            DropOutForm dropOutForm, FormCollection collection)
        {
            string      ForwardTo           = collection["ForwardTo"] + "";
            string      FormStatus          = collection["FormStatus"] + "";
            string      IsWeekBefore        = collection["IsWeekBefore"] + "";
            string      AcademicHeadEndorse = collection["AcademicHeadEndorse"] + "";
            string      formComment         = collection["formComment"] + "";
            string      TuitionFee          = collection["TuitionFee"] + "";
            string      AccountStatus       = collection["AccountStatus"] + "";
            string      LibraryStatus       = collection["LibraryStatus"] + "";
            DropOutForm dof = db.DropOutForms.Find(dropOutForm.FormID);
            Form        f   = db.Forms.Find(dropOutForm.FormID);
            FormComment fC  = new FormComment();

            if (!formComment.Equals(""))
            {
                fC.FormID  = dropOutForm.FormID;
                fC.Comment = formComment;
                fC.RoleID  = Helper.Help.GetRoleId(DAL.UserInfo.Role);
                db.FormComments.Add(fC);
            }
            if (FormStatus.Equals(""))
            {
                f.Status = "Inprogress";
            }
            else
            {
                f.Status = FormStatus;
            }
            string getCurrentDesk = "";

            if (ForwardTo != "")
            {
                getCurrentDesk = Helper.Help.GetCurrentDesk(Int32.Parse(ForwardTo));
            }
            if (getCurrentDesk.Equals("Student"))
            {
                //send mail to notify student
                string notifyMessage = "<p>Please provide more information like: </p>"
                                       + "<p>====================================</p>" + fC.Comment;
                await SendNotification(notifyMessage, DAL.UserInfo.Email, f.StudentEmail);

                //Set status To new
                f.Status      = "New";
                f.CurrentDesk = "Student";
                f.Flow        = f.Flow + "Student,";
            }
            else if (getCurrentDesk.Length > 4)
            {
                f.CurrentDesk = getCurrentDesk;
                f.Flow        = f.Flow + f.CurrentDesk + ",";
            }

            dof.AcademicHeadEndorse = AcademicHeadEndorse;
            dof.AccountStatus       = AccountStatus;
            dof.LibraryStatus       = LibraryStatus;

            if (f.Status.Equals("Approved"))
            {
                f.ApprovalDate = DateTime.Now.ToString();
            }

            db.Entry(dof).State = EntityState.Modified;
            db.SaveChanges();
            if (f.Status.Equals("Approved") || f.Status.Equals("Rejected"))
            {
                f.ApprovalDate = DateTime.Now.ToString();
                f.ApprovalBy   = DAL.UserInfo.Role;
                Helper.Notify notify = new Helper.Notify();

                string notifyMessage = "<p>Your form:       " + f.Type + "</p> "
                                       + "<p>Student Name:   " + f.StudentName + "</p>"
                                       + "<p>Student RollNo: " + f.StudentRollNo + "</p>"
                                       + "<p>Student Email:  " + f.StudentEmail + "</p>"
                                       + "<p>Student Phone:  " + f.StudentPhone + "</p>"
                                       + "<p>Semester:       " + f.SemesterName + "</p>"
                                       + "<p>Class:          " + dof.Class + "</p>"
                                       + "<p>Drop out date:  " + dof.DropOutDate + "</p>"
                                       + "<p>Payment Method: " + dof.MethodPayment + "</p>"
                                       + "<p>Drop out Reason:" + dof.Reason + "</p>"
                                       + " has been <b>" + f.Status + "</b>";
                await SendNotification(notifyMessage, DAL.UserInfo.Email, f.StudentEmail);
            }
            return(RedirectToAction("Index", "Staff"));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> RequestEndorsement([Bind(Include = "FormID")]
                                                            RequestForm requestForm, FormCollection collection)
        {
            string      ForwardTo      = collection["ForwardTo"] + "";
            string      FormStatus     = collection["FormStatus"] + "";
            string      ReceivedBy     = collection["ReceivedBy"] + "";
            string      formComment    = collection["formComment"] + "";
            string      ToDepartment   = collection["ToDepartment"] + "";
            string      ProcessedBy    = collection["ProcessedBy"] + "";
            string      ApprovalReason = collection["ApprovalReason"] + "";
            RequestForm rf             = db.RequestForms.Find(requestForm.FormID);
            Form        f  = db.Forms.Find(requestForm.FormID);
            FormComment fC = new FormComment();

            if (!formComment.Equals(""))
            {
                fC.FormID  = requestForm.FormID;
                fC.Comment = formComment;
                fC.RoleID  = Helper.Help.GetRoleId(DAL.UserInfo.Role);
                db.FormComments.Add(fC);
            }
            rf.ReceivedBy   = ReceivedBy;
            rf.ProcessedBy  = ProcessedBy;
            rf.ToDepartment = ToDepartment;
            if (FormStatus.Equals(""))
            {
                f.Status = "Inprogress";
            }
            else
            {
                f.Status = FormStatus;
            }
            string getCurrentDesk = "";

            if (ForwardTo != "")
            {
                getCurrentDesk = Helper.Help.GetCurrentDesk(Int32.Parse(ForwardTo));
            }
            if (getCurrentDesk.Equals("Student"))
            {
                //send mail to notify student
                string notifyMessage = "<p>Please provide more information like: </p>"
                                       + "<p>====================================</p>" + fC.Comment;
                await SendNotification(notifyMessage, DAL.UserInfo.Email, f.StudentEmail);

                //Set status To new
                f.Status      = "New";
                f.CurrentDesk = "Student";
                f.Flow        = f.Flow + "Student,";
            }
            else if (getCurrentDesk.Length > 4)
            {
                f.CurrentDesk = getCurrentDesk;
                f.Flow        = f.Flow + f.CurrentDesk + ",";
            }

            rf.ApprovalReason = ApprovalReason;

            db.Entry(rf).State = EntityState.Modified;
            db.SaveChanges();
            if (f.Status.Equals("Approved") || f.Status.Equals("Rejected"))
            {
                f.ApprovalDate = DateTime.Now.ToString();
                f.ApprovalBy   = DAL.UserInfo.Role;
                Helper.Notify notify = new Helper.Notify();

                string notifyMessage = "<p>Your form:            " + f.Type + "</p> "
                                       + "<p>Request Title:       " + rf.RequestTitle + "</p>"
                                       + "<p>Semester:            " + f.SemesterName + "</p>"
                                       + "<p>Student Name:        " + f.StudentName + "</p>"
                                       + "<p>Student RollNo:      " + f.StudentRollNo + "</p>"
                                       + "<p>Student Email:       " + f.StudentEmail + "</p>"
                                       + "<p>Student Phone:       " + f.StudentPhone + "</p>"
                                       + "<p>Class:               " + rf.Class + "</p>"
                                       + "<p>Request Description: " + rf.Description + "</p>"
                                       + " for has been <b>" + f.Status + "</b>";
                await SendNotification(notifyMessage, DAL.UserInfo.Email, f.StudentEmail);
            }
            return(RedirectToAction("Index", "Staff"));
        }
Exemplo n.º 3
0
        public async Task <ActionResult> CourseRegEndorsement([Bind(Include = "FormID,TuitionFee")]
                                                              CourseRegForm courseRegForm, FormCollection collection)
        {
            string ForwardTo        = collection["ForwardTo"] + "";
            string FormStatus       = collection["FormStatus"] + "";
            string IsWeekBefore     = collection["IsWeekBefore"] + "";
            string NotAllSubject    = collection["NotAllSubject"] + "";
            string formComment      = collection["formComment"] + "";
            string TuitionFee       = collection["TuitionFee"] + "";
            string CoursesAvailable = collection["CoursesAvailable"] + "";

            CourseRegForm crf = db.CourseRegForms.Find(courseRegForm.FormID);
            Form          f   = db.Forms.Find(courseRegForm.FormID);
            FormComment   fC  = new FormComment();

            if (!formComment.Equals(""))
            {
                fC.FormID  = courseRegForm.FormID;
                fC.Comment = formComment;
                fC.RoleID  = Helper.Help.GetRoleId(DAL.UserInfo.Role);
                db.FormComments.Add(fC);
            }
            if (FormStatus.Equals(""))
            {
                f.Status = "Inprogress";
            }
            else
            {
                f.Status = FormStatus;
            }
            string getCurrentDesk = "";

            if (ForwardTo != "")
            {
                getCurrentDesk = Helper.Help.GetCurrentDesk(Int32.Parse(ForwardTo));
            }
            if (getCurrentDesk.Equals("Student"))
            {
                //send mail to notify student
                string notifyMessage = "<p>Please provide more information like: </p>"
                                       + "<p>====================================</p>" + fC.Comment;
                await SendNotification(notifyMessage, DAL.UserInfo.Email, f.StudentEmail);

                //Set status To new
                f.Status      = "New";
                f.CurrentDesk = "Student";
                f.Flow        = f.Flow + "Student,";
            }
            else if (getCurrentDesk.Length > 4)
            {
                f.CurrentDesk = getCurrentDesk;
                f.Flow        = f.Flow + f.CurrentDesk + ",";
            }
            if (IsWeekBefore != null)
            {
                if (IsWeekBefore.Equals("on"))
                {
                    crf.IsWeekBefore = true;
                }
                else
                {
                    crf.IsWeekBefore = false;
                }
            }

            if (TuitionFee != null)
            {
                if (TuitionFee.Equals("on"))
                {
                    crf.TuitionFee = true;
                }
                else
                {
                    crf.TuitionFee = false;
                }
            }
            crf.CoursesAvailable = CoursesAvailable;
            db.Entry(crf).State  = EntityState.Modified;
            db.SaveChanges();
            if (f.Status.Equals("Approved") || f.Status.Equals("Rejected"))
            {
                f.ApprovalDate = DateTime.Now.ToString();
                f.ApprovalBy   = DAL.UserInfo.Role;
                Helper.Notify notify = new Helper.Notify();

                string notifyMessage = "<p>Your form: " + f.Type + "</p> "
                                       + "<p>Student Name:     " + f.StudentName + "</p>"
                                       + "<p>Student RollNo:   " + f.StudentRollNo + "</p>"
                                       + "<p>Student Email:    " + f.StudentEmail + "</p>"
                                       + "<p>Student Phone:    " + f.StudentPhone + "</p>"
                                       + "<p>Semester:         " + f.SemesterName + "</p>"
                                       + "<p>Subject:   " + crf.Subject + " " + crf.SubjectCode + " </p>"
                                       + " has been <b>" + f.Status + "</b>";
                await SendNotification(notifyMessage, DAL.UserInfo.Email, f.StudentEmail);
            }
            return(RedirectToAction("Index", "Staff"));
        }