示例#1
0
 public void Init()
 {
     BasicInfo     = new ProductBasicInfo();
     PriceInfo     = new ProductPriceInfo();
     AttributeInfo = new ProductAttributeInfo();
     StatusInfo    = new ProductStatusInfo();
     BarcodeInfo   = new ProductBarcodeInfo();
 }
示例#2
0
文件: ProductInfo.cs 项目: ue96/ue96
 public void Init()
 {
     BasicInfo = new ProductBasicInfo();
     PriceInfo = new ProductPriceInfo();
     AttributeInfo = new ProductAttributeInfo();
     StatusInfo = new ProductStatusInfo();
     BarcodeInfo = new ProductBarcodeInfo();
 }
示例#3
0
        public void AddMMbuyProduct(ProductBasicInfo oBasic)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                //Insert Basic Info
                //oBasic.ProductID = GenerateNewProductID(oBasic.C3SysNo);
                oBasic.ProductID = oBasic.ProductID;
                ProductManager.GetInstance().InsertBasic(oBasic);
                //Insert Status Info
                ProductStatusInfo oStatus = new ProductStatusInfo();
                oStatus.ProductSysNo = oBasic.SysNo;
                oStatus.AllowStatus = (int)AppEnum.ProductStatusInfo.Valid;
                oStatus.InfoStatus = (int)AppEnum.ProductStatusInfo.Valid;
                oStatus.PicStatus = (int)AppEnum.ProductStatusInfo.Valid;
                oStatus.PriceStatus = (int)AppEnum.ProductStatusInfo.Valid;
                oStatus.WarrantyStatus = (int)AppEnum.ProductStatusInfo.Valid;
                oStatus.WeightStatus = (int)AppEnum.ProductStatusInfo.Valid;
                oStatus.PreviewStatus = (int)AppEnum.ProductStatusInfo.Valid;
                ProductManager.GetInstance().InsertStatus(oStatus);
                //Insert Price Info
                ProductPriceInfo oPrice = new ProductPriceInfo();
                oPrice.ProductSysNo = oBasic.SysNo;
                oPrice.ClearanceSale = (int)AppEnum.YNStatus.Yes;
                oPrice.IsWholeSale = (int)AppEnum.YNStatus.No;
                oPrice.Q1 = 0;
                oPrice.Q2 = 0;
                oPrice.Q3 = 0;
                oPrice.P1 = AppConst.DefaultPrice;
                oPrice.P2 = AppConst.DefaultPrice;
                oPrice.P3 = AppConst.DefaultPrice;
                oPrice.PointType = (int)AppEnum.ProductPayType.BothSupported;
                oPrice.Point = 0;
                oPrice.CashRebate = 0m;
                oPrice.UnitCost = 0;
                oPrice.BasicPrice = AppConst.DefaultPrice;
                oPrice.CurrentPrice = AppConst.DefaultPrice;
                oPrice.Discount = oPrice.CurrentPrice / oPrice.BasicPrice;
                ProductManager.GetInstance().InsertPrice(oPrice);

                //��ʼ�����
                InventoryManager.GetInstance().InitInventory(oBasic.SysNo);

                scope.Complete();
            }
        }
