Exemplo n.º 1
0
        //Ivan
        public static List <FC_LocalContract> ContractsByStatus_Populate(int status)
        {
            string           query = "select * from FC_LocalContract where Contract_Status = " + status.ToString() + ";";
            FC_LocalContract temp  = new FC_LocalContract();

            return(temp.ObjToTable(SQL.Select(temp, query)));
        }
Exemplo n.º 2
0
        public static List <FC_LocalContract> ContractsByName_Populate(string name)
        {
            string           query = "select * from FC_LocalContract where Client_Name = '" + name.ToString() + "' and Contract_Status = 3;";
            FC_LocalContract temp  = new FC_LocalContract();

            return(temp.ObjToTable(SQL.Select(temp, query)));
        }
Exemplo n.º 3
0
        public static List <FC_LocalContract> GetNominatedContracts()
        {
            string query = "select LC.FC_LocalContractID, LC.Client_Name, LC.Job_type, LC.Quantity, LC.Origin, LC.Destination, LC.Van_type, LC.Contract_Status " +
                           "from FC_BuyerToPlannerContract as bp " +
                           "left join FC_LocalContract as LC on LC.FC_LocalContractID = bp.FC_LocalContractID;";

            FC_LocalContract n = new FC_LocalContract();

            return(n.ObjToTable(SQL.Select(n, query)));
        }
Exemplo n.º 4
0
        //Ivan
        public static List <FC_LocalContract> ContractsPerTicket_Populate(FC_TripTicket temp)
        {
            string query = "select LC.FC_LocalContractID, LC.Client_Name, LC.Job_type, LC.Quantity, LC.Origin, LC.Destination, LC.Van_type, LC.Contract_Status " +
                           "from FC_LocalContract as LC " +
                           "left join FC_TripTicketLine as ttl on ttl.FC_LocalContractID = LC.FC_LocalContractID " +
                           "left join FC_TripTicket as tt on tt.FC_TripTicketID = ttl.FC_TripTicketID " +
                           "where tt.FC_TripTicketID = " + temp.FC_TripTicketID + ";";
            FC_LocalContract lc = new FC_LocalContract();

            return(lc.ObjToTable(SQL.Select(lc, query)));
        }
Exemplo n.º 5
0
        public static List <FC_LocalContract> GetContracts_PreInvoice(FC_Invoice inInvoice)
        {
            string query = "select c.FC_LocalContractID, c.Client_Name, c.Job_type, c.Quantity, c.Origin, c.Destination, c.Van_type, c.Contract_Status " +
                           "from FC_Invoice as inn " +
                           "left join FC_InvoiceContractLine as cl on cl.FC_InvoiceID = inn.FC_InvoiceID " +
                           "left join FC_LocalContract as c on c.FC_LocalContractID = cl.FC_LocalContractID " +
                           "where inn.FC_InvoiceID = " + inInvoice.FC_InvoiceID.ToString() + ";";

            FC_LocalContract c = new FC_LocalContract();

            return(c.ObjToTable(SQL.Select(c, query)));
        }
Exemplo n.º 6
0
        public static void IncrementOneDay()
        {
            try
            {
                string FirstQuery = "Select * from FC_TripTicket where not Is_Complete = 0;";

                FC_TripTicket        t          = new FC_TripTicket();
                List <FC_TripTicket> AllTickets = t.ObjToTable(SQL.Select(t, FirstQuery));

                foreach (FC_TripTicket x in AllTickets)
                {
                    x.Days_Passes++;

                    FC_RouteSeg s = new FC_RouteSeg();

                    string query = "Select FC_TripTicketID, CityA, CityB, PickUpTime, DropOffTime, LtlTime, DrivenTime, KM from FC_RouteSeg where FC_TripTicketID = " + x.FC_TripTicketID + ";";

                    List <FC_RouteSeg> AllSegments = s.ObjToTable(SQL.Select(s, query));

                    double totalTime = x.Days_Passes * 12;
                    double DriveTime = x.Days_Passes * 8;

                    int         SegIndex       = 0;
                    FC_RouteSeg currentSegment = AllSegments[SegIndex];

                    while (true)
                    {
                        totalTime -= currentSegment.PickUpTime;

                        totalTime -= currentSegment.DrivenTime;
                        DriveTime -= currentSegment.DrivenTime;

                        totalTime -= currentSegment.LtlTime;

                        totalTime -= currentSegment.DropOffTime;

                        if (totalTime <= 0 || DriveTime <= 0)
                        {
                            x.CurrentLocation = LoadCSV.ToCityName(currentSegment.CityA);
                            break;
                        }
                        else
                        {
                            SegIndex++;

                            if (SegIndex >= AllSegments.Count)
                            {
                                x.CurrentLocation = LoadCSV.ToCityName(currentSegment.CityB);
                                break;
                            }
                            else
                            {
                                currentSegment = AllSegments[SegIndex];
                            }

                            x.CurrentLocation = LoadCSV.ToCityName(currentSegment.CityB);
                        }
                    }

                    PlannerClass.UpdateTicketLocation(x);
                }

                string Query = "select FC_LocalContractID, Client_Name, Job_type, Quantity, Origin, Destination, Van_type, Contract_Status from " +
                               "FC_LocalContract where Contract_Status = 1";

                FC_LocalContract        l = new FC_LocalContract();
                List <FC_LocalContract> OnrouteContracts = l.ObjToTable(SQL.Select(l, Query));

                MappingClass map = new MappingClass();

                foreach (FC_LocalContract x in OnrouteContracts)
                {
                    bool isComplete = true;

                    List <FC_TripTicket> theTickets = PlannerClass.ConnectedTickets_Populate(x);

                    foreach (FC_TripTicket y in theTickets)
                    {
                        if (!map.AtOrPastCity(x, y))
                        {
                            isComplete = false;
                            break;
                        }
                    }

                    if (isComplete)
                    {
                        PlannerClass.UpdateContratState(x, 2);
                    }
                }

                string theQuery = "Select * from FC_TripTicket where Is_Complete = 1";

                FC_TripTicket        w             = new FC_TripTicket();
                List <FC_TripTicket> ActiveTickets = t.ObjToTable(SQL.Select(t, theQuery));

                foreach (FC_TripTicket x in ActiveTickets)
                {
                    bool foundNotComple = false;

                    List <FC_LocalContract> ContactsPerTick = PlannerClass.ContractsPerTicket_Populate(x);

                    foreach (FC_LocalContract y in ContactsPerTick)
                    {
                        if (y.Contract_Status < 2)
                        {
                            foundNotComple = true;
                        }
                    }

                    if (!foundNotComple)
                    {
                        theQuery = "Update FC_TripTicket set Is_Complete = 2 where FC_TripTicketID = " + x.FC_TripTicketID + ";";
                        SQL.GenericFunction(theQuery);
                    }
                }

                TMSLogger.LogIt(" | " + "TimePass.cs" + " | " + "TimePass" + " | " + "IncrementOneDay" + " | " + "Confirmation" + " | " + "Day incremented" + " | ");
            }
            catch (Exception e)
            {
                TMSLogger.LogIt(" | " + "TimePass.cs" + " | " + "TimePass" + " | " + "IncrementOneDay" + " | " + e.GetType().ToString() + " | " + e.Message + " | ");
            }
        }