DataTable AccountsTable() { u = new Utilisateur(); con = new Connexion(); dataTable = new DataTable(); dataTable = con.showDataTable("select * from dbo.Comptes" + " where U_id = '" + u.ID + "'"); return(dataTable); }
private void FillCategoryList() { con = new Connexion(); cTable = con.showParamDataTable("dbo.Get_Comptes_from_ID_Utili", "@ID"); DataTable actionTable = new DataTable(); int i = 0; Label1.Controls.Add(new LiteralControl("<div>")); Label1.Controls.Add(new LiteralControl("<datalist id=" + "catyList" + ">")); foreach (DataRow cRaw in cTable.Rows) { actionTable = con.showDataTable("select * from dbo.action" + " where C_id = '" + cRaw["ID"] + "'"); foreach (DataRow aRow in actionTable.Rows) { actionTable = con.showDataTable("select * from dbo.categorie where A_id = '" + aRow["ID"] + "'"); if (actionTable.Rows.Count != 0) { if (!catList.Contains(actionTable.Rows[0][1].ToString())) { catList.Add(actionTable.Rows[0][1].ToString()); Label1.Controls.Add(new LiteralControl("<option>")); var Tname = new Label(); Tname.Text = actionTable.Rows[0][1].ToString(); Label1.Controls.Add(Tname); Label1.Controls.Add(new LiteralControl("</option>")); } } } } Label1.Controls.Add(new LiteralControl("</datalist>")); Label1.Controls.Add(new LiteralControl("</div>")); }
private DataTable ActionTable() { con = new Connexion(); DataTable cTable = con.showParamDataTable("dbo.Get_Comptes_from_ID_Utili", "@ID"); DataTable table = new DataTable(); foreach (DataRow cRaw in cTable.Rows) { table.Merge(con.showDataTable("select * from dbo.action" + " where C_id = '" + cRaw["ID"] + "'")); } table.DefaultView.Sort = "Time DESC"; return(table.DefaultView.ToTable()); }
protected void Page_Load(object sender, EventArgs e) { u = new Utilisateur(); a = new Action(); c = new Compte(); con = new Connexion(); if (u.ID != null) { } else if (Request.Cookies["logIn"] != null) { u.Email = Request.Cookies["logIn"]["Email"]; u.Password = Request.Cookies["logIn"]["Password"]; u.LogIn(); } else if (u.ID == null) { Response.Redirect("Login.aspx"); } if (a.EventType == "+") { cbAjout.Checked = true; } if (_bMod) { _dataTable = new DataTable(); _dataTable = con.showParamDataTable("dbo.Get_Comptes_from_ID_Utili", "@ID"); dlCompts.DataSource = _dataTable; dlCompts.DataBind(); dlCompts.DataTextField = "Nom"; dlCompts.DataValueField = "ID"; dlCompts.DataBind(); //_bMod = false; } if (a.ID != null && tbPrix.Text == String.Empty) { _dataTable = new DataTable(); _dataTable = con.showDataTable("select * from dbo.action" + " where ID = '" + a.ID + "'"); string prix; prix = _dataTable.Rows[0][3].ToString().Trim(); if (prix.Contains("-")) { tbPrix.Text = (-float.Parse(prix)).ToString(); } else { tbPrix.Text = prix; cbAjout.Checked = true; } tbDes.Text = _dataTable.Rows[0][2].ToString().Trim(); dlCompts.Items.FindByValue(c.ID).Selected = true; btnEvent.Text = "Modifier Event"; _bMod = false; } FillCategoryList(); }
protected void Button1_Click(object sender, EventArgs e) { a = new Action(); inMoney = new In(); outMoney = new Out(); c = new Compte(); con = new Connexion(); a.Montant = float.Parse(tbPrix.Text); a.Des = tbDes.Text; c.ID = dlCompts.Text; _bMod = true; if (c.ID == dlCompts.Text || a.ID == null) { if (a.ID == null) { if (cbAjout.Checked) { a.Ajouter(); a.ID = con.showDataTable("select ID from Action where C_id = '" + c.ID + "' order by TIme desc").Rows[0]["ID"].ToString(); inMoney.cValue = tags.Value; inMoney.Add(); } else { { a.Montant = float.Parse("-" + a.Montant); a.Ajouter(); outMoney.Withdraw(); } } Response.Redirect("HomePage.aspx"); } else { a.Time = DateTime.Parse(_dataTable.Rows[0][1].ToString()); if (cbAjout.Checked) { a.Modifier(); } else { a.Montant = float.Parse("-" + a.Montant); a.Modifier(); } Response.Redirect("HomePage.aspx"); } } else { a.Time = DateTime.Parse(_dataTable.Rows[0][1].ToString()); a.Suppretion(); a.Ajouter(); Response.Redirect("HomePage.aspx"); } }