Пример #1
0
        /// <summary>
        /// 更改资金变动信息
        /// </summary>
        /// <param name="New_Account">新的资金变动实体</param>
        /// <returns></returns>
        public bool UpdateAccount(Car_Account TempAccount)
        {
            Car_Account OldAccount = DB_Account.Select(P => P.Account_ID == TempAccount.Account_ID).Single();
            Car_Account NewAccount = OldAccount;

            NewAccount.Account_Info  = TempAccount.Account_Info;
            NewAccount.Account_Price = TempAccount.Account_Price;
            NewAccount.Account_Shop  = TempAccount.Account_Shop;
            NewAccount.Account_Time  = TempAccount.Account_Time;
            NewAccount.Account_User  = TempAccount.Account_User;
            return(DB_Account.Update(OldAccount, NewAccount));
        }
Пример #2
0
        public bool Pay_Order(int OrderID)
        {
            Account  Account_Manager  = new Account();
            Checkout Checkout_Manager = new Checkout();

            Checkout_Manager.DB_Checkout.dt = Account_Manager.DB_Account.dt;



            Order_ViewModel Summery      = DB_ViewModel.Select(P => P.Order_ID == OrderID).Single();
            Car_Checkout    old_checkout = Checkout_Manager.SelectCheckout_ID(Summery.Checkout_ID);
            Car_Checkout    new_Checkout = old_checkout;

            new_Checkout.Checkout_Mark = true;

            //定义付款操作所需要的实体成员
            Car_Account account = new Car_Account()
            {
                Account_Price = GetPrice_OrderID(Summery.Order_ID),
                Account_Shop  = Summery.Shop_ID,
                Account_Time  = DateTime.Now,
                Account_User  = (Guid)new_Checkout.Checkout_User,
                Account_Info  = String.Format("第{0}号的订单进行了买单操作!", Summery.Order_ID)
            };

            using (TransactionScope tc = new TransactionScope())
            {
                try
                {
                    Account_Manager.AddAccount_Trans(account);
                    Checkout_Manager.UpdateCheckout_Trans(new_Checkout);
                    Account_Manager.DB_Account.SubmitChanges();
                    tc.Complete();
                }
                catch
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #3
0
        public bool Order_Cancel(int OrderID, Guid UID)
        {
            Checkout Checkout_Manager = new Checkout();
            Account  Account_Manager  = new Account();

            Account_Manager.DB_Account.dt = Checkout_Manager.DB_Checkout.dt;
            Order_ViewModel CancelOrder = DB_ViewModel.Select(P => P.Order_ID == OrderID).Single();

            int     OrderCount = CancelOrder.Order_Count;
            decimal CastPrice  = OrderCount * 1000;

            Car_Account acc = new Car_Account()
            {
                Account_Info  = String.Format("这笔款项来源自用户:{0},身份证:{1}的取消订单违约金", CancelOrder.Client_RealName, CancelOrder.Client_Validaton),
                Account_Price = CastPrice,
                Account_Shop  = CancelOrder.Shop_ID,
                Account_Time  = DateTime.Now,
                Account_User  = UID
            };

            using (TransactionScope TS = new TransactionScope())
            {
                try
                {
                    Checkout_Manager.DeleteCheckout_Trans(OrderID);
                    Account_Manager.AddAccount_Trans(acc);

                    Checkout_Manager.DB_Checkout.SubmitChanges();
                    TS.Complete();
                }
                catch
                {
                    return(false);
                }
                return(true);
            }
        }
Пример #4
0
        /// <summary>
        /// 删除资金变动信息
        /// </summary>
        /// <param name="Account">要删除的资金变动实体</param>
        /// <returns></returns>
        public bool DeleteAccount(int AccountID)
        {
            Car_Account Acc = DB_Account.Select(P => P.Account_ID == AccountID).Single();

            return(DB_Account.Delete(Acc));
        }
Пример #5
0
 /// <summary>
 /// 新增资金变动信息
 /// </summary>
 /// <param name="Account">要增加的资金变动实体</param>
 /// <returns></returns>
 public bool AddAccount(Car_Account Account)
 {
     return(DB_Account.Insert(Account));
 }
Пример #6
0
 /// <summary>
 /// 新增资金变动信息
 /// </summary>
 /// <param name="Account">要增加的资金变动实体</param>
 /// <returns></returns>
 public bool AddAccount_Trans(Car_Account Account)
 {
     return(DB_Account.Insert_NoSub(Account));
 }