public virtual IEnumerable<T_TMS_EmployeeDailyTimesheetTransaction> SearchData(SearchFilter value)
        {
            T_TMS_EmployeeDailyTimesheetTransactionCollection items = new T_TMS_EmployeeDailyTimesheetTransactionCollection();
            string key = string.Format(SETTINGS_Search_KEY,value.CompanyID ,value.Keyword ,value.Page ,value.PageSize,value.OrderBy,value.OrderDirection,value.Condition);
            if (SystemConfig.AllowSearchCache)
            {
                object obj2 = HttpCache.Get(key);

                if ((obj2 != null))
                {
                    return (T_TMS_EmployeeDailyTimesheetTransactionCollection)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<T_TMS_EmployeeDailyTimesheetTransactionCollection>().GetAwaiter().GetResult();
                }
            }

            if (SystemConfig.AllowSearchCache && items.Count>0)
            {
                HttpCache.Max(key, items);
            }
            return items;

            //   return Search(value);
        }
예제 #2
0
        public override ContentResult GetGata([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel)
        {
            SearchFilter SearchKey = SearchFilter.SearchData(1, requestModel, "EmployeeCode", "EmployeeCode");

            SearchKey.Condition      = " tbl.EmployeeCode = " + CurrentUser.EmployeeCode + " ";
            SearchKey.OrderBy        = "DateID";
            SearchKey.OrderDirection = "Desc";
            T_TMS_EmployeeDailyTimesheetTransactionCollection collection = T_TMS_EmployeeDailyTimesheetTransactionManager.Search(SearchKey);
            int TotalRecord = 0;

            if (collection.Count > 0)
            {
                TotalRecord = collection[0].TotalRecord;
            }
            //return Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet);
            return(Content(JsonConvert.SerializeObject(new DataTablesResponseExtend(requestModel.Draw, collection, TotalRecord, TotalRecord)), "application/json"));
        }
        public virtual DataTable ImportData(DataTable objList)
        {
            IEnumerable<T_TMS_EmployeeDailyTimesheetTransaction> myList = objList.ToList<T_TMS_EmployeeDailyTimesheetTransaction>();
            T_TMS_EmployeeDailyTimesheetTransactionCollection ErrorList = new T_TMS_EmployeeDailyTimesheetTransactionCollection();
            foreach (T_TMS_EmployeeDailyTimesheetTransaction objitem in myList)
            {
                try
                {
                    Save(objitem);
                }
                catch (Exception objEx)
                {
                    objitem.ErrorMesssage = "<div class='error'>" + objEx.Message + "</div>";
                    ErrorList.Add(objitem);

                }
            }
            return ErrorList.ToDataTable<T_TMS_EmployeeDailyTimesheetTransaction>();
        }