private void MainView_Load(object sender, EventArgs e) { ConnectDB.getData(); POS ps = new POS(); ps.ShowDialog(); //MdiClient ctlMDI; //// Loop through all of the form's controls looking //// for the control of type MdiClient. //foreach (Control ctl in this.Controls) //{ // try // { // // Attempt to cast the control to type MdiClient. // ctlMDI = (MdiClient)ctl; // // Set the BackColor of the MdiClient control. // ctlMDI.BackColor = this.BackColor; // } // catch (InvalidCastException) // { // // Catch and ignore the error if casting failed. // } //} //// Display a child form to show this is still an MDI application. ////Form2 frm = new Form2(); ////frm.MdiParent = this; //frm.Show(); }
private void Logins() { try { GetLoginInfo login = new GetLoginInfo(txtUserID.Text, txtPassword.Text); if (combRole.Text == "Admin") { if (login.counter == 1) { login.validateLogin(); login.getRoleName(); username = login.Sname + " " + login.Fname; if (login.RoleName == "General Manager" || login.RoleName == "Sales Manager") { MainView main = new MainView(); main.Show(); this.Hide(); } else { MessageBox.Show("Either the Username or Password you supplied is incorrect, cross check and try again!"); } } } else if (combRole.Text == "Sales Clerk") { if (login.counter == 1) { login.validateLogin(); login.getRoleName(); firstname = login.Fname; username = login.Sname + " " + login.Fname; if (login.RoleName == "Sales Clerk") { POS sales = new POS(); sales.userdetail = username; sales.Show(); this.Hide(); } else { MessageBox.Show("Either the Username or Password you supplied is incorrect, cross check and try again!"); } } } else { MessageBox.Show("Either the Username or Password you supplied is incorrect, cross check and try again!"); } } catch (Exception) { throw; } }
private void btnEnter_Click(object sender, EventArgs e) { POS showPOS = (POS)Application.OpenForms["POS"]; //showPOS.labelChange.ForeColor = Color.Green; //showPOS.richTextBox1.Text = showPOS.displayChange; showPOS.Show(); double change = Convert.ToDouble(richCashOut.Text) - Convert.ToDouble(pospay); showPOS.labelChange.Text = String.Format("{0:0,0.00}", change); //MessageBox.Show(String.Format("{0:0,0.00}", change), "Label Change Text"); //showPOS.labelChange.TextChanged += labelChange_TextChanged; showPOS.AddSalesToDB(); showPOS.UpdateStockWithQuantityAfterSale(); showPOS.PrintReceipt(); //showPOS.RemoveItemFromListviewAfterSale(); //showPOS.SetTextBoxToNullAfterSale(); this.Hide(); }