// 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()); dq.currentDate = currentDateInfo; dq.customerInfo = customerInfo; dq.areaTotal = areaTotal; dq.drawerTotal = drawerTotal; dq.materialSelected = materialSelected; dq.materialTotal = materialTotal; dq.shippingSelected = shippingSelected; dq.shippingTotal = "$" + shippingTotal; dq.totalDesk = "$" + deskTotal; DeskQuote.dqList.Add(dq); string jsonData = JsonConvert.SerializeObject(DeskQuote.dqList, Formatting.Indented); File.WriteAllText("../../quotes.json", JsonConvert.SerializeObject(DeskQuote.dqList)); DisplayQuote viewDisplayQuote = new DisplayQuote(currentDateInfo, customerInfo, areaTotal, drawerTotal, materialSelected, materialTotal, shippingSelected, shippingTotal, deskTotal); viewDisplayQuote.Tag = this; viewDisplayQuote.Show(this); Hide(); } }
// 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(); } }