Beispiel #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(DTcms.Model.StoreInGoodsWithVehicles model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update StoreInGoodsWithVehicles set ");

            strSql.Append(" StoreInGoodsStoreInOrderId = @StoreInGoodsStoreInOrderId , ");
            strSql.Append(" StoreInGoodsId = @StoreInGoodsId , ");
            strSql.Append(" StoreInGoodsVehicleId = @StoreInGoodsVehicleId  ");
            strSql.Append(" where StoreInGoodsStoreInOrderId=@StoreInGoodsStoreInOrderId and StoreInGoodsId=@StoreInGoodsId and StoreInGoodsVehicleId=@StoreInGoodsVehicleId  ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@StoreInGoodsStoreInOrderId", SqlDbType.Int, 4),
                new SqlParameter("@StoreInGoodsId",             SqlDbType.Int, 4),
                new SqlParameter("@StoreInGoodsVehicleId",      SqlDbType.Int, 4)
            };

            parameters[0].Value = model.StoreInGoodsStoreInOrderId;
            parameters[1].Value = model.StoreInGoodsId;
            parameters[2].Value = model.StoreInGoodsVehicleId;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DTcms.Model.StoreInGoodsWithVehicles GetModel(int StoreInGoodsStoreInOrderId, int StoreInGoodsId, int StoreInGoodsVehicleId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select StoreInGoodsStoreInOrderId, StoreInGoodsId, StoreInGoodsVehicleId  ");
            strSql.Append("  from StoreInGoodsWithVehicles ");
            strSql.Append(" where StoreInGoodsStoreInOrderId=@StoreInGoodsStoreInOrderId and StoreInGoodsId=@StoreInGoodsId and StoreInGoodsVehicleId=@StoreInGoodsVehicleId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@StoreInGoodsStoreInOrderId", SqlDbType.Int, 4),
                new SqlParameter("@StoreInGoodsId",             SqlDbType.Int, 4),
                new SqlParameter("@StoreInGoodsVehicleId",      SqlDbType.Int, 4)
            };
            parameters[0].Value = StoreInGoodsStoreInOrderId;
            parameters[1].Value = StoreInGoodsId;
            parameters[2].Value = StoreInGoodsVehicleId;


            DTcms.Model.StoreInGoodsWithVehicles model = new DTcms.Model.StoreInGoodsWithVehicles();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["StoreInGoodsStoreInOrderId"].ToString() != "")
                {
                    model.StoreInGoodsStoreInOrderId = int.Parse(ds.Tables[0].Rows[0]["StoreInGoodsStoreInOrderId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["StoreInGoodsId"].ToString() != "")
                {
                    model.StoreInGoodsId = int.Parse(ds.Tables[0].Rows[0]["StoreInGoodsId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["StoreInGoodsVehicleId"].ToString() != "")
                {
                    model.StoreInGoodsVehicleId = int.Parse(ds.Tables[0].Rows[0]["StoreInGoodsVehicleId"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(DTcms.Model.StoreInGoodsWithVehicles model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into StoreInGoodsWithVehicles(");
            strSql.Append("StoreInGoodsStoreInOrderId,StoreInGoodsId,StoreInGoodsVehicleId");
            strSql.Append(") values (");
            strSql.Append("@StoreInGoodsStoreInOrderId,@StoreInGoodsId,@StoreInGoodsVehicleId");
            strSql.Append(") ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@StoreInGoodsStoreInOrderId", SqlDbType.Int, 4),
                new SqlParameter("@StoreInGoodsId",             SqlDbType.Int, 4),
                new SqlParameter("@StoreInGoodsVehicleId",      SqlDbType.Int, 4)
            };

            parameters[0].Value = model.StoreInGoodsStoreInOrderId;
            parameters[1].Value = model.StoreInGoodsId;
            parameters[2].Value = model.StoreInGoodsVehicleId;
            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }