Exemplo n.º 1
0
        public JsonResult LoginUser(string login_User_ArrayData)
        {
            HCM_Users login_user_Obj = new HCM_Users();

            login_User_ArrayData = HttpUtility.UrlDecode(login_User_ArrayData);
            NameValueCollectionData nameValueCollectionData_Obj = new NameValueCollectionData();
            NameValueCollection     Login_User_Collection_Obj   = nameValueCollectionData_Obj.GetQueryStringCollection(login_User_ArrayData);

            ModifyLoginData loginuser_Obj = new ModifyLoginData();

            login_user_Obj = loginuser_Obj.LoginUser(Login_User_Collection_Obj);

            if (login_user_Obj.UserID != 0)
            {
                Session["UserID"]   = Convert.ToString(login_user_Obj.UserID);
                Session["ClientID"] = Convert.ToString(login_user_Obj.Client.ClientID);
                Session["UserType"] = Convert.ToString(login_user_Obj.UserType);


                if (login_user_Obj.UserType == "SuperAdmin")
                {
                    List <HCM_Client>       client_list = new List <HCM_Client>();
                    ModifyGlobalClientsData client_Obj  = new ModifyGlobalClientsData();
                    client_list = client_Obj.GetClients(String.IsNullOrEmpty(Convert.ToString(Session["ClientID"])) ? 0 : Convert.ToInt32(Session["ClientID"]), Convert.ToString(Session["UserType"]));
                    if (String.IsNullOrEmpty(Convert.ToString(Session["ClientID"])))
                    {
                        Session["ClientID"] = Convert.ToString(client_list.First().ClientID);
                    }
                }

                if (login_user_Obj.UserType == "ClientAdmin" || login_user_Obj.UserType == "SuperAdmin")
                {
                    List <HCM_Versions> version_List        = new List <HCM_Versions>();
                    ModifyVersionsData  versionDataList_Obj = new ModifyVersionsData();
                    version_List = versionDataList_Obj.GetActiveVersions();
                    foreach (var item in version_List)
                    {
                        if (item.IsDefault)
                        {
                            Session["VersionID"] = Convert.ToString(item.VersionID);
                        }
                    }
                }

                if (login_user_Obj.UserType == "ClientAdmin" || login_user_Obj.UserType == "SuperAdmin")
                {
                    List <HCM_Product> product_List        = new List <HCM_Product>();
                    ModifyProductData  productDataList_Obj = new ModifyProductData();
                    product_List = productDataList_Obj.GetAllProducts();
                    foreach (var item in product_List)
                    {
                        Session["ProductID"] = Convert.ToInt32(item.ProductID);
                    }
                }
            }
            return(Json(login_user_Obj, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public JsonResult GetAllProducts()
        {
            try
            {
                List <HCM_Product> list_Hcm_Product_Obj = new List <HCM_Product>();
                ModifyProductData  productData_Obj      = new ModifyProductData();
                list_Hcm_Product_Obj = productData_Obj.GetAllProducts();

                var jsonResult = Json(list_Hcm_Product_Obj, JsonRequestBehavior.AllowGet);
                jsonResult.MaxJsonLength = int.MaxValue;
                return(jsonResult);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }