Exemple #1
0
        private string PopulateContainerInventory(string SSLineCode)
        {
            short  x           = 0;
            string DeliverBook = "";
            string LRD         = "";
            char   StreetTurn  = '\0';
            char   Trouble     = '\0';
            string Sql;
            string TempList       = "";
            string VesselName     = "";
            char   ContainerState = '\0';
            string ThisLine       = "";

            for (x = 0; x <= 4; x++)
            {
                ContainerStats[x] = MdlContainerManagement.DoFunctions.MKI(0) + MdlContainerManagement.DoFunctions.MKI(0) + MdlContainerManagement.DoFunctions.MKI(0);
            }
            Sql = @"Select [SS Line Code In], [BookingNumber],[Vessel Name],[LRD],
                [Street Turn],[Gate Date In],[Gate Date In],[Gate Date Out],[Trouble In-Gate],[SS Line Code In]
                     [Carrier Code In],[Yard Code In],[Release Number],[Container Number],
             [Gross Weight],[TARE Weight],[Vessel Name],
          [Assigned To Excel], [Assigned To Storage], [Assigned To Extra] From VW_ContainersByBooking ";
            var DbObjDataTable = new DataTable();
            var DbObjAdapter   = new System.Data.SqlClient.SqlDataAdapter(Sql, DBConnect);
            var DbObjCommand   = new System.Data.SqlClient.SqlCommandBuilder(DbObjAdapter);

            DbObjAdapter.Fill(DbObjDataTable);
            foreach (DataRow DBList in DbObjDataTable.Rows)
            {
                if (Conversions.ToBoolean(Operators.OrObject(SSLineCode == "ALL", (DBList.IsNull("SS Line Code In") == false) && Operators.ConditionalCompareObjectEqual(DBList["SS Line Code In"], SSLineCode, false))))
                {
                    if (DBList.IsNull("BookingNumber") == true)
                    {
                        DeliverBook = MdlContainerManagement.DoFunctions.PadToString(Conversions.ToString(' '), 40);
                    }
                    else
                    {
                        DeliverBook = MdlContainerManagement.DoFunctions.PadToString(Conversions.ToString(DBList["BookingNumber"]), 40);
                    }

                    if (DBList.IsNull("Vessel Name") == true)
                    {
                        VesselName = MdlContainerManagement.DoFunctions.PadToString(Conversions.ToString(' '), 50);
                    }
                    else
                    {
                        VesselName = MdlContainerManagement.DoFunctions.PadToString(Conversions.ToString(DBList["Vessel Name"]), 50);
                    }

                    if (Information.IsDate(DBList["LRD"]) == true)
                    {
                        LRD = MdlContainerManagement.DoFunctions.DateToNum(Conversions.ToDate(DBList["LRD"]));
                    }
                    else
                    {
                        LRD = MdlContainerManagement.DoFunctions.MKL(0);
                    }

                    if (DBList.IsNull("Street Turn") == true)
                    {
                        StreetTurn = '\0';
                    }
                    else if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(DBList["Street Turn"], false, false)))
                    {
                        StreetTurn = '\0';
                    }
                    else if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(DBList["Street Turn"], true, false)))
                    {
                        StreetTurn = '\u0001';
                    }

                    if (DBList.IsNull("Trouble In-Gate") == true)
                    {
                        Trouble = '\0';
                    }
                    else if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(DBList["Trouble In-Gate"], false, false)))
                    {
                        Trouble = '\0';
                    }
                    else if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(DBList["Trouble In-Gate"], true, false)))
                    {
                        Trouble = '\u0001';
                    }

                    DateTime dateIn;
                    if (Information.IsDBNull(DBList["Gate Date In"]))
                    {
                        dateIn = DateTime.MinValue;
                    }
                    else
                    {
                        dateIn = Conversions.ToDate(DBList["Gate Date In"]);
                    }

                    string ssLineIn, carrierIn, yardIn;
                    if (Information.IsDBNull(DBList["SS Line Code In"]))
                    {
                        ssLineIn = "";
                    }
                    else
                    {
                        ssLineIn = Conversions.ToString(DBList["SS Line Code In"]);
                    }

                    if (Information.IsDBNull(DBList["Carrier Code In"]))
                    {
                        carrierIn = "";
                    }
                    else
                    {
                        carrierIn = Conversions.ToString(DBList["Carrier Code In"]);
                    }

                    if (Information.IsDBNull(DBList["Yard Code In"]))
                    {
                        yardIn = "";
                    }
                    else
                    {
                        yardIn = Conversions.ToString(DBList["Yard Code In"]);
                    }

                    string relNumb;
                    if (Information.IsDBNull(DBList["Release Number"]))
                    {
                        relNumb = "";
                    }
                    else
                    {
                        relNumb = Conversions.ToString(DBList["Release Number"]);
                    }

                    ContainerState = Conversions.ToChar(AssignContainerState(DBList));
                    try
                    {
                        ThisLine = Conversions.ToString(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Conversions.ToString('\0') + MdlContainerManagement.DoFunctions.PadToString(Conversions.ToString(DBList["Container Number"]), 11), DBList["Gross Weight"]), DBList["TARE Weight"]), MdlContainerManagement.DoFunctions.DateToNum(dateIn)), MdlContainerManagement.DoFunctions.PadToString(yardIn, 10)), StreetTurn), Trouble), MdlContainerManagement.DoFunctions.PadToString(relNumb, 40)), MdlContainerManagement.DoFunctions.PadToString(ssLineIn, 10)), ContainerState), DeliverBook), VesselName), LRD), MdlContainerManagement.DoFunctions.PadToString(carrierIn, 10)), MdlContainerManagement.DoFunctions.MKI((int)DateAndTime.DateDiff("d", dateIn, DateTime.Today))));
                        if (Strings.Len(ThisLine) == 193)
                        {
                            TempList += ThisLine;
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            // DBConnect.Close()
            return(TempList);
        }