Ejemplo n.º 1
0
    public static object GetModels()
    {
        jQueryDataTableParamModel param = new jQueryDataTableParamModel();
        HttpContext Context             = HttpContext.Current;

        param.sEcho          = String.IsNullOrEmpty(Context.Request["sEcho"]) ? 0 : Convert.ToInt32(Context.Request["sEcho"]);
        param.sSearch        = String.IsNullOrEmpty(Context.Request["sSearch"]) ? "" : Context.Request["sSearch"];
        param.iDisplayStart += String.IsNullOrEmpty(Context.Request["iDisplayStart"]) ? 0 : Convert.ToInt32(Context.Request["iDisplayStart"]);
        param.iDisplayLength = String.IsNullOrEmpty(Context.Request["iDisplayLength"]) ? 0 : Convert.ToInt32(Context.Request["iDisplayLength"]);
        var sortColumnIndex = Convert.ToInt32(Context.Request["iSortCol_0"]);
        var sortDirection   = Context.Request["sSortDir_0"]; // asc or desc

        //var maker = Context.Request["maker"] ?? null;

        // create filter paramters
        string[,] _params = { { "DisplayStart", param.iDisplayStart.ToString() }, { "DisplayLength", param.iDisplayLength.ToString() },
                              { "SearchParam",  param.sSearch                  }, { "SortColumn",    sortColumnIndex.ToString()      },{ "SortDirection", sortDirection } };

        // get all of data.
        var _ds = new Select().SelectLists("CarsMaker_SelectList", _params);

        // inhance data to be list.
        var rows = DataUtilities.ConvertDTToJson(_ds.Tables[0]);

        var data = new
        {
            sEcho                = param.sEcho,
            iTotalRecords        = _ds.Tables[1].Rows[0][0],
            iTotalDisplayRecords = _ds.Tables[1].Rows[0][0],
            aaData               = rows //.ToList()
        };

        return(data);
    }
Ejemplo n.º 2
0
    public static object GetClintsPayments()
    {
        jQueryDataTableParamModel param = new jQueryDataTableParamModel();
        HttpContext Context             = HttpContext.Current;

        string clientIDFilter = String.IsNullOrEmpty(Context.Request["key"]) ? "" : Context.Request["key"],
               fieldID        = String.IsNullOrEmpty(Context.Request["kid"]) ? "ReceiptID" : Context.Request["kid"];

        // create filter paramters
        string[,] _params = { { "ClientIDFilter", clientIDFilter }, { "FieldID", fieldID } };


        // get all of data from db.
        var _ds = new Select().SelectLists("ClientsPayments_Search", _params);

        // get result of (DataTable) as json.
        var rows = DataUtilities.ConvertDTToJson(_ds.Tables[0]);

        var data = new
        {
            sEcho                = param.sEcho,
            iTotalRecords        = _ds.Tables[0].Rows.Count,
            iTotalDisplayRecords = _ds.Tables[0].Rows.Count,
            aaData               = rows
        };

        return(data);
    }
