Esempio n. 1
0
        // GET: Super/SuperLogin
        public ActionResult Index(string returnUrl)
        {
            SystemClass sclass = new SystemClass();
            string      userID = sclass.GetLoggedUser();

            if (Url.IsLocalUrl(returnUrl) && !string.IsNullOrEmpty(returnUrl))
            {
                ViewBag.ReturnURL = returnUrl;
            }
            if (Session["SuperDistributorId"] != null)
            {
                //Response.RedirectToRoute("Dashboard", "Index");
                string username = Session["SuperDistributorId"].ToString();
                var    db       = new DBContext();
                var    userinfo = db.TBL_MASTER_MEMBER.Where(x => x.UName == username).FirstOrDefault();
                Response.Redirect(Url.Action("Index", "SuperDashboard", new { area = "Super" }));
            }

            LoginViewModel model = new LoginViewModel();

            if (Request.Cookies["Login"] != null)
            {
                model.Email    = Request.Cookies["Login"].Values["EmailID"];
                model.Password = Request.Cookies["Login"].Values["Password"];
            }
            return(View(model));
            //return View();
        }
Esempio n. 2
0
        public void initpage()
        {
            try
            {
                //string baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/');
                //ViewBag.Siteroot = baseUrl + ConfigurationManager.AppSettings["Siteroot"];

                ViewBag.ControllerName = "APILabel";

                SystemClass sclass = new SystemClass();
                string      userID = sclass.GetLoggedUser();
                long        userid = long.Parse(userID);
                var         dbmain = new DBContext();
                if (userID != null && userID != "")
                {
                    //string[] pair = userID.Split(new[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
                    //string email = pair[0];
                    //string passwordHash = pair[1];
                    //string timezoneoffset = pair[2];
                    TBL_AUTH_ADMIN_USER currUser = dbmain.TBL_AUTH_ADMIN_USERS.SingleOrDefault(c => c.USER_ID == userid && c.ACTIVE_USER == true);

                    if (currUser != null)
                    {
                        Session["UserId"] = currUser.USER_ID;
                        // Session["UserName"] = currUser.UserName;
                    }
                }
                if (Session["UserId"] == null)
                {
                    Response.Redirect("~/Login/LogOut");
                    return;
                }
                bool Islogin = false;

                if (Session["UserId"] != null)
                {
                    Islogin = true;
                    ViewBag.CurrentUserId = CurrentUser.USER_ID;
                }
                ViewBag.Islogin = Islogin;
                // string countryPath = System.AppDomain.CurrentDomain.BaseDirectory + "\\csv\\" + "Countries.csv";
                //using (MainContext maincontext = new MainContext())
                //{
                //    int uid = CurrentUser.UserId;
                //    var UserProfile = maincontext.tbl_UserProfiles.Where(x => x.UserId == uid).FirstOrDefault();
                //    var User = maincontext.tbl_Users.Where(x => x.UserId == uid).FirstOrDefault();
                //    ViewBag.UserName = User.UserName;
                //    ViewBag.UserImage = UserProfile.UserImage;
                //}
                //ViewBag.IsChatPage = "No";
                //ViewBag.IsleftBarMenuOpen = false;
            }
            catch (Exception e)
            {
                //ViewBag.UserName = CurrentUser.UserId;
                Console.WriteLine(e.InnerException);
                return;
            }
        }