示例#4
0
文件: CartManager.cs 项目: ue96/ue96
        public void GetCartBriefInfo(Hashtable ht, ref int cartProductCount, ref decimal cartMoneyTotal)
        {
            DataSet ds = OnlineListManager.GetInstance().GetCartDs(ht);
            if (!Util.HasMoreRow(ds))
                return;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                ProductPriceInfo oProductPrice = new ProductPriceInfo();

                oProductPrice.ProductSysNo = Util.TrimIntNull(dr["ProductSysNo"]);
                oProductPrice.CurrentPrice = Util.TrimDecimalNull(dr["CurrentPrice"]);
                oProductPrice.PointType = Util.TrimIntNull(dr["PointType"]);
                oProductPrice.IsWholeSale = Util.TrimIntNull(dr["IsWholeSale"]);
                oProductPrice.Q1 = Util.TrimIntNull(dr["Q1"]);
                oProductPrice.P1 = Util.TrimDecimalNull(dr["P1"]);
                oProductPrice.Q2 = Util.TrimIntNull(dr["Q2"]);
                oProductPrice.P2 = Util.TrimDecimalNull(dr["P2"]);
                oProductPrice.Q3 = Util.TrimIntNull(dr["Q3"]);
                oProductPrice.P3 = Util.TrimDecimalNull(dr["P3"]);

                CartInfo oCart = ht[oProductPrice.ProductSysNo] as CartInfo;

                cartProductCount += oCart.Quantity;
                cartMoneyTotal += oCart.Quantity * oProductPrice.GetRealPrice(oCart.Quantity);
            }
        }
示例#5
0
        public Hashtable GetPriceBoundle(Hashtable sysnoHt)
        {
            if (sysnoHt == null || sysnoHt.Count == 0)
                return null;

            string sql = "select * from product_price where productsysno in (";
            int index = 0;
            foreach (int item in sysnoHt.Keys)
            {
                if (index != 0)
                    sql += ",";

                sql += item.ToString();

                index++;
            }
            sql += ")";

            DataSet ds = SqlHelper.ExecuteDataSet(sql);

            if (!Util.HasMoreRow(ds))
                return null;

            Hashtable ht = new Hashtable(5);
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                ProductPriceInfo item = new ProductPriceInfo();
                mapPrice(item, dr);
                ht.Add(item.ProductSysNo, item);
            }
            return ht;
        }
示例#6
0
 private void mapPrice(ProductPriceInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.ProductSysNo = Util.TrimIntNull(tempdr["ProductSysNo"]);
     oParam.BasicPrice = Util.TrimDecimalNull(tempdr["BasicPrice"]);
     oParam.CurrentPrice = Util.TrimDecimalNull(tempdr["CurrentPrice"]);
     oParam.Discount = Util.TrimDecimalNull(tempdr["Discount"]);
     oParam.PointType = Util.TrimIntNull(tempdr["PointType"]);
     oParam.IsWholeSale = Util.TrimIntNull(tempdr["IsWholeSale"]);
     oParam.Q1 = Util.TrimIntNull(tempdr["Q1"]);
     oParam.P1 = Util.TrimDecimalNull(tempdr["P1"]);
     oParam.Q2 = Util.TrimIntNull(tempdr["Q2"]);
     oParam.P2 = Util.TrimDecimalNull(tempdr["P2"]);
     oParam.Q3 = Util.TrimIntNull(tempdr["Q3"]);
     oParam.P3 = Util.TrimDecimalNull(tempdr["P3"]);
     oParam.CashRebate = Util.TrimDecimalNull(tempdr["CashRebate"]);
     oParam.Point = Util.TrimIntNull(tempdr["Point"]);
     oParam.UnitCost = Util.TrimDecimalNull(tempdr["UnitCost"]);
     oParam.LastOrderPrice = Util.TrimDecimalNull(tempdr["LastOrderPrice"]);
     oParam.LastMarketLowestPrice = Util.TrimDecimalNull(tempdr["LastMarketLowestPrice"]);
     oParam.ClearanceSale = Util.TrimIntNull(tempdr["ClearanceSale"]);
     oParam.LimitedQty = Util.TrimIntNull(tempdr["LimitedQty"]);
 }
示例#7
0
        public void UpdatePriceInfo(ProductPriceInfo oPrice)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                ProductPriceDac pp = new ProductPriceDac();
                pp.Update(oPrice);
                scope.Complete();
            }
        }
示例#8
0
        public void EditPrice(ProductPriceInfo oPrice, ProductStatusInfo oStatus)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                //���ԭ��û��priceInfo��Add
                if (oPrice.SysNo == AppConst.IntNull)
                    ProductManager.GetInstance().InsertPrice(oPrice);
                else
                    ProductManager.GetInstance().UpdatePriceInfo(oPrice);
                ProductManager.GetInstance().RefreshStatus(oStatus, oPrice.ProductSysNo);
                scope.Complete();
            }
        }
