Beispiel #1
0
        public bool SaveRec(Guid productId)
        {
            bool result = false;

            DAL.Product oProduct = DAL.Product.Load(productId);
            if (oProduct != null)
            {
                oProduct.FixedPriceItem = chkFixedPrice.Checked;
                oProduct.Save();

                string sql = "ProductId = '" + productId.ToString() + "'";
                DAL.ProductSupplement oProdSupp = DAL.ProductSupplement.LoadWhere(sql);
                if (oProdSupp == null)
                {
                    oProdSupp = new DAL.ProductSupplement();

                    oProdSupp.ProductId = productId;
                }

                oProdSupp.VipDiscount_FixedItem      = Convert.ToDecimal((txtDiscount1_FixPriceItem.Text == string.Empty) ? "0" : txtDiscount1_FixPriceItem.Text);
                oProdSupp.VipDiscount_DiscountItem   = Convert.ToDecimal((txtDiscount2_DiscountItem.Text == string.Empty) ? "0" : txtDiscount2_DiscountItem.Text);
                oProdSupp.VipDiscount_NoDiscountItem = Convert.ToDecimal((txtDiscount3_NoDiscountItem.Text == string.Empty) ? "0" : txtDiscount3_NoDiscountItem.Text);
                oProdSupp.StaffDiscount = Convert.ToDecimal((txtStaff.Text == string.Empty) ? "0" : txtStaff.Text);
                oProdSupp.Save();

                _ProductId = productId;
                result     = true;
            }
            return(result);
        }
Beispiel #2
0
        private bool Save()
        {
            bool result = false;

            if (Verify())
            {
                Cursor.Current = Cursors.WaitCursor;
                #region 2013.12.22 paulus: 舊 code,唔再用
                //this.ProductId = SaveGeneralInfo();
                //if (this.ProductId != System.Guid.Empty)
                //{
                //    SaveProductCurrentSummary(this.ProductId);

                //    SaveQtyInfo();
                //    SaveOrderInfo();
                //    SaveDiscountInfo();

                //    result = true;
                //}
                #endregion
                if (_ProductId == Guid.Empty)
                {
                    SaveAsNewProduct();
                }
                else
                {
                    DAL.Product oProduct = DAL.Product.Load(_ProductId);
                    oProduct.Status     = Convert.ToInt32(RT2020.DAL.Common.Enums.Status.Modified.ToString("d"));
                    oProduct.ModifiedBy = RT2020.DAL.Common.Config.CurrentUserId;
                    oProduct.ModifiedOn = DateTime.Now;
                    oProduct.Save();
                }
                if (_ProductId != Guid.Empty)
                {
                    general.SaveRec(_ProductId);

                    if (tpQty.Contains(quantity))
                    {
                        quantity.SaveRec(_ProductId);
                    }
                    if (tpMisc.Contains(misc))
                    {
                        misc.SaveRec(_ProductId);
                    }
                    if (tpOrder.Contains(order))
                    {
                        order.SaveRec(_ProductId);
                    }
                    if (tpDiscount.Contains(discount))
                    {
                        discount.SaveRec(_ProductId);
                    }
                    result = true;
                }
                Cursor.Current = Cursors.Default;
            }

            return(result);
        }