protected void btFind_Click(object sender, EventArgs e)
        {
            DateTime? from = ctrlDatePickerRequestFrom.SelectedDate;
            DateTime? to = ctrlDatePickerRequestTo.SelectedDate;

            int orderId = 0;
            int.TryParse(txtOrderId.Text, out orderId);

            int custId = 0;
            int.TryParse(ctrlCustomerSelect.CustomerId, out custId);

            int productId = 0;
            int.TryParse(ddlProducts.SelectedValue, out productId);

            int manufactureId = 0;
            int.TryParse(ctrlManufactureSelect.CustomerId, out manufactureId);

            List<int> printingTypeIds = ctrlPrintingTypeSelect.SelectedValues;

            int manuRequestStatus = 0;
            int.TryParse(ddlManufactureStatus.SelectedValue, out manuRequestStatus);

            int businessManId = 0;
            int.TryParse(ddlBusinessMan.SelectedValue, out businessManId);

            int designerId = 0;
            int.TryParse(ddlDesigners.SelectedValue, out designerId);

            ManufactureRequestSearch manuSearchObj = new ManufactureRequestSearch() {
                From = from,
                To = to,
                OrderId = orderId,
                CustomerId = custId,
                ProductId = productId,
                ManufactureId = manufactureId,
                PrintTypeIds = printingTypeIds,
                ManufactureRequestStatus = (ManufactureRequestStatusEnum)manuRequestStatus,
                BusinessManId = businessManId,
                DesignerId = designerId
            };

            List<ManufactureRequestBO> manus = this.OrderService.GetManufactureRequests(manuSearchObj);
            grvManufactureRequest.DataSource = manus;
            grvManufactureRequest.DataBind();
        }
Exemple #2
0
 public List<ManufactureRequestBO> GetManufactureRequests(ManufactureRequestSearch manuSearchObj)
 {
     return orderDao.GetManufactureRequests(manuSearchObj);
 }
Exemple #3
0
        public List<ManufactureRequestBO> GetManufactureRequests(ManufactureRequestSearch manuSearchObj)
        {
            using (var context = new InThuDoEntities())
            {
                var query = from m in context.ManufactureRequests
                            join ds in context.DesignRequests on m.DesignRequestId equals ds.DesignRequestId
                            join oi in context.OrderItems on ds.OrderItemId equals oi.OrderItemId
                            join o in context.Orders on oi.OrderId equals o.OrderId
                            where
                            (m.Deleted == false || m.Deleted == null) &&
                            (ds.Deleted == false || ds.Deleted == null) &&
                            (oi.Deleted == false || oi.Deleted == null) &&
                            (o.Deleted == false || o.Deleted == null) &
                            (manuSearchObj.From == null || manuSearchObj.From <= m.CreatedOn) &&
                            (manuSearchObj.To == null || manuSearchObj.To >= m.CustomerApprovedDate || manuSearchObj.To >= m.EndDate || manuSearchObj.To >= m.BeginDate) &&
                            (manuSearchObj.CustomerId == 0 || manuSearchObj.CustomerId == o.CustomerId) &&
                            (manuSearchObj.ProductId == 0 || manuSearchObj.ProductId == oi.ProductId)&&
                            (manuSearchObj.DesignerId ==0 || manuSearchObj.DesignerId == ds.DesignerId)&&
                            (manuSearchObj.BusinessManId ==0 || manuSearchObj.BusinessManId == o.UserId)&&
                            (manuSearchObj.ManufactureId == 0 || manuSearchObj.ManufactureId == m.ManufactureId)&&
                            (manuSearchObj.PrintTypeIds.Count ==0 || manuSearchObj.PrintTypeIds.Contains(oi.PrintingTypeId))&&
                            (manuSearchObj.OrderId ==0 || manuSearchObj.OrderId == o.OrderId)
                            select m;

                List<ManufactureRequestBO> manuRequests = this.MapManufactureRequestList(query);
                if (manuSearchObj.ManufactureRequestStatus != 0)
                {
                    manuRequests = manuRequests.Where(m => m.ManufactureRequestStatus == manuSearchObj.ManufactureRequestStatus).ToList();
                }

                return manuRequests;
            }
        }