private void AddBook_Load(object sender, EventArgs e) { c = new Connexion(); b = new Books(); SelectfromTable("SELECT * FROM Autor", "autor_name", cb_Writer); SelectfromTable("SELECT * FROM EDITOR", "EDITOR_name", cb_Publisher); SelectfromTable("SELECT * FROM Category", "nom", cb_cate); SelectfromTable("SELECT * FROM Zon", "nom", cb_zon); if (b.ID != null) { dataTable = c.showDataTable(String.Format(@"SELECT * FROM dbo.book WHERE book_id = '{0}'", b.ID)); using (MemoryStream ms = new MemoryStream(c.getImage(int.Parse(dataTable.Rows[0]["image_id"].ToString())))) { image = Image.FromStream(ms); pic_book.Image = image; } tb_Title.Text = dataTable.Rows[0]["title"].ToString(); tb_ISBN.Text = dataTable.Rows[0]["book_isbn"].ToString(); tb_Pnum.Text = dataTable.Rows[0]["page_number"].ToString(); tb_Amount.Text = dataTable.Rows[0]["quantity"].ToString(); mtb_datePub.Text = DateTime.Parse(dataTable.Rows[0]["date_created"].ToString()).ToString("dd:mm:yyyy"); cb_Writer.Text = c.executer_valeur(string.Format(@"SELECT autor_name FROM Autor WHERE [aut_id] = '{0}'", dataTable.Rows[0]["aut_id"].ToString())); cb_Publisher.Text = c.executer_valeur(string.Format(@"SELECT EDITOR_name FROM EDITOR WHERE [EDITOR_id] = '{0}'", dataTable.Rows[0]["id_editor"].ToString())); cb_cate.Text = c.executer_valeur(string.Format(@"SELECT nom FROM category WHERE [id] = '{0}'", dataTable.Rows[0]["category"].ToString())); cb_zon.Text = c.executer_valeur(string.Format(@"SELECT nom FROM Zon WHERE [id] = '{0}'", dataTable.Rows[0]["zon_id"].ToString())); But_Ok.Text = "Update"; } }
public static DataTable Sys_Search(String name) { Connexion c = new Connexion(); c.Con.Open(); DataTable data = c.showDataTable("exec _SearchPerson '"+name+"'"); c.Con.Close(); return data; }
private void Dashbord_Control_Load(object sender, EventArgs e) { c = new Connexion(); //Fill Late table dataTable = c.showDataTable("SELECT TOP 5 * FROM dbo.Borrow ORDER BY date_beg DESC"); DG_Late.DataSource = dataTable; //Fill Book table dataTable.Clear(); dataTable = c.showDataTable("SELECT TOP 5 * FROM dbo.Book ORDER BY date_added DESC"); DG_Book.DataSource = dataTable; //Fill Autor table dataTable.Clear(); dataTable = c.showDataTable("SELECT TOP 5 * FROM dbo.Autor"); DG_Autor.DataSource = dataTable; }
//-----Profile Info Change private void userInfo() { p = new Person(); c = new Connexion(); _dataTable = c.showDataTable(string.Format(@"SELECT * FROM dbo.Person WHERE per_id = {0}", p.ID)); if (_dataTable.Rows.Count > 0) { lb_Uname.Text = _dataTable.Rows[0].ItemArray[0] + " " + _dataTable.Rows[0].ItemArray[1]; } //pic_user.Image = getImage(); }
private void bt_Login_Click(object sender, EventArgs e) { p = new Person(); l = new Login(); c = new Connexion(); con = c; l.Email = tb_Uname.Text; l.PassWord = tb_Pword.Text; string messag = l.CheckLogin().Trim(); Console.WriteLine(messag); if (messag.Equals("50500##Connected")) { this.Hide(); dataTable = c.showDataTable(string.Format(@"SELECT [per_id],[image_id] FROM dbo.Person WHERE email = '{0}'", tb_Uname.Text)); p.ID = (int)dataTable.Rows[0].ItemArray[0]; //p.Image_Id = dataTable.Rows[0]["image_id"].ToString(); if (cb_Rme.Checked) { saveInfo(); } d = new Dashboard(); d.Show(); } else if (messag.Equals("50404##user undifounded")) { tb_Uname.BackColor = Color.FromArgb(255, 173, 173); } else { tb_Pword.BackColor = Color.FromArgb(255, 173, 173); } }
void dataGridRefresh() { dataTable = c.showDataTable(string.Format(@"SELECT * FROM dbo.Autor")); DG_writer.DataSource = dataTable; }
void dataGridRefresh() { dataTable = c.showDataTable(string.Format(@"Select * FROM dbo.Book")); DG_book.DataSource = dataTable; }
void SelectfromTable(string sqlString, string name, ComboBox cb) { dataTable = c.showDataTable(sqlString); cb.DataSource = dataTable; cb.DisplayMember = name; }