Пример #1
0
        public ContentResult Search(SearchFilter SearchKey)
        {
            SearchKey.OrderBy = string.IsNullOrEmpty(SearchKey.OrderBy) ? "Id" : SearchKey.OrderBy;
            ScheduleTaskCollection collection = ScheduleTaskManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(collection), "application/json"));
        }
Пример #2
0
        public static ScheduleTaskCollection Search(SearchFilter value)
        {
            ScheduleTaskCollection items = new ScheduleTaskCollection();
            //string key = string.Format(SETTINGS_Search_KEY, value.CompanyID+value.Keyword+value.Page+value.PageSize+value.OrderBy+value.OrderDirection)
            string key = string.Format(SETTINGS_Search_KEY, value.Keyword, value.Page, value.PageSize, value.OrderBy, value.OrderDirection, value.Condition);

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

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

            if (SystemConfig.AllowSearchCache)
            {
                HttpCache.Max(key, items);
            }
            return(items);
        }
Пример #3
0
        /// <summary>
        /// use for scrolling page
        /// </summary>
        /// <returns></returns>
        public ContentResult GetPg(int page, int pagesize)
        {
            string                 condition = "";
            SearchFilter           SearchKey = SearchFilter.SearchPG(CurrentUser.CompanyID, page, pagesize, "Id", "Id", "Desc", condition);
            ScheduleTaskCollection objItem   = ScheduleTaskManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(objItem), "application/json"));
        }
Пример #4
0
        public JsonResult GetGata([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel)
        {
            SearchFilter           SearchKey  = SearchFilter.SearchData(CurrentUser.CompanyID, requestModel, "Id", "Id");
            ScheduleTaskCollection collection = ScheduleTaskManager.Search(SearchKey);
            int TotalRecord = 0;

            if (collection.Count > 0)
            {
                TotalRecord = collection[0].TotalRecord;
            }
            //ScheduleTaskCollection data = ScheduleTaskManager.GetAll(CurrentUser.CompanyID);
            return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public JsonResult GetSearchData([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, string searchprm)
        {
            SearchFilter SearchKey = BindSearch(searchprm);

            SearchKey = SearchFilter.SearchData(SearchKey, requestModel);
            ScheduleTaskCollection collection = ScheduleTaskManager.Search(SearchKey);
            int TotalRecord = 0;

            if (collection.Count > 0)
            {
                TotalRecord = collection[0].TotalRecord;
            }
            return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet));
        }
Пример #6
0
        public static ScheduleTaskCollection Search(SearchFilter SearchKey)
        {
            ScheduleTaskCollection collection = new ScheduleTaskCollection();

            using (var reader = SqlHelper.ExecuteReader("ScheduleTask_Search", SearchFilterManager.SqlSearchParam(SearchKey)))
            {
                while (reader.Read())
                {
                    ScheduleTask obj = new ScheduleTask();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Пример #7
0
        /// <summary>
        /// ExportExcel File
        /// </summary>
        /// <returns></returns>
        public string ExportExcel()
        {
            ScheduleTaskCollection collection = ScheduleTaskManager.GetAll(CurrentUser.CompanyID);
            DataTable dt       = collection.ToDataTable <ScheduleTask>();
            string    fileName = "ScheduleTask_" + 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, "ScheduleTask List", false);
            return(fileName);
        }
Пример #8
0
        public virtual DataTable ImportData(DataTable objList)
        {
            IEnumerable <ScheduleTask> myList    = objList.ToList <ScheduleTask>();
            ScheduleTaskCollection     ErrorList = new ScheduleTaskCollection();

            foreach (ScheduleTask objitem in myList)
            {
                try
                {
                    Save(objitem);
                }
                catch (Exception objEx)
                {
                    objitem.ErrorMesssage = "<div class='error'>" + objEx.Message + "</div>";
                    ErrorList.Add(objitem);
                }
            }
            return(ErrorList.ToDataTable <ScheduleTask>());
        }
Пример #9
0
        public static ScheduleTaskCollection GetbyUser(string CreatedUser, int CompanyID)
        {
            ScheduleTaskCollection collection = new ScheduleTaskCollection();
            ScheduleTask           obj;
            var sqlParams = new SqlParameter[]
            {
                new SqlParameter("@CreatedUser", CreatedUser),
                new SqlParameter("@CompanyID", CompanyID),
            };

            using (var reader = SqlHelper.ExecuteReader("ScheduleTask_GetAll_byUser", sqlParams))
            {
                while (reader.Read())
                {
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Пример #10
0
        public static ScheduleTaskCollection GetAllItem(int CompanyID)
        {
            ScheduleTaskCollection collection = new ScheduleTaskCollection();

            var sqlParams = new SqlParameter[]
            {
                new SqlParameter("@CompanyID", CompanyID),
            };

            using (var reader = SqlHelper.ExecuteReader("ScheduleTask_GetAll", sqlParams))
            {
                while (reader.Read())
                {
                    ScheduleTask obj = new ScheduleTask();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Пример #11
0
        public static ScheduleTaskCollection GetAll(int CompanyID)
        {
            ScheduleTaskCollection items = new ScheduleTaskCollection();
            string key  = String.Format(SETTINGS_ALL_KEY, CompanyID);
            object obj2 = HttpCache.Get(key);

            if ((obj2 != null))
            {
                return((ScheduleTaskCollection)obj2);
            }
            using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue))
            {
                HttpResponseMessage response = client.GetAsync(string.Format(Resource + "?CompanyID={0}", CompanyID)).GetAwaiter().GetResult();

                if (response.IsSuccessStatusCode)
                {
                    items = response.Content.ReadAsAsync <ScheduleTaskCollection>().GetAwaiter().GetResult();
                }
            }
            HttpCache.Max(key, items);
            return(items);
        }
Пример #12
0
        public ActionResult list()
        {
            ScheduleTaskCollection collection = ScheduleTaskManager.GetAll(CurrentUser.CompanyID);

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