コード例 #1
0
        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();
                }
            }
        }
コード例 #2
0
        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);
                    }
                }
            }
        }