示例#9
0
 public ProductPriceInfo LoadPrice(int productSysNo)
 {
     string sql = "select * from product_price where productsysno=" + productSysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     ProductPriceInfo oPrice = new ProductPriceInfo();
     if (Util.HasMoreRow(ds))
         mapPrice(oPrice, ds.Tables[0].Rows[0]);
     else
         oPrice = null;
     return oPrice;
 }
示例#10
0
 public int InsertPrice(ProductPriceInfo oParam)
 {
     string sql = "select * from product_price where productsysno =" + oParam.ProductSysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     if (Util.HasMoreRow(ds))
         throw new BizException("the same ProductSysNo exists already");
     return new ProductPriceDac().Insert(oParam);
 }
示例#11
0
        public void ImportPrice()
        {
            if (!AppConfig.IsImportable)
                throw new BizException("IsImportable is false");
            string sql = "select top 1 * from product_price";
            DataSet ds = SqlHelper.ExecuteDataSet(sql);
            if (Util.HasMoreRow(ds))
                throw new BizException("the table Product_Price is not empty");

            string sql_product_distinct = "select productsysno from ipp2003..product_price group by productsysno having count(productsysno)>=2";
            DataSet ds_product_distinct = SqlHelper.ExecuteDataSet(sql_product_distinct);
            if (Util.HasMoreRow(ds_product_distinct))
                throw new BizException("the ipp2003..product_price has item of 2 rows price info");

            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                string sqli = @"select pb.newsysno as productsysno,basicprice,discount,currentprice,Point,
                                unitcost,cashrebate,pointstatus as pointtype,clearancesale,createtime, lastOrderPrice
                                from ipp2003..product_price pp
                                left join ippConvert..productbasic pb on pb.oldsysno = pp.productsysno";
                DataSet dsi = SqlHelper.ExecuteDataSet(sqli);
                foreach (DataRow dr in dsi.Tables[0].Rows)
                {
                    ProductPriceInfo oPrice = new ProductPriceInfo();
                    oPrice.ProductSysNo = Util.TrimIntNull(dr["ProductSysNo"]);
                    oPrice.BasicPrice = Util.TrimDecimalNull(dr["BasicPrice"]);
                    if (oPrice.BasicPrice == AppConst.DecimalNull)
                        oPrice.BasicPrice = 999999m;
                    oPrice.CurrentPrice = Util.TrimDecimalNull(dr["CurrentPrice"]);
                    if (oPrice.CurrentPrice == AppConst.DecimalNull)
                        oPrice.CurrentPrice = 999999m;
                    oPrice.UnitCost = Util.TrimDecimalNull(dr["UnitCost"]);
                    if (oPrice.UnitCost == AppConst.DecimalNull)
                        oPrice.UnitCost = 0m;
                    oPrice.LastOrderPrice = Util.TrimDecimalNull(dr["LastOrderPrice"]);
                    oPrice.Discount = Util.TrimDecimalNull(dr["Discount"]);
                    oPrice.PointType = Util.TrimIntNull(dr["PointType"]);
                    oPrice.CashRebate = Util.TrimDecimalNull(dr["CashRebate"]);
                    oPrice.Point = Util.TrimIntNull(dr["Point"]);
                    oPrice.ClearanceSale = Util.TrimIntNull(dr["ClearanceSale"]);
                    //this.InsertPrice(oPrice);
                    new ProductPriceDac().Insert(oPrice);
                }
                scope.Complete();
            }
        }
