コード例 #1
0
ファイル: EmployeesController.cs プロジェクト: TonyNug/CGPSI
 /// <summary>
 /// Get Data Employees for Reference View
 /// </summary>
 public ActionResult GetRefEmployee(string take, string page, string skip, string pageSize, List<GridSort> sort, GridFilter filter)
 {
     string filters = KendoHelper.GenerateFilters(take, page, skip, pageSize, sort, filter);
     var data = new
     {
         Result = new CGPSI_AbsenceDBEntities().SP_ViewEMPLOYEES(filters.Split('|')[0], filters.Split('|')[0]),
         CResult = new CGPSI_AbsenceDBEntities().Employees.Count()
     };
     return Json(data);
 }
コード例 #2
0
ファイル: JobTitleController.cs プロジェクト: TonyNug/CGPSI
 public ActionResult Get(string take, string page, string skip, string pageSize, List<GridSort> sort, GridFilter filter)
 {
     var temp = new CGPSI_AbsenceDBEntities().SP_JOB_TITLES_PagingAndView("", "");
     string filters = KendoHelper.GenerateFilters(take, page, skip, pageSize, sort, filter);
     var data = new
     {
         Result = new CGPSI_AbsenceDBEntities().SP_JOB_TITLES_PagingAndView("", ""), // .MstActivityCategory_getList(filters),
         CResult = new CGPSI_AbsenceDBEntities().JobTitles.Count()
     };
     return Json(data);
     //return Json(null);
 }
コード例 #3
0
ファイル: KendoHelper.cs プロジェクト: TonyNug/CGPSI
 public static string GetValueFromFieldFilter(GridFilter filter, string field, string output_where)
 {
     string output = string.Empty;//berisi query bentukan
     List<string> temp = new List<string>();
     try
     {
         if (filter != null && (filter.Filters != null && filter.Filters.Count > 0))
         {
             //string whereClause = null;
             var parameters = new List<object>();
             var filters = filter.Filters;
             for (int i = 0; i < filters.Count; i++)
             {
                 if (filters[i].Filters == null)
                 {
                     if (filters[i].Value != null)
                     {
                         if (filters[i].Field.ToString() == field)
                         {
                             output_where = filters[i].Value.ToString();
                             break;
                         }
                     }
                 }
                 else
                 {
                     output_where = GetValueFromFieldFilter(filters[i], field, output_where);
                 }
             }
         }
     }
     catch { }
     return output_where;
 }
コード例 #4
0
ファイル: KendoHelper.cs プロジェクト: TonyNug/CGPSI
        public static string GenerateWhereFilterIgnore(GridFilter filter, string output_where, string field_name)
        {
            string output = string.Empty;//berisi query bentukan
            string logic = string.Empty; //berisi "and" atau "or"
            List<string> temp = new List<string>();
            string field = string.Empty;
            try
            {
                logic = filter.Logic;
                if (filter != null && (filter.Filters != null && filter.Filters.Count > 0))
                {
                    //string whereClause = null;
                    var parameters = new List<object>();
                    var filters = filter.Filters;

                    for (int i = 0; i < filters.Count; i++)
                    {
                        if (filters[i].Filters == null)
                        {
                            if (filters[i].Value != null)
                            {
                                if (filters[i].Field.ToLower() != field_name.ToLower())
                                {
                                    temp.Add(buildFilterItem(filters[i].Field.ToString(), filters[i].Operator.ToString(), filters[i].Value.ToString()));
                                    //if (isDate(filters[i].Value.ToString()) == true)
                                    //{
                                    //    temp.Add(buildFilterItem_date(filters[i].Field.ToString(), filters[i].Operator.ToString(), filters[i].Value.ToString()));
                                    //}
                                    //else if (isNumber(filters[i].Value.ToString()) == true && filters[i].Field.ToLower() != "emplid" && filters[i].Field.ToLower() != "v.to_emplid"
                                    //    && filters[i].Field.ToLower() != "to_empl_id" && filters[i].Field.ToLower() != "from_empl_id")
                                    //{
                                    //    temp.Add(buildFilterItem_number(filters[i].Field.ToString(), filters[i].Operator.ToString(), filters[i].Value.ToString()));
                                    //}
                                    //else if (isBoolean(filters[i].Value.ToString()))
                                    //{
                                    //    temp.Add(buildFilterItem_boolean(filters[i].Field.ToString(), filters[i].Operator.ToString(), filters[i].Value.ToString()));
                                    //}
                                    //else
                                    //{
                                    //    temp.Add(buildFilterItem_string(filters[i].Field.ToString(), filters[i].Operator.ToString(), filters[i].Value.ToString()));
                                    //}
                                }
                            }
                        }
                        else
                        {
                            output_where += GenerateWhereFilterIgnore(filters[i], output_where, field_name);
                        }

                    }
                    field = string.Join(" " + logic + " ", temp.ToArray());

                }
            }
            catch { }
            output_where += (field.Trim().Length > 0) ? logic + "  " + field + " " : " ";
            return output_where;
        }
