private void button2_Click(object sender, EventArgs e) { AdminHome h = new AdminHome(ai); h.Show(); this.Visible = false; }
private void button3_Click(object sender, EventArgs e) { if (textBox2.Text.Length == 0 || textBox3.Text.Length == 0) { MessageBox.Show("Please filled all the field properly", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { ai.UFirstName = textBox2.Text; ai.ULastName = textBox3.Text; UpdateDBlink ul = new UpdateDBlink(); string x = ul.UpdateAdmin(textBox1.Text, textBox2.Text, textBox3.Text); MessageBox.Show(x); AdminHome h = new AdminHome(ai); h.Show(); this.Visible = false; button1.Show(); button3.Hide(); this.disableA(); } }
private void button1_Click(object sender, EventArgs e) { if (textBox2.Text.Length == 0 || textBox3.Text.Length == 0 || textBox4.Text.Length == 0 || textBox5.Text.Length == 0) { MessageBox.Show("Please filled all the field properly", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { if (textBox3.Text.Length <= 3) { MessageBox.Show("password too short", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { Admin a = new Admin { user_name = textBox2.Text, First_Name = textBox5.Text, Last_name = textBox4.Text, AdminPassword = textBox3.Text, AdminId = Convert.ToInt32(textBox1.Text), Status = status }; MessageBox.Show("New Admin Added Successfully", "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); pd.Admins.InsertOnSubmit(a); pd.SubmitChanges(); //dataGridView1.DataSource = pd.Admins; AdminHome h = new AdminHome(ai); h.Show(); this.Visible = false; } } }
private void button1_Click(object sender, EventArgs e) { UpdateDBlink ul = new UpdateDBlink(); ai = ul.getAdmin(textBox1.Text); string pass; if (textBox1.Text == ai.UName && ai.UStatus == "Admin") { if (textBox2.Text == ai.Pword) { /* HomeAdmin h = new HomeAdmin(ai); * h.Show(); * this.Visible = false; */ AdminHome h = new AdminHome(ai); h.Show(); this.Visible = false; } else { MessageBox.Show("Wrong Password or Username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { ui = ul.getUser(textBox1.Text); pass = ul.getPassword(textBox1.Text); if (textBox2.Text == pass) { UserHome h = new UserHome(ui); h.Show(); this.Visible = false; } else { MessageBox.Show("Wrong Password or Username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void button2_Click(object sender, EventArgs e) { if (textBox1.Text.Length == 0 || textBox2.Text.Length == 0 || textBox3.Text.Length == 0 || textBox4.Text.Length == 0 || textBox5.Text.Length == 0 || comboBox1.SelectedIndex.ToString() == "Select" || comboBox2.SelectedIndex.ToString() == "Select" || numericUpDown1.Value == 0) { MessageBox.Show("Please fill all the field properly", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { pp.ProductName = textBox1.Text; pp.PID = textBox2.Text; pp.Quantity = Convert.ToInt32(numericUpDown1.Value); pp.BuyingPrice = Convert.ToSingle(textBox3.Text); pp.SellingPrice = Convert.ToSingle(textBox4.Text); pp.Product_Type = textBox5.Text; pp.DivisionP = comboBox1.SelectedItem.ToString(); pp.DistrictsP = comboBox2.SelectedItem.ToString(); ProductInfo p = new ProductInfo { Name = pp.ProductName, ProductType = pp.Product_Type, Division = pp.DivisionP, Districts = pp.DistrictsP, Quantity = pp.Quantity, BuyingPrice = pp.BuyingPrice, SellingPrice = pp.SellingPrice, PId = pp.PID, Profit = Convert.ToSingle(textBox4.Text) - Convert.ToSingle(textBox3.Text), }; pm.ProductInfos.InsertOnSubmit(p); pm.SubmitChanges(); MessageBox.Show("Add Successfully", "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); AdminHome h = new AdminHome(ai); h.Show(); this.Visible = false; } }