private static int DoRegisterNewNewConnectionInDb(NewConnectionInfo newConnectionDetails)
        {
            int returnVal = 0;
            MySql.Data.MySqlClient.MySqlConnection msqlConnection = OpenDbConnection();

            try
            {
                //define the command reference
                MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand();

                //define the connection used by the command object
                msqlCommand.Connection = msqlConnection;

                msqlCommand.CommandText = "INSERT INTO application_register(apps_no,payment_id,customerId,received_date) "
                                                   + "VALUES(@apps_no,@payment_id,@customerId,@received_date)";

                msqlCommand.Parameters.AddWithValue("@apps_no", newConnectionDetails.appsNo);
                msqlCommand.Parameters.AddWithValue("@payment_id", newConnectionDetails.paymentId);
                msqlCommand.Parameters.AddWithValue("@customerId", newConnectionDetails.customerId);
                msqlCommand.Parameters.AddWithValue("@received_date", newConnectionDetails.receivedDate);
                msqlCommand.ExecuteNonQuery();

                returnVal = 1;
            }
            catch (Exception er)
            {
                returnVal = 0;
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }
            return returnVal;
        }
        public static void EditNewConnection(NewConnectionInfo newConnectionToEdit)
        {
            MySql.Data.MySqlClient.MySqlConnection msqlConnection = OpenDbConnection();

            try
            {   //define the command reference
                MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand();
                msqlCommand.Connection = msqlConnection;

                msqlCommand.CommandText = "UPDATE application_register SET payment_id=@payment_id,received_date=@received_date WHERE apps_no=@apps_no";

                msqlCommand.Parameters.AddWithValue("@payment_id", newConnectionToEdit.paymentId);
                msqlCommand.Parameters.AddWithValue("@received_date", newConnectionToEdit.receivedDate);
                msqlCommand.Parameters.AddWithValue("@apps_no", newConnectionToEdit.appsNo);
                msqlCommand.ExecuteNonQuery();
            }

            catch (Exception er)
            {
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }
        }
        private static List<NewConnectionInfo> QueryAllNewConnectionList()
        {
            List<NewConnectionInfo> NewConnectionList = new List<NewConnectionInfo>();

            MySql.Data.MySqlClient.MySqlConnection msqlConnection = OpenDbConnection();

            try
            {   //define the command reference
                MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand();
                msqlCommand.Connection = msqlConnection;

                msqlCommand.CommandText = "Select * From application_register;";
                MySql.Data.MySqlClient.MySqlDataReader msqlReader = msqlCommand.ExecuteReader();

                while (msqlReader.Read())
                {
                    NewConnectionInfo NewConnection = new NewConnectionInfo();

                    NewConnection.appsNo = msqlReader.GetString("apps_no");
                    NewConnection.customerId = msqlReader.GetString("customerId");
                    NewConnection.paymentId = msqlReader.GetString("payment_id");
                    NewConnection.receivedDate = msqlReader.GetDateTime("received_date");
                    NewConnectionList.Add(NewConnection);
                }

            }
            catch (Exception er)
            {
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }

            return NewConnectionList;
        }
 public static int DoRegisterNewNewConnection(NewConnectionInfo newConnectionDetails)
 {
     return DoRegisterNewNewConnectionInDb(newConnectionDetails);
 }
        private void submitBtn_Click(object sender, RoutedEventArgs e)
        {
            NewConnectionInfo newConnection = new ESCMSData.NewConnectionInfo();

            newConnection.paymentId = paymentIDTxtbox.Text;
            newConnection.customerId = customerIdlabel.Content.ToString();
            newConnection.receivedDate = applicationReceivedDateDatePicker.SelectedDate.Value;

            if (isEdit == false)
            {
                newConnection.appsNo = GenerateId();
                ESCMSStorage.DbInteraction.DoRegisterNewNewConnection(newConnection);

                estimateInfo esInfo = new estimateInfo();
                esInfo.appsNo = newConnection.appsNo;
                ESCMSStorage.DbInteraction.DoRegisterNewEstimate(esInfo);
            }
            else
            {
                newConnection.appsNo = newConnectionId;
                ESCMSStorage.DbInteraction.EditNewConnection(newConnection);
            }

            this.Close();
        }