Exemple #1
0
        public static TimeLogCollection Search(SearchFilter value)
        {
            TimeLogCollection items = new TimeLogCollection();
            string            key   = string.Format(SETTINGS_Search_KEY, value.Keyword);

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

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

            if (SystemConfig.AllowSearchCache)
            {
                HttpCache.Max(key, items);
            }
            return(items);
        }
        public ContentResult Search(SearchFilter SearchKey)
        {
            SearchKey.OrderBy = string.IsNullOrEmpty(SearchKey.OrderBy) ? "TimeLogId" : SearchKey.OrderBy;
            TimeLogCollection collection = TimeLogManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(collection), "application/json"));
        }
        /// <summary>
        /// use for scrolling page
        /// </summary>
        /// <returns></returns>
        public ContentResult GetPg(int page, int pagesize)
        {
            string            condition = "";
            SearchFilter      SearchKey = SearchFilter.SearchPG(1, page, pagesize, "TimeLogId", "TimeLogId", "Desc", condition);
            TimeLogCollection objItem   = TimeLogManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(objItem), "application/json"));
        }
        public JsonResult GetGata([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel)
        {
            SearchFilter      SearchKey  = SearchFilter.SearchData(1, requestModel, "TimeLogId", "TimeLogId");
            TimeLogCollection collection = TimeLogManager.Search(SearchKey);
            int TotalRecord = 0;

            if (collection.Count > 0)
            {
                TotalRecord = collection[0].TotalRecord;
            }
            return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet));
        }
Exemple #5
0
        public static TimeLogCollection GetbyUser(string CreatedUser)
        {
            TimeLogCollection collection = new TimeLogCollection();
            TimeLog           obj;

            using (var reader = SqlHelper.ExecuteReader("TimeLog_GetAll_byUser", new SqlParameter("@CreatedUser", CreatedUser)))
            {
                while (reader.Read())
                {
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Exemple #6
0
        //public static TimeLogCollection GetAllItem()
        //{
        //    TimeLogCollection collection = new TimeLogCollection();
        //    using (var reader = SqlHelper.ExecuteReader("TimeLog_GetAll", null))
        //    {
        //        while (reader.Read())
        //        {
        //            TimeLog obj = new TimeLog();
        //            obj = GetItemFromReader(reader);
        //            collection.Add(obj);
        //        }
        //    }
        //    return collection;
        //}

        public static TimeLogCollection Search(SearchFilter SearchKey)
        {
            TimeLogCollection collection = new TimeLogCollection();

            using (var reader = SqlHelper.ExecuteReader("TimeLog_Search", SearchFilterManager.SqlSearchParamNoCompany(SearchKey)))
            {
                while (reader.Read())
                {
                    TimeLog obj = new TimeLog();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
        /// <summary>
        /// ExportExcel File
        /// </summary>
        /// <returns></returns>
        public string ExportExcel()
        {
            TimeLogCollection collection = TimeLogManager.GetAll();
            DataTable         dt         = collection.ToDataTable <TimeLog>();
            string            fileName   = "TimeLog_" + 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]);
                }
            }
            FileInputHelper.ExportExcel(dt, fileName, "TimeLog List", false);
            return(fileName);
        }
Exemple #8
0
        public static TimeLogCollection GetAll()
        {
            TimeLogCollection items = new TimeLogCollection();
            string            key   = SETTINGS_ALL_KEY;
            object            obj2  = HttpCache.Get(key);

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

                if (response.IsSuccessStatusCode)
                {
                    items = response.Content.ReadAsAsync <TimeLogCollection>().GetAwaiter().GetResult();
                }
            }
            HttpCache.Max(key, items);
            return(items);
        }
        public ActionResult list()
        {
            TimeLogCollection collection = TimeLogManager.GetAll();

            return(View(ViewFolder + "list.cshtml", collection));
        }