public ContentResult Search(RBVHSearchFilter SearchKey)
        {
            SearchKey.OrderBy = string.IsNullOrEmpty(SearchKey.OrderBy) ? "EmployeeCode" : SearchKey.OrderBy;
            RBVHEmployeeCollection collection = RBVHEmployeeManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(collection), "application/json"));
        }
        /// <summary>
        /// ExportExcel File
        /// </summary>
        /// <returns></returns>
        public string ExportExcel(string searchprm = "")
        {
            RBVHSearchFilter SearchKey = BindSearchHRDB(searchprm);


            RBVHEmployeeCollection collection = RBVHEmployeeManager.Search(SearchKey);

            DataTable dt       = collection.ToDataTable <RBVHEmployee>();
            string    fileName = "RBVHEmployee_" + SystemConfig.CurrentDate.ToString("MM-dd-yyyy");
            //string[] RemoveColumn = { "CompanyID" , "TargetDisplayID", "ReturnDisplay","TotalRecord", "CreatedUser","CreatedDate"};
            //for (int i = 0; i < RemoveColumn.Length; i++)
            //{
            //    if (dt.Columns.Contains(RemoveColumn[i]))
            //    {
            //        dt.Columns.Remove(RemoveColumn[i]);
            //    }
            //}
            HeaderItemCollection RemoveColumn = CommonHelper.HideColumn <RBVHEmployee>(CurrentUser, "RBVHEmployee");

            for (int i = 0; i < RemoveColumn.Count; i++)
            {
                if (dt.Columns.Contains(RemoveColumn[i].name))
                {
                    dt.Columns.Remove(RemoveColumn[i].name);
                }
            }

            FileInputHelper.ExportExcel(dt, fileName, "RBVHEmployee List", false);
            return(fileName);
        }
        public static RBVHEmployeeCollection Search(RBVHSearchFilter value)
        {
            RBVHEmployeeCollection items = new RBVHEmployeeCollection();
            string key = string.Format(SETTINGS_Search_KEY, value.Keyword, value.Page, value.PageSize, value.OrderBy, value.OrderDirection, value.Condition + value.EntityID);

            if (SystemConfig.AllowSearchCache)
            {
                object obj2 = HttpCache.Get(key);

                if ((obj2 != null))
                {
                    return((RBVHEmployeeCollection)obj2);
                }
            }

            using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue))
            {
                HttpResponseMessage response = client.PostAsJsonAsync(Resource + "?method=search", value).GetAwaiter().GetResult();

                if (response.IsSuccessStatusCode)
                {
                    items = response.Content.ReadAsAsync <RBVHEmployeeCollection>().GetAwaiter().GetResult();
                }
            }

            if (SystemConfig.AllowSearchCache && items.Count > 0)
            {
                HttpCache.Max(key, items);
            }
            return(items);
        }
        /// <summary>
        /// use for scrolling page
        /// </summary>
        /// <returns></returns>
        public ContentResult GetPg(int page, int pagesize)
        {
            string                 condition = "";
            RBVHSearchFilter       SearchKey = RBVHSearchFilter.SearchPG(1, page, pagesize, "EmployeeCode,FirstName_EN,MiddleName_EN,LastName_EN,DomainId", "EmployeeCode", "Desc", condition);
            RBVHEmployeeCollection objItem   = RBVHEmployeeManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(objItem), "application/json"));
        }
        public JsonResult GetActiveData([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel)
        {
            RBVHSearchFilter SearchKey = RBVHSearchFilter.SearchData(1, requestModel, "EmployeeCode,FirstName_EN,MiddleName_EN,LastName_EN,DomainId", "EmployeeCode");

            SearchKey.Condition = " IsActive=0 ";
            RBVHEmployeeCollection collection = RBVHEmployeeManager.Search(SearchKey);
            int TotalRecord = 0;

            if (collection.Count > 0)
            {
                TotalRecord = collection[0].TotalRecord;
            }
            return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetHRBPSearchData([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, string searchprm)
        {
            RBVHSearchFilter SearchKey = BindSearchHRDB(searchprm);

            SearchKey = RBVHSearchFilter.SearchData(SearchKey, requestModel);

            RBVHEmployeeCollection collection = RBVHEmployeeManager.Search(SearchKey);
            int TotalRecord = 0;

            if (collection.Count > 0)
            {
                TotalRecord = collection[0].TotalRecord;
            }
            return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet));
        }
        public static RBVHEmployeeCollection GetAll()
        {
            RBVHEmployeeCollection items = new RBVHEmployeeCollection();
            string key  = SETTINGS_ALL_KEY;
            object obj2 = HttpCache.Get(key);

            if ((obj2 != null))
            {
                return((RBVHEmployeeCollection)obj2);
            }
            using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue))
            {
                HttpResponseMessage response = client.GetAsync(Resource).GetAwaiter().GetResult();

                if (response.IsSuccessStatusCode)
                {
                    items = response.Content.ReadAsAsync <RBVHEmployeeCollection>().GetAwaiter().GetResult();
                }
            }
            HttpCache.Max(key, items);
            return(items);
        }