Пример #1
0
        private void PopulateDataGrid()
        {
            List <PackingList>       PackingLists    = new List <PackingList>();
            List <PackingListViewBO> lstPackingLists = new List <PackingListViewBO>();

            lstPackingLists = PackingListBO.GetPackingList(this.WeekEndDate);

            IEnumerable <IGrouping <int?, PackingListViewBO> > lst = lstPackingLists.GroupBy(m => m.CartonNo).ToList();

            foreach (IGrouping <int?, PackingListViewBO> objPackingList in lst)
            {
                PackingList objPackingListItem = new PackingList();
                objPackingListItem.CartonNo = objPackingList.Key.Value;

                foreach (PackingListViewBO item in objPackingList)
                {
                    objPackingListItem.ListPackingList.Add(item);
                }

                PackingLists.Add(objPackingListItem);
            }

            if (PackingLists.Any())
            {
                Source = PackingLists;

                this.rptPackingList.DataSource = PackingLists;
                this.rptPackingList.DataBind();

                litGrandTotal.Text = "Grand Total: " + grandTotal;
            }
            else
            {
                dvEmptyContent.Visible       = true;
                this.btnPrintLabels.Visible  = false;
                this.btnViewCartons.Visible  = false;
                this.btnStartPacking.Visible = false;
            }

            /* if (PackingLists.Where(m => m.CartonNo == 0).Count() > 0)
             * {
             *   this.btnPrintLabels.Visible = false;
             *   this.btnViewCartons.Visible = false;
             *   this.btnStartPacking.Visible = false;
             * }*/
        }
Пример #2
0
        protected void rptModes_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RepeaterItem item = e.Item;

            if (item.ItemIndex > -1 && item.DataItem is IGrouping <int, PackingListViewBO> )
            {
                List <PackingListViewBO> lstPackingListMode = ((IGrouping <int, PackingListViewBO>)item.DataItem).ToList();

                DataGrid dgPackingList = (DataGrid)item.FindControl("dgPackingList");
                //dgPackingList.Attributes.Add("uid", lstPackingListsGroup[0].ShipTo.ToString().Trim());

                Literal litShipmentMode = (Literal)item.FindControl("litShipmentMode");
                litShipmentMode.Text = lstPackingListMode[0].ShipmentMode;

                Repeater rptPackingList = (Repeater)item.FindControl("rptPackingList");

                List <PackingList> PackingLists = new List <PackingList>();
                IEnumerable <IGrouping <int?, PackingListViewBO> > lst = lstPackingListMode.GroupBy(m => m.CartonNo).ToList();

                foreach (IGrouping <int?, PackingListViewBO> objPackingList in lst)
                {
                    PackingList objPackingListItem = new PackingList();
                    objPackingListItem.CartonNo = objPackingList.Key.Value;

                    foreach (PackingListViewBO item1 in objPackingList)
                    {
                        objPackingListItem.ListPackingList.Add(item1);
                    }

                    PackingLists.Add(objPackingListItem);
                }

                if (lstPackingListMode.Count > 0)
                {
                    rptPackingList.DataSource = PackingLists;
                    rptPackingList.DataBind();

                    Source = PackingLists;
                }
            }
        }
Пример #3
0
        protected void rptPackingList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RepeaterItem item = e.Item;

            if (item.ItemIndex > -1 && item.DataItem is PackingList)
            {
                PackingList objPacking = (PackingList)item.DataItem;

                Literal litCartonNo = (Literal)item.FindControl("litCartonNo");
                litCartonNo.Text = "Carton #" + objPacking.CartonNo.ToString();

                HiddenField hdnCartonNo = (HiddenField)item.FindControl("hdnCartonNo");
                hdnCartonNo.Value = objPacking.CartonNo.ToString();

                HiddenField hdnPackingListID = (HiddenField)item.FindControl("hdnPackingListID");
                // hdnPackingListID.Value = objPacking.ListPackingList[0].PackingList.ToString();

                HiddenField hdnWeeklyID = (HiddenField)item.FindControl("hdnWeeklyID");
                hdnWeeklyID.Value = objPacking.ListPackingList[0].WeeklyProductionCapacity.ToString();

                LinkButton btnStartPackingCarton = (LinkButton)item.FindControl("btnStartPackingCarton");

                LinkButton btnAutoFill = (LinkButton)item.FindControl("btnAutoFill");


                Literal litTotal = (Literal)item.FindControl("litTotal");

                int cartonTotal       = 0;
                int cartonFilledTotal = 0;

                foreach (var s in objPacking.ListPackingList)
                {
                    //List<PackingListSizeQtyBO> lstPackListQtys = s.PackingListSizeQtysWhereThisIsPackingList.Where(m => m.Qty > 0).ToList();
                    //cartonTotal += lstPackListQtys.Select(m => m.Qty).Sum();

                    //List<PackingListCartonItemBO> lstPackListCartonItems = s.PackingListCartonItemsWhereThisIsPackingList.Where(m => m.Count > 0).ToList();
                    //cartonFilledTotal += lstPackListCartonItems.Select(m => m.Count).Sum();

                    cartonTotal       += s.PackingTotal.Value;
                    cartonFilledTotal += s.ScannedTotal.Value;

                    hdnPackingListID.Value = s.PackingList.ToString();
                }

                grandTotal += cartonTotal;

                if (cartonFilledTotal == 0)
                {
                    //start packing
                    btnStartPackingCarton.Text = "Start Packing";
                }
                else if (cartonTotal > cartonFilledTotal)
                {
                    //resume
                    btnStartPackingCarton.Text = "Resume Packing";
                }
                else if (cartonTotal == cartonFilledTotal)
                {
                    //finished
                    btnStartPackingCarton.Visible = false;
                    btnAutoFill.Visible           = false;
                }

                litTotal.Text = "Total " + cartonTotal.ToString();

                DataGrid dgPackingList = (DataGrid)item.FindControl("dgPackingList");
                dgPackingList.DataSource = objPacking.ListPackingList;
                dgPackingList.DataBind();
            }
        }