Пример #1
0
        public static void MakePayment(CashOuts item)
        {
            switch (item.Type)
            {
            case 1:
                if (QiwiApi.MakePayment(item.Number, item.Value))
                {
                    DataHelper.UpdateCashOut(item.Id, (int)CashOutStatesEnum.Finished, string.Empty);
                }
                break;

            case 2:
            case 3:
            case 4:
                if (QiwiApi.MakePaymentBankCard(item.Number, item.Value))
                {
                    DataHelper.UpdateCashOut(item.Id, (int)CashOutStatesEnum.Finished, string.Empty);
                }
                break;

            case 5:
            case 100:
            default:
                break;
            }
        }
Пример #2
0
        //public static string GetHash(string val)
        //{
        //    SHA1 sha = new SHA1CryptoServiceProvider();
        //    byte[] data = sha.ComputeHash(Encoding.Default.GetBytes(val));

        //    StringBuilder sBuilder = new StringBuilder();

        //    for (int i = 0; i < data.Length; i++)
        //    {
        //        sBuilder.Append(data[i].ToString("x2"));
        //    }
        //    return sBuilder.ToString();
        //}

        #endregion

        #region Вывод

        /// <summary>
        /// Создание вывода
        /// </summary>
        public static int AddCashOut(CashOuts item)
        {
            using (var ctx = new RentooloEntities())
            {
                ctx.CashOuts.Add(item);

                try
                {
                    ctx.SaveChanges();
                }
                catch (System.Exception ex)
                {
                    DataHelper.AddException(ex);

                    return(0);
                }

                return(item.Id);
            }
        }