Exemple #1
0
        public JsonResult Loginauthentication(LoginInfo user)
        {
            User userObj = new User();

            try
            {
                if ((user.USERID != null) && (user.UPASSWORD != null))
                {
                    FormsAuthentication.SetAuthCookie(user.USERID, false);

                    userObj = _objIAuthentication.LoginAuthentication(user);
                    if (userObj.IsAuthenticated)
                    {
                        CustomPrincipalSerializeModel serializeModel = new CustomPrincipalSerializeModel();
                        serializeModel.Id       = userObj.Login_Id;
                        serializeModel.RoleName = userObj.RoleName.Trim();
                        serializeModel.UserID   = userObj.User_Id.Trim();

                        JavaScriptSerializer serializer = new JavaScriptSerializer();

                        string userData = serializer.Serialize(serializeModel);

                        FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
                            1,
                            userObj.User_Id.Trim(),
                            DateTime.Now,
                            DateTime.Now.AddMinutes(15),
                            false,
                            userData);

                        string encTicket = FormsAuthentication.Encrypt(authTicket);
                        _log.InfoMessage("[ Log In User Name/ID : " + userObj.User_Id + " , Role Name : " + userObj.RoleName + " ]");
                        System.Web.HttpCookie faCookie = new System.Web.HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
                        Response.Cookies.Add(faCookie);
                        return(Json(userObj, JsonRequestBehavior.AllowGet));
                        //return RedirectToAction("Index", "Home");
                    }
                    else if (!userObj.IsAuthenticated)
                    {
                        _log.InfoMessage("[ Not Log In Proart Media Soluation Application.]");
                        return(Json(userObj, JsonRequestBehavior.AllowGet));
                    }
                }
            }
            catch (Exception e)
            {
                _log.ErrorMessage("Loginauthentication in HomeController");
                _log.ErrorException(e);
            }
            return(Json(userObj, JsonRequestBehavior.AllowGet));
            //return RedirectToAction("Login", "Home");
        }
        public User LoginAuthentication(LoginInfo userLoginData)
        {
            User objUser = new User();

            try
            {
                //string query = "Select ID,USERID,UPASSWORD from SD_LOGIN_DETAILS  where USERID='" + userLoginData.USERID + "' AND UPASSWORD='******'";
                StringBuilder query = new StringBuilder();
                query.Append("declare  @var integer=0;");
                query.Append("declare  @IsAuthenticated bit ='false';");
                query.Append("set @var=(Select count(Login_Id)from SD_LOGIN_DETAILS  where User_Id='" + userLoginData.USERID + "' AND UPassword='******')");
                query.Append("if(@var>=1)	set @IsAuthenticated='true'");
                query.Append("Select Login_Id,User_Id,UPassword,@IsAuthenticated as IsAuthenticated ,(select Role_Name from SD_Role where Role_Id=(select FK_SD_Role_Id from SD_LOGIN_DETAILS  where User_Id='" + userLoginData.USERID + "' AND UPassword='******')) as RoleName  from SD_LOGIN_DETAILS  where User_Id='" + userLoginData.USERID + "' AND UPassword='******'");
                objUser = _objIGenericProcedures.GetSingelData <User>(query.ToString());
            }
            catch (Exception ex)
            {
                _log.ErrorMessage("LoginLogicLayer class file in LoginAuthentication");
                _log.ErrorMessage(ex.StackTrace);
                _log.ErrorMessage(ex.Message);
                _log.ErrorException(ex);
            }
            return(objUser);
        }
Exemple #3
0
        public JsonResult GetTableData(string queryString)
        {
            List <object> listTableData = new List <object>();

            try
            {
                listTableData = _objIMasterLogicLayer.GetTableData(queryString as string);
            }
            catch (Exception ex)
            {
                _log.ErrorMessage("GetTableRole API in MasterController");
                _log.ErrorException(ex);
            }
            return(Json(listTableData, JsonRequestBehavior.AllowGet));
        }
        public List <Role> GetTableRole()
        {
            List <Role> listOfRole = new List <Role>();

            try
            {
                listOfRole = _objIGenericProcedures.GetAll <Role>("select Role_ID ,Role_Name from SD_Role");
            }
            catch (Exception ex)
            {
                _log.ErrorMessage("MasterLogicLayer class file in GetTableRole");
                _log.ErrorMessage(ex.StackTrace);
                _log.ErrorMessage(ex.Message);
                _log.ErrorException(ex);
            }
            return(listOfRole);
        }