Beispiel #1
0
        /// <summary>
        /// 新增定价规则
        /// </summary>
        /// <returns></returns>
        public ActionResult InsertGoodsMoneyRule(S_GoodsMoneyRuleList pwGoodsMoneyRule)
        {
            string strMsg = "fali";

            try
            {
                //判断数据是否已经存在
                int oldGoodsMoneyRuleRows = (from tbGoodsMoneyRule in MyModels.S_GoodsMoneyRuleList
                                             where tbGoodsMoneyRule.ShangXianMoney == pwGoodsMoneyRule.ShangXianMoney
                                             select tbGoodsMoneyRule).Count();
                if (oldGoodsMoneyRuleRows == 0)
                {
                    S_GoodsMoneyRuleList JJ = new S_GoodsMoneyRuleList();
                    JJ.ShangXianMoney = Convert.ToDecimal(Request.Form["ShangXianMoney"]);
                    JJ.XiaXianMoney   = Convert.ToDecimal(Request.Form["XiaXianMoney"]);
                    JJ.DecimalDigits  = Request.Form["DecimalDigits"];
                    JJ.PriceTypeID    = Convert.ToInt32(Request.Form["PriceTypeID"]);

                    MyModels.S_GoodsMoneyRuleList.Add(JJ);
                    MyModels.SaveChanges();

                    strMsg = "success";
                }
                else
                {
                    strMsg = "exsit";
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(Json(strMsg, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        /// <summary>
        /// 删除定价规则
        /// </summary>
        /// <param name="GoodsMoneyRuleId"></param>
        /// <returns></returns>
        public ActionResult DeleteGoodsMoneyRule(int GoodsMoneyRuleId)
        {
            //定义返回
            string strMsg = "fail";

            try
            {
                S_GoodsMoneyRuleList dbGoodsMoneyRule = (from tbGoodsMoneyRule in MyModels.S_GoodsMoneyRuleList
                                                         where tbGoodsMoneyRule.GoodsMoneyRuleID == GoodsMoneyRuleId
                                                         select tbGoodsMoneyRule).Single();
                MyModels.S_GoodsMoneyRuleList.Remove(dbGoodsMoneyRule);
                if (MyModels.SaveChanges() > 0)
                {
                    strMsg = "success";
                }
            }
            catch (Exception e)
            {
            }
            return(Json(strMsg, JsonRequestBehavior.AllowGet));
        }