Exemplo n.º 1
0
        public DataTable getData(DateTime date)
        {
            GatewayOutboundBL gatewayOutboundBl = new GatewayOutboundBL();
            GatewayInboundBL  gatewayInboundBl  = new GatewayInboundBL();

            List <GatewayOutbound> Outboundlist = gatewayOutboundBl.GetAll().Where(x => x.RecordStatus == 1 && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).GroupBy(x => x.Cargo).Select(y => y.First()).ToList();
            List <GatewayInbound>  Inboundlist  = gatewayInboundBl.GetAll().GroupBy(x => x.Cargo).Select(y => y.First()).ToList();

            List <GatewayOutboundViewModel> modelList = Match(Inboundlist, Outboundlist);

            //modelList.GroupBy(x => x.AirwayBillNo).ToList();

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("No", typeof(string)));
            dt.Columns.Add(new DataColumn("Gateway", typeof(string)));
            dt.Columns.Add(new DataColumn("Driver", typeof(string)));
            dt.Columns.Add(new DataColumn("Plate #", typeof(string)));
            dt.Columns.Add(new DataColumn("Batch", typeof(string)));

            dt.Columns.Add(new DataColumn("AWB", typeof(string)));

            dt.Columns.Add(new DataColumn("Recieved(Qty)", typeof(string)));
            dt.Columns.Add(new DataColumn("Discrepancy(Qty)", typeof(string)));
            dt.Columns.Add(new DataColumn("Total Qty", typeof(string)));

            dt.Columns.Add(new DataColumn("CreatedDate", typeof(string)));
            dt.Columns.Add(new DataColumn("Branch", typeof(string)));

            dt.Columns.Add(new DataColumn("ScannedBy", typeof(string)));

            dt.BeginLoadData();

            int ctr = 1;

            foreach (GatewayOutboundViewModel item in modelList)
            {
                DataRow row = dt.NewRow();
                row[0]  = (ctr++).ToString();
                row[1]  = item.Gateway.ToString();
                row[2]  = item.Driver.ToString();
                row[3]  = item.PlateNo.ToString();
                row[4]  = item.Batch;
                row[5]  = item.AirwayBillNo.ToString();
                row[6]  = item.TotalRecieved.ToString();
                row[7]  = item.TotalDiscrepency.ToString();
                row[8]  = item.Total.ToString();
                row[9]  = item.CreatedDate.ToShortDateString();
                row[10] = item.Branch;
                row[11] = item.ScannedBy;
                dt.Rows.Add(row);
            }
            dt.EndLoadData();

            return(dt);
        }
        public DataTable getData(DateTime date)
        {
            GatewayInboundBL gatewayInboundBl = new GatewayInboundBL();
            //List<GatewayInbound> list = list = gatewayInboundBl.GetAll().Where(x => x.BranchCorpOffice.BranchCorpOfficeId == GlobalVars.DeviceBcoId && x.RecordStatus == 1 && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).ToList();
            List <GatewayInbound> list = list = gatewayInboundBl.GetAll().Where(x => x.RecordStatus == 1 && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).ToList();

            List <GatewayInboundViewModel> modelList = Match(list);

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("No", typeof(string)));
            dt.Columns.Add(new DataColumn("Gateway", typeof(string)));
            dt.Columns.Add(new DataColumn("Origin", typeof(string)));
            dt.Columns.Add(new DataColumn("Pieces", typeof(string)));
            dt.Columns.Add(new DataColumn("MAWB", typeof(string)));
            dt.Columns.Add(new DataColumn("Flight #", typeof(string)));
            dt.Columns.Add(new DataColumn("Commodity Type", typeof(string)));
            dt.Columns.Add(new DataColumn("AWB", typeof(string)));
            dt.Columns.Add(new DataColumn("CreatedDate", typeof(string)));

            dt.Columns.Add(new DataColumn("ScannedBy", typeof(string)));
            dt.BeginLoadData();
            int ctr = 1;

            foreach (GatewayInboundViewModel item in modelList)
            {
                DataRow row = dt.NewRow();
                row[0] = (ctr++).ToString();
                row[1] = item.Gateway;
                row[2] = item.Origin;
                row[3] = item.Pieces;
                row[4] = item.MAWB;
                row[5] = item.FlightNo;
                row[6] = item.CommodityType;
                row[7] = item.AirwayBillNo;
                row[8] = item.CreatedDate.ToShortDateString();
                row[9] = item.ScannedBy;
                dt.Rows.Add(row);
            }
            dt.EndLoadData();

            return(dt);
        }
        public DataTable getDatabyFilter(DateTime date, string gatewayName, Guid?bcoid, Guid?commodityTypeId, string flightNumber, string mawb, int num)
        {
            GatewayInboundBL gatewayInboundBl = new GatewayInboundBL();
            //List<GatewayInbound> list = list = gatewayInboundBl.GetAll().Where(x => x.BranchCorpOffice.BranchCorpOfficeId == GlobalVars.DeviceBcoId && x.RecordStatus == 1 && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).ToList();
            List <GatewayInbound> list = new List <GatewayInbound>();

            if (num == 0)
            {
                list = gatewayInboundBl.GetAll().Where(x => x.MasterAirwayBill == mawb && x.RecordStatus == 1 && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).ToList();
            }
            else if (num == 1)
            {
                list = gatewayInboundBl.GetAll().Where(x => x.Gateway == gatewayName && x.OriginBCOID == bcoid && x.CommodityID == commodityTypeId && x.FlightNumber == flightNumber && x.RecordStatus == 1 && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).ToList();
            }
            else if (num == 2)
            {
                list = gatewayInboundBl.GetAll().Where(x => x.Gateway == gatewayName && x.CommodityID == commodityTypeId && x.FlightNumber == flightNumber && x.RecordStatus == 1 && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).ToList();
            }
            else if (num == 3)
            {
                list = gatewayInboundBl.GetAll().Where(x => x.Gateway == gatewayName && x.FlightNumber == flightNumber && x.RecordStatus == 1 && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).ToList();
            }
            else if (num == 4)
            {
                list = gatewayInboundBl.GetAll().Where(x => x.Gateway == gatewayName && x.RecordStatus == 1 && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).ToList();
            }
            else if (num == 5)
            {
                list = gatewayInboundBl.GetAll().Where(x => x.RecordStatus == 1 && x.OriginBCOID == bcoid && x.CommodityID == commodityTypeId && x.FlightNumber == flightNumber && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).ToList();
            }
            else if (num == 6)
            {
                list = gatewayInboundBl.GetAll().Where(x => x.RecordStatus == 1 && x.OriginBCOID == bcoid && x.FlightNumber == flightNumber && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).ToList();
            }
            else if (num == 7)
            {
                list = gatewayInboundBl.GetAll().Where(x => x.RecordStatus == 1 && x.OriginBCOID == bcoid && x.CommodityID == commodityTypeId && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).ToList();
            }
            else if (num == 8)
            {
                list = gatewayInboundBl.GetAll().Where(x => x.RecordStatus == 1 && x.OriginBCOID == bcoid && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).ToList();
            }
            else if (num == 9)
            {
                list = gatewayInboundBl.GetAll().Where(x => x.RecordStatus == 1 && x.Gateway == gatewayName && x.OriginBCOID == bcoid && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).ToList();
            }
            else if (num == 10)
            {
                list = gatewayInboundBl.GetAll().Where(x => x.RecordStatus == 1 && x.Gateway == gatewayName && x.OriginBCOID == bcoid && x.FlightNumber == flightNumber && x.CreatedDate.ToShortDateString() == date.ToShortDateString()).ToList();
            }

            List <GatewayInboundViewModel> modelList = Match(list);

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("No", typeof(string)));
            dt.Columns.Add(new DataColumn("Gateway", typeof(string)));
            dt.Columns.Add(new DataColumn("Origin", typeof(string)));
            dt.Columns.Add(new DataColumn("Pieces", typeof(string)));
            dt.Columns.Add(new DataColumn("MAWB", typeof(string)));
            dt.Columns.Add(new DataColumn("Flight #", typeof(string)));
            dt.Columns.Add(new DataColumn("Commodity Type", typeof(string)));
            dt.Columns.Add(new DataColumn("AWB", typeof(string)));
            dt.Columns.Add(new DataColumn("CreatedDate", typeof(string)));

            dt.Columns.Add(new DataColumn("ScannedBy", typeof(string)));
            dt.BeginLoadData();
            int ctr = 1;

            foreach (GatewayInboundViewModel item in modelList)
            {
                DataRow row = dt.NewRow();
                row[0] = (ctr++).ToString();
                row[1] = item.Gateway;
                row[2] = item.Origin;
                row[3] = item.Pieces;
                row[4] = item.MAWB;
                row[5] = item.FlightNo;
                row[6] = item.CommodityType;
                row[7] = item.AirwayBillNo;
                row[8] = item.CreatedDate.ToShortDateString();
                row[9] = item.ScannedBy;
                dt.Rows.Add(row);
            }
            dt.EndLoadData();

            return(dt);
        }