Esempio n. 3
0
        public async Task <ActionResult> Index(LoginViewModel User, string ReturnURL = "")
        {
            SystemClass sclass = new SystemClass();
            string      userID = sclass.GetLoggedUser();

            //var userpass = "******";
            //userpass = userpass.GetPasswordHash();
            if (Session["SuperDistributorId"] == null || Session["DistributorUserId"] == null)
            {
                using (var db = new DBContext())
                {
                    var GetMember = await db.TBL_MASTER_MEMBER.SingleOrDefaultAsync(x => x.EMAIL_ID == User.Email && x.User_pwd == User.Password && x.MEMBER_ROLE == 3 && x.ACTIVE_MEMBER == true);

                    if (GetMember != null)
                    {
                        if (GetMember.MEMBER_ROLE == 3)
                        {
                            if (GetMember.ACTIVE_MEMBER == false || GetMember.User_pwd != User.Password)
                            {
                                ViewBag.Message = "Invalid Credential or Access Denied";
                                return(View());
                            }
                            else
                            {
                                Session["SuperDistributorId"]       = GetMember.MEM_ID;
                                Session["SuperDistributorUserName"] = GetMember.UName;
                                Session["UserType"] = "Super Distributor";
                                HttpCookie AuthCookie;
                                System.Web.Security.FormsAuthentication.SetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                AuthCookie         = System.Web.Security.FormsAuthentication.GetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                AuthCookie.Expires = DateTime.Now.Add(new TimeSpan(130, 0, 0, 0));
                                Response.Cookies.Add(AuthCookie);
                                return(RedirectToAction("Index", "SuperDashboard", new { area = "Super" }));
                                //Response.Redirect(FormsAuthentication.GetRedirectUrl(GetUser.USER_NAME.ToString(), true));
                            }
                        }
                        else
                        {
                            ViewBag.Message = "Invalid Credential or Access Denied";
                            return(View());
                        }
                    }
                    else
                    {
                        ViewBag.Message = "Invalid Credential or Access Denied";
                        return(View());
                    }

                    //ViewBag.Message = "Invalid Credential or Access Denied";
                    //return View();
                }
            }
            else
            {
                Response.RedirectToRoute("Home", "Index");
            }
            return(View());
        }
Esempio n. 4
0
        public void initpage()
        {
            try
            {
                ViewBag.ControllerName = "Super Requisition";
                SystemClass sclass = new SystemClass();
                string      userID = sclass.GetLoggedUser();
                long        userid = long.Parse(userID);
                var         dbmain = new DBContext();
                if (userID != null && userID != "")
                {
                    TBL_MASTER_MEMBER currUser = dbmain.TBL_MASTER_MEMBER.SingleOrDefault(c => c.MEM_ID == userid && c.ACTIVE_MEMBER == true && c.MEMBER_ROLE == 3);

                    if (currUser != null)
                    {
                        Session["SuperDistributorId"] = currUser.MEM_ID;
                        // Session["UserName"] = currUser.UserName;
                    }
                    else
                    {
                        Response.Redirect(Url.Action("Index", "SuperLogin", new { area = "Super" }));
                        return;
                    }
                }
                if (Session["SuperDistributorId"] == null)
                {
                    //Response.Redirect(Url.Action("Index", "Login", new { area = "" }));
                    //Response.Redirect(Url.Action("Index", "StockistDashboard", new { area = "SuperStockist" }));
                    Response.Redirect(Url.Action("Index", "SuperLogin", new { area = "Super" }));
                    return;
                }
                bool Islogin = false;

                if (Session["SuperDistributorId"] != null)
                {
                    Islogin = true;
                    ViewBag.CurrentUserId = MemberCurrentUser.MEM_ID;
                }
                ViewBag.Islogin = Islogin;
            }
            catch (Exception e)
            {
                //ViewBag.UserName = CurrentUser.UserId;
                Console.WriteLine(e.InnerException);
                return;
            }
        }
        public void initpage()
        {
            try
            {
                ViewBag.ControllerName = "Dashboard";

                SystemClass sclass = new SystemClass();
                string      userID = sclass.GetLoggedUser();
                long        userid = long.Parse(userID);
                var         dbmain = new DBContext();
                if (userID != null && userID != "")
                {
                    TBL_AUTH_ADMIN_USER currUser = dbmain.TBL_AUTH_ADMIN_USERS.SingleOrDefault(c => c.USER_ID == userid && c.ACTIVE_USER == true);

                    if (currUser != null)
                    {
                        Session["UserId"] = currUser.USER_ID;
                        // Session["UserName"] = currUser.UserName;
                    }
                }
                if (Session["UserId"] == null)
                {
                    Response.Redirect("~/Login/LogOut");
                    return;
                }
                bool Islogin = false;

                if (Session["UserId"] != null)
                {
                    Islogin = true;
                    ViewBag.CurrentUserId = CurrentUser.USER_ID;
                }
                ViewBag.Islogin = Islogin;
            }
            catch (Exception e)
            {
                //ViewBag.UserName = CurrentUser.UserId;
                Console.WriteLine(e.InnerException);
                return;
            }
        }
