private void FindFor(string T) { if (!"".Equals(T)) { using (var d = new cDB(GB.Instance.getCurrentSession(Session).PathDB)) { cDB.Queries q; switch (T) { case "Y": q = cDB.Queries.Movimenti_GraficoAnnuale; bGraficoY.Attributes["class"] = "not-active"; bGraficoM.Attributes["class"] = ""; break; case "M": default: q = cDB.Queries.Movimenti_GraficoMensile; bGraficoY.Attributes["class"] = ""; bGraficoM.Attributes["class"] = "not-active"; break; } Chart1.DataSource = d.EseguiSQLDataTable(q); Chart1.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (GB.Instance.getCurrentSession(Session) != null) { using (var d = new cDB(GB.Instance.getCurrentSession(Session).PathDB)) { GridView1.DataSource = d.EseguiSQLDataTable(cDB.Queries.Casse_Lista); GridView1.DataBind(); } } }
private int SalvaMovimento() { var soldi = GB.HTMLDoubleToDouble(idSoldi.Value); var data = GB.StringHTMLToDateTime(idData.Value); using (var db = new cDB(GB.Instance.getCurrentSession(Session).PathDB)) { var tran = db.BeginTransaction(); var param1 = new System.Data.Common.DbParameter[] { cDB.NewPar("nome", idNome.Value, System.Data.DbType.String), cDB.NewPar("tipo", idCassa.SelectedValue, System.Data.DbType.String), cDB.NewPar("descrizione", idDescrizione.Value, System.Data.DbType.String), cDB.NewPar("soldi", soldi, System.Data.DbType.Double), cDB.NewPar("data", data, System.Data.DbType.DateTime), cDB.NewPar("MacroArea", idMacroarea.Value, System.Data.DbType.String) }; var m1 = db.EseguiSQLNoQuery(ref tran, IDMovimento > -1 ? cDB.Queries.Movimenti_Aggiorna : cDB.Queries.Movimenti_Inserisci, param1); // con giroconto if (IDMovimento == -1 && idGiroconto.SelectedIndex > 0) { var param2 = new System.Data.Common.DbParameter[] { cDB.NewPar("nome", idNome.Value, System.Data.DbType.String), cDB.NewPar("tipo", idGiroconto.SelectedValue, System.Data.DbType.String), cDB.NewPar("descrizione", idDescrizione.Value, System.Data.DbType.String), cDB.NewPar("soldi", -soldi, System.Data.DbType.Double), cDB.NewPar("data", data, System.Data.DbType.DateTime), cDB.NewPar("MacroArea", idMacroarea.Value, System.Data.DbType.String) }; var m2 = db.EseguiSQLNoQuery(ref tran, cDB.Queries.Movimenti_Inserisci, param2); if (m1 + m2 == 2) { tran.Commit(); return(2); } else { tran.Rollback(); return(0); } } else { tran.Commit(); return(m1); } } }
protected void Page_Load(object sender, EventArgs e) { if (GB.Instance.getCurrentSession(Session) != null) { Title = "RationesCurare - " + GB.Instance.getCurrentSession(Session).UserName; using (var d = new cDB(GB.Instance.getCurrentSession(Session).PathDB)) { GridView1.DataSource = d.EseguiSQLDataTable(cDB.Queries.Movimenti_SaldoPerCassa); GridView1.DataBind(); } } }
protected void bElimina_Click(object sender, EventArgs e) { using (var db = new cDB(GB.Instance.getCurrentSession(Session).PathDB)) { var param = new System.Data.Common.DbParameter[] { cDB.NewPar("ID", IDMovimento, System.Data.DbType.Int32) }; var r = db.EseguiSQLNoQuery(cDB.Queries.Movimenti_Elimina, param); lErrore.Text = $"{r} elementi eliminati!"; DisableUI(); } }
protected void Page_Load(object sender, EventArgs e) { Title = "RationesCurare - " + Tipo; SottoTitolo = Tipo; Form.DefaultButton = bCerca.UniqueID; if (GB.Instance.getCurrentSession(Session) != null) { using (var d = new cDB(GB.Instance.getCurrentSession(Session).PathDB)) { GridView1.DataSource = d.EseguiSQLDataTable(cDB.Queries.Movimenti_Ricerca, ParametriRicerca(), GB.ObjectToInt(eMax.Text, 50)); GridView1.DataBind(); } } }
protected List <string> getDescrizioni() { var descrizioni = new List <string>(); using (var db = new cDB(GB.Instance.getCurrentSession(Session).PathDB)) using (var dr = db.EseguiSQLDataReader(cDB.Queries.Movimenti_AutoCompleteSource)) if (dr.HasRows) { while (dr.Read()) { descrizioni.Add(dr["descrizione"] as string); } } return(descrizioni); }
protected List <string> getMacroAree() { var macroaree = new List <string>(); using (var db = new cDB(GB.Instance.getCurrentSession(Session).PathDB)) using (var dr = db.EseguiSQLDataReader(cDB.Queries.Movimenti_AutoCompleteSourceMA)) if (dr.HasRows) { while (dr.Read()) { macroaree.Add(dr["MacroArea"] as string); } } return(macroaree); }
public static string getMacroAreaByDescrizione(string userName, string descrizione) { var PathDB = GB.getDBPathByName(userName); using (var db = new cDB(PathDB)) using (var dr = db.EseguiSQLDataReader(cDB.Queries.Movimenti_GetMacroAree_E_Descrizioni)) if (dr.HasRows) { while (dr.Read()) { if (descrizione.Equals(dr["descrizione"] as string, StringComparison.OrdinalIgnoreCase)) { return(dr["MacroArea"] as string); } } } return(""); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString.HasKeys()) { try { IDCassa = Request.QueryString["ID"] ?? ""; } catch { // no id } } SottoTitolo = "".Equals(IDCassa) ? "Nuova cassa" : $"Cassa {IDCassa}"; if (!Page.IsPostBack) { if (!"".Equals(IDCassa)) { using (var db = new cDB(GB.Instance.getCurrentSession(Session).PathDB)) { var par = new System.Data.Common.DbParameter[] { cDB.NewPar("nome", IDCassa) }; using (var dr = db.EseguiSQLDataReader(cDB.Queries.Casse_Carica, par)) if (dr.HasRows) { while (dr.Read()) { idNome.Value = dr["nome"] as string; idNascondi.Value = GB.ObjectToBool(dr["Nascondi"]) ? "1" : "0"; } } } } } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(GridView1, "Select$" + e.Row.RowIndex); } else if (e.Row.RowType == DataControlRowType.Footer) { using (var db = new cDB(GB.Instance.getCurrentSession(Session).PathDB)) using (var dr = db.EseguiSQLDataReader(cDB.Queries.Movimenti_Saldo)) if (dr.HasRows) { var lbl = (Label)e.Row.FindControl("lblTotal"); while (dr.Read()) { lbl.Text = GB.ObjectToDouble(dr["Saldo"], 0).ToString("c"); } } } }
protected void bSalva_Click(object sender, EventArgs e) { try { using (var db = new cDB(GB.Instance.getCurrentSession(Session).PathDB)) { var param = new System.Data.Common.DbParameter[] { cDB.NewPar("nome", idNome.Value, System.Data.DbType.String), cDB.NewPar("Nascondi", "1".Equals(idNascondi.Value), System.Data.DbType.Boolean), }; var r = db.EseguiSQLNoQuery("".Equals(IDCassa) ? cDB.Queries.Casse_Inserisci : cDB.Queries.Casse_Aggiorna, param); lErrore.Text = $"{r} elementi salvati!"; idNome.Disabled = true; } } catch (Exception ex) { lErrore.Text = $"Errore: {ex.Message}"; } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString.HasKeys()) { try { IDMovimento = GB.ObjectToInt(Request.QueryString["ID"], -1); } catch { // no id } try { Tipo = Request.QueryString["T"]; } catch { // no tipo } } SottoTitolo = IDMovimento == -1 ? "Nuovo importo" : $"Importo {IDMovimento}"; if (!Page.IsPostBack) { using (var db = new cDB(GB.Instance.getCurrentSession(Session).PathDB)) { var casse = db.EseguiSQLDataTable(cDB.Queries.Casse_Lista); idCassa.DataSource = casse; idCassa.DataBind(); if (Tipo != null) { idCassa.SelectedValue = Tipo; } idGiroconto.DataSource = casse; idGiroconto.DataBind(); if (IDMovimento > -1) { var par = new System.Data.Common.DbParameter[] { cDB.NewPar("ID", IDMovimento) }; using (var dr = db.EseguiSQLDataReader(cDB.Queries.Movimenti_Dettaglio, par)) if (dr.HasRows) { while (dr.Read()) { idNome.Value = dr["Nome"] as string; idDescrizione.Value = dr["Descrizione"] as string; idMacroarea.Value = dr["Macroarea"] as string; idCassa.SelectedValue = dr["Tipo"] as string; idSoldi.Value = GB.ObjectToHTMLDouble(dr["Soldi"], 0); idData.Value = GB.ObjectToDateTimeStringHTML(dr["Data"]); } } } else { idData.Value = GB.ObjectToDateTimeStringHTML(DateTime.Now); } } } }