예제 #1
0
 /// <summary>
 /// 用于向 tb_sales_install EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddTotb_sales_install(tb_sales_install tb_sales_install)
 {
     base.AddObject("tb_sales_install", tb_sales_install);
 }
        public ActionResult Install(string goodid)
        {
            var msg = new Message();
            var user = User;

            if (user == null)
            {
                msg.code = 0;
                msg.body = "会话时间到,请重新登陆";

                return Json(msg);
            }

            var allian_id = UserService.GetModal(a => a.username.Equals(user.Identity.Name)).alliance;

            var install = new tb_sales_install
            {
                install_time = DateTime.Now,
                order_id = goodid,
                allian_id = allian_id.ToString(),
                user_id = UserService.GetModal(b => b.username.Equals(user.Identity.Name)).id.ToString()
            };

            //1.在安装表中插入条目
            var result1 = InstallService.Insert(install);

            //2.修改订单中的条目,将订单标识为已安装
            var order = OrderService.GetModal(a => a.order_id.Equals(goodid));
            order.is_installed = 1;
            var result2 = OrderService.Update(order);

            if (result1 && result2)
            {
                msg.code = 1;
                msg.body = "安装成功";
            }
            else
            {
                msg.code = 0;
                msg.body = "安装失败";
            }

            return Json(msg);
        }
예제 #3
0
 /// <summary>
 /// 创建新的 tb_sales_install 对象。
 /// </summary>
 /// <param name="id">id 属性的初始值。</param>
 /// <param name="order_id">order_id 属性的初始值。</param>
 /// <param name="allian_id">allian_id 属性的初始值。</param>
 public static tb_sales_install Createtb_sales_install(global::System.Int32 id, global::System.String order_id, global::System.String allian_id)
 {
     tb_sales_install tb_sales_install = new tb_sales_install();
     tb_sales_install.id = id;
     tb_sales_install.order_id = order_id;
     tb_sales_install.allian_id = allian_id;
     return tb_sales_install;
 }