Exemplo n.º 4
0
        public DataTable getGODatabyFilter(DateTime date, Guid?bcoid, string driver, string gateway, Guid?batchid, Guid?commodityTypeId, string mawb, int num)
        {
            GatewayOutboundBL  gatewayOutboundBl = new GatewayOutboundBL();
            GatewayInboundBL   gatewayInboundBl  = new GatewayInboundBL();
            CommodityTypeBL    comtypeService    = new CommodityTypeBL();
            BranchCorpOfficeBL bcoService        = new BranchCorpOfficeBL();


            List <GatewayInbound>           Inboundlist  = gatewayInboundBl.GetAll().GroupBy(x => x.Cargo).Select(y => y.First()).ToList();
            List <GatewayOutbound>          Outboundlist = new List <GatewayOutbound>();
            List <GatewayOutboundViewModel> modelList    = new List <GatewayOutboundViewModel>();

            if (num == 0)
            {
                Outboundlist = gatewayOutboundBl.GetAll().Where
                                   (x => x.RecordStatus == 1
                                   //&& x.CreatedDate.ToShortDateString() == date.ToShortDateString()
                                   && x.MasterAirwayBill == mawb).GroupBy(x => x.Cargo).Select(y => y.First()).ToList();
            }
            else if (num == 1)
            {
                Outboundlist = gatewayOutboundBl.GetAll().Where
                                   (x => x.RecordStatus == 1
                                   //&& ((x.PackageNumber.Shipment.DestinationCity.BranchCorpOfficeId == bcoid && x.PackageNumber.Shipment.DestinationCity.BranchCorpOfficeId != null) || (x.PackageNumber.Shipment.DestinationCity.BranchCorpOfficeId == x.PackageNumber.Shipment.DestinationCity.BranchCorpOfficeId && x.PackageNumber.Shipment.DestinationCity.BranchCorpOfficeId == null))
                                   && ((x.Driver == driver && x.Driver != "All") || (x.Driver == x.Driver && driver == "All")) &&
                                   ((x.Gateway == gateway && x.Gateway != "All") || (x.Gateway == x.Gateway && gateway == "All")) &&
                                   ((x.BatchID == batchid && x.BatchID != Guid.Empty) || (x.BatchID == x.BatchID && batchid == Guid.Empty)) &&
                                   x.CreatedDate.ToShortDateString() == date.ToShortDateString() &&
                                   ((x.MasterAirwayBill == mawb && x.MasterAirwayBill != "") || (x.MasterAirwayBill == x.MasterAirwayBill && mawb == ""))
                                   ).GroupBy(x => x.Cargo).Select(y => y.First()).ToList();
            }
            string comType = "";
            string _bco    = "";

            if (commodityTypeId != Guid.Empty && bcoid != Guid.Empty)
            {
                //string comType = comtypeService.GetAll().Where(x => x.RecordStatus == 1 && x.CommodityTypeId == commodityTypeId).Select(x => x.CommodityTypeName).ToString();
                //string _bco = bcoService.GetAll().Where(x => x.RecordStatus == 1 && x.BranchCorpOfficeId == bcoid).Select(x => x.BranchCorpOfficeName).ToString();
                //List<CommodityType> _ctype = comtypeService.FilterActiveBy(x => x.CommodityTypeId == commodityTypeId).ToList();
                //string comType = _ctype.Select(x => x.CommodityTypeName).ToString();

                //List<BranchCorpOffice> _branch = bcoService.FilterActiveBy(x => x.BranchCorpOfficeId == bcoid).ToList();
                //string _bco = _branch.Select(x => x.BranchCorpOfficeName).ToString();

                comType = comtypeService.GetAll().Find(x => x.CommodityTypeId == commodityTypeId).CommodityTypeName;
                _bco    = bcoService.GetAll().Find(x => x.BranchCorpOfficeId == bcoid).BranchCorpOfficeName;

                modelList = Match(Inboundlist, Outboundlist).FindAll(x => x.CommodityTypeName == comType && x.Branch == _bco);
            }
            else if (commodityTypeId != Guid.Empty && bcoid == Guid.Empty)
            {
                //string comType = comtypeService.GetAll().Where(x => x.RecordStatus == 1 && x.CommodityTypeId == commodityTypeId).Select(x => x.CommodityTypeName).ToString();
                //List<CommodityType> _ctype = comtypeService.FilterActiveBy(x => x.CommodityTypeId == commodityTypeId).ToList();
                //string comType = _ctype.Select(x => x.CommodityTypeName).ToString();
                comType   = comtypeService.GetAll().Find(x => x.CommodityTypeId == commodityTypeId).CommodityTypeName;
                modelList = Match(Inboundlist, Outboundlist).FindAll(x => x.CommodityTypeName == comType);
            }
            else if (commodityTypeId == Guid.Empty && bcoid != Guid.Empty)
            {
                //string _bco = bcoService.GetAll().Where(x => x.RecordStatus == 1 && x.BranchCorpOfficeId == bcoid).Select(x => x.BranchCorpOfficeName).ToString();
                //List<BranchCorpOffice> _branch = bcoService.FilterActiveBy(x => x.BranchCorpOfficeId == bcoid).ToList();
                //string _bco = _branch.Select(x => x.BranchCorpOfficeName).ToString();
                _bco      = bcoService.GetAll().Find(x => x.BranchCorpOfficeId == bcoid).BranchCorpOfficeName;
                modelList = Match(Inboundlist, Outboundlist).FindAll(x => x.Branch == _bco);
            }
            else
            {
                modelList = Match(Inboundlist, Outboundlist);
            }



            //modelList.GroupBy(x => x.AirwayBillNo).ToList();

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("No", typeof(string)));
            dt.Columns.Add(new DataColumn("Gateway", typeof(string)));
            dt.Columns.Add(new DataColumn("Driver", typeof(string)));
            dt.Columns.Add(new DataColumn("Plate #", typeof(string)));
            dt.Columns.Add(new DataColumn("Batch", typeof(string)));

            dt.Columns.Add(new DataColumn("AWB", typeof(string)));

            dt.Columns.Add(new DataColumn("Recieved(Qty)", typeof(string)));
            dt.Columns.Add(new DataColumn("Discrepancy(Qty)", typeof(string)));
            dt.Columns.Add(new DataColumn("Total Qty", typeof(string)));

            dt.Columns.Add(new DataColumn("CreatedDate", typeof(string)));
            dt.Columns.Add(new DataColumn("Branch", typeof(string)));

            dt.Columns.Add(new DataColumn("ScannedBy", typeof(string)));

            dt.BeginLoadData();

            int ctr = 1;

            foreach (GatewayOutboundViewModel item in modelList)
            {
                DataRow row = dt.NewRow();
                row[0]  = (ctr++).ToString();
                row[1]  = item.Gateway.ToString();
                row[2]  = item.Driver.ToString();
                row[3]  = item.PlateNo.ToString();
                row[4]  = item.Batch;
                row[5]  = item.AirwayBillNo.ToString();
                row[6]  = item.TotalRecieved.ToString();
                row[7]  = item.TotalDiscrepency.ToString();
                row[8]  = item.Total.ToString();
                row[9]  = item.CreatedDate.ToShortDateString();
                row[10] = item.Branch;
                row[11] = item.ScannedBy;
                dt.Rows.Add(row);
            }
            dt.EndLoadData();

            return(dt);
        }