Exemplo n.º 1
0
 private void Rate_Fee_TablesList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (Rate_Fee_TablesList.SelectedItem != null)
     {
         selectedCityForEditing = (FC_DepotCity)Rate_Fee_TablesList.SelectedItem;
     }
 }
Exemplo n.º 2
0
        private void Rate_Fee_TablesList_CurrentCellChanged(object sender, EventArgs e)
        {
            if (Rate_Fee_TablesList.SelectedItem != null)
            {
                FC_DepotCity             temp     = (FC_DepotCity)Rate_Fee_TablesList.SelectedItem;
                IList <DataGridCellInfo> cellInfo = Rate_Fee_TablesList.SelectedCells;

                // The cell contents are changed. Update the specified depot city.
            }
        }
Exemplo n.º 3
0
        private void LoadRateFeeTab()
        {
            //Rate_Fee_Tables.DataContext = admin.DisplayFees();
            //Rate_Fee_TablesList.ItemsSource = admin.DisplayFees();

            FC_DepotCity d = new FC_DepotCity();

            Rate_Fee_TablesList.ItemsSource = d.ObjToTable(SQL.Select(d));
            Rate_Fee_TablesList.Items.Refresh();
        }
Exemplo n.º 4
0
        public static double GenerateInvoiceTotal(FC_LocalContract inContract)
        {
            List <FC_TripTicket> AllTickets = ConnectedTickets_Populate(inContract);

            MappingClass       map           = new MappingClass();
            List <FC_RouteSeg> TempRouteSegs = map.GetTravelData(inContract.Origin, inContract.Destination, 1, 1);

            double Total_Cost = 0;

            foreach (FC_TripTicket x in AllTickets)
            {
                List <FC_RouteSeg> TotalContractSegments = new List <FC_RouteSeg>();

                List <FC_RouteSeg> segments = RoutSegsPerTicket_Populate(x);

                for (int i = 0; i < TempRouteSegs.Count; i++)
                {
                    TotalContractSegments.Add(segments[i]);
                }

                RouteSumData sumData = new RouteSumData();
                sumData = sumData.SummerizeTrip(TotalContractSegments);

                string query = "select FC_CarrierID, CityName, FTL_Availibility, LTL_Availibility, FTL_Rate, LTL_Rate, Reefer_Charge " +
                               "from FC_DepotCity " +
                               "where FC_CarrierID = " + x.FC_CarrierID.ToString() + " and CityName = \"" + inContract.Origin + "\";";

                FC_DepotCity        d            = new FC_DepotCity();
                List <FC_DepotCity> theDepotCity = d.ObjToTable(SQL.Select(d, query));

                double tempPrice = 0;

                if (inContract.Job_type == 0)
                {
                    tempPrice = sumData.totalKM * theDepotCity[0].FTL_Rate * 1.08;
                }
                else
                {
                    query = "select * from FC_TripTicketLine where FC_TripTicketID = " + x.FC_TripTicketID.ToString() + " and FC_LocalContractID =  " + inContract.FC_LocalContractID.ToString() + " ;";

                    FC_TripTicketLine        t             = new FC_TripTicketLine();
                    List <FC_TripTicketLine> theTicketLine = t.ObjToTable(SQL.Select(t, query));

                    int QuantityOnTruck = theTicketLine[0].PalletsOnTicket;

                    if (QuantityOnTruck == 0)
                    {
                        QuantityOnTruck = 26;
                    }

                    tempPrice = sumData.totalKM * theDepotCity[0].LTL_Rate * QuantityOnTruck * 1.05;
                }

                if (inContract.Van_type == 1)
                {
                    tempPrice *= (theDepotCity[0].Reefer_Charge + 1);
                }

                Total_Cost += tempPrice;
            }

            try
            {
                Total_Cost = Math.Round(Total_Cost, 2);
            }
            catch (Exception e)
            {
                TMSLogger.LogIt(" | " + "PlannerClass.cs" + " | " + "PlannerClass" + " | " + "GenerateInvoiceTotal" + " | " + e.GetType().ToString() + " | " + e.Message + " | ");
            }


            TMSLogger.LogIt(" | " + "PlannerClass.cs" + " | " + "PlannerClass" + " | " + "GenerateInvoiceTotal" + " | " + "Confirmation" + " | " + "Invoice total generated" + " | ");

            return(Total_Cost);
        }
Exemplo n.º 5
0
 private void Rate_Fee_TablesList_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
 {
     selectedCityForEditing = (FC_DepotCity)Rate_Fee_TablesList.SelectedItem;
 }
Exemplo n.º 6
0
        // METHOD HEADER COMMENT -------------------------------------------------------------------------------

        /**
         *	\fn		        Load
         *	\brief			This method loads the carrier csv, parses it for the carrier info and depot city
         *	\param[in]      none
         *	\param[out]	    none
         *	\return		    bool
         * ---------------------------------------------------------------------------------------------------- */
        public static bool Load()
        {
            bool worked = true;

            if (CSVLocation != "")
            {
                try
                {
                    string localResourcePath = CSVLocation;
                    string ReadInData        = System.IO.File.ReadAllText(localResourcePath);

                    ReadInData = ReadInData.Replace("\r\n", ",");
                    ReadInData = ReadInData.Replace(",,", ",");

                    String[] SeperaterStrings = ReadInData.Split(',');

                    List <FC_Carrier>   ReadInCarriers = new List <FC_Carrier>();
                    List <FC_DepotCity> InDeoptCities  = new List <FC_DepotCity>();

                    int  index        = 7;
                    bool CarrierFound = true;

                    index = 7;

                    do
                    {
                        int CurrentCarrierID = SQL.GetNextID("FC_Carrier");

                        FC_Carrier current = new FC_Carrier(CurrentCarrierID, SeperaterStrings[index]);
                        index++;

                        bool cityFound = true;

                        do
                        {
                            if (ToCityID(SeperaterStrings[index]) != -1)
                            {
                                FC_DepotCity tempDepot = new FC_DepotCity(CurrentCarrierID, SeperaterStrings[index], int.Parse(SeperaterStrings[index + 1]), int.Parse(SeperaterStrings[index + 2]), double.Parse(SeperaterStrings[index + 3]), double.Parse(SeperaterStrings[index + 4]), double.Parse(SeperaterStrings[index + 5]));
                                InDeoptCities.Add(tempDepot);

                                index += 6;
                            }
                            else
                            {
                                cityFound = false;
                            }
                        } while (cityFound);

                        ReadInCarriers.Add(current);

                        if (SeperaterStrings[index] == "")
                        {
                            CarrierFound = false;
                        }

                        SQL.Insert(current);
                    } while (CarrierFound);

                    foreach (FC_DepotCity x in InDeoptCities)
                    {
                        SQL.Insert(x);
                    }
                }
                catch (Exception e)
                {
                    //Console.WriteLine(e.ToString());
                    TMSLogger.LogIt(" | " + "LoadCSV.cs" + " | " + "LoadCSV" + " | " + "Load" + " | " + e.GetType().ToString() + " | " + e.Message + " | ");
                    worked = false;
                }
            }

            TMSLogger.LogIt(" | " + "LoadCSV.cs" + " | " + "LoadCSV" + " | " + "Load" + " | " + "Confirmation" + " | " + "CSV Loaded" + " | ");

            return(worked);
        }