Example #1
0
        public ActionResult AddOrUpdate_Server(PriceProperty info)
        {
            Framework.Commons.CommonResult result = new Framework.Commons.CommonResult();

            //价格明细
            var lstPrice  = new List <PriceDetail>();
            var stepCount = RRequest("IntStepCount").ToInt32();

            //阶梯,如果是则是页面的阶梯数,不是则为1
            stepCount = info.IntStep == 1 ? stepCount : 1;
            for (int i = 1; i <= stepCount; i++)
            {
                PriceDetail price_detail_info = new PriceDetail
                {
                    //阶梯数
                    IntStepOrder = (uint)i,
                    //阶梯起始量
                    IntStepStart = (uint)RRequest("IntStepStart" + i).ToIntOrZero(),
                    // 阶梯增量
                    IntStepInc = (uint)RRequest("IntStepInc" + i).ToIntOrZero(),
                    // 总价格
                    TotalPrice = (double)RRequest("NumTotalPrice" + i).ToDecimalOrZero()
                };
                //价格分项
                Dictionary <int, double> price_info = new Dictionary <int, double>();
                var arrTypeNo = Request["ArrTypeNo"].Split(',');
                foreach (var intTypeNo in arrTypeNo)
                {
                    price_info.Add(intTypeNo.ToInt32(), (double)RRequest("NumPrice" + i + "_" + intTypeNo).ToDecimalOrZero());
                }
                price_detail_info.Price = price_info;
                lstPrice.Add(price_detail_info);
            }
            //厂家编码
            var endcode = Session["EndCode"] ?? "0";

            info.IntEndCode = endcode.ToString().ToInt32();
            //操作员
            info.IntUserNo = CurrentUser.ID;
            try
            {
                ServiceDbClient DbServer = new ServiceDbClient();
                var             flag     = DbServer.PriceProperty_AddOrUpdate(info, lstPrice.ToArray());
                if (flag == "0")
                {
                    result.Success = true;
                }
                else
                {
                    result.ErrorMessage = flag;
                    result.Success      = false;
                }
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(ToJsonContent(result));
        }
Example #2
0
 /// <summary>
 /// コンストラクタ(3)
 /// </summary>
 /// <param name="book">Book</param>
 public Book(Book book)
     : this()
 {
     IdProperty.Init(book.Id);
     TitleProperty.Init(string.Format("*{0}", book.Title));
     AuthorProperty.Init(book.Author);
     PublisherProperty.Init(book.Publisher);
     CategoryProperty.Init(book.Category);
     PriceProperty.Init(book.Price);
     PurchaseDateProperty.Init(book.PurchaseDate);
     ReviewPointProperty.Init(book.ReviewPoint);
 }
Example #3
0
 /// <summary>
 /// コンストラクタ(2)
 /// </summary>
 /// <param name="id">int : ID</param>
 /// <param name="title">string : タイトル</param>
 /// <param name="author">string : 著者</param>
 /// <param name="publisher">string : 出版社</param>
 /// <param name="category">BookCategories : カテゴリー</param>
 /// <param name="price">decimal : 価格</param>
 /// <param name="purchaseDate">DateTime? : 購入日</param>
 /// <param name="reviewPoint">int : 評価点</param>
 public Book(int id, string title, string author, string publisher, BookCategories category, decimal price, DateTime?purchaseDate, int reviewPoint)
     : this()
 {
     IdProperty.Init(id);
     TitleProperty.Init(title);
     AuthorProperty.Init(author);
     PublisherProperty.Init(publisher);
     CategoryProperty.Init(category);
     PriceProperty.Init(price);
     PurchaseDateProperty.Init(purchaseDate);
     ReviewPointProperty.Init(reviewPoint);
 }
Example #4
0
 set => SetValue(PriceProperty, value);
 set => this.SetValue(PriceProperty, value);