Ejemplo n.º 1
0
        private UserListViewModel GetUserListVM(UserFilter objFilter)
        {
            //Thread.Sleep(1000);
            UserListViewModel userListVM  = null;
            CommonBL          objCommonBL = null;

            try
            {
                objUserBL             = new UserBL();
                userListVM            = new UserListViewModel();
                objCommonBL           = new CommonBL();
                objFilter.PagingRoute = new PagingRoute()
                {
                    Action = "Index", Controller = "User"
                };
                userListVM.lstUsers     = objUserBL.GetData(objFilter);
                userListVM.lstUserTypes = objCommonBL.GetCodeDetail(new CodeDetailFilter()
                {
                    CodeTypeId = 1
                });
                userListVM.QueryBO = userListVM.objFilter = objFilter;
                return(userListVM);
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                userListVM = null;
            }
        }
Ejemplo n.º 2
0
        private CountryMasterListVM GetCountryListVM(CountryMasterFilter objFilter)
        {
            //Thread.Sleep(1000);
            //CountryMasterListVM userListVM = null;
            CommonBL objCommonBL = null;

            try
            {
                objCountryBL          = new CountryBL();
                objListVM             = new CountryMasterListVM();
                objCommonBL           = new CommonBL();
                objFilter.PagingRoute = new PagingRoute()
                {
                    Action = "Index", Controller = "Country"
                };
                objListVM.lstCountryMaster = objCountryBL.GetData(objFilter);
                objListVM.lstUserTypes     = objCommonBL.GetCodeDetail(new CodeDetailFilter()
                {
                    CodeTypeId = 1
                });
                objListVM.QueryBO = objListVM.objFilter = objFilter;
                return(objListVM);
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                objListVM = null;
            }
        }
Ejemplo n.º 3
0
        public ActionResult Action(UserFilter objFilter, string submit)
        {
            CommonBL objCommonBL = null;
            User     objUser     = null;

            try
            {
                objDetailsVM = new UserDetailsVM();
                if (submit.ToLower() == "edit")
                {
                    objCommonBL            = new CommonBL();
                    TempData["UserFilter"] = objFilter;
                    objUserBL         = new UserBL();
                    objDetailsVM      = new UserDetailsVM();
                    objDetailsVM.User = objUserBL.GetData(new UserFilter()
                    {
                        UserId = objFilter.UserId
                    }).FirstOrDefault();
                    objDetailsVM.lstUserTypes = objCommonBL.GetCodeDetail(new CodeDetailFilter()
                    {
                        CodeTypeId = 1
                    });
                    return(View("Details", objDetailsVM));
                }
                else if (submit.ToLower() == "delete")
                {
                    objUserBL          = new UserBL();
                    objListVM          = new UserListViewModel();
                    objUser            = new User(objFilter.UserId);
                    objUser.ModifiedBy = 1;
                    objResponse        = objUserBL.SaveUser(objUser, "D");
                    objFilter.UserId   = 0;
                    objListVM          = GetUserListVM(objFilter);
                    objListVM.Toast    = WebCommon.SetToast(objResponse);
                    return(View("Index", objListVM));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                objUserBL    = null;
                objDetailsVM = null;
                objListVM    = null;
                objCommonBL  = null;
            }
            return(null);
        }
Ejemplo n.º 4
0
        public ActionResult DetailsPost(UserDetailsVM objDetailsVM, string Submit, HttpPostedFileBase file)
        {
            CommonBL objCommonBL = null;

            try
            {
                if (Submit == "Save")
                {
                    objUserBL   = new UserBL();
                    objCommonBL = new CommonBL();

                    objDetailsVM.User.Status = 1;
                    if (file != null)
                    {
                        string path = "~/Content/profileimages/" + Guid.NewGuid() + file.FileName;
                        file.SaveAs(Server.MapPath(path));
                        objDetailsVM.User.ImageUrl = path;//.Substring(2, path.Length - 2);
                    }
                    objResponse = objUserBL.SaveUser(objDetailsVM.User, objDetailsVM.User.UserId > 0 ? "U" : "C");
                    objDetailsVM.lstUserTypes = objCommonBL.GetCodeDetail(new CodeDetailFilter()
                    {
                        CodeTypeId = 1
                    });
                    objDetailsVM.Toast = WebCommon.SetToast(objResponse, "User", "Index");
                }
                return(View(objDetailsVM));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objUserBL    = null;
                objDetailsVM = null;
                objCommonBL  = null;
            }
        }
Ejemplo n.º 5
0
        // GET: User
        public ActionResult Details()
        {
            CommonBL objCommonBL = null;

            try
            {
                objDetailsVM = new UserDetailsVM();
                objCommonBL  = new CommonBL();
                objDetailsVM.User.IsActiveOnSite = true;
                objDetailsVM.lstUserTypes        = objCommonBL.GetCodeDetail(new CodeDetailFilter()
                {
                    CodeTypeId = 1
                });
                return(View(objDetailsVM));
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                objCommonBL = null;
            }
        }