Exemplo n.º 1
0
        public bool Delete(SqlConnection conn, SqlTransaction trans, int storeOutOrderId)
        {
            DataSet storeOutGoodsDS = GetList(0, " StoreOutOrderId = " + storeOutOrderId + "", " Id desc");

            if (storeOutGoodsDS != null)
            {
                StoreInGoods         storeInGoodsDAL         = new StoreInGoods();
                StoreOutWaitingGoods storeOutWaitingGoodsDAL = new StoreOutWaitingGoods();
                foreach (DataRow dr in storeOutGoodsDS.Tables[0].Rows)
                {
                    storeInGoodsDAL.UpdateField(conn, trans, Convert.ToInt32(dr["StoreInGoodsId"]), "Count = Count + " + Convert.ToDecimal(dr["Count"]) + "");
                    storeOutWaitingGoodsDAL.UpdateField(conn, trans, Convert.ToInt32(dr["StoreOutWaitingGoodsId"]), " Status = 0 ");
                }
                StringBuilder strSql = new StringBuilder();
                strSql.Append("delete from StoreOutGoods ");
                strSql.Append(" where StoreOutOrderId=@StoreOutOrderId");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@StoreOutOrderId", SqlDbType.Int, 4)
                };
                parameters[0].Value = storeOutOrderId;


                int rows = DbHelperSQL.ExecuteSql(conn, trans, strSql.ToString(), parameters);
                if (rows > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        public bool Delete(SqlConnection conn, SqlTransaction trans, int storeOutOrderId)
        {
            DataSet storeOutGoodsDS = GetList(0, " StoreOutOrderId = " + storeOutOrderId + "", " Id desc");
            if (storeOutGoodsDS != null)
            {
                StoreInGoods storeInGoodsDAL = new StoreInGoods();
                StoreOutWaitingGoods storeOutWaitingGoodsDAL = new StoreOutWaitingGoods();
                foreach (DataRow dr in storeOutGoodsDS.Tables[0].Rows)
                {
                    storeInGoodsDAL.UpdateField(conn, trans, Convert.ToInt32(dr["StoreInGoodsId"]), "Count = Count + " + Convert.ToDecimal(dr["Count"]) + "");
                    storeOutWaitingGoodsDAL.UpdateField(conn, trans, Convert.ToInt32(dr["StoreOutWaitingGoodsId"]), " Status = 0 ");
                }
                StringBuilder strSql = new StringBuilder();
                strSql.Append("delete from StoreOutGoods ");
                strSql.Append(" where StoreOutOrderId=@StoreOutOrderId");
                SqlParameter[] parameters = {
                        new SqlParameter("@StoreOutOrderId", SqlDbType.Int,4)
                };
                parameters[0].Value = storeOutOrderId;

                int rows = DbHelperSQL.ExecuteSql(conn, trans, strSql.ToString(), parameters);
                if (rows > 0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }

            return false;
        }