Exemplo n.º 1
0
        // Store Fuctionality
        public void AddStore(string userId, string storeId)
        {
            LoginUserModel lgModel = new LoginUserModel();

            if (!ValidationUtility.IsNull(storeId))
            {
                string[] storeIdList = storeId.Split(',');

                for (int i = 0; i < storeIdList.Length; i++)
                {
                    int sId = ValidationUtility.ToInteger(storeIdList[i]);
                    int uId = ValidationUtility.ToInteger(userId);
                    lgModel.AddUserStore(sId, uId);

                }
            }
        }
Exemplo n.º 2
0
        public void AssignAreaManager(string generalManagerId, string areaManagerId)
        {
            LoginUserModel lgModel = new LoginUserModel();

            if (!ValidationUtility.IsNull(areaManagerId))
            {
                string[] amIdList = areaManagerId.Split(',');

                for (int i = 0; i < amIdList.Length; i++)
                {

                    int gmId = ValidationUtility.ToInteger(generalManagerId);
                    int amId = ValidationUtility.ToInteger(amIdList[i]);
                    lgModel.AddAssignAreaManager(gmId, amId);
                }
            }
        }
Exemplo n.º 3
0
        public JsonResult DeleteUser(int id)
        {
            LoginUserModel lgModel = new LoginUserModel();

            string error = "";
            string msg = "";

            try
            {
                lgModel.Delete(id);
                error = "Success";
                msg = "User Deleted Successfully";
            }
            catch (Exception ex)
            {

                error = "Error";
                msg = "User is not Deleted";
                log.Error(" Exception in DeleteUser Method ", ex);
            }

            ResponseDTO resDTO = new ResponseDTO { Error = error, Message = msg };
            return Json(resDTO, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 4
0
 public void AddUser(string name, string role, string emailId)
 {
     LoginUserModel lgModel = new LoginUserModel();
     lgModel.Add(name, role, emailId);
 }
Exemplo n.º 5
0
 public void UpdateUser(int id, string sec, string userId, string roleType, string emailId)
 {
     LoginUserModel lgModel = new LoginUserModel();
     lgModel.Update(id, sec, userId, roleType, emailId);
 }
Exemplo n.º 6
0
        public void removeStore(string userId, string storeId)
        {
            LoginUserModel lgModel = new LoginUserModel();

            if (!ValidationUtility.IsNull(storeId) && !ValidationUtility.IsEqual(storeId, "Manager"))
            {
                int sid = ValidationUtility.ToInteger(storeId);
                int uid = ValidationUtility.ToInteger(userId);
                lgModel.ReomoveStore(sid, uid, true);
            }
            else if (!ValidationUtility.IsNull(storeId) && ValidationUtility.IsEqual(storeId, "Manager"))
            {
                int sid = ValidationUtility.ToInteger(storeId);
                int uid = ValidationUtility.ToInteger(userId);
                lgModel.ReomoveStore(sid, uid, false);
            }
        }
Exemplo n.º 7
0
        public void UpdateStore(string userId, string newStoreId, string preStoreId)
        {
            LoginUserModel lgModel = new LoginUserModel();

            if (!ValidationUtility.IsNull(newStoreId) && !ValidationUtility.IsNull(preStoreId))
            {
                if (ValidationUtility.IsEqual(preStoreId, "Manager"))
                {
                    int nsid = ValidationUtility.ToInteger(newStoreId);
                    int uid = ValidationUtility.ToInteger(userId);
                    lgModel.UpdateUserStore(nsid, 0, uid);
                }

            }
        }
Exemplo n.º 8
0
 public JsonResult GetStoreName()
 {
     LoginUserModel lgModel = new LoginUserModel();
     ArrayList val = lgModel.GetStoreList();
     return Json(val, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 9
0
        public void RemoveAssignedAreaManager(string tId)
        {
            LoginUserModel lgModel = new LoginUserModel();

            int id = ValidationUtility.ToInteger(tId);

            lgModel.RemoveareaManager(id);
        }
Exemplo n.º 10
0
 public JsonResult GetRoleList()
 {
     LoginUserModel lgModel = new LoginUserModel();
     ArrayList roleList = lgModel.GetAllRoleList();
     return Json(roleList, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 11
0
        public JsonResult GetAssignAreaManagerList(string userId)
        {
            LoginUserModel lgModel = new LoginUserModel();

            ArrayList list = new ArrayList();
            int gmId = ValidationUtility.ToInteger(userId);

            ArrayList assignAreaManager = lgModel.GetAllAssignAreaManagerList(gmId);
            ArrayList AllUser = lgModel.GetList();
            ArrayList remainingAreaManager = new ArrayList();

            for (int j = 0; j < AllUser.Count; j++)
            {
                UserContext allDTO = (UserContext)AllUser[j];
                if (allDTO.Role == "AreaManager")
                {
                    remainingAreaManager.Add(allDTO);
                }
            }

            for (int i = 0; i < assignAreaManager.Count; i++)
            {
                AssignAreaManagerInfoDTO asineDTO = (AssignAreaManagerInfoDTO)assignAreaManager[i];

                for (int k = 0; k < remainingAreaManager.Count; k++)
                {
                    UserContext unAsineDTO = (UserContext)remainingAreaManager[k];

                    if (asineDTO.AreaManagerId == unAsineDTO.Id)
                    {
                        remainingAreaManager.Remove(unAsineDTO);
                        break;
                    }

                }

            }

            list.Add(assignAreaManager);
            list.Add(remainingAreaManager);

            return Json(list, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 12
0
        public JsonResult GetAllUser()
        {
            LoginUserModel lgModel = new LoginUserModel();
            DataTable ds = lgModel.GetUserList();
            string jsone = ValidationUtility.DataTableToJson(ds);
            //JsonResult js = Json(ds, JsonRequestBehavior.AllowGet);
            // string s = jsone;
            //return Json(jsone, JsonRequestBehavior.AllowGet);

            ArrayList list = lgModel.GetList();

            return Json(list, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 13
0
        //public JsonResult GetAllAssignStore()
        //{
        //    LoginUserModel lgModel = new LoginUserModel();
        //    ArrayList list = lgModel.GetUserAssignStore();
        //    return Json(list, JsonRequestBehavior.AllowGet);
        //}
        public JsonResult GetAllAssignStore(string userId)
        {
            LoginUserModel lgModel = new LoginUserModel();
            ArrayList list = new ArrayList();

            ArrayList allStoreList = ValidationUtility.GetStoreList(false);

            int uId = ValidationUtility.ToInteger(userId);

            ArrayList AssignStoreList = lgModel.GetUserAssignStore(uId);
            ArrayList unAssingStoreList = new ArrayList();

            for (int i = 0; i < AssignStoreList.Count; i++)
            {
                StoreDTO asineDTO = (StoreDTO)AssignStoreList[i];

                for (int j = 0; j < allStoreList.Count; j++)
                {
                    StoreDTO unAsineDTO = (StoreDTO)allStoreList[j];

                    if (asineDTO.Id == unAsineDTO.Id)
                    {
                        allStoreList.Remove(unAsineDTO);
                        break;
                    }

                }

            }

            list.Add(AssignStoreList);
            list.Add(allStoreList);

            return Json(list, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 14
0
        public ActionResult Authenticate()
        {
            try
            {
                log.Info("Call Info");
                // RecordSalesJob rsb = new RecordSalesJob();
                // rsb.UpdateRecordSale();

                    string userId = Request.Form["userId"];
                    string password = Request.Form["password"];

                    log.Info("userId  " + userId);

                    LoginUserModel lgModel = new LoginUserModel();

                    UserContext context = lgModel.UserAuthenticate(userId, password);

                    if (context != null && ValidationUtility.IsEqual("Manager", context.Role))
                    {
                        context.StoreDBConnectionString = lgModel.GetConnectionString(context.Id);

                        Session["UserId"] = context.UserId;
                        Session["UserContext"] = context;
                        Session["ConnectionString"] = context.StoreDBConnectionString;
                        return Redirect("/Manager/Index");
                    }

                    if (context != null && ValidationUtility.IsEqual("Admin", context.Role))
                    {
                        context.StoreDBConnectionString = lgModel.GetConnectionString();

                        Session["UserId"] = context.UserId;
                        Session["UserContext"] = context;
                        Session["ConnectionString"] = context.StoreDBConnectionString;
                        return Redirect("/Admin/Index");
                    }
                    if (context != null && ValidationUtility.IsEqual("Corporate", context.Role))
                    {
                        context.StoreDBConnectionString = lgModel.GetConnectionString(context.Id);

                        Session["UserId"] = context.UserId;
                        Session["UserContext"] = context;
                        Session["ConnectionString"] = context.StoreDBConnectionString;
                        return Redirect("/Corporate/Index");
                    }

                    if (context != null && ValidationUtility.IsEqual("AreaManager", context.Role))
                    {
                        context.StoreDBConnectionString = lgModel.GetConnectionString(context.Id);

                        Session["UserId"] = context.UserId;
                        Session["UserContext"] = context;
                        Session["ConnectionString"] = context.StoreDBConnectionString;
                        return Redirect("/AreaManager/Index");
                    }

                    if (context != null && ValidationUtility.IsEqual("Maintenance", context.Role))
                    {
                        context.StoreDBConnectionString = lgModel.GetConnectionString();

                        Session["UserId"] = context.UserId;
                        Session["UserContext"] = context;
                        Session["ConnectionString"] = context.StoreDBConnectionString;
                        return Redirect("/Maintenance/Index");
                    }

                    if (context != null && ValidationUtility.IsEqual("GeneralManager", context.Role))
                    {
                        context.StoreDBConnectionString = lgModel.GetConnectionString(context.Id);

                        Session["UserId"] = context.UserId;
                        Session["UserContext"] = context;
                        Session["ConnectionString"] = context.StoreDBConnectionString;
                        return Redirect("/GeneralManager/Index");
                    }

                    else
                    {
                        log.Error(" User contex is null  ");

                        ViewBag.Message = " Please Enter Correct Information ";
                        return Redirect("/Home");
                    }

            }
            catch (Exception ex)
            {
                log.Error("Exception in Authenticate ", ex);
            }

            return Redirect("/Home");

            //if (userId == "pos1" && password == "pos1")
            //{
            //    ViewBag.Message = "Succeeded";

            //}
            //else
            //{
            //    ViewBag.Message = "Failed";
            //}

            // return  View("~/views/ManagerDashboard/Home");
        }