public ActionResult SignUpThanks(string LogUserName, string LogPassword)
        {
            MemberAction objMember = new MemberAction();
            Member memberData = objMember.Authenticate(LogUserName, LogPassword);

            if (memberData != null)
            {
                SessionStore.SetSessionValue(SessionStore.Memberobject, memberData);
                if (memberData.Role.name == SystemStatements.ROLE_SUPER_ADMIN)
                    return RedirectToAction("AdminDashboard", "Admin");
                else if (memberData.Role.name == SystemStatements.ROLE_END_USER)
                    return RedirectToAction("Dashboard", "Member");
                else
                    return RedirectToAction("Dashboard", "Member");
            }
            else
            {
                ModelState.AddModelError("", "Login failed for current user.");
            }
            return View();
        }
        public string CheckMember(string userName, string password)
        {
            Boolean isAuthenticate = false;

            MemberAction objMember = new MemberAction();
            Member memberData = objMember.Authenticate(userName, password);
            if (memberData != null)
            {
                isAuthenticate = true;
            }

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            var output = serializer.Serialize(isAuthenticate);

            return output;
        }
        /// <summary>
        /// This method is user to autenticate the member.
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public IList<MemberLogin> MemberAuthenticate(string UserName, string Password)
        {
            IList<MemberLogin> lstMemberLogIn = new List<MemberLogin>();
            MemberLogin objMemberLogin = new MemberLogin();
            MemberAction objMember = new MemberAction();
            Member tmpData = objMember.Authenticate(UserName, Password);

            string catResult = "";
            if (tmpData != null)
            {
                objMemberLogin.MemberID = tmpData.id.ToString();
                CategoryAction objCategory = new CategoryAction();
                foreach (Category catData in objCategory.GetAllCategories())
                {
                    catResult += "||" + catData.name;
                }
                catResult = catResult.Substring(2);
                if (!string.IsNullOrEmpty(catResult))
                {
                    objMemberLogin.Categories = catResult;
                }

                string imgPath = "No Image";

                if (tmpData.MemberProfiles != null)
                {
                    MemberProfile memProfile = tmpData.MemberProfiles.FirstOrDefault();

                    if (memProfile != null)
                    {
                        imgPath = memProfile.imagePath;

                        imgPath = imgPath.Substring(imgPath.LastIndexOf('/'));

                        if (imgPath.Length > 1)
                            imgPath = System.Configuration.ConfigurationManager.AppSettings["RootURL"].ToString() + "/UploadedMedia" + imgPath;
                        else
                            imgPath = "No Image";
                    }
                }
                objMemberLogin.MemberURL = imgPath;
                lstMemberLogIn.Add(objMemberLogin);
            }
            //result = result.Substring(2);
            return  lstMemberLogIn;
        }
        public ActionResult Login(RegisterModel objLoginModel, string chkRemember)
        {
            #region
            MemberAction objMember = new MemberAction();
            Member memberData = objMember.Authenticate(objLoginModel.LogUserName, objLoginModel.LogPassword);

            if (memberData != null)
            {
                if (chkRemember != null)
                {
                    //Create a new cookie, passing the name into the constructor
                    HttpCookie cookie = new HttpCookie("UserInfo");
                    HttpCookie cookie1 = new HttpCookie("PassInfo");

                    //Set the cookies value
                    cookie.Value = objLoginModel.LogUserName;
                    cookie1.Value = objLoginModel.LogPassword;

                    //Set the cookie to expire in 1 minute
                    DateTime dtNow = DateTime.Now.AddDays(30);

                    cookie.Expires = dtNow;
                    cookie1.Expires = dtNow;

                    //Add the cookie
                    Response.Cookies.Add(cookie);
                    Response.Cookies.Add(cookie1);
                }

                SessionStore.SetSessionValue(SessionStore.Memberobject, memberData);
                string requestURL = (string)SessionStore.GetSessionValue("RequestedURL");
                SessionStore.SetSessionValue("RequestedURL", null);

                if (memberData.Role.name == SystemStatements.ROLE_SUPER_ADMIN)
                {
                    if (!string.IsNullOrEmpty(requestURL))
                        return Redirect(requestURL);
                    else
                        return RedirectToAction("AdminDashboard", "Admin");
                }
                else if (memberData.Role.name == SystemStatements.ROLE_END_USER)
                {
                    if (!string.IsNullOrEmpty(requestURL))
                    {
                        //Response.Redirect(requestURL);
                        return Redirect(requestURL);
                    }
                    else
                    {
                        //return RedirectToAction("Dashboard", "Member");
                        return RedirectToAction("Default", "Member");
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(requestURL))
                        return Redirect(requestURL);
                    else
                    {
                        //return RedirectToAction("Dashboard", "Member");
                        return RedirectToAction("Default", "Member");
                    }
                }
            }
            else
            {
                ModelState.AddModelError("", "Login failed for current user.");
            }
            return View("Default");
            #endregion
        }
        /// <summary>
        /// This method is user to autenticate the member.
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public string MemberAuthenticate(string UserName, string Password)
        {
            #region
            MemberAction objMember = new MemberAction();
            Member tmpData = objMember.Authenticate(UserName, Password);
            string result = "";
            string catResult = "";
            if (tmpData != null)
            {
                result = tmpData.id.ToString() + "##";
                CategoryAction objCategory = new CategoryAction();
                foreach (Category catData in objCategory.GetAllCategories())
                {
                    catResult += "||" + catData.name;
                }
                catResult = catResult.Substring(2);
                if (!string.IsNullOrEmpty(catResult))
                {
                    result = result + catResult;
                }

                string imgPath = "No Image";
                if (tmpData.MemberProfiles != null)
                {
                    MemberProfile memProfile = tmpData.MemberProfiles.FirstOrDefault();
                    if (memProfile != null)
                    {
                        imgPath = memProfile.imagePath;
                        imgPath = imgPath.Substring(imgPath.LastIndexOf('/'));
                        if (imgPath.Length > 1)
                            imgPath = System.Configuration.ConfigurationManager.AppSettings["RootURL"].ToString() + "/UploadedMedia" + imgPath;
                        else
                            imgPath = "No Image";
                    }
                }
                result = result + "##" + imgPath;
            }
            return result;
            #endregion
        }