Ejemplo n.º 1
0
        public virtual tb_mqpath_model CreateModel(DataRow dr)
        {
            var o = new tb_mqpath_model();

            //
            if(dr.Table.Columns.Contains("id"))
            {
                o.id = dr["id"].Toint();
            }
            //mq·��
            if(dr.Table.Columns.Contains("mqpath"))
            {
                o.mqpath = dr["mqpath"].Tostring();
            }
            //��·����mq,����������ʱ��(�Ե�ǰ��ʱ��Ϊ׼)
            if(dr.Table.Columns.Contains("lastupdatetime"))
            {
                o.lastupdatetime = dr["lastupdatetime"].ToDateTime();
            }
            //mq����ʱ��(�Ե�ǰ��ʱ��Ϊ׼)
            if(dr.Table.Columns.Contains("createtime"))
            {
                o.createtime = dr["createtime"].ToDateTime();
            }
            return o;
        }
        public virtual tb_mqpath_model CreateModel(DataRow dr)
        {
            var o = new tb_mqpath_model();

            //
            if (dr.Table.Columns.Contains("id"))
            {
                o.id = dr["id"].Toint();
            }
            //mq路径
            if (dr.Table.Columns.Contains("mqpath"))
            {
                o.mqpath = dr["mqpath"].Tostring();
            }
            //该路径下mq,配置最后更新时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("lastupdatetime"))
            {
                o.lastupdatetime = dr["lastupdatetime"].ToDateTime();
            }
            //mq创建时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("createtime"))
            {
                o.createtime = dr["createtime"].ToDateTime();
            }
            return(o);
        }
Ejemplo n.º 3
0
 public ActionResult Update(int id)
 {
     using (DbConn conn = DbConfig.CreateConn(DataConfig.MqManage))
     {
         conn.Open();
         tb_mqpath_model model = pathDal.Get(conn, id);
         return(View(model));
     }
 }
        public virtual bool Add(DbConn PubConn, tb_mqpath_model model)
        {
            List <ProcedureParameter> Par = new List <ProcedureParameter>()
            {
                //mq路径
                new ProcedureParameter("@mqpath", model.mqpath),
                //该路径下mq,配置最后更新时间(以当前库时间为准)
                new ProcedureParameter("@lastupdatetime", model.lastupdatetime),
                //mq创建时间(以当前库时间为准)
                new ProcedureParameter("@createtime", model.createtime)
            };
            int rev = PubConn.ExecuteSql(@"insert into tb_mqpath(mqpath,lastupdatetime,createtime)
										   values(@mqpath,@lastupdatetime,@createtime)"                                        , Par);

            return(rev == 1);
        }
        public virtual bool Edit(DbConn PubConn, tb_mqpath_model model)
        {
            List <ProcedureParameter> Par = new List <ProcedureParameter>()
            {
                //mq路径
                new ProcedureParameter("@mqpath", model.mqpath),
                //该路径下mq,配置最后更新时间(以当前库时间为准)
                new ProcedureParameter("@lastupdatetime", model.lastupdatetime),
                //mq创建时间(以当前库时间为准)
                new ProcedureParameter("@createtime", model.createtime)
            };

            Par.Add(new ProcedureParameter("@id", model.id));

            int rev = PubConn.ExecuteSql("update tb_mqpath set mqpath=@mqpath,lastupdatetime=@lastupdatetime,createtime=@createtime where id=@id", Par);

            return(rev == 1);
        }
Ejemplo n.º 6
0
 /// <summary>
 ///获取所有队列
 /// </summary>
 /// <param name="conn"></param>
 /// <returns></returns>
 public IList <tb_mqpath_model> GetAllMaPath(DbConn conn)
 {
     return(SqlHelper.Visit((ps) =>
     {
         IList <tb_mqpath_model> list = new List <tb_mqpath_model>();
         string sql = "SELECT * FROM tb_mqpath WITH(NOLOCK)";
         DataTable dt = conn.SqlToDataTable(sql, null);
         if (dt != null && dt.Rows.Count > 0)
         {
             foreach (DataRow dr in dt.Rows)
             {
                 tb_mqpath_model model = CreateModel(dr);
                 list.Add(model);
             }
         }
         return list;
     }));
 }
Ejemplo n.º 7
0
 public ActionResult Update(tb_mqpath_model model)
 {
     using (DbConn conn = DbConfig.CreateConn(DataConfig.MqManage))
     {
         conn.Open();
         tb_mqpath_model result = pathDal.Get(conn, model.id);
         if (result != null)
         {
             result.mqpath         = model.mqpath;
             result.lastupdatetime = DateTime.Now;
             if (pathDal.Edit(conn, result))
             {
                 return(RedirectToAction("index"));
             }
         }
         ModelState.AddModelError("Error", "更新错误");
         return(View(result));
     }
 }