Ejemplo n.º 1
0
        /// <summary>
        /// Checks for valid information and then submits the route information to a queue
        /// </summary>
        private void submitToQueue()
        {
            if (string.IsNullOrWhiteSpace(modelNumber))
            {
                informationText = "Enter a valid model before submitting route.";
            }
            else if (string.IsNullOrWhiteSpace(prodSupCodeText) || prodSupCodeText.Equals("N/A"))
            {
                informationText = "Information is not valid. Cannot submit.";
            }
            else
            {
                try
                {
                    informationText = "Adding route to queue...";

                    RouteQueue route = new RouteQueue
                    {
                        Route         = int.Parse(routeText),
                        ModelNumber   = model.Base,
                        Line          = model.Line,
                        TotalTime     = (decimal)productionTime,
                        IsApproved    = false,
                        AddedDate     = DateTime.Now,
                        SubmittedDate = new DateTime(1900, 1, 1)
                    };

                    _serviceProxy.addRouteQueue(route);

                    informationText = "Route added to queue.";
                }
                catch (Exception e)
                {
                    informationText = "There was a problem accessing the database.";
                    Console.WriteLine(e.Message);
                }
            }
        }
        /// <summary>
        /// Adds the route information to the database if all the information is filled out
        /// </summary>
        private void submitToQueue()
        {
            if (string.IsNullOrWhiteSpace(prodSupCodeText))
            {
                informationText = "Complete route information before submitting route.";
            }
            else if (string.IsNullOrWhiteSpace(modelNumber))
            {
                informationText = "Enter the material number before submitting route.";
            }
            else
            {
                try
                {
                    informationText = "Adding route to queue...";
                    RouteQueue route = new RouteQueue
                    {
                        Route         = int.Parse(routeText),
                        ModelNumber   = modelNumber,
                        Line          = "ENG-FLR", //Engineered Floor Mount Line
                        TotalTime     = (decimal)totalTime,
                        IsApproved    = false,
                        AddedDate     = DateTime.Now,
                        SubmittedDate = new DateTime(1900, 1, 1)
                    };

                    _serviceProxy.addRouteQueue(route);

                    informationText = "Route added to queue.";
                }
                catch (Exception e)
                {
                    informationText = "There was a problem accessing the database.";
                    Console.WriteLine(e.Message);
                }
            }
        }