Exemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Tunnel.Model.Tunnel_check GetModel(int c_id)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@c_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = c_id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["c_id"].ToString() != "")
                {
                    model.c_id = int.Parse(ds.Tables[0].Rows[0]["c_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["c_userId"].ToString() != "")
                {
                    model.c_userId = int.Parse(ds.Tables[0].Rows[0]["c_userId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["c_itemsId"].ToString() != "")
                {
                    model.c_itemsId = int.Parse(ds.Tables[0].Rows[0]["c_itemsId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["c_score"].ToString() != "")
                {
                    model.c_score = int.Parse(ds.Tables[0].Rows[0]["c_score"].ToString());
                }

                model.c_income = ds.Tables[0].Rows[0]["c_income"].ToString();

                model.c_date = ds.Tables[0].Rows[0]["c_date"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(Tunnel.Model.Tunnel_check model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@c_id",      SqlDbType.Int,      4),
                new SqlParameter("@c_userId",  SqlDbType.Int,      4),
                new SqlParameter("@c_itemsId", SqlDbType.Int,      4),
                new SqlParameter("@c_score",   SqlDbType.Int,      4),
                new SqlParameter("@c_income",  SqlDbType.VarChar, 50),
                new SqlParameter("@c_date",    SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.c_id;
            parameters[1].Value = model.c_userId;
            parameters[2].Value = model.c_itemsId;
            parameters[3].Value = model.c_score;
            parameters[4].Value = model.c_income;
            parameters[5].Value = model.c_date;

            DbHelperSQL.RunProcedure("UP_Tunnel_check_Update", parameters, out rowsAffected);
        }
Exemplo n.º 3
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(Tunnel.Model.Tunnel_check model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@c_id",      SqlDbType.Int,      4),
                new SqlParameter("@c_userId",  SqlDbType.Int,      4),
                new SqlParameter("@c_itemsId", SqlDbType.Int,      4),
                new SqlParameter("@c_score",   SqlDbType.Int,      4),
                new SqlParameter("@c_income",  SqlDbType.VarChar, 50),
                new SqlParameter("@c_date",    SqlDbType.VarChar, 50)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.c_userId;
            parameters[2].Value     = model.c_itemsId;
            parameters[3].Value     = model.c_score;
            parameters[4].Value     = model.c_income;
            parameters[5].Value     = model.c_date;

            DbHelperSQL.RunProcedure("UP_Tunnel_check_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }