Пример #1
0
 /// <summary>
 /// 创建新的 tb_sales_fee 对象。
 /// </summary>
 /// <param name="id">id 属性的初始值。</param>
 public static tb_sales_fee Createtb_sales_fee(global::System.Int32 id)
 {
     tb_sales_fee tb_sales_fee = new tb_sales_fee();
     tb_sales_fee.id = id;
     return tb_sales_fee;
 }
Пример #2
0
 /// <summary>
 /// 用于向 tb_sales_fee EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddTotb_sales_fee(tb_sales_fee tb_sales_fee)
 {
     base.AddObject("tb_sales_fee", tb_sales_fee);
 }
        public ActionResult SetFee(tb_sales_fee fee)
        {
            var msg = new Message();

            if (UserService.GetModal(a => a.username.Equals(User.Identity.Name)).type == 0)
            {
                msg.code = 0;
                msg.body = "您的权限不足";

                return Json(msg);
            }

            if (fee.installfee <= 0 || fee.recommendfee <= 0)
            {
                fee.installfee = 0;
                fee.recommendfee = 0;
            }
            else
            {
                var fees = FeeService.GetList(a => a.id > 0);
                if (fees != null)
                {
                    if (fees.Count >= 1)
                    {
                        fees.ToList().ForEach((f) => { FeeService.Delete(f); });
                    }
                }

                var result = FeeService.Insert(fee);

                if (result)
                {
                    msg.code = 1;
                    msg.body = "设置成功";
                }
                else
                {
                    msg.code = 0;
                    msg.body = "设置失败";
                }
            }
            return Json(msg);
        }