Ejemplo n.º 1
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(Tunnel.Model.Tunnel_project model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@p_id",    SqlDbType.Int,       8),
                new SqlParameter("@p_name",  SqlDbType.VarChar, 200),
                new SqlParameter("@p_yname", SqlDbType.VarChar, 100),
                new SqlParameter("@p_jname", SqlDbType.VarChar, 100),
                new SqlParameter("@p_xfile", SqlDbType.VarChar, 200),
                new SqlParameter("@p_zfile", SqlDbType.VarChar, 200),
                new SqlParameter("@p_user",  SqlDbType.Int,       4),
                new SqlParameter("@p_ip",    SqlDbType.VarChar,  20),
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.p_name;
            parameters[2].Value     = model.p_yname;
            parameters[3].Value     = model.p_jname;
            parameters[4].Value     = model.p_xfile;
            parameters[5].Value     = model.p_zfile;
            parameters[6].Value     = model.p_user;
            parameters[7].Value     = model.p_Ip;

            DbHelperSQL.RunProcedure("Tunnel_project_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(Tunnel.Model.Tunnel_project model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@p_id",    SqlDbType.BigInt,    8),
                new SqlParameter("@p_name",  SqlDbType.VarChar, 200),
                new SqlParameter("@p_yname", SqlDbType.VarChar, 100),
                new SqlParameter("@p_jname", SqlDbType.VarChar, 100),
                new SqlParameter("@p_xfile", SqlDbType.VarChar, 200),
                new SqlParameter("@p_zfile", SqlDbType.VarChar, 200),
                new SqlParameter("@p_user",  SqlDbType.Int,       4),
                new SqlParameter("@p_ip",    SqlDbType.VarChar,  20),
            };
            parameters[0].Value = model.p_id;
            parameters[1].Value = model.p_name;
            parameters[2].Value = model.p_yname;
            parameters[3].Value = model.p_jname;
            parameters[4].Value = model.p_xfile;
            parameters[5].Value = model.p_zfile;
            parameters[6].Value = model.p_user;
            parameters[7].Value = model.p_Ip;

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

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["p_id"].ToString() != "")
                {
                    model.p_id = long.Parse(ds.Tables[0].Rows[0]["p_id"].ToString());
                }
                model.p_name  = ds.Tables[0].Rows[0]["p_name"].ToString();
                model.p_yname = ds.Tables[0].Rows[0]["p_yname"].ToString();
                model.p_jname = ds.Tables[0].Rows[0]["p_jname"].ToString();
                model.p_xfile = ds.Tables[0].Rows[0]["p_xfile"].ToString();
                model.p_zfile = ds.Tables[0].Rows[0]["p_zfile"].ToString();
                if (ds.Tables[0].Rows[0]["p_user"].ToString() != "")
                {
                    model.p_user = int.Parse(ds.Tables[0].Rows[0]["p_user"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Tunnel.Model.Tunnel_project> DataTableToList(DataTable dt)
        {
            List <Tunnel.Model.Tunnel_project> modelList = new List <Tunnel.Model.Tunnel_project>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Tunnel.Model.Tunnel_project model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model         = new Tunnel.Model.Tunnel_project();
                    model.p_id    = Convert.ToInt64(dt.Rows[n]["p_id"].ToString());
                    model.p_name  = dt.Rows[n]["p_name"].ToString();
                    model.p_yname = dt.Rows[n]["p_yname"].ToString();
                    model.p_jname = dt.Rows[n]["p_jname"].ToString();
                    model.p_xfile = dt.Rows[n]["p_xfile"].ToString();
                    model.p_zfile = dt.Rows[n]["p_zfile"].ToString();
                    if (dt.Rows[n]["p_user"].ToString() != "")
                    {
                        model.p_user = int.Parse(dt.Rows[n]["p_user"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <param name="pb">分页基本信息</param>
        /// <param name="count">返回总数</param>
        /// <returns></returns>
        public List <Tunnel.Model.Tunnel_project> GetList(PageBase pb, ref int count)
        {
            DataTable dt = dal.GetList(pb, ref count).Tables[0];
            List <Tunnel.Model.Tunnel_project> modelList = new List <Tunnel.Model.Tunnel_project>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0 && pb.DoCount == 0)
            {
                Tunnel.Model.Tunnel_project model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model         = new Tunnel.Model.Tunnel_project();
                    model.p_id    = Convert.ToInt64(dt.Rows[n]["p_id"].ToString());
                    model.p_name  = dt.Rows[n]["p_name"].ToString();
                    model.p_yname = dt.Rows[n]["p_yname"].ToString();
                    model.p_jname = dt.Rows[n]["p_jname"].ToString();
                    model.p_xfile = dt.Rows[n]["p_xfile"].ToString();
                    model.p_zfile = dt.Rows[n]["p_zfile"].ToString();
                    if (dt.Rows[n]["p_user"].ToString() != "")
                    {
                        model.p_user = int.Parse(dt.Rows[n]["p_user"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Tunnel.Model.Tunnel_project model)
 {
     dal.Update(model);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Tunnel.Model.Tunnel_project model)
 {
     return(dal.Add(model));
 }