示例#12
0
 public Hashtable GetSOItemPriceList(SOInfo soInfo)
 {
     Hashtable ht = new Hashtable();
     string sql = @"select pp.*
                    from product_price pp
                    inner join so_item si on si.productSysNo = pp.productSysNo
                    where si.sosysno=" + soInfo.SysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     if (Util.HasMoreRow(ds))
     {
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             ProductPriceInfo ppInfo = new ProductPriceInfo();
             this.mapPrice(ppInfo, dr);
             ht.Add(ppInfo.ProductSysNo, ppInfo);
         }
     }
     return ht;
 }
示例#13
0
        public int Insert(ProductPriceInfo oParam)
        {
            string sql = @"INSERT INTO product_price
                            (
                            ProductSysNo, BasicPrice, CurrentPrice, UnitCost,
                            Discount, PointType, IsWholeSale, Q1,
                            P1, Q2, P2, Q3,
                            P3, CashRebate, Point, ClearanceSale, LastOrderPrice, LastMarketLowestPrice, LimitedQty
                            )
                            VALUES (
                            @ProductSysNo, @BasicPrice, @CurrentPrice, @UnitCost,
                            @Discount, @PointType, @IsWholeSale, @Q1,
                            @P1, @Q2, @P2, @Q3,
                            @P3, @CashRebate, @Point, @ClearanceSale, @LastOrderPrice, @LastMarketLowestPrice, @LimitedQty
                            )";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramProductSysNo = new SqlParameter("@ProductSysNo", SqlDbType.Int,4);
            SqlParameter paramBasicPrice = new SqlParameter("@BasicPrice", SqlDbType.Decimal,9);
            SqlParameter paramCurrentPrice = new SqlParameter("@CurrentPrice", SqlDbType.Decimal,9);
            SqlParameter paramUnitCost = new SqlParameter("@UnitCost", SqlDbType.Decimal,9);
            SqlParameter paramDiscount = new SqlParameter("@Discount", SqlDbType.Decimal,9);
            SqlParameter paramPointType = new SqlParameter("@PointType", SqlDbType.Int,4);
            SqlParameter paramIsWholeSale = new SqlParameter("@IsWholeSale", SqlDbType.Int,4);
            SqlParameter paramQ1 = new SqlParameter("@Q1", SqlDbType.Int,4);
            SqlParameter paramP1 = new SqlParameter("@P1", SqlDbType.Decimal,9);
            SqlParameter paramQ2 = new SqlParameter("@Q2", SqlDbType.Int,4);
            SqlParameter paramP2 = new SqlParameter("@P2", SqlDbType.Decimal,9);
            SqlParameter paramQ3 = new SqlParameter("@Q3", SqlDbType.Int,4);
            SqlParameter paramP3 = new SqlParameter("@P3", SqlDbType.Decimal,9);
            SqlParameter paramCashRebate = new SqlParameter("@CashRebate", SqlDbType.Decimal,9);
            SqlParameter paramPoint = new SqlParameter("@Point", SqlDbType.Int,4);
            SqlParameter paramClearanceSale = new SqlParameter("@ClearanceSale", SqlDbType.Int,4);
            SqlParameter paramLastOrderPrice = new SqlParameter("@LastOrderPrice", SqlDbType.Decimal,9);
            SqlParameter paramLastMarketLowestPrice = new SqlParameter("@LastMarketLowestPrice", SqlDbType.Decimal, 9);
            SqlParameter paramLimitedQty = new SqlParameter("@LimitedQty", SqlDbType.Int, 4);

            if ( oParam.ProductSysNo != AppConst.IntNull)
                paramProductSysNo.Value = oParam.ProductSysNo;
            else
                paramProductSysNo.Value = System.DBNull.Value;
            if ( oParam.BasicPrice != AppConst.DecimalNull)
                paramBasicPrice.Value = oParam.BasicPrice;
            else
                paramBasicPrice.Value = System.DBNull.Value;
            if ( oParam.CurrentPrice != AppConst.DecimalNull)
                paramCurrentPrice.Value = oParam.CurrentPrice;
            else
                paramCurrentPrice.Value = System.DBNull.Value;
            if ( oParam.UnitCost != AppConst.DecimalNull)
                paramUnitCost.Value = oParam.UnitCost;
            else
                paramUnitCost.Value = System.DBNull.Value;
            if ( oParam.Discount != AppConst.DecimalNull)
                paramDiscount.Value = oParam.Discount;
            else
                paramDiscount.Value = System.DBNull.Value;
            if ( oParam.PointType != AppConst.IntNull)
                paramPointType.Value = oParam.PointType;
            else
                paramPointType.Value = System.DBNull.Value;
            if ( oParam.IsWholeSale != AppConst.IntNull)
                paramIsWholeSale.Value = oParam.IsWholeSale;
            else
                paramIsWholeSale.Value = 0;
            if ( oParam.Q1 != AppConst.IntNull)
                paramQ1.Value = oParam.Q1;
            else
                paramQ1.Value = System.DBNull.Value;
            if ( oParam.P1 != AppConst.DecimalNull)
                paramP1.Value = oParam.P1;
            else
                paramP1.Value = System.DBNull.Value;
            if ( oParam.Q2 != AppConst.IntNull)
                paramQ2.Value = oParam.Q2;
            else
                paramQ2.Value = System.DBNull.Value;
            if ( oParam.P2 != AppConst.DecimalNull)
                paramP2.Value = oParam.P2;
            else
                paramP2.Value = System.DBNull.Value;
            if ( oParam.Q3 != AppConst.IntNull)
                paramQ3.Value = oParam.Q3;
            else
                paramQ3.Value = System.DBNull.Value;
            if ( oParam.P3 != AppConst.DecimalNull)
                paramP3.Value = oParam.P3;
            else
                paramP3.Value = System.DBNull.Value;
            if ( oParam.CashRebate != AppConst.DecimalNull)
                paramCashRebate.Value = oParam.CashRebate;
            else
                paramCashRebate.Value = System.DBNull.Value;
            if ( oParam.Point != AppConst.IntNull)
                paramPoint.Value = oParam.Point;
            else
                paramPoint.Value = System.DBNull.Value;
            if ( oParam.ClearanceSale != AppConst.IntNull)
                paramClearanceSale.Value = oParam.ClearanceSale;
            else
                paramClearanceSale.Value = System.DBNull.Value;

            if ( oParam.LastOrderPrice != AppConst.IntNull)
                paramLastOrderPrice.Value = oParam.LastOrderPrice;
            else
                paramLastOrderPrice.Value = 0;

            if (oParam.LastMarketLowestPrice != AppConst.IntNull)
                paramLastMarketLowestPrice.Value = oParam.LastMarketLowestPrice;
            else
                paramLastMarketLowestPrice.Value = 0;

            if (oParam.LimitedQty != AppConst.IntNull)
                paramLimitedQty.Value = oParam.LimitedQty;
            else
                paramLimitedQty.Value = 999;
            cmd.Parameters.Add(paramProductSysNo);
            cmd.Parameters.Add(paramBasicPrice);
            cmd.Parameters.Add(paramCurrentPrice);
            cmd.Parameters.Add(paramUnitCost);
            cmd.Parameters.Add(paramDiscount);
            cmd.Parameters.Add(paramPointType);
            cmd.Parameters.Add(paramIsWholeSale);
            cmd.Parameters.Add(paramQ1);
            cmd.Parameters.Add(paramP1);
            cmd.Parameters.Add(paramQ2);
            cmd.Parameters.Add(paramP2);
            cmd.Parameters.Add(paramQ3);
            cmd.Parameters.Add(paramP3);
            cmd.Parameters.Add(paramCashRebate);
            cmd.Parameters.Add(paramPoint);
            cmd.Parameters.Add(paramClearanceSale);
            cmd.Parameters.Add(paramLastOrderPrice);
            cmd.Parameters.Add(paramLastMarketLowestPrice);
            cmd.Parameters.Add(paramLimitedQty);

            return SqlHelper.ExecuteNonQuery(cmd);
        }