Exemplo n.º 1
0
 private void companyDataGridView_RowLeave(object sender, DataGridViewCellEventArgs e)
 {
     Cursor = Cursors.WaitCursor;
     try
     {
         if (companyDataGridView.Rows.Count > 0)
         {
             if (companyDataGridView.IsCurrentRowDirty)
             {
                 this.Validate();
                 companyBindingSource.EndEdit();
                 int iResult = ActionClass.SaveCompany((Company)companyBindingSource.Current);
                 if (iResult > 0)
                 {
                     Console.WriteLine(iResult.ToString());
                     toolStripStatusLabel1.Text = "Saved.";
                     Thread.Sleep(500);
                     companyBindingSource.DataSource = ActionClass.FillCompanies();
                 }
             }
         }
         toolStripStatusLabel1.Text = "Ready...";
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error - " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         toolStripStatusLabel1.Text = "Error - " + ex.Message + ". Please refer to system administrator.";
         //throw;
     }
     Cursor = Cursors.Default;
 }
Exemplo n.º 2
0
        public void InitComponents()
        {
            departmentBindingSource.DataSource    = ActionClass.FillDepartments();
            miscellaneousBindingSource.DataSource = ActionClass.FillMiscellaneous();
            holidayBindingSource.DataSource       = ActionClass.FillHolidays();
            companyBindingSource.DataSource       = ActionClass.FillCompanies();
            checkBoxShowHourMinDTRPrint.Checked   =
                Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["PrintAll"]);
            // 1st IP Address
            textBoxIPAddress.Text = System.Configuration.ConfigurationManager.AppSettings["IPAddressNW1"];
            textBoxPortNo.Text    = System.Configuration.ConfigurationManager.AppSettings["IPortNW1"];
            textBoxSerialNo.Text  = ConfigurationManager.AppSettings["MachineSN_NW1"];
            textBoxKey.Text       = ConfigurationManager.AppSettings["MacKeyTempNW1"];
            if (System.Configuration.ConfigurationManager.AppSettings["ScreenTypeNW1"] == "CO")
            {
                radioButtonColored.Checked = true;
            }
            else
            {
                radioButtonBW.Checked = true;
            }

            // 2ns IP Address
            textBoxIP1.Text     = System.Configuration.ConfigurationManager.AppSettings["IPAddressNW2"];
            textBoxPort1.Text   = System.Configuration.ConfigurationManager.AppSettings["IPortNW2"];
            textBoxSerial1.Text = ConfigurationManager.AppSettings["MachineSN_NW2"];
            textBoxKey1.Text    = ConfigurationManager.AppSettings["MacKeyTempNW2"];
            if (System.Configuration.ConfigurationManager.AppSettings["ScreenType2"] == "CO")
            {
                radioButtonColor1.Checked = true;
            }
            else
            {
                radioButtonBW1.Checked = true;
            }


            labelCompanyName.Text = SCompanyName;
        }