コード例 #1
0
 public WalletError ChangePaymentSystemWallets(ProtectedOperationContext ctx, UserPaymentSystem paySys,
                                               bool remove,
                                               string userLogin, string walletPwrd)
 {
     if (Channel == null)
     {
         throw new Exception("WalletManagerProxy: связь не установлена");
     }
     try
     {
         return(Channel.ChangePaymentSystemWallets(ctx, paySys, remove, userLogin, walletPwrd));
     }
     catch
     {
         RenewFactory();
         try
         {
             return(Channel.ChangePaymentSystemWallets(ctx, paySys, remove, userLogin, walletPwrd));
         }
         catch (Exception ex2)
         {
             Logger.Error("ChangePaymentSystemWallets() error: ", ex2);
             return(WalletError.CommonError);
         }
     }
 }
コード例 #2
0
 public static USER_PAYMENT_SYSTEM UndecorateUserPaymentSystem(UserPaymentSystem userPaySys)
 {
     if (userPaySys == null)
     {
         return(null);
     }
     return(new USER_PAYMENT_SYSTEM
     {
         Id = userPaySys.Id,
         UserId = userPaySys.UserId,
         PurseId = userPaySys.PurseId,
         RootId = userPaySys.RootId,
         SystemPayment = (byte)userPaySys.SystemPayment,
         PurseConfirm = userPaySys.PurseConfirm,
         FirstName = userPaySys.FirstName,
         LastName = userPaySys.LastName,
         Email = userPaySys.Email
     });
 }
コード例 #3
0
 public WalletError ChangePaymentSystemWallets(ProtectedOperationContext ctx, UserPaymentSystem paySys,
                                               bool remove,
                                               string userLogin, string walletPwrd)
 {
     if (Channel == null)
         throw new Exception("WalletManagerProxy: связь не установлена");
     try
     {
         return Channel.ChangePaymentSystemWallets(ctx, paySys, remove, userLogin, walletPwrd);
     }
     catch
     {
         RenewFactory();
         try
         {
             return Channel.ChangePaymentSystemWallets(ctx, paySys, remove, userLogin, walletPwrd);
         }
         catch (Exception ex2)
         {
             Logger.Error("ChangePaymentSystemWallets() error: ", ex2);
             return WalletError.CommonError;
         }
     }
 }
コード例 #4
0
        public WalletError ChangePaymentSystemWallets(ProtectedOperationContext secCtx, UserPaymentSystem paySys, bool remove,
                                                      string userLogin, string walletPwrd)
        {
            if (!UserSessionStorage.Instance.PermitUserOperation(secCtx, false, false))
            {
                return(WalletError.InsufficientRights);
            }

            try
            {
                using (var ctx = DatabaseContext.Instance.Make())
                {
                    var user = ctx.PLATFORM_USER.FirstOrDefault(u => u.Login == userLogin);
                    if (user == null)
                    {
                        return(WalletError.AuthenticationError);
                    }
                    var existSyst = ctx.USER_PAYMENT_SYSTEM.FirstOrDefault(s => s.Id == paySys.Id);

                    // удалить запись
                    if (remove)
                    {
                        if (existSyst == null)
                        {
                            return(WalletError.ServerError);
                        }
                        ctx.USER_PAYMENT_SYSTEM.Remove(existSyst);
                        ctx.SaveChanges();
                        return(WalletError.OK);
                    }

                    // создать новую запись
                    if (existSyst == null)
                    {
                    }

                    return(WalletError.OK);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("ChangePaymentSystemWallets() error", ex);
                return(WalletError.ServerError);
            }
        }
コード例 #5
0
 public static USER_PAYMENT_SYSTEM UndecorateUserPaymentSystem(UserPaymentSystem userPaySys)
 {
     if (userPaySys == null) return null;
     return new USER_PAYMENT_SYSTEM
     {
         Id = userPaySys.Id,
         UserId = userPaySys.UserId,
         PurseId = userPaySys.PurseId,
         RootId = userPaySys.RootId,
         SystemPayment = (byte)userPaySys.SystemPayment,
         PurseConfirm = userPaySys.PurseConfirm,
         FirstName = userPaySys.FirstName,
         LastName = userPaySys.LastName,
         Email = userPaySys.Email
     };
 }
コード例 #6
0
 /// <summary>
 /// проверяет по совпадению фактического
 /// (составного) ключа
 /// </summary>
 public bool AreSame(UserPaymentSystem syst)
 {
     return(SystemPayment == syst.SystemPayment && RootId == syst.RootId &&
            PurseId == syst.PurseId);
 }