Beispiel #1
0
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="message">实体集</param>
        /// <returns>列新结果</returns>
        public int Update(Tunnel.Model.Tunnel_Message message)
        {
            string strSQL = string.Format("UPDATE Tunnel_Message SET MesTitle='{1}',MesContent='{2}',ModiDate='{3}' WHERE MesID={0}", message.MesID, message.MesTitle, message.MesContent, message.ModiDate);
            object obj    = DbHelperSQL.ExecuteSql(strSQL);

            if (null != obj)
            {
                return(Convert.ToInt32(obj));
            }
            else
            {
                return(0);
            }
        }
Beispiel #2
0
    /// <summary>
    /// 页面数据绑定
    /// </summary>
    public void PageBind()
    {
        if (Id == 0)
        {
            return;
        }
        Tunnel.Model.Tunnel_Message        model     = new Tunnel.Model.Tunnel_Message();
        List <Tunnel.Model.Tunnel_Message> modelList = new List <Tunnel.Model.Tunnel_Message>();

        model = tbll.GetMessageModel(Id);
        modelList.Add(model);
        Repeater1.DataSource = modelList;
        Repeater1.DataBind();
    }
Beispiel #3
0
        /// <summary>
        /// 新增一条数据
        /// </summary>
        /// <param name="message">实体集</param>
        /// <returns>新增结果</returns>
        public int Add(Tunnel.Model.Tunnel_Message message)
        {
            string strSQL = string.Format("INSERT INTO Tunnel_Message (MesTitle,MesContent,MesDate,MesUser) "
                                          + "VALUES ('{0}','{1}','{2}','{3}')", message.MesTitle, message.MesContent, message.MesDate, message.MesUser);
            object obj = DbHelperSQL.ExecuteSql(strSQL);

            if (null != obj)
            {
                return(Convert.ToInt32(obj));
            }
            else
            {
                return(0);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 获得信息实体集
        /// </summary>
        /// <param name="mesID">信息编号</param>
        /// <returns>信息实体集</returns>
        public Tunnel.Model.Tunnel_Message GetMessageModel(int mesID)
        {
            Tunnel.Model.Tunnel_Message mes = new Tunnel.Model.Tunnel_Message();
            string strSQL = string.Format("SELECT * FROM Tunnel_Message WHERE MesID={0}", mesID);

            using (SqlDataReader reader = DbHelperSQL.ExecuteReader(strSQL))
            {
                if (reader.Read())
                {
                    mes.MesID      = Convert.ToInt32(reader["MesID"]);
                    mes.MesTitle   = reader["MesTitle"].ToString();
                    mes.MesContent = reader["MesContent"].ToString();
                    mes.MesDate    = Convert.ToDateTime(reader["MesDate"]);
                    mes.MesUser    = Convert.ToInt32(reader["MesUser"]);
                }
            }
            return(mes);
        }
Beispiel #5
0
        /// <summary>
        /// 获得分页集合
        /// </summary>
        /// <param name="pb">页类</param>
        /// <param name="count">总数</param>
        /// <returns>集合</returns>
        public List <Tunnel.Model.Tunnel_Message> GetList(PageBase pb, ref int count)
        {
            DataTable dt = m_Message.GetList(pb, ref count).Tables[0];
            List <Tunnel.Model.Tunnel_Message> modelList = new List <Tunnel.Model.Tunnel_Message>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0 && pb.DoCount == 0)
            {
                Tunnel.Model.Tunnel_Message model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model            = new Tunnel.Model.Tunnel_Message();
                    model.MesID      = Convert.ToInt32(dt.Rows[n]["MesID"].ToString());
                    model.MesTitle   = dt.Rows[n]["MesTitle"].ToString();
                    model.MesContent = dt.Rows[n]["MesContent"].ToString();
                    model.MesDate    = Convert.ToDateTime(dt.Rows[n]["MesDate"]);
                    model.MesUser    = Convert.ToInt32(dt.Rows[n]["MesUser"].ToString());
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #6
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="message">信息集合</param>
 /// <returns>修改结果</returns>
 public int Update(Tunnel.Model.Tunnel_Message message)
 {
     return(m_Message.Update(message));
 }
Beispiel #7
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="message">信息集合</param>
 /// <returns>添加结果</returns>
 public int Add(Tunnel.Model.Tunnel_Message message)
 {
     return(m_Message.Add(message));
 }