Пример #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Tunnel.Model.Tunnel_projectlog GetModel(long pl_id)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@pl_id", SqlDbType.BigInt)
            };
            parameters[0].Value = pl_id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["pl_id"].ToString() != "")
                {
                    model.pl_id = long.Parse(ds.Tables[0].Rows[0]["pl_id"].ToString());
                }
                model.pl_title   = ds.Tables[0].Rows[0]["pl_title"].ToString();
                model.pl_content = ds.Tables[0].Rows[0]["pl_content"].ToString();
                if (ds.Tables[0].Rows[0]["pl_time"].ToString() != "")
                {
                    model.pl_time = DateTime.Parse(ds.Tables[0].Rows[0]["pl_time"].ToString());
                }
                if (ds.Tables[0].Rows[0]["pl_user"].ToString() != "")
                {
                    model.pl_user = int.Parse(ds.Tables[0].Rows[0]["pl_user"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Tunnel.Model.Tunnel_projectlog> DataTableToList(DataTable dt)
        {
            List <Tunnel.Model.Tunnel_projectlog> modelList = new List <Tunnel.Model.Tunnel_projectlog>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Tunnel.Model.Tunnel_projectlog model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model            = new Tunnel.Model.Tunnel_projectlog();
                    model.pl_id      = Convert.ToInt64(dt.Rows[n]["pl_id"].ToString());
                    model.pl_title   = dt.Rows[n]["pl_title"].ToString();
                    model.pl_content = dt.Rows[n]["pl_content"].ToString();
                    if (dt.Rows[n]["pl_time"].ToString() != "")
                    {
                        model.pl_time = DateTime.Parse(dt.Rows[n]["pl_time"].ToString());
                    }
                    if (dt.Rows[n]["pl_user"].ToString() != "")
                    {
                        model.pl_user = int.Parse(dt.Rows[n]["pl_user"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <param name="pb">分页基本信息</param>
        /// <param name="count">返回总数</param>
        /// <returns></returns>
        public List <Tunnel.Model.Tunnel_projectlog> GetList(PageBase pb, ref int count)
        {
            DataTable dt = dal.GetList(pb, ref count).Tables[0];
            List <Tunnel.Model.Tunnel_projectlog> modelList = new List <Tunnel.Model.Tunnel_projectlog>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0 && pb.DoCount == 0)
            {
                Tunnel.Model.Tunnel_projectlog model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model            = new Tunnel.Model.Tunnel_projectlog();
                    model.pl_id      = Convert.ToInt64(dt.Rows[n]["pl_id"].ToString());
                    model.pl_title   = dt.Rows[n]["pl_title"].ToString();
                    model.pl_content = dt.Rows[n]["pl_content"].ToString();
                    if (dt.Rows[n]["pl_time"].ToString() != "")
                    {
                        model.pl_time = DateTime.Parse(dt.Rows[n]["pl_time"].ToString());
                    }
                    if (dt.Rows[n]["pl_user"].ToString() != "")
                    {
                        model.pl_user = int.Parse(dt.Rows[n]["pl_user"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #4
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(Tunnel.Model.Tunnel_projectlog model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@pl_id",      SqlDbType.BigInt,      8),
                new SqlParameter("@pl_title",   SqlDbType.VarChar,   200),
                new SqlParameter("@pl_content", SqlDbType.Text),
                new SqlParameter("@pl_time",    SqlDbType.DateTime),
                new SqlParameter("@pl_user",    SqlDbType.Int,         4),
                new SqlParameter("@pl_ip",      SqlDbType.VarChar,    20),
            };
            parameters[0].Value = model.pl_id;
            parameters[1].Value = model.pl_title;
            parameters[2].Value = model.pl_content;
            parameters[3].Value = model.pl_time;
            parameters[4].Value = model.pl_user;
            parameters[5].Value = model.pl_Ip;

            DbHelperSQL.RunProcedure("Tunnel_projectlog_Update", parameters, out rowsAffected);
        }
Пример #5
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(Tunnel.Model.Tunnel_projectlog model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@pl_id",      SqlDbType.Int,         8),
                new SqlParameter("@pl_title",   SqlDbType.VarChar,   200),
                new SqlParameter("@pl_content", SqlDbType.Text),
                new SqlParameter("@pl_time",    SqlDbType.DateTime),
                new SqlParameter("@pl_user",    SqlDbType.Int,         4),
                new SqlParameter("@pl_ip",      SqlDbType.VarChar,    20),
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.pl_title;
            parameters[2].Value     = model.pl_content;
            parameters[3].Value     = model.pl_time;
            parameters[4].Value     = model.pl_user;
            parameters[5].Value     = model.pl_Ip;

            DbHelperSQL.RunProcedure("Tunnel_projectlog_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }
Пример #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Tunnel.Model.Tunnel_projectlog model)
 {
     dal.Update(model);
 }
Пример #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Tunnel.Model.Tunnel_projectlog model)
 {
     return(dal.Add(model));
 }