Пример #1
0
        public void selectUserRole()
        {
            //UserRol r = new UserRol();
            //r.user_id = Convert.ToInt32(Session["UserID"]);
            ////Shakeeb
            var r = context.spAuthenticateUserRole(Convert.ToInt32(Session["UserID"])).FirstOrDefault();

            //r.RoleName(r);
            Session["Rolename"]         = r.role_name;
            Session["company_id"]       = r.company_id;
            Session["financialyear_id"] = context.tbl_financialyear.Where(w => w.company_id == r.company_id && w.status == true).Select(s => s.financialyear_id).FirstOrDefault();
            Session["branch_id"]        = r.branch_id;
            Session["LoginuserName"]    = r.Name;
        }
Пример #2
0
        public HttpResponseMessage ValidatedUser(int userName, string password)
        {
            string enPswd       = GetSwcSHA1(password);
            var    authenticate = context.tbl_User.Where(g => g.user_id == userName && g.password == enPswd && g.status == true).FirstOrDefault();
            var    role         = context.spAuthenticateUserRole(authenticate.user_id).FirstOrDefault();

            //return Request.CreateResponse(HttpStatusCode.OK, "Request send successfully.");
            if (authenticate != null)
            {
                if (authenticate.user_id != 0)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, authenticate.user_id));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound, "User Name or Password is not corroect."));
                }
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.Forbidden, "You are not having access to the application, Please contact to administrator."));
            }
        }