Exemple #1
0
        public JsonResult GetUserAccesspages(int id)
        {
            try
            {
                int userid = id;
                objuserproperty     = new User_Property();
                objuserproperty.idx = id;
                objUserBll          = new User_BLL(objuserproperty);


                var useraccesspages = JsonConvert.SerializeObject(objUserBll.GetUserPagsAccess());



                return(Json(new { success = true, statuscode = 200, url = "/Pages/Index", data = useraccesspages }, JsonRequestBehavior.AllowGet));
            }

            catch (Exception ex)
            {
                return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #2
0
        public JsonResult Login(User_Property objuser)
        {
            try
            {
                objUserBll = new User_BLL(objuser);
                var data = objUserBll.SelectByIDPassword();
                if (data.Rows.Count > 0)
                {
                    for (int i = 0; i < data.Rows.Count; i++)
                    {
                        Session["UID"]       = data.Rows[0]["idx"].ToString();
                        Session["LOGINID"]   = data.Rows[0]["loginId"].ToString();
                        Session["COMPANYID"] = data.Rows[0]["companyIdx"].ToString();
                        Session["BRANCHID"]  = data.Rows[0]["branchIdx"].ToString();
                        Session["LOGGEDIN"]  = true;
                        Session["ISADMIN"]   = data.Rows[0]["Is_Admin"].ToString();
                    }

                    int userid = Convert.ToInt32(Session["UID"].ToString());
                    objuserproperty     = new User_Property();
                    objuserproperty.idx = userid;
                    objUserBll          = new User_BLL(objuserproperty);

                    List <LP_Pages_Property> pagelist = new List <LP_Pages_Property>();
                    pagelist            = Helper.ConvertDataTable <LP_Pages_Property>(objUserBll.GetUserPagsAccess());
                    Session["PageList"] = pagelist;


                    return(Json(new { data = "", msg = "Login Successfull", success = true, statuscode = 200, count = data.Rows.Count }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { data = "", msg = "Login Failed", success = true, statuscode = 200, count = 0 }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
            }
        }