Ejemplo n.º 3
0
    public static object LoadData()
    {
        jQueryDataTableParamModel param = new jQueryDataTableParamModel();
        HttpContext Context             = HttpContext.Current;

        param.sEcho          = String.IsNullOrEmpty(Context.Request["sEcho"]) ? 0 : Convert.ToInt32(Context.Request["sEcho"]);
        param.sSearch        = String.IsNullOrEmpty(Context.Request["sSearch"]) ? "" : Context.Request["sSearch"];
        param.iDisplayStart += String.IsNullOrEmpty(Context.Request["iDisplayStart"]) ? 0 : Convert.ToInt32(Context.Request["iDisplayStart"]);
        param.iDisplayLength = String.IsNullOrEmpty(Context.Request["iDisplayLength"]) ? 0 : Convert.ToInt32(Context.Request["iDisplayLength"]);
        var sortColumnIndex = Convert.ToInt32(Context.Request["iSortCol_0"]);
        var sortDirection   = Context.Request["sSortDir_0"];// asc or desc

        // get dynamic more paramters from user
        var addtionalParamtersNam = Context.Request["names"].Split('~') ?? null;
        var addtionalParamtersVal = Context.Request["values"].Split('~') ?? null;

        // prepare all paramters in two arrays
        string[] prmNme = new string[5 + (addtionalParamtersNam != null ? addtionalParamtersNam.Length : 0)];
        string[] prmVal = new string[5 + (addtionalParamtersNam != null ? addtionalParamtersNam.Length : 0)];

        // set default paramters value
        prmNme[0] = "DisplayStart"; prmNme[1] = "DisplayLength"; prmNme[2] = "SortColumn"; prmNme[3] = "SearchParam"; prmNme[4] = "SortDirection";
        prmVal[0] = param.iDisplayStart.ToString(); prmVal[1] = param.iDisplayLength.ToString(); prmVal[2] = sortColumnIndex.ToString(); prmVal[3] = param.sSearch; prmVal[4] = sortDirection;


        // add more dynamic paratmers and its value to my arrays
        for (int i = 0; i < addtionalParamtersNam.Length; i++)
        {
            int position = 5 + i;
            prmNme[position] = addtionalParamtersNam[i];
            prmVal[position] = string.IsNullOrEmpty(addtionalParamtersVal[i]) ? addtionalParamtersVal[i] : DBNull.Value.ToString();
        }

        // get all of data.
        var _ds = new Select().SelectLists(Context.Request["funName"], prmNme, prmVal);

        // inhance data to be list.
        var rows = DataUtilities.ConvertDTToJson(_ds.Tables[0]);

        var data = new
        {
            sEcho                = param.sEcho,
            iTotalRecords        = _ds.Tables[1].Rows[0][0],
            iTotalDisplayRecords = _ds.Tables[1].Rows[0][0],
            aaData               = rows
        };

        return(data);
    }
Ejemplo n.º 4
0
    public static object searchClientCars(string searchTerm, string pageSize, string pageNum, string clientId)
    {
        string[,] _params = { { "pageSize", pageSize }, { "key", searchTerm }, { "pageNum", pageNum }, { "ClientID", clientId } };

        var _ds = new Select().SelectLists("ClientCars_GetBySearch", _params);

        var rows = DataUtilities.ConvertDTToJson(_ds.Tables[0]);

        var data = new
        {
            Total   = _ds.Tables[1].Rows[0][0],
            Results = rows
        };

        return(data);
    }
Ejemplo n.º 5
0
    public static object LoadData()
    {
        jQueryDataTableParamModel param = new jQueryDataTableParamModel();
        HttpContext Context             = HttpContext.Current;

        param.sEcho          = String.IsNullOrEmpty(Context.Request["sEcho"]) ? 0 : Convert.ToInt32(Context.Request["sEcho"]);
        param.iDisplayStart += String.IsNullOrEmpty(Context.Request["iDisplayStart"]) ? 0 : Convert.ToInt32(Context.Request["iDisplayStart"]);
        param.iDisplayLength = String.IsNullOrEmpty(Context.Request["iDisplayLength"]) ? 0 : Convert.ToInt32(Context.Request["iDisplayLength"]);
        var sortColumnIndex = Convert.ToInt32(Context.Request["iSortCol_0"]);
        var sortDirection   = Context.Request["sSortDir_0"];// asc or desc

        var    customCoFilter = String.IsNullOrEmpty(Context.Request["Shipper"]) ? null : Context.Request["Shipper"];
        var    paid = String.IsNullOrEmpty(Context.Request["Paid"]) ? null : Context.Request["Paid"];
        var    container = String.IsNullOrEmpty(Context.Request["Container"]) ? null : Context.Request["Container"];
        string fromDate = null, toDate = null;

        fromDate = string.IsNullOrEmpty(Context.Request["From"]) ? null : Context.Request["From"];
        toDate   = string.IsNullOrEmpty(Context.Request["To"]) ? null : Context.Request["To"];

        // create filter paramters
        string[,] _params = { { "DisplayStart",  param.iDisplayStart.ToString()  },
                              { "DisplayLength", param.iDisplayLength.ToString() },
                              { "SortColumn",    sortColumnIndex.ToString()      },
                              { "SortDirection", sortDirection                   },
                              { "From",          fromDate                        }, { "To",   toDate },
                              { "CustomCo",      customCoFilter                  }, { "Paid", paid   },{ "ContainerNo", container } };

        // get all of data.
        var _ds = new Select().SelectLists("InvoicesCustoms_List", _params);

        // inhance data to be list.
        var rows = DataUtilities.ConvertDTToJson(_ds.Tables[0]);

        var data = new
        {
            sEcho                = param.sEcho,
            iTotalRecords        = _ds.Tables[1].Rows[0][0],
            iTotalDisplayRecords = _ds.Tables[1].Rows[0][0],
            aaData               = rows,
            TotalSum             = _ds.Tables[1].Rows[0][1],
            TotalSumDhs          = _ds.Tables[1].Rows[0][2]
        };

        return(data);
    }
