/// <summary> /// Process for generating a Circle Widget Order /// </summary> /// <returns>string for a Circle Widget</returns> public string Process() { Circle circle = new Circle(); Console.WriteLine("Please enter the values for your Circle Widget"); try { // Prompt to user for X Postion string posX = UserPrompts.PromptForWidgetValue("Position X", circle.PositionX); // Validate the user input. If valid, stores the value in the object circle.PositionX = string.IsNullOrEmpty(posX) ? circle.PositionX : Validation.ValidatePositionValue(posX); string posY = UserPrompts.PromptForWidgetValue("Position Y", circle.PositionY); circle.PositionY = string.IsNullOrEmpty(posY) ? circle.PositionY : Validation.ValidatePositionValue(posY); string diameter = UserPrompts.PromptForWidgetValue("diameter", circle.Diameter); circle.Diameter = string.IsNullOrEmpty(diameter) ? circle.Diameter : Validation.ValidateSizeValue(diameter); // If all the user input is valid, pass the object on to have a BOM statement constructed return(BOMBuilder(circle)); } // Any problems are caught and an exception is thrown catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// Process for generating a Textbox Widget Order /// </summary> /// <returns>string for a Textbox Widget</returns> public string Process() { Textbox textbox = new Textbox(); Console.WriteLine("Please enter the values for your Textbox Widget"); try { // Prompt to user for X Postion string posX = UserPrompts.PromptForWidgetValue("Position X", textbox.PositionX); // Validate the user input. If valid, stores the value in the object textbox.PositionX = string.IsNullOrEmpty(posX) ? textbox.PositionX : Validation.ValidatePositionValue(posX); string posY = UserPrompts.PromptForWidgetValue("Position Y", textbox.PositionY); textbox.PositionY = string.IsNullOrEmpty(posY) ? textbox.PositionY : Validation.ValidatePositionValue(posY); string width = UserPrompts.PromptForWidgetValue("Width", textbox.Width); textbox.Width = string.IsNullOrEmpty(width) ? textbox.Width : Validation.ValidateSizeValue(width); string height = UserPrompts.PromptForWidgetValue("Height", textbox.Height); textbox.Height = string.IsNullOrEmpty(height) ? textbox.Height : Validation.ValidateSizeValue(height); Console.WriteLine($"Please provide the Text you require. Default Text = {textbox.Text}"); string text = Console.ReadLine(); textbox.Text = string.IsNullOrEmpty(text) ? textbox.Text : text; // If all the user input is valid, pass the object on to have a BOM statement constructed return(BOMBuilder(textbox)); } // Any problems are caught and an exception is thrown catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// Process for generating a Square Widget Order /// </summary> /// <returns>string for a Square Widget</returns> public string Process() { Square square = new Square(); Console.WriteLine("Please enter the values for your Square Widget"); try { // Prompt to user for X Postion string posX = UserPrompts.PromptForWidgetValue("Position X", square.PositionX); // Validate the user input. If valid, stores the value in the object square.PositionX = string.IsNullOrEmpty(posX) ? square.PositionX : Validation.ValidatePositionValue(posX); string posY = UserPrompts.PromptForWidgetValue("Position Y", square.PositionY); square.PositionY = string.IsNullOrEmpty(posY) ? square.PositionY : Validation.ValidatePositionValue(posY); string width = UserPrompts.PromptForWidgetValue("Width", square.Width); square.Width = string.IsNullOrEmpty(width) ? square.Width : Validation.ValidateSizeValue(width); // If all the user input is valid, pass the object on to have a BOM statement constructed return(BOMBuilder(square)); } // Any problems are caught and an exception is thrown catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// Process for generating a Ellipse Widget Order /// </summary> /// <returns>string for a Ellipse Widget</returns> public string Process() { Ellipse ellipse = new Ellipse(); Console.WriteLine("Please enter the values for your Ellipse Widget"); try { // Prompt to user for X Postion string posX = UserPrompts.PromptForWidgetValue("Position X", ellipse.PositionX); // Validate the user input. If valid, stores the value in the object ellipse.PositionX = string.IsNullOrEmpty(posX) ? ellipse.PositionX : Validation.ValidatePositionValue(posX); string posY = UserPrompts.PromptForWidgetValue("Position Y", ellipse.PositionY); ellipse.PositionY = string.IsNullOrEmpty(posY) ? ellipse.PositionY : Validation.ValidatePositionValue(posY); string hDiameter = UserPrompts.PromptForWidgetValue("Horizontal Diameter", ellipse.HorizontalDiameter); ellipse.HorizontalDiameter = string.IsNullOrEmpty(hDiameter) ? ellipse.HorizontalDiameter : Validation.ValidateSizeValue(hDiameter); string vDiameter = UserPrompts.PromptForWidgetValue("Vertical Diameter", ellipse.VerticalDiameter); ellipse.VerticalDiameter = string.IsNullOrEmpty(vDiameter) ? ellipse.VerticalDiameter : Validation.ValidateSizeValue(vDiameter); // If all the user input is valid, pass the object on to have a BOM statement constructed return(BOMBuilder(ellipse)); } // Any problems are caught and an exception is thrown catch (Exception ex) { throw new Exception(ex.Message); } }