Esempio n. 1
0
 public static bool CheckExistCashIn(CashIns item)
 {
     using (var ctx = new DataClasses1DataContext())
     {
         return(ctx.CashIns.Any(x => x.UserId == item.UserId &&
                                x.Value == item.Value &&
                                x.WhenDate == item.WhenDate));
     }
 }
Esempio n. 2
0
 public static bool CheckExistCashIn(CashIns item)
 {
     using (var ctx = new RentooloEntities())
     {
         return(ctx.CashIns.Any(x => x.UserId == item.UserId &&
                                x.Value == item.Value &&
                                x.WhenDate == item.WhenDate));
     }
 }
Esempio n. 3
0
        public static void AddCashIn(CashIns item)
        {
            using (var ctx = new DataClasses1DataContext())
            {
                ctx.CashIns.InsertOnSubmit(item);

                try
                {
                    ctx.SubmitChanges();
                }
                catch (System.Exception ex)
                {
                    DataHelper.AddException(ex);
                }
            }
        }
Esempio n. 4
0
        public static void AddCashIn(CashIns item)
        {
            using (var ctx = new RentooloEntities())
            {
                ctx.CashIns.Add(item);

                try
                {
                    ctx.SaveChanges();
                }
                catch (System.Exception ex)
                {
                    DataHelper.AddException(ex);
                }
            }
        }
Esempio n. 5
0
        public static void AddQiwiPayment(int userPublicId, double amount, DateTime date, string acceptedAccount)
        {
            try
            {
                CashIns cashIn = new CashIns
                {
                    UserId          = DataHelper.GetUserByPublicId(userPublicId).UserId,
                    Value           = amount,
                    Sposob          = "Qiwi",
                    WhenDate        = date,
                    AcceptedAccount = acceptedAccount
                };

                if (!CheckExistCashIn(cashIn))
                {
                    AddCashIn(cashIn);

                    DataHelper.AddQiwiBalanceUpdatePerMonth(acceptedAccount, amount);

                    #region Логирование операции

                    {
                        Operation operation = new Operation
                        {
                            UserId  = cashIn.UserId,
                            Value   = cashIn.Value,
                            Type    = (int)OperationTypesEnum.AddBalance,
                            Comment =
                                string.Format("Пополнение RURT на сумму {0} р. Способ: 'Qiwi'.",
                                              cashIn.Value),
                            WhenDate = cashIn.WhenDate
                        };

                        AddOperation(operation);
                    }

                    #endregion
                }
            }
            catch (System.Exception ex)
            {
                AddException(ex);
            }
        }