示例#1
0
 private void buttonUpdateHQ_Click(object sender, EventArgs e)
 {
     using (HQConnection x = new HQConnection())
     {
         try
         {
             HQConnection.UpdateWarrenties();
             MessageBox.Show(this, "Warranties Successfully Updated", "Success");
         }
         catch (Exception ex)
         {
             MessageBox.Show(this, "Error Occurred While Updating. "
                             + Environment.NewLine
                             + "Please Check the Error Message." + Environment.NewLine
                             + "Please take a screen shot and send to System Administrator" + Environment.NewLine + Environment.NewLine
                             + ex.Message, "Error Occurred");
         }
     }
 }
示例#2
0
        private void buttonCustmerForm_Click(object sender, EventArgs e)
        {
            using (HQConnection hqConnection = new HQConnection())
            {
                try
                {
                    hqConnection.DedicatedConnection.Open();

                    hqConnection.DedicatedConnection.Close();
                    CustomerForm CustomerForm = new CustomerForm();
                    CustomerForm.ShowDialog(this);
                }
                catch (Exception ex)
                {
                    DetailedDialog x = new DetailedDialog(new PropertyGrid());
                    x.Message = "Error Occurred while connecting to server.";
                    x.Details = ex.Message;
                    x.Text    = "Connection Error.";
                    x.ShowDialog(this);
                }
            }
        }