Exemplo n.º 1
0
        public DataTable GetUserList(ViewUserLoginModel objUserLoginList)
        {
            try
            {
                SqlParameter[] parmList =
                {
                    new SqlParameter("@UserName", objUserLoginList.FilterUserName)
                    ,                             new SqlParameter("@CurrentPage", objUserLoginList.CurrentPage)
                    ,                             new SqlParameter("@PageSize", objUserLoginList.PageSize)
                    ,                             new SqlParameter("@SortBy", objUserLoginList.SortBy)
                    ,                             new SqlParameter("@SortOrder", objUserLoginList.SortOrder)
                };

                DataSet ds = SQLHelper.ExecuteDataset(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, DBConstants.Admin_GetUserList, parmList);

                if (ds != null && ds.Tables.Count > 0)
                {
                    return(ds.Tables[0]);
                }
                return(null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public ActionResult List(ViewUserLoginModel objViewUserLoginModel)
 {
     try
     {
         objViewUserLoginModel.Message = objViewUserLoginModel.MessageType = String.Empty;
         serviceResponse       = objUtilityWeb.PostAsJsonAsync(WebApiURL.UserLogin + "/GetUsernameList", objViewUserLoginModel);
         objViewUserLoginModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewUserLoginModel>().Result : null;
     }
     catch (Exception ex)
     {
         ErrorLog(ex, "UserList", "View POST");
     }
     return(PartialView("_UserList", objViewUserLoginModel));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Get  SubCategory List based on paging, searching and sorting parameter
        /// </summary>
        /// <param name="objViewUserLoginModel">object of Model ViewSubCategoryModel</param>
        /// <returns></returns>
        public ViewUserLoginModel GetUsernameList(ViewUserLoginModel objViewUserLoginModel)
        {
            List <UserLogin> lstUserLogin = new List <UserLogin>();

            //if FilterSubCategoryName is NULL than set to empty
            objViewUserLoginModel.FilterUserName = objViewUserLoginModel.FilterUserName ?? String.Empty;

            //if SortBy is NULL than set to empty
            objViewUserLoginModel.SortBy = objViewUserLoginModel.SortBy ?? String.Empty;

            //call GetSubCategoryList Method which will retrun datatable of  SubCategory
            DataTable dtSubCategory = objDLUserLogin.GetUserList(objViewUserLoginModel);

            //fetch each row of datable
            foreach (DataRow dr in dtSubCategory.Rows)
            {
                //Convert datarow into Model object and set Model object property
                UserLogin itemUserLogin = GetDataRowToEntity <UserLogin>(dr);
                //Add  SubCategory in List
                lstUserLogin.Add(itemUserLogin);
            }

            //set SubCategory List of Model ViewSubCategoryModel
            objViewUserLoginModel.UserLoginList = lstUserLogin;
            //if  SubCategory List count is not null and greater than 0 Than set Total Pages for Paging.
            if (objViewUserLoginModel != null && objViewUserLoginModel.UserLoginList != null && objViewUserLoginModel.UserLoginList.Count > 0)
            {
                objViewUserLoginModel.CurrentPage = objViewUserLoginModel.UserLoginList[0].CurrentPage;
                int totalRecord = objViewUserLoginModel.UserLoginList[0].TotalCount;

                if (decimal.Remainder(totalRecord, objViewUserLoginModel.PageSize) > 0)
                {
                    objViewUserLoginModel.TotalPages = (totalRecord / objViewUserLoginModel.PageSize + 1);
                }
                else
                {
                    objViewUserLoginModel.TotalPages = totalRecord / objViewUserLoginModel.PageSize;
                }
            }
            else
            {
                objViewUserLoginModel.TotalPages  = 0;
                objViewUserLoginModel.CurrentPage = 1;
            }
            return(objViewUserLoginModel);
        }
        public ActionResult List()
        {
            ViewUserLoginModel ObjViewUserLoginModel = new ViewUserLoginModel();

            try
            {
                //initial set of current page, pageSize , Total pages
                ObjViewUserLoginModel.CurrentPage = 1;
                ObjViewUserLoginModel.PageSize    = CommonUtils.PageSize;
                ObjViewUserLoginModel.TotalPages  = 0;
                //Get  SubCategory List
                serviceResponse       = objUtilityWeb.PostAsJsonAsync(WebApiURL.UserLogin + "/GetUsernameList", ObjViewUserLoginModel);
                ObjViewUserLoginModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewUserLoginModel>().Result : null;
                //ObjViewSubCategoryModel = objBLSubCategory.GetSubCategoryList(ObjViewSubCategoryModel);
            }
            catch (Exception ex)
            {
                ErrorLog(ex, "UserList", "View GET");
            }
            return(View("ViewUserList", ObjViewUserLoginModel));
        }
 public ViewUserLoginModel GetUsernameList(ViewUserLoginModel objViewUserLoginModel)
 {
     return(objBusUserLogin.GetUsernameList(objViewUserLoginModel));
 }