Ejemplo n.º 1
0
        public void UpdateTheme(Theme theme)
        {
            ThemeDT themeDT = new ThemeDT(theme);

            FillCommand(this.Command, themeDT);
            this.Command.CommandText = "UPDATE Themes SET [name]=? WHERE [id]=?;";
            this.Connect(this.Command);
            this.ExecuteNonQuery(this.Command, true);
        }
Ejemplo n.º 2
0
        private List <ThemeDT> MapToThemesDTList(OleDbDataReader reader)
        {
            List <ThemeDT> ThemeDTList = new List <ThemeDT>();

            while (reader.Read())
            {
                ThemeDT theme = new ThemeDT();
                theme.ID   = Convert.ToInt32(reader["id"]);
                theme.Name = reader["name"] != DBNull.Value ? reader["Name"].ToString() : "Undefined";
                ThemeDTList.Add(theme);
            }
            return(ThemeDTList);
        }
Ejemplo n.º 3
0
        private void FillCommand(OleDbCommand com, ThemeDT themeDT)
        {
            OleDbParameter p1 = new OleDbParameter("name", OleDbType.LongVarWChar);

            p1.Value = themeDT.Name;

            OleDbParameter p2 = new OleDbParameter("ID", OleDbType.BigInt);

            p2.Value = themeDT.ID;
            this.Command.Parameters.Clear();
            com.Parameters.Add(p1);
            com.Parameters.Add(p2);
        }
Ejemplo n.º 4
0
        public int AddTheme(Theme theme)
        {
            ThemeDT themeDT = new ThemeDT(theme);

            FillCommand(this.Command, themeDT);
            this.Command.CommandText = "INSERT INTO [Themes] ([name])VALUES (?);";
            this.Connect(this.Command);
            this.ExecuteNonQuery(this.Command, false);
            this.Command.CommandText = "SELECT @@IDENTITY as newID;";
            int id = Convert.ToInt32(this.ExecuteScalar(this.Command, true));

            return(id);
        }