Ejemplo n.º 1
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            using (SqlConnection connection = new SqlConnection(Database.ConnectionString))
            {
                connection.Update(newQuotationData);
            }

            QuotationData.Update(newQuotationData);
            this.Close();
        }
Ejemplo n.º 2
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            bool isNull  = false;
            var  message = "Please Enter:";

            if (newQuotationData.PowerVoltage == null || newQuotationData.PowerVoltage == "")
            {
                message += $"\n  Power Voltage."; isNull = true;
            }
            if (newQuotationData.Phase == null || newQuotationData.Phase == "")
            {
                message += $"\n  Phase."; isNull = true;
            }
            if (newQuotationData.Frequency == null || newQuotationData.Frequency == "")
            {
                message += $"\n  Frequency."; isNull = true;
            }
            if (newQuotationData.NetworkSystem == null || newQuotationData.NetworkSystem == "")
            {
                message += $"\n  Network System."; isNull = true;
            }
            if (newQuotationData.ControlVoltage == null || newQuotationData.ControlVoltage == "")
            {
                message += $"\n  Control Voltage."; isNull = true;
            }
            if (newQuotationData.TinPlating == null || newQuotationData.TinPlating == "")
            {
                message += $"\n  Tin Plating."; isNull = true;
            }
            if (newQuotationData.NeutralSize == null || newQuotationData.NeutralSize == "")
            {
                message += $"\n  Neutral Size."; isNull = true;
            }
            if (newQuotationData.EarthSize == null || newQuotationData.EarthSize == "")
            {
                message += $"\n  Earth Size."; isNull = true;
            }
            if (newQuotationData.EarthingSystem == null || newQuotationData.EarthingSystem == "")
            {
                message += $"\n  Earthing System."; isNull = true;
            }

            if (!isNull)
            {
                using (SqlConnection connection = new SqlConnection(Database.ConnectionString))
                {
                    connection.Update <Quotation>(newQuotationData);
                }

                QuotationData.Update(newQuotationData);
                if (OpenPanelsWindow)
                {
                    var panelsWindow = new PanelsWindow()
                    {
                        UserData      = this.UserData,
                        QuotationData = this.QuotationData
                    };
                    this.Close();
                    panelsWindow.ShowDialog();
                }
                else
                {
                    this.Cancel_Click(sender, e);
                }
            }
            else
            {
                MessageWindow.Show("Error", message, MessageWindowButton.OK, MessageWindowImage.Information);
            }
        }