示例#1
0
        public static List <int?> GetRoles(int user_id)
        {
            MvcAppDemoEntities db = new MvcAppDemoEntities();

            using (db = new MvcAppDemoEntities())
            {
                List <int?> userRoles = db.cse_role_userrelation.Where(u => u.user_id == user_id).Select(x => x.role_id).ToList();
                return(userRoles);
            }
        }
示例#2
0
        //internal static bool sendAppErrorEmail(Exception ex, string name)
        //{
        //    string fromEmail = "*****@*****.**";
        //    string toEmail = ConfigurationManager.AppSettings["UnsupportEmail"];
        //    string body = "\n ------------------------------------------------ Exception Details  ------------------------------------------------";

        //    body = body + "\n Message :" + ex.Message + " USER NAME was [" + name + "] " + "\n Targetsite :" + ex.TargetSite + "\n StackTrace" + ex.StackTrace;

        //    if (ex.InnerException != null)
        //    {
        //        body = body + "\n \n InnerException Message :" + ex.InnerException.Message + "\n InnerException Targetsite :" + ex.InnerException.TargetSite + "\n StackTrace" + ex.InnerException.StackTrace;
        //    }

        //    body = body + "\n\n Thanks";

        //    //return SendExceptionMail(fromEmail, toEmail, "Application Error Occured", body, false);
        //    return SendExceptionMail(fromEmail, toEmail, "SCC -"+ex.Message +" "+name, body, false); //Need to send on next Delivery 02/05/2019
        //}
        //public static bool SendExceptionMail(string fromEmail, string toEmail, string subject, string body, bool isHtml)
        //{
        //    MailMessage mail = new MailMessage(fromEmail, toEmail, subject, body);
        //    mail.IsBodyHtml = isHtml;
        //    return SendExceptionMail(mail);
        //}
        //public static bool SendExceptionMail(MailMessage mail)
        //{
        //    try
        //    {
        //        SmtpClient client = new SmtpClient();
        //        client.EnableSsl = false;
        //        client.Port = 25;
        //        client.Send(mail);
        //        return true;
        //    }
        //    catch (Exception ex)
        //    {
        //        return false;
        //    }
        //}
        public static cse_users GetLoggedInUser(string email)
        {
            MvcAppDemoEntities db = new MvcAppDemoEntities();

            using (db = new MvcAppDemoEntities())
            {
                cse_users userObj = db.cse_users.Where(u => u.email_id == email).FirstOrDefault();
                return(userObj);
            }
        }