private void btn_login_Click(object sender, EventArgs e) { if (textBox_userName.Text != "" && textBox_password.Text != "") { ClassDB2 db = new ClassDB2(); db.ConnectDb(); string Query = ("select * from login where name ='" + textBox_userName.Text + "' and password='******'"); DataSet DS = new DataSet(); DS = db.SetectDB(Query, "login"); if (DS.Tables["login"].Rows.Count > 0) { Form_main.getMainForm.control1.Enabled = true; Form_main.getMainForm.heder1.Enabled = true; Form_queryDevices f = new Form_queryDevices(); // f.Location = new Point(20, 20); f.Show(); ((Form)this.TopLevelControl).Close(); this.Close(); } else { label_error.Text = "Your Name or your password not valid"; } } }
private void Form_select_Load(object sender, EventArgs e) { db = new ClassDB2(); ds = new DataSet(); DataSet ds2 = new DataSet(); DataSet ds3 = new DataSet(); DataSet ds4 = new DataSet(); db.ConnectDb(); ds = db.SetectDB("select * from DEVICES ", "DEVICES"); ds2 = db.SetectDB("select * from BILL_SALES_TABLE", "BILL_SALES_TABLE"); ds3 = db.SetectDB("select * from CUSTOMER ", "CUSTOMER"); // ds4 = db.SetectDB("select * from BILL_SALES_TABLE ", "BILL_SALES_TABLE"); comboBoxDevices.DataSource = ds; comboBoxDevices.DisplayMember = "DEVICES.name"; comboBoxDevices.ValueMember = "DEVICES.id"; comboBoxCustomer.DataSource = ds3; comboBoxCustomer.DisplayMember = "CUSTOMER.name"; comboBoxCustomer.ValueMember = "CUSTOMER.id"; comboBox_bill.DataSource = ds2; // comboBox_bill.DisplayMember = "BILL_SALES_TABLE.name"; comboBox_bill.ValueMember = "BILL_SALES_TABLE.BILL_SALES_NO"; //ds4 = db.SetectDB("select MAX(BILL_SALES_NO) from BILL_SALES_TABLE", "BILL_SALES_TABLE"); //textBox_IdBill.DataBindings.Add("text", ds4, "BILL_SALES_NO"); }
private void Form_Devices_Load(object sender, EventArgs e) { db = new ClassDB2(); ////جلب البيانات من الجدول //ds = new DataSet(); DataSet ds2 = new DataSet(); db.ConnectDb(); ds = db.SetectDB("select * from DEVICES ", "DEVICES"); ds2 = db.SetectDB("select * from CATEGROIES", "CATEGROIES"); comboBoxCategories.DataSource = ds2; comboBoxCategories.DisplayMember = "CATEGROIES.name"; comboBoxCategories.ValueMember = "CATEGROIES.id"; // textBoxاظهار بيانات الجدول في textBox_num.DataBindings.Add("text", ds, "DEVICES.id"); textBox_name.DataBindings.Add("text", ds, "DEVICES.name"); textBox_dasc.DataBindings.Add("text", ds, "DEVICES.DESCRIPTION"); textBox_issus.DataBindings.Add("text", ds, "DEVICES.issus"); textBox_man.DataBindings.Add("text", ds, "DEVICES.MANUFACTURE"); textBox_sales.DataBindings.Add("text", ds, "DEVICES.sales"); textBox_type.DataBindings.Add("text", ds, "DEVICES.type"); comboBoxCategories.DataBindings.Add("text", ds, "DEVICES.cate_name"); }
private void Form_sales_Load(object sender, EventArgs e) { db = new ClassDB2(); //جلب البيانات من الجدول ds = new DataSet(); db.ConnectDb(); ds = db.SetectDB("select * from SALES ", "SALES"); // textBoxاظهار بيانات الجدول في textBox_num.DataBindings.Add("text", ds, "SALES.SALE_NO"); // اظهار بيانات الجدول كامل dataGrid_sale.DataSource = ds; dataGrid_sale.DataMember = "SALES"; }
private void Form_setting_Load(object sender, EventArgs e) { db = new ClassDB2(); ds = new DataSet(); db.ConnectDb(); ds = db.SetectDB("select * from login ", "login"); textBox_num.DataBindings.Add("text", ds, "login.ID"); textBox_name.DataBindings.Add("text", ds, "login.name"); textBox_pass.DataBindings.Add("text", ds, "login.password"); // textBox_img.DataBindings.Add("text", ds, "login.img"); // picture_user.Image = Image.FromFile("../../Upload/" + textBox_img.Text); dataGrid_user.DataSource = ds; dataGrid_user.DataMember = "login"; }
private void Form_categ_Load(object sender, EventArgs e) { db = new ClassDB2(); //جلب البيانات من الجدول ds = new DataSet(); db.ConnectDb(); ds = db.SetectDB("select * from CATEGROIES ", "CATEGROIES"); // textBoxاظهار بيانات الجدول في textBox_num.DataBindings.Add("text", ds, "CATEGROIES.id"); textBox_name.DataBindings.Add("text", ds, "CATEGROIES.name"); // اظهار بيانات الجدول كامل dataGrid_cat.DataSource = ds; dataGrid_cat.DataMember = "CATEGROIES"; }
private void Form_customer_Load(object sender, EventArgs e) { db = new ClassDB2(); //جلب البيانات من الجدول ds = new DataSet(); db.ConnectDb(); ds = db.SetectDB("select * from CUSTOMER ", "CUSTOMER"); // textBoxاظهار بيانات الجدول في textBox_num.DataBindings.Add("text", ds, "CUSTOMER.id"); textBox_name.DataBindings.Add("text", ds, "CUSTOMER.name"); textBox_title.DataBindings.Add("text", ds, "CUSTOMER.title"); textBox_phone.DataBindings.Add("text", ds, "CUSTOMER.phone"); // اظهار بيانات الجدول كامل dataGrid_cust.DataSource = ds; dataGrid_cust.DataMember = "CUSTOMER"; }