Exemple #1
0
 /// <summary>
 /// Add
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Add(tb_config_model model, DbConn conn)
 {
     return SqlHelper.Visit((ps) =>
     {
         tb_config_model config = Get(conn, model.key);
         if (config == null)
             return Add(conn, model);
         return false;
     });
 }
Exemple #2
0
 public virtual bool Add(DbConn PubConn, tb_config_model model)
 {
     List<ProcedureParameter> Par = new List<ProcedureParameter>()
         {
             new ProcedureParameter("@key",    model.key),
             //����Value
             new ProcedureParameter("@value",    model.value),
             //���ñ�ע��Ϣ
             new ProcedureParameter("@remark",    model.remark)
         };
     int rev = PubConn.ExecuteSql(@"insert into tb_config([key],value,remark)
                                    values(@key,@value,@remark)", Par);
     return rev == 1;
 }
Exemple #3
0
        public virtual bool Edit(DbConn PubConn, tb_config_model model)
        {
            List<ProcedureParameter> Par = new List<ProcedureParameter>()
            {

                    //����Value
                    new ProcedureParameter("@value",    model.value),
                    //���ñ�ע��Ϣ
                    new ProcedureParameter("@remark",    model.remark)
            };
            Par.Add(new ProcedureParameter("@key", model.key));

            int rev = PubConn.ExecuteSql("update tb_config set value=@value,remark=@remark where [key]=@key", Par);
            return rev == 1;
        }
Exemple #4
0
 public ActionResult Update(tb_config_model model)
 {
     using (DbConn conn = DbConfig.CreateConn(DataConfig.MqManage))
     {
         conn.Open();
         bool flag = configDal.Edit(conn, model);
         if (flag)
         {
             CacheManage.Remove("configCache");
             return RedirectToAction("index");
         }
         else
         {
             ModelState.AddModelError("Error", "更新错误");
             return View(model);
         }
     }
 }
Exemple #5
0
        public virtual tb_config_model CreateModel(DataRow dr)
        {
            var o = new tb_config_model();

            //����Key
            if (dr.Table.Columns.Contains("key"))
            {
                o.key = dr["key"].Tostring();
            }
            //����Value
            if (dr.Table.Columns.Contains("value"))
            {
                o.value = dr["value"].Tostring();
            }
            //���ñ�ע��Ϣ
            if (dr.Table.Columns.Contains("remark"))
            {
                o.remark = dr["remark"].Tostring();
            }
            return o;
        }