Ejemplo n.º 1
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public int Update(Tunnel.Model.Tunnel_meeting model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@m_id",       SqlDbType.BigInt,       8),
                new SqlParameter("@m_title",    SqlDbType.VarChar,    200),
                new SqlParameter("@m_content",  SqlDbType.Text),
                new SqlParameter("@m_menber",   SqlDbType.VarChar,   1000),
                new SqlParameter("@m_startime", SqlDbType.DateTime),
                new SqlParameter("@m_endtime",  SqlDbType.DateTime),
                new SqlParameter("@m_user",     SqlDbType.Int,          4),
                new SqlParameter("@m_state",    SqlDbType.Int,          4),
                new SqlParameter("@m_ip",       SqlDbType.VarChar, 20)
            };
            parameters[0].Value = model.m_id;
            parameters[1].Value = model.m_title;
            parameters[2].Value = model.m_content;
            parameters[3].Value = model.m_menber;
            parameters[4].Value = model.m_startime;
            parameters[5].Value = model.m_endtime;
            parameters[6].Value = model.m_user;
            parameters[7].Value = model.m_state;
            parameters[8].Value = model.m_Ip;

            int relt = -1;

            relt = DbHelperSQL.RunProcedure("Tunnel_meeting_Update", parameters, out rowsAffected);
            return(relt);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<Tunnel.Model.Tunnel_meeting> DataTableToList(DataTable dt)
 {
     List<Tunnel.Model.Tunnel_meeting> modelList = new List<Tunnel.Model.Tunnel_meeting>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         Tunnel.Model.Tunnel_meeting model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new Tunnel.Model.Tunnel_meeting();
             model.m_id = Convert.ToInt64(dt.Rows[n]["m_id"].ToString());
             model.m_title = dt.Rows[n]["m_title"].ToString();
             model.m_content = dt.Rows[n]["m_content"].ToString();
             model.m_menber = dt.Rows[n]["m_menber"].ToString();
             if (dt.Rows[n]["m_startime"].ToString() != "")
             {
                 model.m_startime = DateTime.Parse(dt.Rows[n]["m_startime"].ToString());
             }
             if (dt.Rows[n]["m_endtime"].ToString() != "")
             {
                 model.m_endtime = DateTime.Parse(dt.Rows[n]["m_endtime"].ToString());
             }
             if (dt.Rows[n]["m_user"].ToString() != "")
             {
                 model.m_user = int.Parse(dt.Rows[n]["m_user"].ToString());
             }
             if (dt.Rows[n]["m_state"].ToString() != "")
             {
                 model.m_state = int.Parse(dt.Rows[n]["m_state"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Ejemplo n.º 3
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(Tunnel.Model.Tunnel_meeting model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@m_id",       SqlDbType.Int,          8),
                new SqlParameter("@m_title",    SqlDbType.VarChar,    200),
                new SqlParameter("@m_content",  SqlDbType.Text),
                new SqlParameter("@m_menber",   SqlDbType.VarChar,   1000),
                new SqlParameter("@m_startime", SqlDbType.DateTime),
                new SqlParameter("@m_endtime",  SqlDbType.DateTime),
                new SqlParameter("@m_user",     SqlDbType.Int,          4),
                new SqlParameter("@m_state",    SqlDbType.Int,          4),
                new SqlParameter("@m_ip",       SqlDbType.VarChar, 20)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.m_title;
            parameters[2].Value     = model.m_content;
            parameters[3].Value     = model.m_menber;
            parameters[4].Value     = model.m_startime;
            parameters[5].Value     = model.m_endtime;
            parameters[6].Value     = model.m_user;
            parameters[7].Value     = model.m_state;
            parameters[8].Value     = model.m_Ip;

            DbHelperSQL.RunProcedure("Tunnel_meeting_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Tunnel.Model.Tunnel_meeting GetModel(long m_id)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@m_id", SqlDbType.BigInt)
            };
            parameters[0].Value = m_id;

            Tunnel.Model.Tunnel_meeting model = new Tunnel.Model.Tunnel_meeting();
            DataSet ds = DbHelperSQL.RunProcedure("Tunnel_meeting_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["m_id"].ToString() != "")
                {
                    model.m_id = long.Parse(ds.Tables[0].Rows[0]["m_id"].ToString());
                }
                model.m_title   = ds.Tables[0].Rows[0]["m_title"].ToString();
                model.m_content = ds.Tables[0].Rows[0]["m_content"].ToString();
                model.m_menber  = ds.Tables[0].Rows[0]["m_menber"].ToString();
                if (ds.Tables[0].Rows[0]["m_startime"].ToString() != "")
                {
                    model.m_startime = DateTime.Parse(ds.Tables[0].Rows[0]["m_startime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["m_endtime"].ToString() != "")
                {
                    model.m_endtime = DateTime.Parse(ds.Tables[0].Rows[0]["m_endtime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["m_user"].ToString() != "")
                {
                    model.m_user = int.Parse(ds.Tables[0].Rows[0]["m_user"].ToString());
                }
                if (ds.Tables[0].Rows[0]["m_state"].ToString() != "")
                {
                    model.m_state = int.Parse(ds.Tables[0].Rows[0]["m_state"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <param name="pb">分页基本信息</param>
 /// <param name="count">返回总数</param>
 /// <returns></returns>
 public List<Tunnel.Model.Tunnel_meeting> GetList(PageBase pb, ref int count)
 {
     DataTable dt = dal.GetList(pb, ref count).Tables[0];
     List<Tunnel.Model.Tunnel_meeting> modelList = new List<Tunnel.Model.Tunnel_meeting>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0 && pb.DoCount == 0)
     {
         Tunnel.Model.Tunnel_meeting model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new Tunnel.Model.Tunnel_meeting();
             model.m_id = Convert.ToInt64(dt.Rows[n]["m_id"].ToString());
             model.m_title = dt.Rows[n]["m_title"].ToString();
             model.m_content = dt.Rows[n]["m_content"].ToString();
             model.m_menber = dt.Rows[n]["m_menber"].ToString();
             if (dt.Rows[n]["m_startime"].ToString() != "")
             {
                 model.m_startime = DateTime.Parse(dt.Rows[n]["m_startime"].ToString());
             }
             if (dt.Rows[n]["m_endtime"].ToString() != "")
             {
                 model.m_endtime = DateTime.Parse(dt.Rows[n]["m_endtime"].ToString());
             }
             if (dt.Rows[n]["m_user"].ToString() != "")
             {
                 model.m_user = int.Parse(dt.Rows[n]["m_user"].ToString());
             }
             if (dt.Rows[n]["m_state"].ToString() != "")
             {
                 model.m_state = int.Parse(dt.Rows[n]["m_state"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(Tunnel.Model.Tunnel_meeting model)
 {
     return dal.Update(model);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Tunnel.Model.Tunnel_meeting model)
 {
     return dal.Add(model);
 }