Ejemplo n.º 6
0
    public static object GetCarsData()
    {
        jQueryDataTableParamModel param = new jQueryDataTableParamModel();
        HttpContext Context             = HttpContext.Current;

        param.sEcho          = String.IsNullOrEmpty(Context.Request["sEcho"]) ? 0 : Convert.ToInt32(Context.Request["sEcho"]);
        param.iDisplayStart += String.IsNullOrEmpty(Context.Request["iDisplayStart"]) ? 0 : Convert.ToInt32(Context.Request["iDisplayStart"]);
        param.iDisplayLength = String.IsNullOrEmpty(Context.Request["iDisplayLength"]) ? 0 : Convert.ToInt32(Context.Request["iDisplayLength"]);
        var    sortColumnIndex = Convert.ToInt32(Context.Request["iSortCol_0"]);
        string sortDirection   = Context.Request["sSortDir_0"], // asc or desc

        // custome search
               sKey  = Context.Request["searchKey"] ?? null,
               sType = Context.Request["searchType"] ?? null;

        // create filter paramters
        string[,] _params = { { "DisplayStart",  param.iDisplayStart.ToString()  },
                              { "DisplayLength", param.iDisplayLength.ToString() },
                              { "SortColumn",    sortColumnIndex.ToString()      },
                              { "SortDirection", sortDirection                   },
                              { "SearchType",    sType                           },{ "SearchKey", sKey } };

        // get all of data from db.
        var _ds = new Select().SelectLists("CarsData_SearchCarsList", _params);

        // get result of (DataTable) as json.
        var rows = DataUtilities.ConvertDTToJson(_ds.Tables[0]);

        var data = new
        {
            sEcho                = param.sEcho,
            iTotalRecords        = _ds.Tables[1].Rows[0][0],
            iTotalDisplayRecords = _ds.Tables[1].Rows[0][0],
            aaData               = rows
        };

        return(data);
    }
Ejemplo n.º 7
0
    public static object LoadData()
    {
        jQueryDataTableParamModel param = new jQueryDataTableParamModel();
        HttpContext Context             = HttpContext.Current;

        param.sEcho          = String.IsNullOrEmpty(Context.Request["sEcho"]) ? 0 : Convert.ToInt32(Context.Request["sEcho"]);
        param.sSearch        = String.IsNullOrEmpty(Context.Request["sSearch"]) ? "" : Context.Request["sSearch"];
        param.iDisplayStart += String.IsNullOrEmpty(Context.Request["iDisplayStart"]) ? 0 : Convert.ToInt32(Context.Request["iDisplayStart"]);
        param.iDisplayLength = String.IsNullOrEmpty(Context.Request["iDisplayLength"]) ? 0 : Convert.ToInt32(Context.Request["iDisplayLength"]);

        var    sortColumnIndex = Convert.ToInt32(Context.Request["iSortCol_0"]);
        string sortDirection = Context.Request["sSortDir_0"],// asc or desc
               chassisFilter = Context.Request["chassis"], shipper = Context.Request["shipper"],
               lateDays  = String.IsNullOrEmpty(Context.Request["lateDays"]) ? null : Context.Request["lateDays"],
               lateTitle = String.IsNullOrEmpty(Context.Request["title"]) ? null : Context.Request["title"];

        // create filter paramters
        string[,] _params = { { "DisplayStart", param.iDisplayStart.ToString() }, { "DisplayLength", param.iDisplayLength.ToString() },
                              { "SortColumn",   sortColumnIndex.ToString()     }, { "SortDirection", sortDirection                   },
                              { "Shipper",      shipper                        }, { "Chassis",       chassisFilter                   },{ "LateDays", lateDays }, { "LateTitle", lateTitle } };

        // get all of data.
        var _ds = new Select().SelectLists("CarsData_Search4Notes", _params);

        // inhance data to be list.
        var rows = DataUtilities.ConvertDTToJson(_ds.Tables[0]);

        var data = new
        {
            param.sEcho,
            iTotalRecords        = _ds.Tables[1].Rows[0][0],
            iTotalDisplayRecords = _ds.Tables[1].Rows[0][0],
            aaData = rows
        };

        return(data);
    }