public dynamic GetAllocateSupplierOrderList([FromBody] Newtonsoft.Json.Linq.JObject param)
        {
            DateTime          date                = System.DateTime.Now;
            dynamic           objresponse         = null;
            dynamic           lstResult           = new List <dynamic>();
            dynamic           lstResultAdd        = new List <dynamic>();
            List <dynamic>    lstFinalresult      = new List <dynamic>();
            dynamic           obj                 = param;
            int               productID           = obj.data.productID;
            DataSourceRequest request             = KendoDataSourceRequestUtil.Parse(param);
            var               SupplierOrderIDList = _repositoryWrapper.Supplierorder.FindByCondition(x => x.inactive == true).Select(x => x.supplierOrderID).ToList();

            for (int i = 0; i < SupplierOrderIDList.Count; i++)
            {
                string SupplierOrderID     = SupplierOrderIDList[i];
                var    SupplierOrderDetail = _repositoryWrapper.Supplierorder.GetAllocateOrderList(SupplierOrderID, param);
                var    productName         = _repositoryWrapper.Product.GetProductName(obj);
                foreach (var item in SupplierOrderDetail)
                {
                    int ProductID = item.ProductID;
                    // int CustomerID = item.CustomerID;
                    SupplierorderRepository.SupplierOrderDetailData result = new SupplierorderRepository.SupplierOrderDetailData();
                    result.SupplierOrderID = SupplierOrderID;
                    result.SupplierName    = item.SupplierName;
                    result.ArrivalDate     = item.arrivaldate;
                    result.ProductName     = _repositoryWrapper.Product.FindByCondition(x => x.productID == ProductID).Select(x => x.productName).FirstOrDefault();
                    // result.Status = item.status == 1 ? "New" : item.status == 2 ? "Pending" : "Delivered";
                    result.Shipment  = item.Shipment;
                    result.ProductID = item.ProductID;
                    // result.Week3 = item.Week3;
                    // result.Week4 = item.Week4;
                    result.Liter = item.Liter;
                    lstResult.Add(result);
                }
                lstResultAdd = _repositoryWrapper.Supplierorder.GetProductNameForSupplierOrder(productName, lstResult);
                if (lstResultAdd != null)
                {
                    lstFinalresult.Add(lstResultAdd);
                    lstResult = new List <dynamic>();
                }
            }
            //lstFinalresult=lstFinalresult.Where(x =>x.productID==productID).ToList();
            DataSourceResult list = lstFinalresult.ToDataSourceResult(request);

            if (list == null)
            {
                objresponse = new { data = "", dataFoundRowsCount = 0 };
            }
            else
            {
                objresponse = new { data = list.Data, total = list.Total }
            };

            return(objresponse);
        }
        public dynamic GetAllCustomerOrderList([FromBody] Newtonsoft.Json.Linq.JObject param)
        {
            dynamic           objresponse         = null;
            dynamic           lstResult           = new List <dynamic>();
            dynamic           lstResultAdd        = new List <dynamic>();
            List <dynamic>    lstFinalresult      = new List <dynamic>();
            dynamic           obj                 = param;
            int               productID           = obj.data.productID;
            DataSourceRequest request             = KendoDataSourceRequestUtil.Parse(param);
            var               CustomerOrderIDList = _repositoryWrapper.CustomerOrder.FindByCondition(x => x.inactive == true).Select(x => x.customerOrderID).ToList();

            for (int i = 0; i < CustomerOrderIDList.Count; i++)
            {
                string CustomerOrderID     = CustomerOrderIDList[i];
                var    CustomerOrderDetail = _repositoryWrapper.CustomerOrder.GetAllCustomerOrderList(CustomerOrderID, param);
                var    productName         = _repositoryWrapper.Product.GetProductName(obj);
                foreach (var item in CustomerOrderDetail)
                {
                    int ProductID  = item.ProductID;
                    int CustomerID = item.CustomerID;
                    CustomerOrderRepository.CustomerOrderDetailData result = new CustomerOrderRepository.CustomerOrderDetailData();
                    result.CustomerOrderID = CustomerOrderID;
                    result.OrderMonth      = item.ordermonth.ToString("MMMM yyyy");
                    result.CustomerName    = _repositoryWrapper.Customer.FindByCondition(x => x.customerID == CustomerID).Select(x => x.customername).FirstOrDefault();
                    result.ProductName     = _repositoryWrapper.Product.FindByCondition(x => x.productID == ProductID).Select(x => x.productName).FirstOrDefault();
                    result.Status          = item.status == 1 ? "New" : item.status == 2 ? "Pending" : "Delivered";
                    result.Week1           = item.Week1;
                    result.Week2           = item.Week2;
                    result.Week3           = item.Week3;
                    result.Week4           = item.Week4;
                    result.Total           = item.Total;
                    lstResult.Add(result);
                }
                lstResultAdd = _repositoryWrapper.CustomerOrder.GetProductNameForCustomerOrder(productName, lstResult);
                if (lstResultAdd != null)
                {
                    lstFinalresult.Add(lstResultAdd);
                    lstResult = new List <dynamic>();
                }
            }
            //lstFinalresult=lstFinalresult.Where(x =>x.productID==productID).ToList();
            DataSourceResult list = lstFinalresult.ToDataSourceResult(request);

            if (list == null)
            {
                objresponse = new { data = "", dataFoundRowsCount = 0 };
            }
            else
            {
                objresponse = new { data = list.Data, total = list.Total }
            };

            return(objresponse);
        }
        public dynamic GetGainLossData([FromBody] Newtonsoft.Json.Linq.JObject param)
        {
            dynamic           objresponse     = null;
            dynamic           obj             = param;
            List <dynamic>    mainQuery       = new List <dynamic>();
            string            SupplierOrderID = obj.data;
            DataSourceRequest request         = KendoDataSourceRequestUtil.Parse(param);
            var movement = _repositoryWrapper.MovementTransaction.GetMovementProductData(SupplierOrderID);

            mainQuery = _repositoryWrapper.CustomerAssign.GetGainLossData(param, movement);
            DataSourceResult list = mainQuery.ToDataSourceResult(request);

            if (mainQuery == null)
            {
                objresponse = new { data = "", dataFoundRowsCount = 0 };
            }
            else
            {
                objresponse = new { data = list.Data, total = list.Total };
            }
            return(objresponse);
        }