Пример #1
0
        public JqueryDataTablesPagedResults <AccountBillReportAC> GetAccountBillSearchReportList(JqueryDataWithExtraParameterAC param, long userId)
        {
            JqueryDataTablesPagedResults <AccountBillReportAC> _searchData = new JqueryDataTablesPagedResults <AccountBillReportAC>();
            int totalsize = 0;
            List <AccountBillReportAC> _searchDataList = new List <AccountBillReportAC>();

            try
            {
                int    skip             = (param.DataTablesParameters.Start / param.DataTablesParameters.Length) * param.DataTablesParameters.Length;
                int    take             = param.DataTablesParameters.Length;
                int?   sortColumnNumber = null;
                string sortType         = string.Empty;
                if (param.DataTablesParameters.Order.Length > 0)
                {
                    sortColumnNumber = param.DataTablesParameters.Order[0].Column;
                    sortType         = param.DataTablesParameters.Order[0].Dir.ToString();
                }

                SortedList sl = new SortedList();
                sl.Add("SkipRecord", skip);
                sl.Add("Length", take);
                sl.Add("SearchValue", param.DataTablesParameters.Search.Value);
                sl.Add("SMonth", param.Month);
                sl.Add("SYear", param.Year);

                sl.Add("ProviderId", param.ProviderId);
                sl.Add("UserId", param.UserId);
                sl.Add("BusinessUnitId", param.BusinessUnitId);
                sl.Add("CostCenterId", param.CostCenterId);

                DataSet ds = _objDalmysql.GetDataSet("usp_GetEmpBillListReportWithPagging", sl);
                if (ds != null)
                {
                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0] != null)
                    {
                        _searchDataList = _objDal.ConvertDataTableToGenericList <AccountBillReportAC>(ds.Tables[0]).ToList();
                    }
                    if (ds.Tables[1].Rows.Count > 0 && ds.Tables[1] != null)
                    {
                        totalsize = Convert.ToInt16(ds.Tables[1].Rows[0]["TotalSize"]);
                    }
                }
                return(new JqueryDataTablesPagedResults <AccountBillReportAC>
                {
                    Items = _searchDataList,
                    TotalSize = totalsize
                });
            }
            catch (Exception e)
            {
                return(null);
            }
        }
        public static async Task <JqueryDataTablesResult <T> > GetJqueryDataTablesResultAsync <T, TEntity>(JqueryDataTablesParameters @params, IQueryable <TEntity> query, IConfigurationProvider configurationProvider)
        {
            if (@params == null)
            {
                throw new ArgumentNullException($"{nameof(@params)} cannot be null!");
            }

            if (query == null)
            {
                throw new ArgumentNullException($"{nameof(query)} cannot be null!");
            }

            query = new SearchOptionsProcessor <T, TEntity>().Apply(query, @params.Columns);
            query = new SortOptionsProcessor <T, TEntity>().Apply(query, @params);

            var size = await query.CountAsync();

            if (@params.Length <= 0)
            {
                @params.Length = size;
            }

            var items = await query
                        .Skip((@params.Start / @params.Length) * @params.Length)
                        .Take(@params.Length)
                        .ProjectTo <T>(configurationProvider)
                        .ToArrayAsync();

            var results = new JqueryDataTablesPagedResults <T>
            {
                Items     = items,
                TotalSize = size
            };

            return(new JqueryDataTablesResult <T>
            {
                Draw = @params.Draw,
                Data = results.Items,
                RecordsFiltered = results.TotalSize,
                RecordsTotal = results.TotalSize
            });
        }
        public static async Task <JqueryDataTablesExcelResult <T> > GetJqueryDataTablesExcelResultAsync <T, TEntity>(JqueryDataTablesParameters @params, IQueryable <TEntity> query, IConfigurationProvider configurationProvider, bool convertAllData = false, string sheetName = "sheetName", string fileName = "fileName")
        {
            if (@params == null)
            {
                throw new ArgumentNullException($"{nameof(@params)} cannot be null!");
            }

            if (query == null)
            {
                throw new ArgumentNullException($"{nameof(query)} cannot be null!");
            }

            var results = new JqueryDataTablesPagedResults <T>();

            if (convertAllData)
            {
                var items = await query
                            .ProjectTo <T>(configurationProvider)
                            .ToArrayAsync();

                results.Items = items;
            }
            else
            {
                query = new SearchOptionsProcessor <T, TEntity>().Apply(query, @params.Columns);
                query = new SortOptionsProcessor <T, TEntity>().Apply(query, @params);

                var items = await query
                            .Skip((@params.Start / @params.Length) * @params.Length)
                            .Take(@params.Length)
                            .ProjectTo <T>(configurationProvider)
                            .ToArrayAsync();

                results.Items = items;
            }

            return(new JqueryDataTablesExcelResult <T>(results.Items, sheetName, fileName));
        }
