Esempio n. 1
0
 private void mnuInsert_Click(object sender, EventArgs e)
 {
     
     try
     {
         assignChildData(); // assign the child data to the class properties 
         _order.OrderLineClass.addNewRecord(); // add a new order line record
         dgvOrderLines.Refresh(); // refresh the datagrid view
         calculateGrandTotal(); // calculate the total
         emptyProductControls();
         // if the combo boxes selected items arent null
         if (cboCustomer.SelectedItem != null && txtShipAddress.Text != string.Empty)
         {
             mnuInsert.Enabled = false; mnuSave.Enabled = true; mnuDeleteLine.Enabled = true;
             // generate a code for the purhcase code by passing a value from this text boxe
                 txtOrderName.Text = cboCustomer.Text;
          
         }
         else
         {
             mnuInsert.Enabled = false;
         }
         mnuInsert.Enabled = false;
     }
     catch (NullReferenceException ex)
     {
         _errorCollection = new ErrorCollection(ex.Message.ToString()); // write the error message to the file 
         _errorCollection.writeToFile(); // write to the error log by passing the exception 
     }
 }
Esempio n. 2
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     // if allow login is true
     if (allowLogin())
     {
         FrmParent.AccessRights = getAccessRightsHashTable(); // get the access rights for frmParent
         FrmView.AccessRights = getAccessRightsHashTable(); // get the access rights for frmView
         _frm.CheckAccessRights("Parent"); // check the access rights for parent form
         _frm.DisplayUser(txtUsername.Text); // call a method from the parent frm to display the current user by passing the string
         _frm.OrganizeMenuStrip(true); // call method to enable the menu strip by passing the boolean value
         this.Close();
     }
     else
     {
         ErrorProvider.SetError(this, "Invalid login. Please try again."); // show the error message
         string strTemp = "Invalid Login" + " " + "Username:" + txtUsername.Text; // create temp string 
         _errorCollection = new ErrorCollection(strTemp); // make a new instance of the error collection class and pass temp string
         _errorCollection.writeToFile(); // write to the file in the error collection class
     }
 }
 private void mnuInsert_Click(object sender, EventArgs e)
 {
     try
     {
         assignChildData(); // assign the child data to the class properties 
         _supplierPurchase.SupplierPurchaseLineClass.addNewRecord(); // add a new supplier purchase line record
         dgvPurchaseLines.Refresh(); // refresh the datagrid view
         calculateGrandTotal(); // calculate the total
         emptyRawIngredientControls();
         // if the combo boxes selected items arent null
         if (cboSupplier.SelectedItem != null && cboBranch.Text != string.Empty)
         {
             mnuInsert.Enabled = false; mnuSave.Enabled = true; mnuDeleteLine.Enabled = true;
             // generate a code for the purhcase code by passing values from these two text boxes
             txtPurchaseCode.Text = cboSupplier.Text + "_" + cboBranch.Text;
         }
         else
         {
             mnuInsert.Enabled = false;
         }
         mnuInsert.Enabled = false;
     }
     catch (NullReferenceException ex)
     {
         _errorCollection = new ErrorCollection(ex.Message.ToString()); // write the error message to the file 
         _errorCollection.writeToFile(); // write to the error log by passing the exception 
     }
 }