Example #1
0
        public static bool SendEmailOnSaveForDOFAPeer(string Action, int EmpNo, string EmpName)
        {
            string subject = "IRD Data Entry updated by " + SessionManager.UserName;
            DataCollectionModelDataContext db = new DataCollectionModelDataContext();
            string tomail = "*****@*****.**";
            string body   = string.Empty;

            if (Action == "Save")
            {
                body = "Peer List Added/Updated For EmpNo:" + EmpNo + "<br /> EmpName:" + EmpName + " On " + DateTime.Now.ToString() + " by User: "******"", subject, body));
            }
            else
            {
                return(true);
            }
        }
Example #2
0
        public static bool SendFinallizeEmail(string Action, int DataCaptYM, string DeptId, string needModificationMSG)
        {
            string subject = "IRD Data Entry updated by " + SessionManager.UserName;
            DataCollectionModelDataContext db = new DataCollectionModelDataContext();
            string tomail = "*****@*****.**";
            string body   = string.Empty;

            if (Action == "Finalize" || Action == "FinalizedByHod" || Action == "FinalizedByAssoDean")
            {
                body = "The User: "******", Dept: " + DeptId + " , DataCapt: " + DataCaptYM + ", IRD Data has been finalised & sent for your Authorization.  Kindly Check & Authorize/Approve the data."
                       + "Time Stamp: DateTime Stamp: " + DateTime.Now
                       + "This is a System generated Email.";
            }
            else if (Action == "ModificationNeededHod" || Action == "ModificationNeededADean" || Action == "ModificationNeededDean")
            {
                body = "The User: "******", Dept: " + DeptId + " , DataCapt: " + DataCaptYM + ", IRD Data has been sent for Modification.  Kindly Check Modification Note for data changes. <br /> Modification Note: " + needModificationMSG
                       + "Time Stamp: DateTime Stamp: " + DateTime.Now
                       + "<br /> This is a System generated Email.";
            }

            if (Action == "Finalize")
            {
                var hod = db.RankUsers.Where(a => a.DeptID.ToLower() == SessionManager.DeptID.ToLower() &&
                                             a.UserRole.ToLower() == UserRoles.User.ToString().ToLower() &&
                                             a.UserWork.ToLower() == DataAccess.Enum.UserWork.HOD.ToString().ToLower()).FirstOrDefault();
                if (hod != null)
                {
                    tomail = hod.UserEmail;
                }
            }
            else if (Action == "FinalizedByHod")
            {
                var adsric = db.RankUsers.Where(a => a.UserRole.ToLower() == UserRoles.User.ToString().ToLower() &&
                                                a.UserWork.ToLower() == DataAccess.Enum.UserWork.ADSRIC.ToString().ToLower()).FirstOrDefault();
                if (adsric != null)
                {
                    tomail = adsric.UserEmail;
                }
            }
            else if (Action == "FinalizedByAssoDean")
            {
                var dsric = db.RankUsers.Where(a => a.UserRole.ToLower() == UserRoles.User.ToString().ToLower() &&
                                               a.UserWork.ToLower() == DataAccess.Enum.UserWork.DSRIC.ToString().ToLower()).FirstOrDefault();
                if (dsric != null)
                {
                    tomail = dsric.UserEmail;
                }
            }
            else if (Action == "ModificationNeededHod")
            {
                var doModification = db.RankUsers.Where(a => a.DeptID.ToLower() == SessionManager.DeptID.ToLower() &&
                                                        a.UserRole.ToLower() == UserRoles.User.ToString().ToLower() &&
                                                        a.UserWork.ToLower() == DataAccess.Enum.UserWork.DO.ToString().ToLower()).ToList();
                if (doModification != null && doModification.Count > 0)
                {
                    tomail = string.Join(",", doModification.Select(i => i.UserEmail));
                }
            }
            else if (Action == "ModificationNeededADean")
            {
                var hodModification = db.RankUsers.Where(a => a.DeptID.ToLower() == SessionManager.DeptID.ToLower() &&
                                                         a.UserRole.ToLower() == UserRoles.User.ToString().ToLower() &&
                                                         a.UserWork.ToLower() == DataAccess.Enum.UserWork.HOD.ToString().ToLower()).FirstOrDefault();
                if (hodModification != null)
                {
                    tomail = hodModification.UserEmail;
                }
            }
            else if (Action == "ModificationNeededDean")
            {
                var adeanModification = db.RankUsers.Where(a => a.UserRole.ToLower() == UserRoles.User.ToString().ToLower() &&
                                                           a.UserWork.ToLower() == DataAccess.Enum.UserWork.ADSRIC.ToString().ToLower()).FirstOrDefault();
                if (adeanModification != null)
                {
                    tomail = adeanModification.UserEmail;
                }
            }

            if (!string.IsNullOrEmpty(body))
            {
                body = body.Replace("\r\n", "<br />");
                FormServices formServices = new FormServices();
                return(formServices.SendEmail(tomail, "", subject, body));
            }
            else
            {
                return(true);
            }
        }