Пример #4
0
        public JqueryDataTablesPagedResults <MemoReportListAC> GetAccountMemoReport(JqueryDataWithExtraParameterAC param)
        {
            JqueryDataTablesPagedResults <MemoReportListAC> _searchData = new JqueryDataTablesPagedResults <MemoReportListAC>();
            int totalsize = 0;
            List <MemoReportListAC> _searchDataList = new List <MemoReportListAC>();

            int skip = (param.DataTablesParameters.Start / param.DataTablesParameters.Length) * param.DataTablesParameters.Length;
            int take = param.DataTablesParameters.Length;

            SortedList sl = new SortedList();

            sl.Add("SkipRecord", skip);
            sl.Add("Length", take);
            sl.Add("SearchValue", param.DataTablesParameters.Search.Value);
            sl.Add("SMonth", param.Month);
            sl.Add("SYear", param.Year);
            sl.Add("ProviderId", param.ProviderId);

            DataSet ds = _objDalmysql.GetDataSet("usp_GetMemoListReportWithPagging", sl);

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0] != null)
                {
                    _searchDataList = _objDal.ConvertDataTableToGenericList <MemoReportListAC>(ds.Tables[0]).ToList();
                }
                if (ds.Tables[1].Rows.Count > 0 && ds.Tables[1] != null)
                {
                    totalsize = Convert.ToInt16(ds.Tables[1].Rows[0]["TotalSize"]);
                }
            }

            return(new JqueryDataTablesPagedResults <MemoReportListAC>
            {
                Items = _searchDataList,
                TotalSize = totalsize
            });
        }
        public async Task <IActionResult> LoadTable([FromBody] JqueryDataTablesParameters param)
        {
            try
            {
                HttpContext.Session.SetString(nameof(JqueryDataTablesParameters), JsonSerializer.Serialize(param));
                List <Order_MasterViewModel> list = new List <Order_MasterViewModel>();

                IQueryable <Invoice> query = _dbContext.tbl_Invoice.FromSqlRaw("select custNum  ,invoiceNum  , cast( releaseDate as char)   releaseDate,freight  ,salesManNum  ,salesManNum2  ,billName  ,billAddress1 ,billAddress2 ,billAddress3 ,shipName ,shipAddress1,shipAddress2,shipAddress3,termId  ,carrierCode  ,d2  ,poNum  , cast( orderDate as char) orderDate, cast( shipDate as char) shipDate,  CAST( cancelDate AS CHAR) cancelDate,cast( enterDate as char) enterDate,terminal  ,custNote ,clerk  ,netTotal  ,commision ,d4  ,d6  ,storeNum  ,dept  ,orderType  ,bolNum  ,cast( bolDate as char) bolDate ,tracking1  ,tracking2 ,orderNum  ,cast( invoiceDate as char) invoiceDate  ,isCreditMemo  ,isCreditHold  ,isFreightCollect from  v_Invoice").AsNoTracking();

                query = SearchOptionsProcessor <InvoiceViewModel, Invoice> .Apply(query, param.Columns);

                query = SortOptionsProcessor <InvoiceViewModel, Invoice> .Apply(query, param);

                var size = await query.CountAsync();

                var InvoiceNum = "";
                var OrderNum   = "";
                var BillName   = "";

                var i = 0;
                foreach (var column in param.AdditionalValues)
                {
                    if (i == 0)
                    {
                        InvoiceNum = column;
                    }
                    else if (i == 1)
                    {
                        OrderNum = column;
                    }
                    else
                    {
                        BillName = column;
                    }
                    i++;
                }

                if (InvoiceNum != "" || OrderNum != "" || BillName != "")
                {
                    query = query.Where(w =>
                                        ((InvoiceNum == "" ? true : w.InvoiceNum.Contains(InvoiceNum))) &&
                                        ((OrderNum == "" ? true : w.InvoiceNum.Contains(OrderNum))) &&
                                        ((BillName == "" ? true : w.BillName.Contains(BillName))));
                }


                foreach (var column in param.Columns)
                {
                    if (column.Data == "InvoiceNum")
                    {
                        column.Searchable   = true;
                        column.Search.Value = InvoiceNum;
                    }
                    if (column.Data == "OrderNum")
                    {
                        column.Searchable   = true;
                        column.Search.Value = OrderNum;
                    }
                    if (column.Data == "BillName")
                    {
                        column.Searchable   = true;
                        column.Search.Value = BillName;
                    }
                }
                var items = await query
                            .AsNoTracking()
                            .Skip((param.Start / param.Length) * param.Length)
                            .Take(param.Length)
                            .ProjectTo <InvoiceViewModel>(_mappingConfiguration)
                            .ToArrayAsync();


                var result = new JqueryDataTablesPagedResults <InvoiceViewModel>
                {
                    Items     = items,
                    TotalSize = size
                };

                return(new JsonResult(new JqueryDataTablesResult <InvoiceViewModel>
                {
                    Draw = param.Draw,
                    Data = result.Items,
                    RecordsFiltered = result.TotalSize,
                    RecordsTotal = result.TotalSize
                }));
            }
            catch (Exception e)
            {
                Console.Write(e.Message);
                return(new JsonResult(new { error = "Internal Server Error" }));
            }
        }
        public async Task <IActionResult> LoadTable([FromBody] JqueryDataTablesParameters param)
        {
            try
            {
                HttpContext.Session.SetString(nameof(JqueryDataTablesParameters), JsonSerializer.Serialize(param));
                IQueryable <EmployeeViewModel_datatable> employees;
                string            queryDef = "call get_careGiverList()";
                DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                CommanUtility     _commanUtility = new CommanUtility(_appSettings);
                DateTime          startDate = new DateTime(); DateTime endDate = new DateTime(); int i = 0; bool isDateFilter = false;
                DataSet           ds = new DataSet();

                foreach (var column in param.AdditionalValues)
                {
                    if (Convert.ToString(column) != "")
                    {
                        isDateFilter = true;
                        var dateParts = column.Split("/");

                        // var date = dateParts[1] + "/" + dateParts[0] + "/" + dateParts[2];
                        if (i == 0)
                        {
                            DateTime.TryParse(column, out startDate);
                        }
                        else if (i == 1)
                        {
                            DateTime.TryParse(column, out endDate);
                        }
                    }
                    i++;
                }

                if (isDateFilter == false)
                {
                    ds = dbfunction.GetDataset(@"call get_careGiverList()");
                }
                else
                {
                    ds = dbfunction.GetDataset(@"call get_careGiverListByDate('" + startDate.ToString("yyyy/MM/dd") + "','" + endDate.ToString("yyyy/MM/dd") + "') ");
                }

                employees = (from row in ds.Tables[0].AsEnumerable()
                             select new EmployeeViewModel_datatable
                {
                    EmployeeId = Convert.ToInt32(row["Id"]),
                    FirstName = Convert.ToString(row["FirstName"]),
                    MiddleName = Convert.ToString(row["MiddleName"]),
                    LastName = Convert.ToString(row["LastName"]),
                    Email = Convert.ToString(row["Email"]),
                    EmployeeNo = Convert.ToString(row["EmployeeNo"]),
                    UserId = Convert.ToInt32(row["UserId"]),
                    HrGroupName = Convert.ToString(row["HrGroup"]),
                    HrGroupId = Convert.ToInt32(row["HrGroupId"]),
                    PassedTest = Convert.ToInt32(row["PassedTest"]),
                    Totaltest = Convert.ToInt32(row["total_tests_1"]),
                    VideoDuration = Convert.ToString(row["VideoDuration"]) == "" ? (Decimal?)null : Convert.ToDecimal(row["VideoDuration"]),
                    ExamDate = Convert.ToString(row["ExamDate"]) == "" ? (DateTime?)null : Convert.ToDateTime(row["ExamDate"]),
                    ValidEmail = _commanUtility.CheckValidEmail(Convert.ToString(row["Email"]))
                }).AsQueryable();

                if (_rolename.ToLower() == "hr")
                {
                    employees = employees.Where(w => _HrGroupId.Contains("/" + w.HrGroupId.ToString() + "/")).AsQueryable();
                }


                employees = SearchOptionsProcessor <EmployeeViewModel_datatable, EmployeeViewModel_datatable> .Apply(employees, param.Columns);

                employees = SortOptionsProcessor <EmployeeViewModel_datatable, EmployeeViewModel_datatable> .Apply(employees, param);

                var size = employees.Count();


                if (Convert.ToString(param.Search?.Value) != "")
                {
                    var serchValue = param.Search?.Value.ToLower();
                    employees = employees.Where(w =>
                                                (w.FirstName.ToLower().Contains(serchValue) ? true :
                                                 (w.MiddleName.ToLower().Contains(serchValue) ? true :
                                                  ((w.LastName.ToLower().Contains(serchValue) ? true :
                                                    ((w.EmployeeNo.ToLower().Contains(serchValue) ? true :
                                                      ((w.Email.ToLower().Contains(serchValue) ? true :
                                                        ((w.HrGroupName.ToLower().Contains(serchValue) ? true : false))))))))
                                                 )));
                }

                var items = employees
                            .Skip((param.Start / param.Length) * param.Length)
                            .Take(param.Length)
                            .ProjectTo <EmployeeViewModel_datatable>(_mappingConfiguration)
                            .ToArray();


                var result = new JqueryDataTablesPagedResults <EmployeeViewModel_datatable>
                {
                    Items     = items,
                    TotalSize = size
                };

                return(new JsonResult(new JqueryDataTablesResult <EmployeeViewModel_datatable>
                {
                    Draw = param.Draw,
                    Data = result.Items,
                    RecordsFiltered = result.TotalSize,
                    RecordsTotal = result.TotalSize
                }));
            }
            catch (Exception e)
            {
                Console.Write(e.Message);
                return(new JsonResult(new { error = "Internal Server Error" }));
            }
        }
        public async Task <IActionResult> LoadTable([FromBody] JqueryDataTablesParameters param)
        {
            try
            {
                HttpContext.Session.SetString(nameof(JqueryDataTablesParameters), JsonSerializer.Serialize(param));
                List <Order_MasterViewModel> list = new List <Order_MasterViewModel>();

                var    showAll  = param.AdditionalValues.Last();
                string queryDef = "";
                if (showAll == "true")
                {
                    queryDef = @"SELECT Custnum,orders.ordernum,Orderdate,Credit,Freight, Slnum, Slnum2, D0, NAME, Address1, Address2, Address3, Shipname, Shipaddress1, Shipaddress2, Shipaddress3, Terms, Via,
                                                                              Backorder,Tax,Terminal, Ponum,Shippeddate, Shipdate, Canceldate, Edidate, Custnote, clerk, Poammount, Commission, STATUS, D1, D2, Creditmemo, Storenum,
                                                                              Dept, Ordertype, WeborderId, IsOpenOrder, NoteCount,'a' AS ACTION  FROM orders LEFT JOIN (SELECT Ordernum,COUNT(*)NoteCount,YEAR FROM ordernotes
                                                                              GROUP BY Ordernum,YEAR  ) a ON  (SUBSTRING((orders.Ordernum ),1,6)= a.Ordernum AND  SUBSTRING((orders.Ordernum ),8,2)= a.Year)
                                                                           ";
                }
                else
                {
                    queryDef = @"SELECT Custnum,orders.ordernum,Orderdate,Credit,Freight, Slnum, Slnum2, D0, NAME, Address1, Address2, Address3, Shipname, Shipaddress1, Shipaddress2, Shipaddress3, Terms, Via,
                                                                              Backorder,Tax,Terminal, Ponum,Shippeddate, Shipdate, Canceldate, Edidate, Custnote, clerk, Poammount, Commission, STATUS, D1, D2, Creditmemo, Storenum,
                                                                              Dept, Ordertype, WeborderId, IsOpenOrder, NoteCount,'a' AS ACTION  FROM orders LEFT JOIN (SELECT Ordernum,COUNT(*)NoteCount,YEAR FROM ordernotes
                                                                              GROUP BY Ordernum,YEAR  ) a ON  (SUBSTRING((orders.Ordernum ),1,6)= a.Ordernum AND  SUBSTRING((orders.Ordernum ),8,2)= a.Year)
                                                                              WHERE IsOpenOrder =1                                                                          
                                                                            ";
                }


                IQueryable <Order> query = _dbContext.tbl_Orders.FromSqlRaw(queryDef).AsNoTracking();


                query = SearchOptionsProcessor <Order_MasterViewModel, Order> .Apply(query, param.Columns);

                query = SortOptionsProcessor <Order_MasterViewModel, Order> .Apply(query, param);

                var size = await query.CountAsync();

                var      orderNum         = "";
                var      custnumOrName    = "";
                var      Shipdate         = "";
                DateTime ShipDateD        = DateTime.Now;
                var      i                = 0;
                var      additionalValues = param.AdditionalValues.SkipLast(1);
                foreach (var column in additionalValues)
                {
                    if (i == 0)
                    {
                        orderNum = column;
                    }
                    else if (i == 1)
                    {
                        custnumOrName = column;
                    }
                    else
                    {
                        Shipdate = column;
                        if (Convert.ToString(Shipdate) == "1/1/0001 12:00:00 AM")
                        {
                            Shipdate = "";
                        }
                        if (Shipdate != "")
                        {
                            DateTime.TryParse(Shipdate, out ShipDateD);
                        }
                    }
                    i++;
                }

                if (orderNum != "" || custnumOrName != "" || Shipdate != "")
                {
                    query = query.Where(w =>
                                        ((orderNum == "" ? true : w.ordernum.Contains(orderNum))) &&
                                        ((custnumOrName == "" ? true : (w.Custnum.Contains(custnumOrName) ? true : (w.Name.Contains(custnumOrName))))) &&
                                        ((Shipdate == "" ? true : w.Shipdate == ShipDateD)));
                }


                foreach (var column in param.Columns)
                {
                    if (column.Data == "ordernum")
                    {
                        column.Searchable   = true;
                        column.Search.Value = orderNum;
                    }
                    if (column.Data == "Shipdate")
                    {
                        column.Searchable   = true;
                        column.Search.Value = orderNum;
                    }
                    if (column.Data == "Shipdate")
                    {
                        column.Searchable   = true;
                        column.Search.Value = orderNum;
                    }
                }



                var items = query
                            //.AsNoTracking()
                            .Skip((param.Start / param.Length) * param.Length)
                            .Take(param.Length)
                            .ProjectTo <Order_MasterViewModel>(_mappingConfiguration)
                            .ToArray();


                var result = new JqueryDataTablesPagedResults <Order_MasterViewModel>
                {
                    Items     = items,
                    TotalSize = size
                };

                return(new JsonResult(new JqueryDataTablesResult <Order_MasterViewModel>
                {
                    Draw = param.Draw,
                    Data = result.Items,
                    RecordsFiltered = result.TotalSize,
                    RecordsTotal = result.TotalSize
                }));
            }
            catch (Exception e)
            {
                Console.Write(e.Message);
                return(new JsonResult(new { error = "Internal Server Error" }));
            }
        }
        public async Task <IActionResult> LoadTable([FromBody] JqueryDataTablesParameters param)
        {
            try
            {
                //return new JsonResult(new { error = "Internal Server Error" });

                HttpContext.Session.SetString(nameof(JqueryDataTablesParameters), System.Text.Json.JsonSerializer.Serialize(param));

                DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                DataSet           ds         = dbfunction.GetDataset(@"select indSell_Compo.*,itemmaster.Description as Item_master,itemcomponent.Description as Item_component
                                                    from indSell_Compo 
                                                    left join items as itemmaster on trim(indSell_ItemMaster) = itemmaster.Itemnum
                                                    left join items as itemcomponent on trim(indSell_Compo.indSell_ItemComponent) = itemcomponent.Itemnum");

                IQueryable <IndsellCompoViewModel> itemComponentList = (from row in ds.Tables[0].AsEnumerable()
                                                                        select new IndsellCompoViewModel
                {
                    indSell_ItemMaster = Convert.ToString(row["indSell_ItemMaster"]),
                    indSell_ItemComponent = Convert.ToString(row["indSell_ItemComponent"]),
                    indSell_Allowed = Convert.ToInt16(row["indSell_Allowed"]),
                    Item_master = Convert.ToString(row["Item_master"]),
                    Item_component = Convert.ToString(row["Item_component"]),
                }).AsQueryable();


                var size = itemComponentList.Count();


                if (Convert.ToString(param.AdditionalValues.FirstOrDefault()) != "")
                {
                    var serchValue = Convert.ToString(param.AdditionalValues.FirstOrDefault()).ToLower();
                    itemComponentList = itemComponentList.Where(w =>
                                                                ((w.indSell_ItemMaster ?? "").ToLower().Contains(serchValue) ? true :
                                                                 ((w.indSell_ItemComponent ?? "").ToLower().Contains(serchValue) ? true :
                                                                  (w.indSell_Allowed).ToString().ToLower().Contains(serchValue) ? true :
                                                                  (w.Item_master).ToString().ToLower().Contains(serchValue) ? true :
                                                                  (w.Item_component).ToString().ToLower().Contains(serchValue) ? true : false)));
                }


                if (param.Length == -1)
                {
                    var items = itemComponentList
                                .ProjectTo <IndsellCompoViewModel_Datatable>(_mappingConfiguration)
                                .ToArray();


                    var result = new JqueryDataTablesPagedResults <IndsellCompoViewModel_Datatable>
                    {
                        Items     = items,
                        TotalSize = size
                    };

                    return(new JsonResult(new JqueryDataTablesResult <IndsellCompoViewModel_Datatable>
                    {
                        Draw = param.Draw,
                        Data = result.Items,
                        RecordsFiltered = result.TotalSize,
                        RecordsTotal = result.TotalSize
                    }));
                }
                else
                {
                    var items = itemComponentList
                                .Skip((param.Start / param.Length) * param.Length)
                                .Take(param.Length)
                                .ProjectTo <IndsellCompoViewModel_Datatable>(_mappingConfiguration)
                                .ToArray();


                    var result = new JqueryDataTablesPagedResults <IndsellCompoViewModel_Datatable>
                    {
                        Items     = items,
                        TotalSize = size
                    };

                    return(new JsonResult(new JqueryDataTablesResult <IndsellCompoViewModel_Datatable>
                    {
                        Draw = param.Draw,
                        Data = result.Items,
                        RecordsFiltered = result.TotalSize,
                        RecordsTotal = result.TotalSize
                    }));
                }
            }
            catch (Exception e)
            {
                Console.Write(e.Message);
                return(new JsonResult(new { error = "Internal Server Error" }));
            }
        }
Пример #9
0
        public JqueryDataTablesPagedResults <UserConsumptionReportAC> GetUserConsumptionSearchReportList(JqueryDataWithExtraParameterAC param, long userId)
        {
            JqueryDataTablesPagedResults <OperatorLogReportAC> _searchData = new JqueryDataTablesPagedResults <OperatorLogReportAC>();
            int totalsize = 0;
            List <UserConsumptionReportAC> _searchDataList = new List <UserConsumptionReportAC>();

            try
            {
                int    skip             = (param.DataTablesParameters.Start / param.DataTablesParameters.Length) * param.DataTablesParameters.Length;
                int    take             = param.DataTablesParameters.Length;
                int?   sortColumnNumber = null;
                string sortType         = string.Empty;
                if (param.DataTablesParameters.Order.Length > 0)
                {
                    sortColumnNumber = param.DataTablesParameters.Order[0].Column;
                    sortType         = param.DataTablesParameters.Order[0].Dir.ToString();
                }

                if (param.Month > 0 && param.Year > 0)
                {
                    SortedList sl = new SortedList();
                    sl.Add("SkipRecord", skip);
                    sl.Add("Length", take);
                    sl.Add("SearchValue", param.DataTablesParameters.Search.Value);

                    sl.Add("SMonth", param.Month);
                    sl.Add("SYear", param.Year);
                    sl.Add("ProviderId", param.ProviderId);
                    sl.Add("BillStatusId", param.StatusId); // pass 5 if close bill else open bill


                    DataSet ds = _objDalmysql.GetDataSet("usp_GetUserConsumptionReportWithPagging", sl);
                    if (ds != null)
                    {
                        if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0] != null)
                        {
                            _searchDataList = _objDal.ConvertDataTableToGenericList <UserConsumptionReportAC>(ds.Tables[0]).ToList();
                        }
                        if (ds.Tables[1].Rows.Count > 0 && ds.Tables[1] != null)
                        {
                            totalsize = Convert.ToInt16(ds.Tables[1].Rows[0]["TotalSize"]);
                        }
                    }



                    return(new JqueryDataTablesPagedResults <UserConsumptionReportAC>
                    {
                        Items = _searchDataList,
                        TotalSize = totalsize
                    });
                }
                else
                {
                    return(new JqueryDataTablesPagedResults <UserConsumptionReportAC>
                    {
                        Items = new List <UserConsumptionReportAC>(),
                        TotalSize = 0
                    });
                }
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Пример #10
0
        public JqueryDataTablesPagedResults <OperatorLogReportAC> GetOperatorCallLogSearchReportList(JqueryDataWithExtraParameterAC param, long userId)
        {
            JqueryDataTablesPagedResults <OperatorLogReportAC> _searchData = new JqueryDataTablesPagedResults <OperatorLogReportAC>();
            int totalsize = 0;
            List <OperatorLogReportAC> _searchDataList = new List <OperatorLogReportAC>();

            try
            {
                int    skip             = (param.DataTablesParameters.Start / param.DataTablesParameters.Length) * param.DataTablesParameters.Length;
                int    take             = param.DataTablesParameters.Length;
                int?   sortColumnNumber = null;
                string sortType         = string.Empty;
                if (param.DataTablesParameters.Order.Length > 0)
                {
                    sortColumnNumber = param.DataTablesParameters.Order[0].Column;
                    sortType         = param.DataTablesParameters.Order[0].Dir.ToString();
                }

                SortedList sl = new SortedList();
                sl.Add("SkipRecord", skip);
                sl.Add("Length", take);
                sl.Add("SearchValue", param.DataTablesParameters.Search.Value);

                sl.Add("SMonth", param.Month);
                sl.Add("SYear", param.Year);
                sl.Add("EmployeeName", param.EmployeeName);

                if (param.start != null)
                {
                    DateTime StartDate = new DateTime();
                    StartDate = param.start ?? System.DateTime.Now;
                    DateTime newStartDate = StartDate.AddDays(1);
                    int      dateFrom     = Convert.ToInt32(newStartDate.ToString("yyyyMMdd"));
                    sl.Add("DateFrom", dateFrom);
                }
                else
                {
                    sl.Add("DateFrom", 0);
                }

                if (param.end != null)
                {
                    DateTime EndDate = new DateTime();
                    EndDate = param.end ?? System.DateTime.Now;
                    DateTime newEndDate = EndDate.AddDays(1);
                    int      Dateto     = Convert.ToInt32(newEndDate.ToString("yyyyMMdd"));
                    sl.Add("DateTo", Dateto);
                }
                else
                {
                    sl.Add("DateTo", 0);
                }

                DataSet ds = _objDalmysql.GetDataSet("usp_GetCallLogReportWithPagging", sl);
                if (ds != null)
                {
                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0] != null)
                    {
                        _searchDataList = _objDal.ConvertDataTableToGenericList <OperatorLogReportAC>(ds.Tables[0]).ToList();
                    }
                    if (ds.Tables[1].Rows.Count > 0 && ds.Tables[1] != null)
                    {
                        totalsize = Convert.ToInt16(ds.Tables[1].Rows[0]["TotalSize"]);
                    }
                }



                return(new JqueryDataTablesPagedResults <OperatorLogReportAC>
                {
                    Items = _searchDataList,
                    TotalSize = totalsize
                });
            }
            catch (Exception e)
            {
                return(null);
            }
        }