public ResultResponse<CustomerSummary> Get(CustomerSummarySearchRequest request)
        {
            var response = new ResultResponse<CustomerSummary>();
            try
            {
                using (var rwplDb = new RWPLLinqDataContext())
                {
                    var queryable = rwplDb.GetTable<CustomerSummary>()
                        .Where(x =>  x.CompanyName.Contains(request.CustomerName))
                        .OrderBy(x => x.CompanyName);

                    var skipRecord = ((request.PageNo > 0) ? (request.PageNo - 1) * request.PageSize : 0);

                    response.PageData = queryable.Skip(skipRecord).Take(request.PageSize).ToList();
                    response.TotalItem = queryable.Count();

                    if (response.TotalItem > 0)
                    {
                        var totalCustomer = queryable.Count();

                        response.ReportSummary = string.Format("Total Customer : {0}", totalCustomer);
                    }

                    response.IsSuccess = true;
                }
            }
            catch (Exception ex)
            {
                response.IsSuccess = false;
                response.Exception = ex;
            }

            return response;
        }
        public ResultResponse<ApplicationDataRequest> Get()
        {
            var response = new ResultResponse<ApplicationDataRequest>();
            try
            {
                using (var rwplDb = new RWPLLinqDataContext())
                {
                    var queryableItems = rwplDb.GetTable<ItemMaster>()
                        .Where(x => !x.IsDeleted)
                        .OrderBy(x => x.ItemName);

                    var queryableCustomers = rwplDb.GetTable<CustomerMaster>()
                        .Where(x => !x.IsDeleted)
                        .OrderBy(x => x.CustomerName);

                    var queryableReelNo = rwplDb.GetTable<InwardMaster>()
                        .Where(x => !x.IsDeleted)
                        .OrderBy(x => x.ReelNo);

                    response.Object = new ApplicationDataRequest()
                    {
                        Items = queryableItems.ToList(),
                        Customers = queryableCustomers.ToList(),
                        Stocks = queryableReelNo.ToList()
                    };

                    response.IsSuccess = true;
                }
            }
            catch (Exception ex)
            {
                response.IsSuccess = false;
                response.Exception = ex;
            }

            return response;
        }
        public ResultResponse<DispatchAnalysi> Get(DispatchAnalysiSearchRequest request)
        {
            var response = new ResultResponse<DispatchAnalysi>();
            try
            {
                using (var rwplDb = new RWPLLinqDataContext())
                {
                    var skipRecord = ((request.PageNo > 0) ? (request.PageNo - 1) * request.PageSize : 0);

                    var queryable = rwplDb.GetTable<DispatchAnalysi>()
                        .Where(x => x.Client.Contains(request.Client)
                                    && x.ItemCode.Contains(request.ItemCode)
                                    && x.ItemName.Contains(request.ItemName)
                        //&& (!request.IsSearchByDate ||
                        //    (dispatch.Date >= request.FromDate.Date && dispatch.Date <= request.ToDate.Date))
                        )
                        .OrderBy(x => (x.Year*100) + x.Month);

                    response.PageData = queryable.Skip(skipRecord)
                        .Take(request.PageSize)
                        .ToList();

                    response.TotalItem = queryable.Count();

                    if (response.TotalItem > 0)
                    {
                        var totalClient = queryable.Select(x => x.Client).Distinct().Count();
                        var totalQtyDispatch = queryable.Select(x => x.TotalDispatchQty).Sum();

                        response.ReportSummary =
                            string.Format("Total Client : {0}, Total dispatch Qty : {1}", totalClient, totalQtyDispatch);
                    }

                    response.IsSuccess = true;
                }
            }
            catch (Exception ex)
            {
                response.IsSuccess = false;
                response.Exception = ex;
            }
            return response;
        }