Esempio n. 6
0
        public async Task <ActionResult> Index(LoginViewModel User, string ReturnURL = "")
        {
            SystemClass sclass = new SystemClass();
            string      userID = sclass.GetLoggedUser();

            using (var db = new DBContext())
            {
                var GetUser = await db.TBL_AUTH_ADMIN_USERS.FirstOrDefaultAsync(x => x.USER_MOBILE == User.MEMBER_MOBILE);

                if (GetUser != null)
                {
                    if (!GetUser.ACTIVE_USER || GetUser.USER_PASSWORD_MD5 != User.Password)
                    {
                        ViewBag.Message = "Invalid Credential or Access Denied";
                        FormsAuthentication.SignOut();
                        return(View());
                    }
                    else
                    {
                        Session["PowerAdminUserId"]   = GetUser.USER_ID;
                        Session["PowerAdminUserName"] = GetUser.USER_NAME;
                        Session["UserType"]           = "Power Admin";
                        HttpCookie AuthCookie;
                        System.Web.Security.FormsAuthentication.SetAuthCookie(GetUser.USER_NAME + "||" + Encrypt.EncryptMe(GetUser.USER_ID.ToString()), true);
                        AuthCookie         = System.Web.Security.FormsAuthentication.GetAuthCookie(GetUser.USER_NAME + "||" + Encrypt.EncryptMe(GetUser.USER_ID.ToString()), true);
                        AuthCookie.Expires = DateTime.Now.Add(new TimeSpan(130, 0, 0, 0));
                        Response.Cookies.Add(AuthCookie);
                        return(RedirectToAction("Index", "PowerAdminHome", new { area = "PowerAdmin" }));
                    }
                }
                else
                {
                    var GetMember = await db.TBL_MASTER_MEMBER.SingleOrDefaultAsync(x => x.MEMBER_MOBILE == User.MEMBER_MOBILE && x.User_pwd == User.Password && x.ACTIVE_MEMBER == true);

                    if (GetMember != null)
                    {
                        if (GetMember.MEMBER_ROLE == 1)
                        {
                            if (GetMember.ACTIVE_MEMBER == false || GetMember.User_pwd != User.Password)
                            {
                                ViewBag.Message = "Invalid Credential or Access Denied";
                                FormsAuthentication.SignOut();
                                return(View());
                            }
                            else
                            {
                                Session["WhiteLevelUserId"]   = GetMember.MEM_ID;
                                Session["WhiteLevelUserName"] = GetMember.UName;
                                Session["UserType"]           = "White Level";
                                HttpCookie AuthCookie;
                                System.Web.Security.FormsAuthentication.SetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                AuthCookie         = System.Web.Security.FormsAuthentication.GetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                AuthCookie.Expires = DateTime.Now.Add(new TimeSpan(130, 0, 0, 0));
                                Response.Cookies.Add(AuthCookie);
                                //Response.Redirect(FormsAuthentication.GetRedirectUrl(GetUser.USER_NAME.ToString(), true));
                                return(RedirectToAction("Index", "WhiteLevelAdmin", new { area = "Admin" }));
                            }
                        }
                        else if (GetMember.MEMBER_ROLE == 2)
                        {
                            if (GetMember.ACTIVE_MEMBER == false || GetMember.User_pwd != User.Password)
                            {
                                ViewBag.Message = "Invalid Credential or Access Denied";
                                FormsAuthentication.SignOut();
                                return(View());
                            }
                            else
                            {
                                Session["UserId"]   = GetMember.MEM_ID;
                                Session["UserName"] = GetMember.UName;

                                HttpCookie AuthCookie;
                                System.Web.Security.FormsAuthentication.SetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                AuthCookie         = System.Web.Security.FormsAuthentication.GetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                AuthCookie.Expires = DateTime.Now.Add(new TimeSpan(130, 0, 0, 0));
                                Response.Cookies.Add(AuthCookie);
                                return(RedirectToAction("Index", "WhiteLevelAdmin", new { area = "Admin" }));
                                //Response.Redirect(FormsAuthentication.GetRedirectUrl(GetUser.USER_NAME.ToString(), true));
                            }
                        }
                        else if (GetMember.MEMBER_ROLE == 3)
                        {
                            if (GetMember.ACTIVE_MEMBER == false || GetMember.User_pwd != User.Password)
                            {
                                ViewBag.Message = "Invalid Credential or Access Denied";
                                FormsAuthentication.SignOut();
                                return(View());
                            }
                            else
                            {
                                Session["SuperDistributorId"]       = GetMember.MEM_ID;
                                Session["SuperDistributorUserName"] = GetMember.UName;
                                Session["UserType"] = "Super Distributor";
                                HttpCookie AuthCookie;
                                System.Web.Security.FormsAuthentication.SetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                AuthCookie         = System.Web.Security.FormsAuthentication.GetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                AuthCookie.Expires = DateTime.Now.Add(new TimeSpan(130, 0, 0, 0));
                                Response.Cookies.Add(AuthCookie);
                                return(RedirectToAction("Index", "SuperDashboard", new { area = "Super" }));
                                //Response.Redirect(FormsAuthentication.GetRedirectUrl(GetUser.USER_NAME.ToString(), true));
                            }
                        }
                        else if (GetMember.MEMBER_ROLE == 4)
                        {
                            if (GetMember.ACTIVE_MEMBER == false || GetMember.User_pwd != User.Password)
                            {
                                ViewBag.Message = "Invalid Credential or Access Denied";
                                FormsAuthentication.SignOut();
                                return(View());
                            }
                            else
                            {
                                Session["DistributorUserId"]   = GetMember.MEM_ID;
                                Session["DistributorUserName"] = GetMember.UName;
                                Session["UserType"]            = "Distributor";
                                HttpCookie AuthCookie;
                                System.Web.Security.FormsAuthentication.SetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                AuthCookie         = System.Web.Security.FormsAuthentication.GetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                AuthCookie.Expires = DateTime.Now.Add(new TimeSpan(130, 0, 0, 0));
                                Response.Cookies.Add(AuthCookie);
                                return(RedirectToAction("Index", "DistributorDashboard", new { area = "Distributor" }));
                                //Response.Redirect(FormsAuthentication.GetRedirectUrl(GetUser.USER_NAME.ToString(), true));
                            }
                        }
                        else if (GetMember.MEMBER_ROLE == 5)
                        {
                            if (GetMember.ACTIVE_MEMBER == false || GetMember.User_pwd != User.Password)
                            {
                                ViewBag.Message = "Invalid Credential or Access Denied";
                                FormsAuthentication.SignOut();
                                return(View());
                            }
                            else
                            {
                                Session["MerchantUserId"]   = GetMember.MEM_ID;
                                Session["MerchantUserName"] = GetMember.UName;
                                Session["UserType"]         = "Merchant";
                                HttpCookie AuthCookie;
                                System.Web.Security.FormsAuthentication.SetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                AuthCookie         = System.Web.Security.FormsAuthentication.GetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                AuthCookie.Expires = DateTime.Now.Add(new TimeSpan(130, 0, 0, 0));
                                Response.Cookies.Add(AuthCookie);
                                return(RedirectToAction("Index", "MerchantDashboard", new { area = "Merchant" }));
                                //Response.Redirect(FormsAuthentication.GetRedirectUrl(GetUser.USER_NAME.ToString(), true));
                            }
                        }
                        else
                        {
                            ViewBag.Message = "Invalid Credential or Access Denied";
                            return(View());
                        }
                    }
                    else
                    {
                        ViewBag.Message = "Invalid Credential or Access Denied";
                        return(View());
                    }
                }
            }
        }
