Beispiel #1
0
        /// <summary>
        /// 保存变价原因
        /// </summary>
        /// <returns></returns>
        public ActionResult UpdataChangeWhyBaoCun()
        {
            string styMy = "fail";

            try
            {
                S_ChangeWhyList JJ = new S_ChangeWhyList();
                JJ.ChangeWhyID = Convert.ToInt32(Request.Form["ChangeWhyID"]);
                JJ.ChangeWhy   = Request.Form["ChangeWhy"];

                MyModels.Entry(JJ).State = System.Data.Entity.EntityState.Modified;
                MyModels.SaveChanges();
                styMy = "success";
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(Json(styMy, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        /// <summary>
        /// 新增变价原因
        /// </summary>
        /// <returns></returns>
        public ActionResult InsertChangeWhy(S_ChangeWhyList pwApplyTarget)
        {
            string strMsg = "fali";

            try
            {
                //判断数据是否已经存在
                int oldGoodsMoneyRuleRows = (from tbGoodsMoneyRule in MyModels.S_ChangeWhyList
                                             where tbGoodsMoneyRule.ChangeWhy == pwApplyTarget.ChangeWhy
                                             select tbGoodsMoneyRule).Count();
                if (oldGoodsMoneyRuleRows == 0)
                {
                    S_ChangeWhyList JJ = new S_ChangeWhyList();
                    JJ.ChangeWhy = Request.Form["ChangeWhy"];
                    if (JJ.ChangeWhy != null)
                    {
                        MyModels.S_ChangeWhyList.Add(JJ);
                        MyModels.SaveChanges();
                        return(Json("success", JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json("fail", JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    strMsg = "exsit";
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(Json(strMsg, JsonRequestBehavior.AllowGet));
        }