コード例 #5
0
ファイル: KendoHelper.cs プロジェクト: TonyNug/CGPSI
 public static string GetValueOfFilter(string field, GridFilter filter)
 {
     return QueryBuilder.GetValueFromFieldFilter(filter, field, "");
 }
コード例 #6
0
ファイル: KendoHelper.cs プロジェクト: TonyNug/CGPSI
        /// <summary>
        /// Fungsi ini digunakan untuk menggenerate string filter dengan mengabaikan salah satu field berdasarkan inputan agar tidak dimasukkan kedalam query
        /// </summary>
        public static string GenerateFiltersIgnore(string take, string page, string skip, string pageSize, List<GridSort> sort, GridFilter filter, string field)
        {
            string hasil = string.Empty;
            string where = string.Empty;
            string paging = string.Empty;
            string sorting = string.Empty;

            int pageNum = (page.ToString().Length > 0) ? int.Parse(page) : 0;
            int limit = (take.ToString().Length > 0) ? int.Parse(take.ToString()) : 0;

            if (sort != null)
            {
                sorting = (sort.Count() > 0) ? QueryBuilder.buildSortingFilter(sort) : "";
            }
            where += QueryBuilder.GenerateWhereFilterIgnore(filter, where, field);

            paging = (limit.ToString().Length > 0 || pageNum.ToString().Length > 0) ? " " + QueryBuilder.buildPagingFilter(int.Parse(pageNum.ToString()), int.Parse(limit.ToString())) + " " : "";
            hasil += sorting + " ;" + paging + " | " + where + " ";
            return hasil;
        }
コード例 #7
0
ファイル: KendoHelper.cs プロジェクト: TonyNug/CGPSI
        public static string GenerateFiltersCustomTableIgnored(string take, string page, string skip, string pageSize, List<GridSort> sort, GridFilter filter, string ignored, string customField)
        {
            string hasil = string.Empty;
            //Dictionary<string, object> Filter = JsonConvert.DeserializeObject<Dictionary<string, object>>(input);
            // List<string> Filter = JsonConvert.DeserializeObject<List<string>>(input);
            string where = string.Empty;
            string paging = string.Empty;
            string sorting = string.Empty;

            int pageNum = (page.ToString().Length > 0) ? int.Parse(page) : 0;
            int limit = (take.ToString().Length > 0) ? int.Parse(take.ToString()) : 0;

            if (sort != null)
            {
                sorting = (sort.Count() > 0) ? QueryBuilder.buildSortingFilter(sort) : "";
            }
            where += QueryBuilder.GenerateWhereFilterCustomFieldIgnored(filter, where, ignored, customField);

            paging = (limit.ToString().Length > 0 || pageNum.ToString().Length > 0) ? " " + QueryBuilder.buildPagingFilter(int.Parse(pageNum.ToString()), int.Parse(limit.ToString())) + " " : "";
            hasil += sorting + " ;" + paging + " | " + where + " ";
            return hasil;
        }