Esempio n. 7
0
        public ActionResult Index(string returnUrl)
        {
            var         db     = new DBContext();
            SystemClass sclass = new SystemClass();
            string      userID = sclass.GetLoggedUser();

            if (Url.IsLocalUrl(returnUrl) && !string.IsNullOrEmpty(returnUrl))
            {
                ViewBag.ReturnURL = returnUrl;
            }
            if (Session["UserId"] != null)
            {
                //Response.RedirectToRoute("Dashboard", "Index");
                string username = Session["UserId"].ToString();

                var userinfo = db.TBL_MASTER_MEMBER.Where(x => x.UName == username).FirstOrDefault();

                if (userinfo.MEMBER_ROLE == 1)
                {
                    Response.Redirect(Url.Action("Index", "WhiteLevelAdmin", new { area = "Admin" }));
                }
                else if (userinfo.MEMBER_ROLE == null)
                {
                    Response.Redirect(Url.Action("Index", "WhiteLevelAdmin", new { area = "Admin" }));
                }
                else if (userinfo.UNDER_WHITE_LEVEL == null)
                {
                    Response.RedirectToRoute("Dashboard", "Index");
                }
            }
            LoginViewModel model = new LoginViewModel();

            if (Request.Cookies["Login"] != null)
            {
                model.Email    = Request.Cookies["Login"].Values["EmailID"];
                model.Password = Request.Cookies["Login"].Values["Password"];
            }


            string host = Request.Url.Host;
            //string host = "www.ramkrushnaharitravels.co.in";
            var logochecking = (from x in db.TBL_MASTER_MEMBER
                                join y in db.TBL_WHITE_LEVEL_HOSTING_DETAILS
                                on x.MEM_ID equals y.MEM_ID
                                //where y.DOMAIN == DomaineName && y.STATUS == 1
                                where y.DOMAIN.Contains(host) && y.STATUS == 1
                                select new
            {
                logoPath = x.LOGO,
                LogoStyle = x.LOGO_STYLE,
                CompanyName = x.COMPANY
            }).FirstOrDefault();

            if (logochecking != null)
            {
                if (logochecking.logoPath != null)
                {
                    if (logochecking.logoPath != "")
                    {
                        ViewBag.Logopath    = Url.Content(logochecking.logoPath);
                        ViewBag.LogoStyle   = logochecking.LogoStyle;
                        ViewBag.CompanyName = logochecking.CompanyName;
                    }
                    else
                    {
                        ViewBag.Logopath    = "";
                        ViewBag.LogoStyle   = "";
                        ViewBag.CompanyName = "";
                    }
                }
                else
                {
                    ViewBag.Logopath    = "";
                    ViewBag.LogoStyle   = "";
                    ViewBag.CompanyName = "";
                }
            }
            else
            {
                return(RedirectToAction("DomainError", "Login"));
            }
            return(View(model));
        }
