Exemplo n.º 1
0
 //Delete an Object in database Config
 public static int Delete(Config_Object DeletingObject)
 {
     List<SqlParameter> paralist = new List<SqlParameter>();
     string DeleteQuery =
     @"Delete [Config]
     Where ConfigName= @ConfigName";
     paralist.Add(new SqlParameter("ConfigName", DeletingObject.ConfigName));
     return commonDatabase.ExecuteNonQuerySQL(clsConnectionString.GetConnectionString(), DeleteQuery, paralist);
 }
Exemplo n.º 2
0
 //Save changes of an Object to database Config
 public static int SaveChanged(Config_Object UpdatingObject)
 {
     List<SqlParameter> paralist = new List<SqlParameter>();
     string UpdateQuery =
     @"Update [systbModules] SET
        ConfigValue= @ConfigValue
     Where ConfigName= @ConfigName";
     paralist.Add(new SqlParameter("ConfigName", UpdatingObject.ConfigName));
     paralist.Add(new SqlParameter("ConfigValue", UpdatingObject.ConfigValue));
     return commonDatabase.ExecuteNonQuerySQL(clsConnectionString.GetConnectionString(), UpdateQuery, paralist);
 }
Exemplo n.º 3
0
 //Get an Object of Config
 public static Config_Object GetObject(string _ConfigName)
 {
     List<SqlParameter> paralist = new List<SqlParameter>();
     Config_Object newObject = new Config_Object();
     string SelectQuery = "Select * from [Config] where (1=1) and [ConfigName]= @ConfigName";
     paralist.Add(new SqlParameter("ConfigName", _ConfigName));
     DataTable tb = commonDatabase.GetSQLDataTable(clsConnectionString.GetConnectionString(), SelectQuery, paralist);
     if (tb.Rows.Count < 1) return null;
     DataRow row = tb.Rows[0];
     newObject.ConfigName = (string)row["ConfigName"];
     if (row["ConfigValue"].ToString() != "") newObject.ConfigValue = (string)row["ConfigValue"];
     return newObject;
 }
Exemplo n.º 4
0
 //Insert Config
 public static int Insert(Config_Object newObject)
 {
     string InsertQuery = "Insert Into [Config]";
     List<SqlParameter> paralist = new List<SqlParameter>();
     string _val = "", _para = "";
     _val += "ConfigName, "; _para += "@ConfigName, ";
     paralist.Add(new SqlParameter("ConfigName", newObject.ConfigName));
     if (newObject.ConfigValue != null)
     {
         _val += "ConfigValue, "; _para += "@ConfigValue, ";
         paralist.Add(new SqlParameter("ConfigValue", newObject.ConfigValue));
     }
     InsertQuery += "(" + _val + ") Values (" + _para + ")";
     InsertQuery = InsertQuery.Replace(", )", ")");
     return commonDatabase.ExecuteNonQuerySQL(clsConnectionString.GetConnectionString(), InsertQuery, paralist);
 }
Exemplo n.º 5
0
 //Select Config
 public static List<Config_Object> SelectAll()
 {
     string SelectQuery = @"Select * from [Config]";
     List<Config_Object> result = new List<Config_Object>();
     DataTable tb = commonDatabase.GetSQLDataTable(clsConnectionString.GetConnectionString(), SelectQuery);
     foreach (DataRow row in tb.Rows)
     {
         Config_Object newObject = new Config_Object();
         newObject.ConfigName = (string)row["ConfigName"];
         if (row["ConfigValue"].ToString() != "") newObject.ConfigValue = (string)row["ConfigValue"];
         result.Add(newObject);
     }
     return result;
 }