private void textBox1_TextChanged(object sender, EventArgs e) { PointOfSellEntities db = new PointOfSellEntities(); var query = db.Clerks.Where(x => x.ClerkName.Contains(this.textBox1.Text)).ToList(); this.metroGrid1.DataSource = query; }
private void metroTile1_Click(object sender, EventArgs e) { if (Val.IsStringValid(this.textBox2.Text) && Val.IsStringValid(this.textBox4.Text) && Val.IsStringValid(this.textBox5.Text)) { try { PointOfSellEntities db = new PointOfSellEntities(); Clerk cl = new Clerk(); cl.ClerkID = cl.autoUserID(); cl.ClerkName = this.textBox2.Text; cl.Address = this.textBox3.Text; cl.Salary = Int32.Parse(this.textBox4.Text); cl.Password = this.textBox5.Text; cl.DeptID = this.deptID; cl.JoinDate = this.metroDateTime1.Value; db.Clerks.Add(cl); db.SaveChanges(); } catch (Exception ex) { MetroMessageBox.Show(this, "Message", ex.Message.ToString(), MessageBoxButtons.OK); } } MetroMessageBox.Show(this, "Message", "Value Has been Update ", MessageBoxButtons.OK); }
private void CustomerCURD_Load(object sender, EventArgs e) { PointOfSellEntities db = new PointOfSellEntities(); var data = from s in db.Customers select new { s.CustomerID, s.CustomerName, s.CustomerAddress }; var result = data.ToList(); this.metroGrid1.DataSource = result; }
void populateGridView() { PointOfSellEntities db = new PointOfSellEntities(); var data = from s in db.Customers select new { s.CustomerID, s.CustomerName, s.CustomerAddress }; var result = data.ToList(); this.metroGrid1.DataSource = result; }
void populategridView() { using (PointOfSellEntities db = new PointOfSellEntities()) { var query = db.Clerks.ToList(); this.metroGrid1.DataSource = query; } }
private void CustomerADD_Load(object sender, EventArgs e) { using (PointOfSellEntities db = new PointOfSellEntities()) { Customer cus = new Customer(); this.label1.Text = cus.autoUserID(); } this.clear(); }
private void metroTextBoxSearch_TextChanged(object sender, EventArgs e) { PointOfSellEntities db = new PointOfSellEntities(); var query = db.Customers.Where(x => x.CustomerName.Contains(this.metroTextBoxSearch.Text) || x.CustomerAddress.Contains(this.metroTextBoxSearch.Text)).ToList(); var query2 = from s in query select new { s.CustomerID, s.CustomerName, s.CustomerAddress }; var result = query2.ToList(); this.metroGrid1.DataSource = result; }
private void metroTile1_Click(object sender, EventArgs e) { PointOfSellEntities db = new PointOfSellEntities(); String ClerkID = this.index; var query = db.Clerks.Where(x => x.ClerkID == ClerkID).First(); db.Clerks.Remove(query); db.SaveChanges(); ClearAll(); }
private void metroTile3delete_Click(object sender, EventArgs e) { PointOfSellEntities db = new PointOfSellEntities(); // String cusId = this.metroGrid1.Rows[e.RowIndex].Cells[0].Value.ToString(); //this.ClerkID = cusId; var frm = new ClerkDelete(this.ClerkID); frm.Location = this.Location; frm.StartPosition = FormStartPosition.Manual; frm.FormClosing += delegate { this.Show(); }; frm.Show(); this.Hide(); }
private void ClerkDelete_Load(object sender, EventArgs e) { PointOfSellEntities db = new PointOfSellEntities(); String ClerkID = this.index; var query = db.Clerks.Where(x => x.ClerkID == ClerkID).First(); this.label8.Text = query.ClerkID; this.textBox2.Text = query.ClerkName; this.textBox3.Text = query.Address; this.textBox4.Text = query.Salary.ToString(); this.textBox5.Text = query.Password; this.textBox6.Text = query.Manager; this.textBox7.Text = query.JoinDate.ToString(); }
private void metroGrid1_CellClick(object sender, DataGridViewCellEventArgs e) { PointOfSellEntities db = new PointOfSellEntities(); String cusId = this.metroGrid1.Rows[e.RowIndex].Cells[0].Value.ToString(); this.ClerkID = cusId; /* var frm = new Info(this.ClerkID); * frm.Location = this.Location; * frm.StartPosition = FormStartPosition.Manual; * frm.FormClosing += delegate { this.Show(); }; * frm.Show(); * this.Hide(); * */ }
private void metroGrid1_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { this.CustomerSelectedID = metroGrid1.Rows[e.RowIndex].Cells[0].Value.ToString(); PointOfSellEntities db = new PointOfSellEntities(); var query = db.Customers.Where(x => x.CustomerID == CustomerSelectedID).First(); this.metroTextBoxCustName.Text = query.CustomerName; this.metroTextBoxCustAddress.Text = query.CustomerAddress; this.metrotextboxCustomerID.Text = CustomerSelectedID; } catch (Exception E) { MessageBox.Show(E.Message.ToString()); } }
private void ClerkUpdate_Load(object sender, EventArgs e) { PointOfSellEntities db = new PointOfSellEntities(); String ClerkID = this.index; var query = db.Clerks.Where(x => x.ClerkID == ClerkID).First(); //this.label8.Text = query.ClerkID; this.textBox2.Text = query.ClerkName; this.textBox3.Text = query.Address; this.textBox4.Text = query.Salary.ToString(); this.textBox5.Text = query.Password; this.metroComboBox1.SelectedValue = query.Manager; this.metroDateTime1.Value = query.JoinDate; this.metroComboBox1.Items.Add("Sales"); this.metroComboBox1.Items.Add("Marketing"); this.metroComboBox1.Items.Add("Human Resourse"); }
private void metroTile1AddCustomer_Click(object sender, EventArgs e) { using (PointOfSellEntities db = new PointOfSellEntities()) { try { Customer cus = new Customer(); cus.CustomerName = this.metroTextBox1name.Text; cus.CustomerAddress = this.metroTextBox2Address.Text; cus.CustomerID = cus.autoUserID(); db.Customers.Add(cus); db.SaveChanges(); this.clear(); this.label1.Text = cus.autoUserID(); } catch (Exception a) { MessageBox.Show(a.Message.ToString()); //throw; } } }
private void metroTile2UpdateCustomer_Click(object sender, EventArgs e) { PointOfSellEntities db = new PointOfSellEntities(); if (IsStringValid(this.metroTextBoxCustName.Text) && IsStringValid(this.metroTextBoxCustAddress.Text)) { try { var query = db.Customers.Where(x => x.CustomerID == CustomerSelectedID).First(); query.CustomerAddress = this.metroTextBoxCustAddress.Text; query.CustomerName = this.metroTextBoxCustName.Text; db.SaveChanges(); this.populateGridView(); this.ClearAll(); } catch (Exception) { MessageBox.Show(this, "Message ", "Please Enter the Updated Name and Address ", MessageBoxButtons.OK); //throw; } } }