コード例 #1
0
        public ContentResult Search(SearchFilter SearchKey)
        {
            SearchKey.OrderBy = string.IsNullOrEmpty(SearchKey.OrderBy) ? "EmployeeCode" : SearchKey.OrderBy;
            T_COM_Master_EmployeeCollection collection = T_COM_Master_EmployeeManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(collection), "application/json"));
        }
コード例 #2
0
        public static T_COM_Master_EmployeeCollection Search(SearchFilter value)
        {
            T_COM_Master_EmployeeCollection items = new T_COM_Master_EmployeeCollection();
            string key = string.Format(SETTINGS_Search_KEY, value.Keyword, value.Page, value.PageSize, value.OrderBy, value.OrderDirection);

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

                if ((obj2 != null))
                {
                    return((T_COM_Master_EmployeeCollection)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_COM_Master_EmployeeCollection>().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(1, page, pagesize, "EmployeeCode", "EmployeeCode", "Desc", condition);
            T_COM_Master_EmployeeCollection objItem = T_COM_Master_EmployeeManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(objItem), "application/json"));
        }
コード例 #4
0
        public JsonResult GetGata([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel)
        {
            SearchFilter SearchKey = SearchFilter.SearchData(1, requestModel, "EmployeeCode", "EmployeeCode");
            T_COM_Master_EmployeeCollection collection = T_COM_Master_EmployeeManager.Search(SearchKey);
            int TotalRecord = 0;

            if (collection.Count > 0)
            {
                TotalRecord = collection[0].TotalRecord;
            }
            return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
        public static T_COM_Master_EmployeeCollection GetbyUser(string CreatedUser)
        {
            T_COM_Master_EmployeeCollection collection = new T_COM_Master_EmployeeCollection();
            T_COM_Master_Employee           obj;

            using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, "T_COM_Master_Employee_GetAll_byUser", new SqlParameter("@CreatedUser", CreatedUser)))
            {
                while (reader.Read())
                {
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
コード例 #6
0
        public static T_COM_Master_EmployeeCollection Search(SearchFilter SearchKey)
        {
            T_COM_Master_EmployeeCollection collection = new T_COM_Master_EmployeeCollection();

            using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, "T_COM_Master_Employee_Search", SearchFilterManager.SqlSearchConditionNoCompany(SearchKey)))
            {
                while (reader.Read())
                {
                    T_COM_Master_Employee obj = new T_COM_Master_Employee();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
コード例 #7
0
        public static T_COM_Master_EmployeeCollection GetAllItem()
        {
            T_COM_Master_EmployeeCollection collection = new T_COM_Master_EmployeeCollection();

            using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, "T_COM_Master_Employee_GetAll", null))
            {
                while (reader.Read())
                {
                    T_COM_Master_Employee obj = new T_COM_Master_Employee();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
コード例 #8
0
        /// <summary>
        /// ExportExcel File
        /// </summary>
        /// <returns></returns>
        public string ExportExcel()
        {
            T_COM_Master_EmployeeCollection collection = T_COM_Master_EmployeeManager.GetAll();
            DataTable dt       = collection.ToDataTable <T_COM_Master_Employee>();
            string    fileName = "T_COM_Master_Employee_" + 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, "T_COM_Master_Employee List", false);
            return(fileName);
        }
コード例 #9
0
        public static T_COM_Master_EmployeeCollection GetAll()
        {
            T_COM_Master_EmployeeCollection items = new T_COM_Master_EmployeeCollection();
            string key  = SETTINGS_ALL_KEY;
            object obj2 = HttpCache.Get(key);

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

                if (response.IsSuccessStatusCode)
                {
                    items = response.Content.ReadAsAsync <T_COM_Master_EmployeeCollection>().GetAwaiter().GetResult();
                }
            }
            HttpCache.Max(key, items);
            return(items);
        }
コード例 #10
0
        public ActionResult list()
        {
            T_COM_Master_EmployeeCollection collection = T_COM_Master_EmployeeManager.GetAll();

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