Esempio n. 8
0
        public async Task <ActionResult> Index(LoginViewModel User, string ReturnURL = "")
        {
            SystemClass sclass = new SystemClass();
            string      userID = sclass.GetLoggedUser();

            //var userpass = "******";
            //userpass = userpass.GetPasswordHash();
            //if (Session["PowerAdminUserId"] ==null)
            //{
            using (var db = new DBContext())
            {
                //var GetUser = await db.TBL_AUTH_ADMIN_USERS.FirstOrDefaultAsync(x => x.USER_EMAIL == User.Email && x.USER_PASSWORD_MD5==User.Password);
                var GetUser = await db.TBL_AUTH_ADMIN_USERS.FirstOrDefaultAsync(x => x.USER_EMAIL == User.Email);

                if (GetUser != null)
                {
                    if (!GetUser.ACTIVE_USER || !GetUser.USER_PASSWORD_MD5.VerifyHashedPassword(User.Password))
                    {
                        ViewBag.Message = "Invalid Credential or Access Denied";
                        FormsAuthentication.SignOut();
                        return(View());
                    }
                    else
                    {
                        Session["PowerAdminUserId"]   = GetUser.USER_ID;
                        Session["PowerAdminUserName"] = GetUser.USER_NAME;
                        Session["UserType"]           = "Power Admin";
                        HttpCookie AuthCookie;
                        System.Web.Security.FormsAuthentication.SetAuthCookie(GetUser.USER_NAME + "||" + Encrypt.EncryptMe(GetUser.USER_ID.ToString()), true);
                        AuthCookie         = System.Web.Security.FormsAuthentication.GetAuthCookie(GetUser.USER_NAME + "||" + Encrypt.EncryptMe(GetUser.USER_ID.ToString()), true);
                        AuthCookie.Expires = DateTime.Now.Add(new TimeSpan(130, 0, 0, 0));
                        Response.Cookies.Add(AuthCookie);
                        //return RedirectToAction("Index", "login", new { area = "" });
                        //Response.Redirect(FormsAuthentication.GetRedirectUrl(GetUser.USER_NAME.ToString(), true));
                        return(RedirectToAction("Index", "PowerAdminHome", new { area = "PowerAdmin" }));
                    }
                }
                else
                {
                    string DomaineName  = Request.Url.Host;
                    var    logochecking = (from x in db.TBL_MASTER_MEMBER
                                           join y in db.TBL_WHITE_LEVEL_HOSTING_DETAILS
                                           on x.MEM_ID equals y.MEM_ID
                                           //where y.DOMAIN == DomaineName && y.STATUS == 1
                                           where y.DOMAIN.Contains(DomaineName) && y.STATUS == 1
                                           select new
                    {
                        logoPath = x.LOGO,
                        LogoStyle = x.LOGO_STYLE,
                        CompanyName = x.COMPANY
                    }).FirstOrDefault();
                    if (logochecking != null)
                    {
                        if (logochecking.logoPath != null)
                        {
                            if (logochecking.logoPath != "")
                            {
                                Session["LogoPath"]    = Url.Content(logochecking.logoPath);
                                Session["LogoStyle"]   = logochecking.LogoStyle;
                                Session["CompanyName"] = logochecking.CompanyName;
                            }
                            else
                            {
                                Session["LogoPath"]    = "";
                                Session["LogoStyle"]   = "";
                                Session["CompanyName"] = "";
                            }
                        }
                        else
                        {
                            Session["LogoPath"]    = "";
                            Session["LogoStyle"]   = "";
                            Session["CompanyName"] = "";
                        }
                    }
                    else
                    {
                        return(RedirectToAction("DomainError", "Login"));
                    }
                    var GetMember = await db.TBL_MASTER_MEMBER.SingleOrDefaultAsync(x => x.EMAIL_ID == User.Email && x.User_pwd == User.Password && x.ACTIVE_MEMBER == true);

                    if (GetMember != null)
                    {
                        if (GetMember.MEMBER_ROLE == 1)
                        {
                            var GETWHITELevelDOMAIn = (from x in db.TBL_MASTER_MEMBER
                                                       join y in db.TBL_WHITE_LEVEL_HOSTING_DETAILS
                                                       on x.MEM_ID equals y.MEM_ID
                                                       //where y.DOMAIN == DomaineName && y.STATUS == 1
                                                       //where y.DOMAIN.Contains(DomaineName) && y.STATUS == 1 && x.EMAIL_ID == User.Email && x.User_pwd == User.Password && x.ACTIVE_MEMBER == true
                                                       where y.DOMAIN.Contains(DomaineName) && y.STATUS == 1 && y.MEM_ID == GetMember.MEM_ID
                                                       select new
                            {
                                MEM_ID = x.MEM_ID,
                                MEMBER_ROLE = x.MEMBER_ROLE,
                                ACTIVE_MEMBER = x.ACTIVE_MEMBER,
                                User_pwd = x.User_pwd,
                                UName = x.UName,
                                DOMAIN = y.DOMAIN
                            }).FirstOrDefault();
                            if (GETWHITELevelDOMAIn != null)
                            {
                                Session["DOMAINNAME"] = GETWHITELevelDOMAIn.DOMAIN;

                                if (GetMember.ACTIVE_MEMBER == false || GetMember.User_pwd != User.Password)
                                {
                                    ViewBag.Message = "Invalid Credential or Access Denied";
                                    FormsAuthentication.SignOut();
                                    return(View());
                                }
                                else
                                {
                                    Session["WhiteLevelUserId"]   = GetMember.MEM_ID;
                                    Session["WhiteLevelUserName"] = GetMember.UName;
                                    Session["UserType"]           = "White Level";

                                    HttpCookie AuthCookie;
                                    System.Web.Security.FormsAuthentication.SetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                    AuthCookie         = System.Web.Security.FormsAuthentication.GetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                    AuthCookie.Expires = DateTime.Now.Add(new TimeSpan(130, 0, 0, 0));
                                    Response.Cookies.Add(AuthCookie);
                                    //Response.Redirect(FormsAuthentication.GetRedirectUrl(GetUser.USER_NAME.ToString(), true));
                                    return(RedirectToAction("Index", "WhiteLevelAdmin", new { area = "Admin" }));
                                }
                            }
                            else
                            {
                                return(RedirectToAction("DomainError", "Login"));
                            }
                        }
                        else if (GetMember.MEMBER_ROLE == 2)
                        {
                            if (GetMember.ACTIVE_MEMBER == false || GetMember.User_pwd != User.Password)
                            {
                                ViewBag.Message = "Invalid Credential or Access Denied";
                                FormsAuthentication.SignOut();
                                return(View());
                            }
                            else
                            {
                                Session["UserId"]   = GetMember.MEM_ID;
                                Session["UserName"] = GetMember.UName;

                                HttpCookie AuthCookie;
                                System.Web.Security.FormsAuthentication.SetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                AuthCookie         = System.Web.Security.FormsAuthentication.GetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                AuthCookie.Expires = DateTime.Now.Add(new TimeSpan(130, 0, 0, 0));
                                Response.Cookies.Add(AuthCookie);
                                return(RedirectToAction("Index", "WhiteLevelAdmin", new { area = "Admin" }));
                                //Response.Redirect(FormsAuthentication.GetRedirectUrl(GetUser.USER_NAME.ToString(), true));
                            }
                        }
                        else if (GetMember.MEMBER_ROLE == 3)
                        {
                            var GETWHITELevelDOMAIn = (from x in db.TBL_MASTER_MEMBER
                                                       join y in db.TBL_WHITE_LEVEL_HOSTING_DETAILS
                                                       on x.UNDER_WHITE_LEVEL equals y.MEM_ID
                                                       //where y.DOMAIN == DomaineName && y.STATUS == 1
                                                       //where y.DOMAIN.Contains(DomaineName) && y.STATUS == 1 && x.EMAIL_ID == User.Email && x.User_pwd == User.Password && x.ACTIVE_MEMBER == true
                                                       where y.DOMAIN.Contains(DomaineName) && y.STATUS == 1 && x.MEM_ID == GetMember.MEM_ID
                                                       select new
                            {
                                MEM_ID = x.MEM_ID,
                                MEMBER_ROLE = x.MEMBER_ROLE,
                                ACTIVE_MEMBER = x.ACTIVE_MEMBER,
                                User_pwd = x.User_pwd,
                                UName = x.UName,
                                DOMAIN = y.DOMAIN
                            }).FirstOrDefault();
                            if (GETWHITELevelDOMAIn != null)
                            {
                                Session["DOMAINNAME"] = GETWHITELevelDOMAIn.DOMAIN;

                                if (GetMember.ACTIVE_MEMBER == false || GetMember.User_pwd != User.Password)
                                {
                                    ViewBag.Message = "Invalid Credential or Access Denied";
                                    FormsAuthentication.SignOut();
                                    return(View());
                                }
                                else
                                {
                                    Session["SuperDistributorId"]       = GetMember.MEM_ID;
                                    Session["SuperDistributorUserName"] = GetMember.UName;
                                    Session["UserType"] = "Super Distributor";

                                    HttpCookie AuthCookie;

                                    System.Web.Security.FormsAuthentication.SetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                    AuthCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                    //System.Web.Security.FormsAuthentication.SetAuthCookie(GetMember.EMAIL_ID +"||"+GetMember.User_pwd +"||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                    //AuthCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(GetMember.UName + "||" + GetMember.User_pwd + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);

                                    AuthCookie.Expires = DateTime.Now.Add(new TimeSpan(130, 0, 0, 0));
                                    Response.Cookies.Add(AuthCookie);
                                    return(RedirectToAction("Index", "SuperDashboard", new { area = "Super" }));
                                    //Response.Redirect(FormsAuthentication.GetRedirectUrl(GetUser.USER_NAME.ToString(), true));
                                }
                            }
                            else
                            {
                                return(RedirectToAction("DomainError", "Login"));
                            }
                        }
                        else if (GetMember.MEMBER_ROLE == 4)
                        {
                            var GETWHITELevelDOMAIn = (from x in db.TBL_MASTER_MEMBER
                                                       join y in db.TBL_WHITE_LEVEL_HOSTING_DETAILS
                                                       on x.UNDER_WHITE_LEVEL equals y.MEM_ID
                                                       //where y.DOMAIN == DomaineName && y.STATUS == 1
                                                       //where y.DOMAIN.Contains(DomaineName) && y.STATUS == 1 && x.EMAIL_ID == User.Email && x.User_pwd == User.Password && x.ACTIVE_MEMBER == true
                                                       where y.DOMAIN.Contains(DomaineName) && y.STATUS == 1 && x.MEM_ID == GetMember.MEM_ID
                                                       select new
                            {
                                MEM_ID = x.MEM_ID,
                                MEMBER_ROLE = x.MEMBER_ROLE,
                                ACTIVE_MEMBER = x.ACTIVE_MEMBER,
                                User_pwd = x.User_pwd,
                                UName = x.UName,
                                DOMAIN = y.DOMAIN
                            }).FirstOrDefault();
                            if (GETWHITELevelDOMAIn != null)
                            {
                                Session["DOMAINNAME"] = GETWHITELevelDOMAIn.DOMAIN;
                                if (GetMember.ACTIVE_MEMBER == false || GetMember.User_pwd != User.Password)
                                {
                                    ViewBag.Message = "Invalid Credential or Access Denied";
                                    FormsAuthentication.SignOut();
                                    return(View());
                                }
                                else
                                {
                                    Session["DistributorUserId"]   = GetMember.MEM_ID;
                                    Session["DistributorUserName"] = GetMember.UName;
                                    Session["UserType"]            = "Distributor";

                                    HttpCookie AuthCookie;
                                    System.Web.Security.FormsAuthentication.SetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                    AuthCookie         = System.Web.Security.FormsAuthentication.GetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                    AuthCookie.Expires = DateTime.Now.Add(new TimeSpan(130, 0, 0, 0));
                                    Response.Cookies.Add(AuthCookie);
                                    return(RedirectToAction("Index", "DistributorDashboard", new { area = "Distributor" }));
                                    //Response.Redirect(FormsAuthentication.GetRedirectUrl(GetUser.USER_NAME.ToString(), true));
                                }
                            }
                            else
                            {
                                return(RedirectToAction("DomainError", "Login"));
                            }
                        }
                        else if (GetMember.MEMBER_ROLE == 5)
                        {
                            var GETWHITELevelDOMAIn = (from x in db.TBL_MASTER_MEMBER
                                                       join y in db.TBL_WHITE_LEVEL_HOSTING_DETAILS
                                                       on x.UNDER_WHITE_LEVEL equals y.MEM_ID
                                                       //where y.DOMAIN == DomaineName && y.STATUS == 1
                                                       //where y.DOMAIN.Contains(DomaineName) && y.STATUS == 1 && x.EMAIL_ID == User.Email && x.User_pwd == User.Password && x.ACTIVE_MEMBER == true
                                                       where y.DOMAIN.Contains(DomaineName) && y.STATUS == 1 && x.MEM_ID == GetMember.MEM_ID
                                                       select new
                            {
                                MEM_ID = x.MEM_ID,
                                MEMBER_ROLE = x.MEMBER_ROLE,
                                ACTIVE_MEMBER = x.ACTIVE_MEMBER,
                                User_pwd = x.User_pwd,
                                UName = x.UName,
                                DOMAIN = y.DOMAIN
                            }).FirstOrDefault();
                            if (GETWHITELevelDOMAIn != null)
                            {
                                Session["DOMAINNAME"] = GETWHITELevelDOMAIn.DOMAIN;
                                if (GetMember.ACTIVE_MEMBER == false || GetMember.User_pwd != User.Password)
                                {
                                    ViewBag.Message = "Invalid Credential or Access Denied";
                                    FormsAuthentication.SignOut();
                                    return(View());
                                }
                                else
                                {
                                    Session["MerchantUserId"]   = GetMember.MEM_ID;
                                    Session["MerchantUserName"] = GetMember.UName;
                                    Session["UserType"]         = "Merchant";
                                    HttpCookie AuthCookie;
                                    System.Web.Security.FormsAuthentication.SetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                    AuthCookie         = System.Web.Security.FormsAuthentication.GetAuthCookie(GetMember.UName + "||" + Encrypt.EncryptMe(GetMember.MEM_ID.ToString()), true);
                                    AuthCookie.Expires = DateTime.Now.Add(new TimeSpan(130, 0, 0, 0));
                                    Response.Cookies.Add(AuthCookie);
                                    return(RedirectToAction("Index", "MerchantDashboard", new { area = "Merchant" }));
                                    //Response.Redirect(FormsAuthentication.GetRedirectUrl(GetUser.USER_NAME.ToString(), true));
                                }
                            }
                            else
                            {
                                return(RedirectToAction("DomainError", "Login"));
                            }
                        }
                        else
                        {
                            ViewBag.Message = "Invalid Credential or Access Denied";
                            return(View());
                        }
                    }
                    else
                    {
                        ViewBag.Message = "Invalid Credential or Access Denied";
                        return(View());
                    }
                    //}
                    //else
                    //{
                    //    return RedirectToAction("DomainError", "Login");
                    //}
                    //ViewBag.Message = "Invalid Credential or Access Denied";
                    //return View();
                }
            }
            //}
            //else
            //{
            //    Response.RedirectToRoute("Home", "Index");
            //}
            //return View();
        }