public DisplayQuote(string currentDateInfo, string customerInfo, string areaTotal, string drawerTotal, string materialSelected, string materialTotal, string shippingSelected, string shippingTotal, string totalDesk)
        {
            InitializeComponent();

            quoteDate.Text      = currentDateInfo;
            custName.Text       = customerInfo;
            areaCost.Text       = areaTotal;
            drawerCost.Text     = drawerTotal;
            materialName.Text   = materialSelected;
            materialCost.Text   = materialTotal;
            shippingMethod.Text = shippingSelected;
            shippingCost.Text   = shippingTotal;
            totalCost.Text      = totalDesk;



            // This is used to create the JSON FILE to store the info
            DeskQuote DeskQuoteInfo = new DeskQuote();

            DeskQuoteInfo.currentDate      = currentDateInfo;
            DeskQuoteInfo.customerInfo     = customerInfo;
            DeskQuoteInfo.areaTotal        = areaTotal;
            DeskQuoteInfo.drawerTotal      = drawerTotal;
            DeskQuoteInfo.materialSelected = materialSelected;
            DeskQuoteInfo.materialTotal    = materialTotal;
            DeskQuoteInfo.shippingSelected = shippingSelected;
            DeskQuoteInfo.shippingTotal    = shippingTotal;
            DeskQuoteInfo.totalDesk        = totalDesk;

            //try
            //{


            //    string jsonData = JsonConvert.SerializeObject(DeskQuoteInfo, Formatting.Indented);
            //    string path = "quotes.json";

            //    if (jsonData != null && jsonData != "")
            //    {
            //        File.AppendAllText(path, jsonData + Environment.NewLine);
            //    }
            //    else
            //    {
            //        File.WriteAllText(path, jsonData);
            //    }

            //}
            //catch (IOException e)
            //{

            //}
        }
Ejemplo n.º 2
0
        // Submit Botton 
        public void btnAddQuoteSbt_Click(object sender, EventArgs e)
        {

            if (string.IsNullOrEmpty(customerName.Text) || string.IsNullOrEmpty(InputWidth.Text) ||
                string.IsNullOrEmpty(InputDepth.Text) || string.IsNullOrEmpty(DesktopMaterial.Text) ||
                 string.IsNullOrEmpty(shippingDays.Text) || string.IsNullOrEmpty(DrawersNumber.Text))
            {
                string message = "Please enter all the inputs.";
                string title = "Error";
                MessageBox.Show(message, title);
            }
            else
            {
                //Display the the results and selected options in the display quote
                string currentDateInfo = currentDate.Text;
                string customerInfo = customerName.Text;
                string areaTotal = Convert.ToString(getInput());
                string drawerTotal = Convert.ToString(DrawersCalc());
                string materialSelected = DesktopMaterial_SelectedIndexChanged();
                string materialTotal = Convert.ToString(deskMaterial());
                string shippingSelected = shippingDays_Selected();
                string shippingTotal = Convert.ToString(shippingDays_SelectedIndexChanged());
                string deskTotal = Convert.ToString(totalMath());

                DeskQuote newQuote = new DeskQuote(currentDateInfo, customerInfo, areaTotal, drawerTotal, materialSelected, materialTotal, shippingSelected,
                    shippingTotal, deskTotal);

                string jsonData = JsonConvert.SerializeObject(newQuote, Formatting.Indented);
                string path = @"../../quotes.json";

                if (jsonData != null && jsonData != "")
                {
                    File.AppendAllText(path, jsonData + Environment.NewLine);
                }
                else
                {
                    File.WriteAllText(path, jsonData);
                }
                DisplayQuote viewDisplayQuote = new DisplayQuote(jsonData);
                viewDisplayQuote.Tag = this;
                viewDisplayQuote.Show(this);
                Hide();

            }

        }
Ejemplo n.º 3
0
        public DisplayQuote(string jsonData)
        {
            InitializeComponent();

            Console.WriteLine(jsonData);
            DeskQuote viewQuote = JsonConvert.DeserializeObject <DeskQuote>(jsonData);

            Console.WriteLine(viewQuote.currentDate);
            quoteDate.Text      = viewQuote.currentDate;
            custName.Text       = viewQuote.customerInfo;
            areaCost.Text       = viewQuote.areaTotal;
            drawerCost.Text     = viewQuote.drawerTotal;
            materialName.Text   = viewQuote.materialSelected;
            materialCost.Text   = viewQuote.materialTotal;
            shippingMethod.Text = viewQuote.shippingSelected;
            shippingCost.Text   = viewQuote.shippingTotal;
            totalCost.Text      = viewQuote.totalDesk;
        }
Ejemplo n.º 4
0
 public MainMenu()
 {
     InitializeComponent();
     DeskQuote.GetQueryList();
 }
Ejemplo n.º 5
0
 public SearchQuotes()
 {
     InitializeComponent();
     DeskQuote.GetQueryList();
     CreateHeadRowSearchListBox();
 }