Ejemplo n.º 1
0
        public bool DeleteAccount(AccountItem account)
        {
            this.ThrowIfWalletIsNotOpen();

            Guard.ArgumentIsNotNull(account, nameof(account));

            if (account == null)
            {
                throw new ArgumentNullException(nameof(account));
            }

            var accountScriptHash = account.ScriptHash;

            var deletedSuccessfully = this.currentWallet.DeleteAccount(accountScriptHash);

            if (!deletedSuccessfully)
            {
                return(false);
            }

            this.currentWalletInfo.RemoveAccount(accountScriptHash);

            this.SetWalletBalanceChangedFlag();

            return(true);
        }
Ejemplo n.º 2
0
        public static UpdateInsertPair <VideoItem> ImportToSitecore(this AccountItem account, BCVideo Video, UpdateType utype)
        {
            List <BCVideo> Videos = new List <BCVideo>();

            Videos.Add(Video);
            return(ImportToSitecore(account, Videos, utype));
        }
Ejemplo n.º 3
0
        public void given_account_item_return_correct_csv_format_string()
        {
            AccountItem accountItem     = new AccountItem("Salary", Category.Income, new Money(8000, Currency.RMB), new DateTime(2019, 5, 26));
            string      csvFormatString = "Salary;Income;RMB 8000.00;2019/05/26 12:00;;";

            Assert.AreEqual(csvFormatString, accountItem.ToCsvFormatString());
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            AccountItem item1   = new AccountItem("item1", CategoryType.Expend, new Money(100), new DateTime(2019, 5, 6), Note: "sad");
            AccountItem item2   = new AccountItem("item2", CategoryType.Expend, new Money(300), new DateTime(2019, 5, 8));
            AccountItem item3   = new AccountItem("item2", CategoryType.Income, new Money(50), new DateTime(2019, 5, 15));
            AccountItem item4   = new AccountItem("item3", CategoryType.Expend, new Money(500), new DateTime(2019, 3, 8));
            AccountItem item5   = new AccountItem("item4", CategoryType.Expend, new Money(700, MoneyType.USD), new DateTime(2019, 3, 2));
            Accounts    account = new Accounts();

            account.addItem(item1);
            account.addItem(item2);
            account.addItem(item3);
            account.addItem(item4);
            account.addItem(item5);
            int      month       = 5;
            DateTime OccuredTime = new DateTime(2019, month, 1);

            Console.WriteLine($"Total Revenue in {OccuredTime} is {account.TotalRevenue(OccuredTime)}");
            Console.WriteLine($"Total Income in {OccuredTime} is {account.TotalIncome(OccuredTime)}");
            Console.WriteLine($"Total Expend in {OccuredTime} is {account.TotalExpend(OccuredTime)}");
            foreach (AccountItem item in account.Display(OccuredTime))
            {
                Console.WriteLine(item);
            }



            //Console.WriteLine("123");
        }
Ejemplo n.º 5
0
        /// <summary>
        /// This method will import / update a list of videos into the Brightcove Video Library
        /// </summary>
        /// <param name="Videos">
        /// The Videos to import / update
        /// </param>
        /// <returns>
        /// returns a list of the new videos imported
        /// </returns>
        public static UpdateInsertPair <VideoItem> ImportToSitecore(this AccountItem account, List <BCVideo> Videos, UpdateType utype)
        {
            UpdateInsertPair <VideoItem> uip = new UpdateInsertPair <VideoItem>();

            //set all BCVideos into hashtable for quick access
            Hashtable ht = new Hashtable();

            foreach (VideoItem exVid in account.VideoLib.Videos)
            {
                if (!ht.ContainsKey(exVid.VideoID.ToString()))
                {
                    //set as string, Item pair
                    ht.Add(exVid.VideoID.ToString(), exVid);
                }
            }

            //Loop through the data source and add them
            foreach (BCVideo vid in Videos)
            {
                try {
                    //remove access filter
                    using (new Sitecore.SecurityModel.SecurityDisabler()) {
                        VideoItem currentItem;

                        //if it exists then update it
                        if (ht.ContainsKey(vid.id.ToString()) && (utype.Equals(UpdateType.BOTH) || utype.Equals(UpdateType.UPDATE)))
                        {
                            currentItem = (VideoItem)ht[vid.id.ToString()];

                            //add it to the new items
                            uip.UpdatedItems.Add(currentItem);

                            using (new EditContext(currentItem.videoItem, true, false)) {
                                SetVideoFields(ref currentItem.videoItem, vid);
                            }
                        }
                        //else just add it
                        else if (!ht.ContainsKey(vid.id.ToString()) && (utype.Equals(UpdateType.BOTH) || utype.Equals(UpdateType.NEW)))
                        {
                            //Create new item
                            TemplateItem templateType = account.Database.Templates["Modules/Brightcove/Brightcove Video"];

                            currentItem = new VideoItem(account.VideoLib.videoLibraryItem.Add(vid.name.StripInvalidChars(), templateType));

                            //add it to the new items
                            uip.NewItems.Add(currentItem);

                            using (new EditContext(currentItem.videoItem, true, false)) {
                                SetVideoFields(ref currentItem.videoItem, vid);
                            }
                        }
                    }
                } catch (System.Exception ex) {
                    //HttpContext.Current.Response.Write(vid.name + "<br/>");
                    throw new Exception("Failed on video: " + vid.name + ". " + ex.ToString());
                }
            }

            return(uip);
        }
Ejemplo n.º 6
0
        public MsgEntity AccountLogin(AccountItem account)
        {
            MsgEntity r;

            string             path          = GZH.CL.ConfigSetting.weixinAgentAccount;
            Account            accountEntity = XmlHelper.XmlDeserializeFromFile <GZH.Agent.Manager.Models.Account>(path, Encoding.UTF8);
            List <AccountItem> accounts      = (from a in accountEntity.accountItem where (a.name == account.name && a.pwd == account.pwd) select a).ToList <AccountItem>();

            if (accounts.Count > 0)
            {
                if (accounts[0].status)
                {
                    r = ResponseMsg.SetEntity(out r, 4000);

                    string sessionName = WebConfigurationManager.AppSettings["loginSessionName"];
                    HttpContext.Current.Session[sessionName] = accounts[0];
                    logs.Fatal(accounts[0].name + " is logined");
                }
                else
                {
                    r = ResponseMsg.SetEntity(out r, 4101);
                }
            }
            else
            {
                r = ResponseMsg.SetEntity(out r, 4100);
            }

            return(r);
        }
Ejemplo n.º 7
0
        public async Task <ActionResult> AccountPaymentResult(string paymentUniqueId, int state,
                                                              CancellationToken cancellationToken)
        {
            var uniqueId = Guid.Parse(paymentUniqueId);
            var payment  = await _dataContext.Payments.Include(q => q.ShopItem).FirstOrDefaultAsync(q => q.UniqueId == uniqueId, cancellationToken);

            if (payment == null)
            {
                return(NotFound());
            }

            //TODO: Real online payment verification
            if (state == 0)
            {
                payment.State = PaymentStateIds.Paid;

                var accountItem = await _dataContext.AccountItems.FirstOrDefaultAsync(
                    q => q.AccountId == payment.AccountId && q.ItemTypeId == payment.ShopItem.TypeId,
                    cancellationToken);

                var playerStats = await _dataContext.AccountStatsSummaries.FirstAsync(q =>
                                                                                      q.IsArchived == false && q.AccountId == payment.AccountId, cancellationToken : cancellationToken);

                if (accountItem != null)
                {
                    accountItem.Quantity += payment.ShopItem.Quantity ?? 1;
                }
                else
                {
                    accountItem = new AccountItem
                    {
                        AccountId  = payment.AccountId,
                        ShopItemId = payment.ShopItemId,
                        Quantity   = payment.ShopItem.Quantity ?? 1,
                        ItemTypeId = payment.ShopItem.TypeId
                    };

                    _dataContext.AccountItems.Add(accountItem);
                }

                if (payment.ShopItem.TypeId == ShopItemTypeIds.AvatarItem)
                {
                    playerStats.CoinsSpentOnAvatarItems += (long)payment.Amount;
                }
                else if (payment.ShopItem.TypeId == ShopItemTypeIds.Booster)
                {
                    playerStats.CoinsSpentOnBoosterItems += (long)payment.Amount;
                }

                await _achievementService.ProcessPaymentAchievementsAsync(playerStats, payment, cancellationToken);
            }
            else
            {
                payment.State = PaymentStateIds.Failed;
            }

            await _dataContext.SaveChangesAsync(cancellationToken);

            return(Redirect($"{payment.RedirectUrl}?isSuccess={(payment.State == PaymentStateIds.Paid ? "true" : "false")}"));
        }
        /// <summary>
        /// Event when "SIGN IN" button is clicked.
        /// </summary>
        /// <param name="sender"> Parameter about which object is invoked the current event. </param>
        /// <param name="args"> Event arguments</param>
        public async void CreateClicked(object sender, EventArgs args)
        {
            int    id;
            Button button = (Button)sender;

            // Set account item
            AccountItem account = new AccountItem();

            account.UserId       = userId;
            account.UserPassword = userPass;

            if (string.IsNullOrEmpty(account.UserId) || string.IsNullOrEmpty(account.UserPassword))
            {
                // Check wrong Input parameter
                await DisplayAlert("Error!", "Please Input ID / Password Correctly", "OK");
            }
            else
            {
                // Add account and receive account id.
                id = accountAPIs.AccountAdd(account);

                // Load account sign out content page
                AccountSignOut accountSignOut = new AccountSignOut(id, userId);
                await Navigation.PushAsync(accountSignOut);
            }
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,AccountCode,Amount,BankCode,Description,InputDate,MandateId,PartnerName,Type,ValueDate,ConnectionId")] AccountItem accountItem)
        {
            if (id != accountItem.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(accountItem);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccountItemExists(accountItem.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ConnectionId"] = new SelectList(_context.ConnectionData, "Id", "AccountId", accountItem.ConnectionId);
            return(View(accountItem));
        }
Ejemplo n.º 10
0
        public Form1()
        {
            InitializeComponent();
            accounts = new Accounts();

            if (!File.Exists(fileName))
            {
                File.Create(fileName);
            }
            using (StreamReader streamReader = new StreamReader(fileName))
            {
                string line;
                while ((line = streamReader.ReadLine()) != null)
                {
                    var infos    = line.Split(';');
                    var amount   = double.Parse(infos[0]);
                    var content  = infos[1];
                    var note     = infos[2];
                    var category = infos[3] == "Spending" ? Category.Spending : Category.Income;
                    var name     = infos[4];
                    var time     = DateTime.Parse(infos[5]);
                    var account  = new AccountItem(name, category, content, note, amount, time);
                    accounts.Add(account);
                }
            }
        }
Ejemplo n.º 11
0
 internal static void AddItem(AccountItem accountItem)
 {
     accounts.Add(accountItem);
     WriteData(dataFilePath);
     mainForm.SetMonthPicker(accountItem.OccuredTime);
     mainForm.RefreshDataView(accounts);
 }
Ejemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try {
                //get the current item and database
                currentDB   = Sitecore.Configuration.Factory.GetDatabase("master");
                currentItem = new PlaylistItem(currentDB.Items[HttpContext.Current.Request.QueryString["id"].ToString()]);
                Item acct = currentItem.playlistItem.Parent.Parent;
                //if current parent isn't the account then it's the parent of the folder
                if (!acct.TemplateName.Equals("Account Folder"))
                {
                    acct = acct.Parent;
                }
                accountItem = new AccountItem(acct.ID, acct.InnerData, acct.Database);
                bc          = new BCAPI(accountItem.PublisherID);

                if (!IsPostBack)
                {
                    loadFormWithCurrentValues();

                    //load non-editable information
                    ltlPlaylistID.Text = currentItem.PlaylistID.ToString();
                    ltlVideos.Text     = currentItem.VideoIds.Count.ToString();
                    ltlAccount.Text    = currentItem.AccountId.ToString();
                }
            }
            catch (Exception ex) {
                ltlError.Text = ex.ToString();
            }
        }
Ejemplo n.º 13
0
        public static async void Update(AccountItem item)
        {
            using (var connection = await DaoUtil.GetSqlConnection())
            {
                connection.Open();
                var command = new SqliteCommand
                {
                    Connection  = connection,
                    CommandText = @"UPDATE accountItem
                            SET year = @year,
                            month = @month ,
                            day = @day,
                            remark = @remark,
                            money = @money,
                            category_id = @categoryId
                            WHERE id =@id"
                };
                command.Parameters.AddWithValue("@year", item.Year);
                command.Parameters.AddWithValue("@month", item.Month);
                command.Parameters.AddWithValue("@day", item.Day);
                command.Parameters.AddWithValue("@remark", item.Remark);
                command.Parameters.AddWithValue("@money", item.Money);
                command.Parameters.AddWithValue("@categoryId", item.CategoryId);
                command.Parameters.AddWithValue("@id", item.Id);
                await command.ExecuteNonQueryAsync();

                connection.Close();
            }
        }
Ejemplo n.º 14
0
        public static UpdateInsertPair <PlaylistItem> ImportToSitecore(this AccountItem account, BCPlaylist Playlist, UpdateType utype)
        {
            List <BCPlaylist> Playlists = new List <BCPlaylist>();

            Playlists.Add(Playlist);
            return(ImportToSitecore(account, Playlists, utype));
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 將接收到的資料依格式解析並載入
        /// </summary>
        /// <returns></returns>
        public void recieveData(string msg)
        {
            // if (File.Exists("aaa_Account.txt"))
            //   {
            //     StreamReader accountFileReader = new StreamReader("aaa_Account.txt");
            //     _account.Clear();
            //    while (true)
            //    {
            //         string dataString = accountFileReader.ReadLine();
            //         if (dataString == null) break;

            //程式代碼_帳戶_該筆資料ID_該筆資料日期_該筆收支描述_該筆資料收支
            string[]    splitData  = msg.Split('_');
            AccountItem newAccount = new AccountItem();

            newAccount.Id = Convert.ToInt32(splitData[2]);
            DateTime resultDate = Tool.StringToDate(splitData[3]);

            newAccount.Date     = new DateTime(resultDate.Year, resultDate.Month, resultDate.Day);
            newAccount.ItemName = splitData[4];
            newAccount.Cost     = Convert.ToInt32(splitData[5]);

            _account.Add(newAccount);
            //   }
            _nextId = _account[_account.Count - 1].Id + 1;
            //      accountFileReader.Close();
            //  }
        }
Ejemplo n.º 16
0
        private void AddAccountItem(WalletAccount account)
        {
            // Check if account item already exists
            if (this.currentWalletInfo.ContainsAccount(account.ScriptHash))
            {
                return;
            }

            AccountType accountType;

            if (account.WatchOnly)
            {
                accountType = AccountType.WatchOnly;
            }
            else
            {
                accountType = account.Contract.IsStandard
                    ? AccountType.Standard
                    : AccountType.NonStandard;
            }

            var newAccountItem = new AccountItem(account.Label, account.ScriptHash, accountType);

            this.currentWalletInfo.AddAccount(newAccountItem);

            this.messagePublisher.Publish(new AccountAddedMessage(newAccountItem));
        }
        private void AddAccountItem(Account account)
        {
            // Create an account item based on the specified account
            AccountItem item = new AccountItem(account);

            // Register the custom click event to handle selection
            item.ItemClicked += (sender, e) =>
            {
                // Either unselect the item if its already selected or select it
                if (m_selected == sender)
                {
                    // Unselect the item
                    m_selected.Unselect();

                    // set the selected item to null
                    m_selected = null;
                }
                else
                {
                    // Unselect the currently selected item if not null
                    m_selected?.Unselect();

                    // Change the selected item and select it
                    m_selected = sender as AccountItem;
                    m_selected.Select();
                }

                // Update the UI to apply selection change
                btnRemoveAccount.Enabled = m_selected != null;
            };

            // Add the item control to the flow layout panel
            flwpnlAccounts.Controls.Add(item);
        }
Ejemplo n.º 18
0
        private List <AccountItem> GetSelectedAccounts()
        {
            if (PageParameter("token") != String.Empty && PageParameter("PayerID") != string.Empty)
            {
                // Load this once per token request
                if (TokenSelectedAccounts != null)
                {
                    return(TokenSelectedAccounts);
                }
                SelectedAccounts = new List <AccountItem>();
                String errorMessage     = string.Empty;
                var    selectedAccounts = ((org.secc.PayPalExpress.Gateway)_payPalExpressGatewayComponent).GetSelectedAccounts(_payPalExpressGateway, PageParameter("token"), out errorMessage);
                if (errorMessage != string.Empty)
                {
                    ShowMessage(NotificationBoxType.Danger, "Payment Processing Error", errorMessage);
                    return(SelectedAccounts);
                }

                foreach (RedirectGatewayComponent.GatewayAccountItem accountItem in selectedAccounts)
                {
                    AccountItem item = new AccountItem(accountItem.Id, 0, accountItem.Name, null, accountItem.PublicName);
                    item.Amount = accountItem.Amount;
                    SelectedAccounts.Add(item);
                }
                TokenSelectedAccounts = SelectedAccounts;
            }
            return(SelectedAccounts);
        }
Ejemplo n.º 19
0
 public JsonResult AccountWrite(AccountItem item)
 {
     item.State   = "REG";
     item.RegDate = DateTime.Now;
     COD.Insert(item);
     return(Json(new { result = "success" }, JsonRequestBehavior.AllowGet));
 }
Ejemplo n.º 20
0
        private static bool IsSafe(UserAccount userAccount, AccountItem accountItem, string value)
        {
            switch (accountItem)
            {
            case AccountItem.Description:
                return(!(value.Length > 100));

            case AccountItem.AuthorPage:
            case AccountItem.TranslatorPage:
                if (!IsWikiLink(value))
                {
                    return(false);
                }
                UpdatePrivatePage(userAccount, value);
                return(true);

            case AccountItem.PrivatePage:
            case AccountItem.Sandbox:
                return(IsWikiLink(value));

            case AccountItem.ProfileColor:
                var match = Regex.Match(value, @"^#[0-9A-F]{6}$", RegexOptions.IgnoreCase);
                return(match.Success);

            case AccountItem.WikidotUsername:
                // No check here
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(accountItem), accountItem, null);
            }

            return(true);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Inserts a rule.
        /// </summary>
        /// <param name="rule">The rule to insert.</param>
        /// <param name="user">The user who owns the rule.</param>
        /// <param name="cancellationToken">A token to observe while waiting for the task to complete.</param>
        /// <returns>
        /// A task that represents the asynchronous operation.
        /// </returns>
        public virtual async Task <ValidationResult> CreateAsync(RuleItem rule, AccountItem user, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfDisposed();
            if (rule == null)
            {
                throw new ArgumentNullException("rule");
            }
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }
            var ruleEntity = new LoggingRule
            {
                UserId  = user.Id,
                Options = LoggingRuleOptionsHelpers.Serialize(new LoggingRuleOptions {
                    Conditions = rule.Conditions, Actions = rule.Actions
                })
            };

            Context.Add(ruleEntity);
            await SaveChangesAsync(cancellationToken);

            rule.Id = ruleEntity.Id;
            return(ValidationResult.Success);
        }
Ejemplo n.º 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //available querystring values for context info (id, language, version, database)

            try {
                //get the current item and database
                currentDB   = Sitecore.Configuration.Factory.GetDatabase("master");
                currentItem = new VideoItem(currentDB.Items[HttpContext.Current.Request.QueryString["id"].ToString()]);
                Item acct = currentItem.videoItem.Parent.Parent;
                //if current parent isn't the account then it's the parent of the folder
                if (!acct.TemplateName.Equals("Account Folder"))
                {
                    acct = acct.Parent;
                }
                accountItem = new AccountItem(acct.ID, acct.InnerData, acct.Database);
                bc          = new BCAPI(accountItem.PublisherID);

                if (!currentItem.ThumbnailURL.Equals(""))
                {
                    pnlThumb.Visible  = true;
                    imgThumb.ImageUrl = currentItem.ThumbnailURL;
                }
                if (!currentItem.VideoStillURL.Equals(""))
                {
                    pnlStill.Visible  = true;
                    imgStill.ImageUrl = currentItem.VideoStillURL;
                }
            }
            catch (Exception ex) {
                ltlError.Text = ex.ToString();
            }
        }
Ejemplo n.º 23
0
        public static IEnumerable <AccountItem> GetData()
        {
            List <AccountItem> ret = new List <AccountItem>();

            using (RepositoryEntities db = new RepositoryEntities())
            {/*
              * var ret = (from us in db.Users
              *            from rl in db.UserRoles
              *            from r in db.Roles
              *            where us.ID == rl.UserId && r.Id == rl.RoleId && us.UserPsw.Length > 0
              *            select (new AccountItem()
              *            {
              *                ID = us.ID,
              *                Login = us.UserLogin,
              *                Password = us.UserPsw,
              *                Role = r.Name
              *            })).ToList();
              *
              * ret.Sort((a,b) => { return (b.ID == a.ID) ? 0 : b.ID > a.ID ? -1 : 1; });
              * return ret;*/
                db.Users.Where(p => p.UserPsw.Length > 0).ForEach(x =>
                {
                    AccountItem it = new AccountItem()
                    {
                        ID       = x.ID,
                        Login    = x.UserLogin,
                        Password = x.UserPsw,
                        Role     = string.Join(" ", System.Web.Security.Roles.GetRolesForUser(x.UserLogin)).Trim()
                    };
                    ret.Add(it);
                });
            }
            return(ret);
        }
Ejemplo n.º 24
0
        private void BuildRepository(AccountItem item)
        {
            var account = item.MapTo <Accounts>();
            var result  = Result <object> .Ok(1);

            _commandRepository.Setup(x => x.Add(account)).Verifiable();// .Returns(result);
            _commandRepository.Setup(x => x.Delete(1)).Returns(Result <int> .Ok(1));
        }
Ejemplo n.º 25
0
        public void Account_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGridRow         dgr  = (DataGridRow)sender;
            AccountItem         item = (AccountItem)dgr.DataContext;
            MainWindowViewModel vm   = (MainWindowViewModel)this.DataContext;

            vm.ShowTransactionRoll(item);
        }
Ejemplo n.º 26
0
        public static UpdateInsertPair <PlaylistItem> ImportToSitecore(this AccountItem account, List <BCPlaylist> Playlists, UpdateType utype)
        {
            UpdateInsertPair <PlaylistItem> uip = new UpdateInsertPair <PlaylistItem>();

            //set all BCVideos into hashtable for quick access
            Hashtable ht = new Hashtable();

            foreach (PlaylistItem exPlay in account.PlaylistLib.Playlists)
            {
                if (!ht.ContainsKey(exPlay.playlistItem.ToString()))
                {
                    //set as string, Item pair
                    ht.Add(exPlay.PlaylistID.ToString(), exPlay);
                }
            }

            //Loop through the data source and add them
            foreach (BCPlaylist play in Playlists)
            {
                try {
                    //remove access filter
                    using (new Sitecore.SecurityModel.SecurityDisabler()) {
                        PlaylistItem currentItem;

                        //if it exists then update it
                        if (ht.ContainsKey(play.id.ToString()) && (utype.Equals(UpdateType.BOTH) || utype.Equals(UpdateType.UPDATE)))
                        {
                            currentItem = (PlaylistItem)ht[play.id.ToString()];

                            //add it to the new items
                            uip.UpdatedItems.Add(currentItem);

                            using (new EditContext(currentItem.playlistItem, true, false)) {
                                SetPlaylistFields(ref currentItem.playlistItem, play);
                            }
                        }
                        //else just add it
                        else if (!ht.ContainsKey(play.id.ToString()) && (utype.Equals(UpdateType.BOTH) || utype.Equals(UpdateType.NEW)))
                        {
                            //Create new item
                            TemplateItem templateType = account.Database.Templates["Modules/Brightcove/Brightcove Playlist"];
                            currentItem = new PlaylistItem(account.PlaylistLib.playlistLibraryItem.Add(play.name.StripInvalidChars(), templateType));

                            //add it to the new items
                            uip.NewItems.Add(currentItem);

                            using (new EditContext(currentItem.playlistItem, true, false)) {
                                SetPlaylistFields(ref currentItem.playlistItem, play);
                            }
                        }
                    }
                } catch (System.Exception ex) {
                    throw new Exception("Failed on playlist: " + play.name + ". " + ex.ToString());
                }
            }

            return(uip);
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Finds a collection of categories with the given values.
 /// </summary>
 /// <param name="user">The user for the item to be found.</param>
 /// <param name="project">The project for the item to be found.</param>
 /// <param name="orderBy">The order in which items are returned in a result set.</param>
 /// <param name="fields">The related fields to include in the query results.</param>
 /// <param name="cancellationToken">A token to observe while waiting for the task to complete.</param>
 /// <returns>
 /// A task that represents the asynchronous operation.
 /// </returns>
 /// <exception cref="System.ArgumentNullException">user</exception>
 public virtual Task <ListResult <CategoryItem> > FindAllAsync(AccountItem user, ProjectItem project, CategorySortOrder orderBy, CategoryField fields, CancellationToken cancellationToken)
 {
     ThrowIfDisposed();
     if (user == null)
     {
         throw new ArgumentNullException("user");
     }
     return(Store.FindAllAsync(user, project, orderBy, fields, cancellationToken));
 }
Ejemplo n.º 28
0
        /// <summary>
        /// 編輯一筆記帳
        /// </summary>
        /// <param name="id"></param>
        /// <param name="cost"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public bool changeAccountItem(int id, int cost, String name)
        {
            AccountItem resultAccount = _account.Find(searchAccount => searchAccount.Id.Equals(id));

            resultAccount.ItemName = name;
            resultAccount.Cost     = cost;

            return(true);
        }
Ejemplo n.º 29
0
 /// <summary>
 /// Inserts a category.
 /// </summary>
 /// <param name="user">The user who owns the category.</param>
 /// <param name="project">The project which is associated with the category.</param>
 /// <param name="category">The category to insert.</param>
 /// <param name="cancellationToken">A token to observe while waiting for the task to complete.</param>
 /// <returns>
 /// A task that represents the asynchronous operation.
 /// </returns>
 /// <exception cref="System.ArgumentNullException">category</exception>
 public virtual Task <ValidationResult> CreateAsync(AccountItem user, ProjectItem project, CategoryItem category, CancellationToken cancellationToken)
 {
     ThrowIfDisposed();
     if (category == null)
     {
         throw new ArgumentNullException("category");
     }
     return(Store.CreateAsync(user, project, category, cancellationToken));
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Date.
 /// <para>Leading zeroes on month and day can be skipped. Year can be either 4 digits or 2 digits or '6 (=2006).</para>
 /// <para>D25 December 2006</para>
 /// </summary>
 private static void FillDate(AccountItem item, ReadOnlySpan <char> value)
 {
     item.Date = DateTime.ParseExact(
         value,
         "MM/dd/yy",
         CultureInfo.InvariantCulture,
         DateTimeStyles.AssumeLocal);
     // TODO: Support others formats, with customization
 }
Ejemplo n.º 31
0
    /// <summary>
    /// 号码百事通账户查询 lihongtu
    /// </summary>
    public static Int32 BesttoneAccountInfoQuery(String besttoneAccount, out AccountItem accountInfo, out String ResCode, out String ErrMsg)
    {
        Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
        ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;
        accountInfo = null;
        ResCode = "000000";
        string ACCOUNTTYPE = "1";
        StringBuilder requestXml = new StringBuilder();
        String responseXml = String.Empty;
        //流水号
        String TransactionID = CreateTransactionID();
        try
        {
            #region 拼接请求xml字符串

            requestXml.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            requestXml.Append("<PayPlatRequestParameter>");
            requestXml.Append("<CTRL-INFO WEBSVRNAME=\"账户查询\" WEBSVRCODE=\"100100\" APPFROM=\"100100|310000-TEST1-127.0.0.1|1.0|127.0.0.1\" KEEP=\"" + TransactionID + "\" />");
            requestXml.Append("<PARAMETERS>");

            //添加参数
            requestXml.AppendFormat("<PRODUCTNO>{0}</PRODUCTNO>", "yy" + besttoneAccount);
            requestXml.AppendFormat("<ACCOUNTTYPE>{0}</ACCOUNTTYPE>", ACCOUNTTYPE);

            requestXml.AppendFormat("<ACCEPTORGCODE>{0}</ACCEPTORGCODE>", BesttoneAccountConstDefinition.DefaultInstance.ACCEPTORGCODE);

            requestXml.AppendFormat("<ACCEPTSEQNO>{0}</ACCEPTSEQNO>", TransactionID);
            requestXml.AppendFormat("<INPUTTIME>{0}</INPUTTIME>", DateTime.Now.ToString("yyyyMMddHHmmss"));

            requestXml.Append("</PARAMETERS>");
            requestXml.Append("</PayPlatRequestParameter>");

            #endregion

            //请求接口
            //log(String.Format("账户查询请求:{0}", requestXml));
            responseXml = serviceProxy.dispatchCommand("100100|310000-TEST1-127.0.0.1|1.0|127.0.0.1", requestXml.ToString());
            //log(String.Format("账户查询返回:{0}", responseXml));
            #region 解析接口返回参数

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(responseXml);

            String responseCode = xmlDoc.SelectNodes("/PayPlatResponseParameter/RESPONSECODE")[0].InnerText;
            ResCode = responseCode;

            ErrMsg = xmlDoc.SelectNodes("/PayPlatResponseParameter/RESPONSECONTENT")[0].InnerText;
            if (responseCode == "000000")
            {

                accountInfo = new AccountItem();
                XmlNode dataNode = xmlDoc.SelectNodes("/PayPlatResponseParameter/RESULTDATESET/DATAS")[0];
                accountInfo.AccountNo = dataNode.Attributes["ACCOUNTNO"].Value;
                accountInfo.AccountName = dataNode.Attributes["ACCOUNTNAME"].Value;
                accountInfo.AccountType = dataNode.Attributes["ACCOUNTTYPE"].Value;
                accountInfo.AccountStatus = dataNode.Attributes["ACCOUNTSTATUS"].Value;
                accountInfo.AccountBalance = Convert.ToInt64(dataNode.Attributes["ACCOUNTBALANCE"].Value);
                accountInfo.PredayBalance = Convert.ToInt64(dataNode.Attributes["PREDAYBALANCE"].Value);
                accountInfo.PreMonthBalance = Convert.ToInt64(dataNode.Attributes["PREMONTHBALANCE"].Value);
                accountInfo.AvailableBalance = Convert.ToInt64(dataNode.Attributes["AVAILABLEBALANCE"].Value);
                accountInfo.UnAvailableBalance = Convert.ToInt64(dataNode.Attributes["UNAVAILABLEBALANCE"].Value);
                accountInfo.AvailableLecash = Convert.ToInt64(dataNode.Attributes["AVAILABLECASH"].Value);
                accountInfo.CardNum = dataNode.Attributes["CARDNUM"].Value;
                accountInfo.CardType = dataNode.Attributes["CARDTYPE"].Value;
            }
            Result = 0;
            #endregion

        }
        catch (Exception ex)
        {

        }
        finally
        {

        }
        return Result;
    }
Ejemplo n.º 32
0
    protected void register_Click(object sender, EventArgs e)
    {
        StringBuilder strLog = new StringBuilder();
        try
        {
            logger.Info("RegisterAllInOne-注册来源:"+HttpContext.Current.Request.RawUrl);
            Response.AddHeader("P3P", "CP=CAO PSA OUR");
            strLog.AppendFormat("----------------------注册事件开始:------------------\r\n");
            strLog.AppendFormat("SPID:{0}\r\n", SPID);
            strLog.AppendFormat("ReturnUrl:{0}\r\n", ReturnUrl);
            PassWord = Request.Form["password"].ToString().Trim();
            strLog.AppendFormat("PassWord:{0}\r\n", PassWord);
            Mobile = Request.Form["mobile"].ToString().Trim();
            strLog.AppendFormat("mobile:{0}\r\n", Mobile);
            CheckPhoneCode = Request.Form["checkCode"].ToString().Trim();
            strLog.AppendFormat("checkCode:{0}\r\n", CheckPhoneCode);
            Email = Request.Form["email"].ToString().Trim();
            UserName = Request.Form["userName"].ToString().Trim();

            strLog.AppendFormat("ViewState[phonestate]:{0}\r\n", ViewState["phonestate"]);
            strLog.AppendFormat("Request.Form[phonestate]:{0}\r\n", Request.Form["phonestate"]);
            if (ViewState["phonestate"] == null)
            {
                ViewState["phonestate"] = Request.Form["phonestate"].ToString();
                string a = (string)ViewState["phonestate"];
            }

            if (((string)ViewState["phonestate"]).Equals("0"))
            {
                strLog.AppendFormat("phonestate==0\r\n");
                //判断手机验证码
                string needCheckCode = "0";  //ConfigurationManager.AppSettings["needCheckCode"];
                strLog.AppendFormat("判断手机验证码\r\n");
                //strLog.AppendFormat("needCheckCode:{0}\r\n}", needCheckCode);
                if ("0".Equals(needCheckCode))
                {
                    //strLog.AppendFormat("needCheckCode==0");
                    Result = PhoneBO.SelSendSMSMassage("", Mobile, CheckPhoneCode, out ErrMsg);
                    if (Result != 0)
                    {
                        strLog.AppendFormat("手机验证码验证错误\r\n");
                        hintCode.InnerHtml = "手机验证码错误,请重新输入";  // 这里如何控制样式
                        return;
                    }
                    strLog.AppendFormat("手机验证码验证无误\r\n");
                }
                //strLog.AppendFormat("does not needCheckCode:{0}\r\n}", needCheckCode);
            }
            //strLog.AppendFormat("phonestate!=0 \r\n");
            strLog.AppendFormat("-----------------quickUserRegistryWeb  begin------------------\r\n");
            Result = UserRegistry.quickUserRegistryWebV3(SPID, PassWord, Mobile, (string)ViewState["phonestate"],UserName,Email, out CustID, out ErrMsg);
            if (Result != 0)
            {
                strLog.AppendFormat("注册失败!\r\n");
                CommonBizRules.ErrorHappenedRedircet(Result, ErrMsg, "用户注册", this.Context);
                return;
            }

            strLog.AppendFormat("注册成功!\r\n");
            //短信通知
           // string VoicePwdSPID = System.Configuration.ConfigurationManager.AppSettings["VoicePwd_SPID"];
           // int SIP1 = VoicePwdSPID.IndexOf(SPID);
            String SMS_Message = String.Empty;
           // if (SIP1 >= 0)
          //  {
                SMS_Message = "恭喜您成为号码百事通会员!请妥善保管您的密码;如需帮助请联系:4008-118114。";
                //通知短信网关
                //CommonBizRules.SendMessageV3(Mobile, SMS_Message, SPID);   //2013-11-19 注释掉
         //   }

            strLog.AppendFormat("检查邮箱是否需要发送\r\n");
            if (!String.IsNullOrEmpty(Email))
            {
                SendEmail(CustID, Email);
            }

            strLog.AppendFormat("写Cookie\r\n");
            String TimeStamp = DateTime.Now.ToString("yyyy-MM-dd HH:ta:ss");
            SPInfoManager spInfo = new SPInfoManager();
            Object SPData = spInfo.GetSPData(this.Context, "SPData");
            String key = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
            String Digest = CryptographyUtil.GenerateAuthenticator(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg, key);
            String temp = SPID + "$" + CryptographyUtil.Encrypt(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg + "$" + Digest, key);
            String RegistryResponseValue = HttpUtility.UrlEncode(temp);

            //给用户写cookie
            UserToken UT = new UserToken();
            String RealName = Mobile;
            String NickName = Mobile;
            string UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, "", "42", UserName, "1", key, out ErrMsg);
            string CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
            PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);
            //通知积分平台
            //strLog.AppendFormat("通知积分平台,CustID:{0}\r\n", CustID);

            CIP2BizRules.InsertCustInfoNotify(CustID, "2", SPID, "", "0", out ErrMsg);
            strLog.AppendFormat("写入数据库日志\r\n");
            //记登录日志
            CommonBizRules.WriteDataCustAuthenLog(SPID, CustID, "35", "0", "", "2", Result, ErrMsg);
            strLog.AppendFormat("-----------------quickUserRegistryWeb  end------------------\r\n");

            strLog.AppendFormat("是否开户\r\n");
            strLog.AppendFormat("--------------------openBestToneAccount begin------------------------\r\n");
            String hid_openAccount = Request.Form["hid_openAccount"].ToString().Trim();
            //strLog.AppendFormat("hid_openAccount:{0}\r\n", hid_openAccount);
            if ("1".Equals(hid_openAccount))
            {
                strLog.AppendFormat("hid_openAccount==1 需要开户\r\n");
                // 开户要做的事情  需要前面注册获得的custID
                string BindedBestpayAccount = "";
                string CreateTime = "";
                strLog.AppendFormat("先查看该CustID:{0}头上是否有账户\r\n", CustID);
                int IsBesttoneAccountBindV5Result = CIP2BizRules.IsBesttoneAccountBindV5(CustID, out BindedBestpayAccount, out CreateTime, out ErrMsg);
                //strLog.AppendFormat("查看结果:IsBesttoneAccountBindV5Result:{0},BindedBestpayAccount:{1},CreateTime:{2},ErrMsg:{3}\r\n", IsBesttoneAccountBindV5Result, BindedBestpayAccount, CreateTime, ErrMsg);
                if (IsBesttoneAccountBindV5Result == 0)
                {
                    //strLog.AppendFormat("IsBesttoneAccountBindV5Result==0,该CustID:{0}头上有账户BindedBestpayAccount:{1}\r\n", CustID, BindedBestpayAccount);
                    Response.Redirect("ErrorInfo.aspx?ErrorInfo=该账户绑定关系未解除,请联系管理人员!");
                }
                strLog.AppendFormat("该CustID:{0}头上无绑定账户\r\n",CustID);
                String TransactionID = BesttoneAccountHelper.CreateTransactionID();
                AccountItem ai = new AccountItem();
                string ResponseCode = "";
                BestToneAccount = Request.Form["mobile"].ToString().Trim();
                //strLog.AppendFormat("开户账号:{0}\r\n", BestToneAccount);
                realName = Request.Form["realName"].ToString().Trim();
                //strLog.AppendFormat("realName:{0}\r\n", realName);
                certnum = Request.Form["certnum"].ToString().Trim();
                //strLog.AppendFormat("certnum:{0}\r\n", certnum);
                strLog.AppendFormat("去翼支付查看该账号是否已经存在\r\n");
                int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(BestToneAccount, out ai, out ResponseCode, out ErrMsg);
                //strLog.AppendFormat("查看结果 QueryBesttoneAccountResult:{0},ResponseCode:{1},ErrMsg:{2}\r\n", QueryBesttoneAccountResult, ResponseCode, ErrMsg);
                if (QueryBesttoneAccountResult == 0)
                {

                    if ("200010".Equals(ResponseCode))   // 未开户
                    {
                        strLog.AppendFormat("200010-未开户\r\n");
                        strLog.AppendFormat("准备开户\r\n");
                        //strLog.AppendFormat("开户前日志参数:SPID:{0},TransactionID:{1},CustID:{2},BestToneAccount:{3}\r\n", SPID, TransactionID, BestToneAccount);
                        UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out  ErrMsg);
                        //strLog.AppendFormat("日志结果 ErrMsg:{0} \r\n", ErrMsg);
                        strLog.AppendFormat("开户...\r\n");

                        Result = BesttoneAccountHelper.RegisterBesttoneAccount(BestToneAccount, realName, BestToneAccount, "", sex, "1", certnum, TransactionID, out ErrMsg);
                        //strLog.AppendFormat("开户结果:Result:{0},ErrMsg:{1},TransactionID:{2}\r\n", Result, ErrMsg, TransactionID);
                        if (Result == 0)
                        {
                            //strLog.AppendFormat("开户成功\r\n,准备去将账户{0}绑定到{1}上\r\n", BestToneAccount, CustID);
                            int BindResult = UserRegistry.CreateBesttoneAccount(SPID, CustID, BestToneAccount, out ErrMsg);
                            //strLog.AppendFormat("绑定结果:BindResult:{0},ErrMsg:{1}上\r\n", BindResult, ErrMsg);
                            if (BindResult == 0)
                            {
                                strLog.AppendFormat("开户后日志\r\n");
                                UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out  ErrMsg);
                                int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, certnum, out ErrMsg);
                                //strLog.AppendFormat("开户后日志结果:ErrMsg:{0}\r\n", ErrMsg);
                                Response.Redirect("NewOpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0&RegistryResponse=" + HttpUtility.UrlEncode(RegistryResponseValue), true);
                            }
                            else
                            {
                                Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                            }
                        }
                        else
                        {
                            Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                        }

                    }
                    else
                    {
                        // 账户已存在
                        strLog.AppendFormat("账户已经存在\r\n");
                        strLog.AppendFormat("仅仅做绑定\r\n");
                        UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out  ErrMsg);

                        int BindResult = UserRegistry.CreateBesttoneAccount(SPID, CustID, BestToneAccount, out ErrMsg);
                        //strLog.AppendFormat("绑定结果:ErrMsg:{0}\r\n", ErrMsg);
                        if (BindResult == 0)
                        {
                            UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out  ErrMsg);
                            int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, certnum, out ErrMsg);
                            Response.Redirect("NewOpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0&RegistryResponse=" + HttpUtility.UrlEncode(RegistryResponseValue),true);
                        }
                        else
                        {
                            Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                        }
                    }
                }
                else
                {
                    Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                }
            }
            //不需要开户
            //这里应该先到一个结果页面,并将ReturnUrl传给结果页面,结果页面倒计时3秒后自动跳转到ReturnUrl,根据注册和开户跳转到不同的结果页面
            if (ReturnUrl.IndexOf("?") > 0)
            {
                Response.Redirect(ReturnUrl + "&RegistryResponse=" + RegistryResponseValue, false);
            }
            else
            {
                Response.Redirect(ReturnUrl + "?RegistryResponse=" + RegistryResponseValue, false);
            }
        }
        catch (Exception ex)
        {
            strLog.AppendFormat(ex.ToString());
            Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ex.ToString());
        }
        finally
        {
            log(strLog.ToString());
        }
    }
Ejemplo n.º 33
0
        /// <summary>
        /// Gets the accounts.
        /// </summary>
        private void GetAccounts()
        {
            var rockContext = new RockContext();
            var selectedGuids = GetAttributeValues( "Accounts" ).Select( Guid.Parse ).ToList();
            bool showAll = !selectedGuids.Any();

            bool additionalAccounts = GetAttributeValue( "AdditionalAccounts" ).AsBoolean( true );

            SelectedAccounts = new List<AccountItem>();
            AvailableAccounts = new List<AccountItem>();

            // Enumerate through all active accounts that are public
            foreach ( var account in new FinancialAccountService( rockContext ).Queryable()
                .Where( f =>
                    f.IsActive &&
                    f.IsPublic.HasValue &&
                    f.IsPublic.Value &&
                    ( f.StartDate == null || f.StartDate <= RockDateTime.Today ) &&
                    ( f.EndDate == null || f.EndDate >= RockDateTime.Today ) )
                .OrderBy( f => f.Order ) )
            {
                var accountItem = new AccountItem( account.Id, account.Order, account.Name, account.CampusId, account.PublicName );

                if ( showAll )
                {
                    SelectedAccounts.Add( accountItem );
                }
                else
                {
                    if ( selectedGuids.Contains( account.Guid ) )
                    {
                        SelectedAccounts.Add( accountItem );
                    }
                    else
                    {
                        if ( additionalAccounts )
                        {
                            AvailableAccounts.Add( accountItem );
                        }
                    }
                }
            }

            // Set account item *amounts* using the existing transaction
            if ( _scheduledTransactionToBeTransferred != null )
            {
                foreach ( var item in _scheduledTransactionToBeTransferred.ScheduledTransactionDetails )
                {
                    // Find a matching account
                    var account = SelectedAccounts.Where( a => a.Id == item.AccountId ).FirstOrDefault();

                    // if not in the selected list, try the available list
                    if ( account == null )
                    {
                        account = AvailableAccounts.Where( a => a.Id == item.AccountId ).FirstOrDefault();
                        if ( account != null )
                        {
                            AvailableAccounts = AvailableAccounts.Except( new List<AccountItem>() { account } ).ToList();
                            SelectedAccounts.AddRange( new List<AccountItem>() { account } );
                        }
                    }

                    // if still not found, just use the first account
                    if ( account == null )
                    {
                        account = SelectedAccounts.First();
                    }

                    account.Amount += item.Amount;
                }
            }
        }
Ejemplo n.º 34
0
        private void GetAccounts(FinancialScheduledTransaction scheduledTransaction)
        {
            var selectedGuids = GetAttributeValues( "Accounts" ).Select( Guid.Parse ).ToList();
            bool showAll = !selectedGuids.Any();

            bool additionalAccounts = true;
            if ( !bool.TryParse( GetAttributeValue( "AdditionalAccounts" ), out additionalAccounts ) )
            {
                additionalAccounts = true;
            }

            SelectedAccounts = new List<AccountItem>();
            AvailableAccounts = new List<AccountItem>();

            // Enumerate through all active accounts that have a public name
            foreach ( var account in new FinancialAccountService().Queryable()
                .Where( f =>
                    f.IsActive &&
                    f.PublicName != null &&
                    f.PublicName.Trim() != "" &&
                    ( f.StartDate == null || f.StartDate <= DateTime.Today ) &&
                    ( f.EndDate == null || f.EndDate >= DateTime.Today ) )
                .OrderBy( f => f.Order ) )
            {
                var accountItem = new AccountItem( account.Id, account.Order, account.Name, account.CampusId );
                if ( showAll )
                {
                    SelectedAccounts.Add( accountItem );
                }
                else
                {
                    if ( selectedGuids.Contains( account.Guid ) )
                    {
                        SelectedAccounts.Add( accountItem );
                    }
                    else
                    {
                        if ( additionalAccounts )
                        {
                            AvailableAccounts.Add( accountItem );
                        }
                    }
                }
            }

            foreach ( var txnDetail in scheduledTransaction.ScheduledTransactionDetails )
            {
                var selectedAccount = SelectedAccounts.Where( a => a.Id == txnDetail.AccountId ).FirstOrDefault();
                if ( selectedAccount != null )
                {
                    selectedAccount.Amount = txnDetail.Amount;
                }
                else
                {
                    var selected = AvailableAccounts.Where( a => a.Id == txnDetail.AccountId ).ToList();
                    if ( selected != null )
                    {
                        selected.ForEach( a => a.Amount = txnDetail.Amount );
                        AvailableAccounts = AvailableAccounts.Except( selected ).ToList();
                        SelectedAccounts.AddRange( selected );
                    }
                }
            }

            BindAccounts();

        }
Ejemplo n.º 35
0
        /// <summary>
        /// Gets the accounts.
        /// </summary>
        private void GetAccounts()
        {
            var rockContext = new RockContext();
            var selectedGuids = GetAttributeValues( "Accounts" ).Select( Guid.Parse ).ToList();
            bool showAll = !selectedGuids.Any();

            bool additionalAccounts = GetAttributeValue( "AdditionalAccounts" ).AsBoolean( true );

            SelectedAccounts = new List<AccountItem>();
            AvailableAccounts = new List<AccountItem>();

            // Enumerate through all active accounts that are public
            foreach ( var account in new FinancialAccountService( rockContext ).Queryable()
                .Where( f =>
                    f.IsActive &&
                    f.IsPublic.HasValue &&
                    f.IsPublic.Value &&
                    ( f.StartDate == null || f.StartDate <= RockDateTime.Today ) &&
                    ( f.EndDate == null || f.EndDate >= RockDateTime.Today ) )
                .OrderBy( f => f.Order ) )
            {
                var accountItem = new AccountItem( account.Id, account.Order, account.Name, account.CampusId, account.PublicName );
                if ( showAll )
                {
                    SelectedAccounts.Add( accountItem );
                }
                else
                {
                    if ( selectedGuids.Contains( account.Guid ) )
                    {
                        SelectedAccounts.Add( accountItem );
                    }
                    else
                    {
                        if ( additionalAccounts )
                        {
                            AvailableAccounts.Add( accountItem );
                        }
                    }
                }
            }
        }
Ejemplo n.º 36
0
    public OpenBesttoneAccountV2Result OpenBesttoneAccountV2(String Request)
    {
        OpenBesttoneAccountV2Result openBesttoneAccountV2Result = new OpenBesttoneAccountV2Result();
        String ReturnCode = "";
        String Descriptioin = "";
        int Result = 0;
        String ErrMsg = "";

        #region
        XmlDocument xmlDoc = new XmlDocument();
        String version = "";
        String SPID = "";
        String CustID = "";
        String EC = "";
        String HC = "";
        try
        {
            xmlDoc.LoadXml(Request);
            XmlNode versionNode = xmlDoc.SelectNodes("/root/callinfo/version")[0];
            version = versionNode.Attributes["value"].Value;

            XmlNode SPIDNode = xmlDoc.SelectNodes("/root/callinfo/SPID")[0];
            SPID = SPIDNode.Attributes["value"].Value;

            XmlNode CustIDNode = xmlDoc.SelectNodes("/root/param/CUSTID")[0];
            CustID = CustIDNode.Attributes["value"].Value;

            EC = xmlDoc.SelectNodes("/root/param/EC")[0].InnerText;
            HC = xmlDoc.SelectNodes("/root/param/HC")[0].InnerText;
        }
        catch (Exception e)
        {
            ReturnCode = Convert.ToString(ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Code);
            ErrMsg = ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Msg + "," + e.Message;
            Descriptioin = ErrMsg+":xml格式错误";
            //Response.AppendFormat("<result returnCode = '{0}' msg = '{1}' />", ReturnCode, Descriptioin);
            //return Response.ToString();
            openBesttoneAccountV2Result.returnCode = ReturnCode;
            openBesttoneAccountV2Result.msg = Descriptioin;
            return openBesttoneAccountV2Result;
        }
        //String AuthenCode = xmlDoc.SelectNodes("/root/param/AuthenCode")[0].InnerText;
        #endregion

        StringBuilder strLog = new StringBuilder();
        try
        {

            SPInfoManager spInfo = new SPInfoManager();
            Object SPData = spInfo.GetSPData(this.Context, "SPData");
            string ScoreSystemSecret = spInfo.GetPropertyBySPID(SPID, "SecretKey", SPData);

            string newHC = CryptographyUtil.GenerateAuthenticator(SPID + "$" + CustID + "$" + EC, ScoreSystemSecret);

            strLog.AppendFormat("HC:{0};newHC:{1}\r\n" , HC, newHC);
            string realName = "";
            string mobile = "";
            string contactTel = "";
            string email = "";
            string sex = "";
            string cerType = "";
            string cerNum = "";

            if (newHC.Equals(HC))
            {
                try
                {
                    string PlanTextStr = CryptographyUtil.Decrypt(EC.ToString(), ScoreSystemSecret);
                    if (String.IsNullOrEmpty(PlanTextStr))
                    {
                        ReturnCode = "-7020";
                        Descriptioin = "解密失败!" ;
                        openBesttoneAccountV2Result.returnCode = ReturnCode;
                        openBesttoneAccountV2Result.msg = Descriptioin;
                        return openBesttoneAccountV2Result;

                    }
                    strLog.AppendFormat("planTextStr:{0}\r\n", PlanTextStr);
                    string[] alSourceStr = PlanTextStr.Split('$');
                    realName = alSourceStr[0];
                    strLog.AppendFormat("realName:{0}\r\n", realName);
                    mobile = alSourceStr[1];
                    strLog.AppendFormat("mobile:{0}\r\n", mobile);
                    contactTel = alSourceStr[2];
                    strLog.AppendFormat("contactTel:{0}\r\n", contactTel);
                    email = alSourceStr[3];
                    strLog.AppendFormat("email:{0}\r\n", email);
                    sex = alSourceStr[4];
                    strLog.AppendFormat("sex:{0}\r\n", sex);
                    cerType = alSourceStr[5];
                    strLog.AppendFormat("cerType:{0}\r\n", cerType);
                    cerNum = alSourceStr[6];
                    strLog.AppendFormat("cerNum:{0}\r\n", cerNum);
                }
                catch (System.Exception e)
                {
                    ReturnCode = "-7020";
                    Descriptioin = "解密错误"+e.ToString();
                    openBesttoneAccountV2Result.returnCode = ReturnCode;
                    openBesttoneAccountV2Result.msg = Descriptioin;
                    return openBesttoneAccountV2Result;
                }
            }
            else
            {
                ReturnCode = "-7021";
                Descriptioin = "hashcode校验不通过!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            strLog.AppendFormat("Begin 开通号码百事通账户\r\n");
            strLog.AppendFormat("SPID:{0},CustID:{1},mobile:{2},realName:{3},contactTel:{4},email:{5},sex:{6},cerType:{7},cerNum:{8}\r\n", SPID, CustID, mobile, realName, contactTel, email, sex, cerType, cerNum);

            #region 数据合法性判断

            //if (CommonUtility.IsEmpty(AuthenCode))
            //{
            //    ReturnCode = "-7014";
            //    Descriptioin = "手机校验码不能为空!";
            //    Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
            //    return Response.ToString();
            //}

            //验证码校验
            //Result = PhoneBO.SelSendSMSMassage(CustID, mobile, AuthenCode, out ErrMsg);
            //if (Result != 0)
            //{
            //    ReturnCode = "-7014";
            //    Descriptioin = "验证码验证失败:" + ErrMsg;
            //    Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
            //    return Response.ToString();

            //}

            if (CommonUtility.IsEmpty(SPID))
            {
                ReturnCode = Convert.ToString(ErrorDefinition.CIP_IError_Result_SPIDInValid_Code);
                Descriptioin = ErrorDefinition.CIP_IError_Result_SPIDInValid_Msg;
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            //IP是否允许访问
            Result = CommonBizRules.CheckIPLimit(SPID, HttpContext.Current.Request.UserHostAddress, this.Context, out ErrMsg);
            strLog.AppendFormat("请求方ip:{0}\r\n", HttpContext.Current.Request.UserHostAddress);
            strLog.AppendFormat("CheckIPLimit Result:'{0}',ErrMsg:'{1}'\r\n", Result, ErrMsg);
            if (Result != 0)
            {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizIPLimit_Code);
                Descriptioin = ErrorDefinition.BT_IError_Result_BizIPLimit_Msg;
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;

            }

            //接口访问权限判断
            Result = CommonBizRules.CheckInterfaceLimit(SPID, "OpenBesttoneAccountV2", this.Context, out ErrMsg);
            strLog.AppendFormat("CheckInterfaceLimit Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
            if (Result != 0)
            {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
                Descriptioin = ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Msg;
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            if (CommonUtility.IsEmpty(CustID))
            {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_InValidCustID_Code);
                Descriptioin = "CustID不能为空:"+ErrorDefinition.BT_IError_Result_InValidCustID_Msg;
                //Response.AppendFormat("<result returnCode = '{0}' msg = '{1}' />", ReturnCode, Descriptioin);
                //return Response.ToString();
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            if (CommonUtility.IsEmpty(mobile))
            {
                ReturnCode = "-7015";
                Descriptioin = "账户名不能为空!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;

            }

            if (!Utils.isMobilePhoneV2(mobile))
            {
                ReturnCode = "-7016";
                Descriptioin = "无效的手机号码!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            if (CommonUtility.IsEmpty(realName))
            {
                ReturnCode = "-7017";
                Descriptioin = "用户名不能为空!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;

            }

            if (CommonUtility.IsEmpty(sex))
            {
                ReturnCode = "-7018";
                Descriptioin = "性别不能为空!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;

            }
            if (!Utils.IsNumeric(sex))
            {
                ReturnCode = "-7019";
                Descriptioin = "性别只能为数字!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            if ("0".Equals(sex) || "1".Equals(sex) || "2".Equals(sex))
            {
            }
            else
            {
                ReturnCode = "-7020";
                Descriptioin = "性别只能为0和1,2!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            if (CommonUtility.IsEmpty(cerType))
            {
                ReturnCode = "-7021";
                Descriptioin = "证件类型不能为空!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            if (cerType.Equals("1") || cerType.Equals("2") || cerType.Equals("3") || cerType.Equals("4") || cerType.Equals("5") || cerType.Equals("6") || cerType.Equals("7") || cerType.Equals("8") || cerType.Equals("9") || cerType.Equals("10") || cerType.Equals("X"))
            { }
            else
            {
                ReturnCode = "-7022";
                Descriptioin = "非法证件类型!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;

            }

            if (CommonUtility.IsEmpty(cerNum))
            {
                ReturnCode = "-7023";
                Descriptioin = "证件号不能为空!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            if ("X".Equals(cerType))
            {
                if ("99999".Equals(cerNum))
                {
                }
                else
                {
                    ReturnCode = "-7024";
                    Descriptioin = "证件类型为其他类型(X),则证件号必须是99999!";
                    openBesttoneAccountV2Result.returnCode = ReturnCode;
                    openBesttoneAccountV2Result.msg = Descriptioin;
                    return openBesttoneAccountV2Result;
                }
            }

            if ("1".Equals(cerType))
            {
                if (!CommonUtility.CheckIDCard(cerNum))
                {
                    ReturnCode = "-7025";
                    Descriptioin = "身份证不合法!";
                    openBesttoneAccountV2Result.returnCode = ReturnCode;
                    openBesttoneAccountV2Result.msg = Descriptioin;
                    return openBesttoneAccountV2Result;
                }
            }

            #endregion

            String TransactionID = BesttoneAccountHelper.CreateTransactionID();
            BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
            strLog.AppendFormat("select * from besttoneaccount where custid={0}\r\n", CustID);
            BesttoneAccount besttoneAccountEntity = _besttoneAccount_dao.QueryByCustID(CustID);
            String ResponseCode = "";
            AccountItem ai = new AccountItem();
            if (besttoneAccountEntity == null)    // 未绑定
            {
                strLog.AppendFormat("0 records return\r\n");
                strLog.AppendFormat("未绑定\r\n");
                int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(mobile, out ai,  out ResponseCode, out ErrMsg);
                strLog.AppendFormat("BesttoneAccountHelper.BesttoneAccountInfoQuery QueryBesttoneAccountResult:{0},ErrMsg:{1}\r\n ", QueryBesttoneAccountResult, ErrMsg);
                if (QueryBesttoneAccountResult == 0)
                {
                    if ("200010".Equals(ResponseCode))   // 未开户
                    {
                        strLog.AppendFormat("未绑定且未开户\r\n");
                        strLog.AppendFormat("准备去开户了\r\n");
                        strLog.AppendFormat("开户前日志,参数 SPID:{0},TransactionID:{1},CustID:{2},mobile:{3}", SPID, TransactionID, CustID, mobile);
                        UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, mobile, out  ErrMsg);  //日志
                        strLog.AppendFormat("开户前日志完成\r\n");
                        strLog.AppendFormat("开户......\r\n");
                        strLog.AppendFormat("开户参数:mobile:{0},realName:{1},contactTel:{2},email:{3},sex:{4},cerType:{5},cerNum:{6},TransactionID:{7}", mobile, realName, contactTel, email, sex, cerType, cerNum, TransactionID);
                        Result = BesttoneAccountHelper.RegisterBesttoneAccount(mobile, realName, contactTel, email, sex, cerType, cerNum, TransactionID, out ErrMsg);
                        strLog.AppendFormat("开户后返回的状态 Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
                        //绑定操作
                        strLog.AppendFormat("开完户准备进行绑定,将{0}绑定至{1}\r\n", mobile, CustID);
                        UserRegistry.CreateBesttoneAccount(SPID, CustID, mobile, out ErrMsg);
                        strLog.AppendFormat("绑定后结果ErrMsg:{0}\r\n", ErrMsg);
                        UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, mobile, out  ErrMsg); //日志
                        strLog.AppendFormat("开户后日志\r\n");
                        UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, cerNum, out ErrMsg);
                        strLog.AppendFormat("开户完成\r\n");
                        ReturnCode = "0";
                        Descriptioin = "开户成功";
                        openBesttoneAccountV2Result.returnCode = ReturnCode;
                        openBesttoneAccountV2Result.msg = Descriptioin;
                        return openBesttoneAccountV2Result;
                    }
                    else
                    {  // 已开户
                        //绑定操作
                        if ("000000".Equals(ResponseCode))
                        {
                            strLog.AppendFormat("未绑定且 已开户\r\n");
                            strLog.AppendFormat("仅绑定.......\r\n");
                            UserRegistry.CreateBesttoneAccount(SPID, CustID, mobile, out ErrMsg);
                            strLog.AppendFormat("将{0}绑定到{1}\r\n", mobile, CustID);
                            UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, CustID, mobile, out  ErrMsg);
                            strLog.AppendFormat("记录绑定日志表,流水号:{0}", TransactionID);
                            strLog.AppendFormat("绑定后结果ErrMsg:{0}\r\n", ErrMsg);
                            ReturnCode = "1";
                            Descriptioin = "该用户已开过户,仅做绑定关系";
                            openBesttoneAccountV2Result.returnCode = ReturnCode;
                            openBesttoneAccountV2Result.msg = Descriptioin;
                            return openBesttoneAccountV2Result;
                        }
                        else
                        {
                            ReturnCode = "-7026";
                            Descriptioin = ResponseCode;
                            openBesttoneAccountV2Result.returnCode = ReturnCode;
                            openBesttoneAccountV2Result.msg = Descriptioin;
                            return openBesttoneAccountV2Result;
                        }
                    }
                }
                else
                {
                    ReturnCode = "-7027";
                    Descriptioin = "查询账户出错!";
                    openBesttoneAccountV2Result.returnCode = ReturnCode;
                    openBesttoneAccountV2Result.msg = Descriptioin;
                    return openBesttoneAccountV2Result;
                }
            }
            else
            {
                // 账户已经绑定到其他人身上
                strLog.AppendFormat("1 record return.\r\n");
                strLog.AppendFormat("该CustID:{0}上已经有绑定的账户号{1}\r\n", CustID, mobile);

                Result = -12300;
                ErrMsg = mobile + "手机号已为其他客户(" + CustID + ")开通了号码百事通账户,您可以登录系统,进入您的账户中心,用另一手机号码开通号码百事通账户,也可以咨询客服人员帮助排查问题。";
                openBesttoneAccountV2Result.returnCode = "-12300";
                openBesttoneAccountV2Result.msg = ErrMsg;
                return openBesttoneAccountV2Result;

            }
            strLog.AppendFormat("End 开通号码百事通账户 Result:{0},ErrMsg{1}\r\n", Result, ErrMsg);
            //-99999 失败 0 成功
        }
        catch (Exception e)
        {
            ReturnCode = Convert.ToString(ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Code);
            ErrMsg = ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Msg + "," + e.Message;
            openBesttoneAccountV2Result.returnCode = ReturnCode;
            openBesttoneAccountV2Result.msg = ErrMsg+e.ToString();
            return openBesttoneAccountV2Result;
        }
        finally
        {
            log(strLog.ToString(),"OpenBesttoneAccountV2");
        }
        openBesttoneAccountV2Result.returnCode = ReturnCode;
        openBesttoneAccountV2Result.msg = Descriptioin;
        return openBesttoneAccountV2Result;
    }
Ejemplo n.º 37
0
    public OpenBesttoneAccountResult OpenBesttoneAccount(String SPID, String CustID, String EC,String HC)
    {
        OpenBesttoneAccountResult Result = new OpenBesttoneAccountResult();
        Result.Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
        Result.ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;
        StringBuilder strLog = new StringBuilder();
        try
        {

            SPInfoManager spInfo = new SPInfoManager();
            Object SPData = spInfo.GetSPData(this.Context, "SPData");
            string ScoreSystemSecret = spInfo.GetPropertyBySPID(SPID, "SecretKey", SPData);

            string newHC= CryptographyUtil.GenerateAuthenticator(SPID + "$" + CustID + "$" + EC, ScoreSystemSecret);

            strLog.AppendFormat("HC:{0};newHC:{1}\r\n"+HC,newHC);
            string realName = "";
            string mobile = "";
            string contactTel = "";
            string email = "";
            string sex = "";
            string cerType = "";
            string cerNum = "";

            if (newHC.Equals(HC))
            {
                try
                {
                    string PlanTextStr = CryptographyUtil.Decrypt(EC.ToString(), ScoreSystemSecret);
                    strLog.AppendFormat("planTextStr:{0}\r\n",PlanTextStr);
                    string[] alSourceStr = PlanTextStr.Split('$');
                    realName = alSourceStr[0];
                    strLog.AppendFormat("realName:{0}\r\n", realName);
                    mobile = alSourceStr[1];
                    strLog.AppendFormat("mobile:{0}\r\n",mobile);
                    contactTel = alSourceStr[2];
                    strLog.AppendFormat("contactTel:{0}\r\n",contactTel);
                    email = alSourceStr[3];
                    strLog.AppendFormat("email:{0}\r\n",email);
                    sex = alSourceStr[4];
                    strLog.AppendFormat("sex:{0}\r\n",sex);
                    cerType = alSourceStr[5];
                    strLog.AppendFormat("cerType:{0}\r\n",cerType);
                    cerNum = alSourceStr[6];
                    strLog.AppendFormat("cerNum:{0}\r\n",cerNum);
                }
                catch (System.Exception e)
                {
                    Result.Result = -7020;
                    Result.ErrMsg = "解密错误!"+e.ToString();
                    return Result;
                }

            }
            else {
                Result.Result = -7020;
                Result.ErrMsg = "hashcode校验不通过!";
                return Result;
            }

            strLog.AppendFormat("Begin 开通号码百事通账户\r\n");
            strLog.AppendFormat("SPID:{0},CustID:{1},mobile:{2},realName:{3},contactTel:{4},email:{5},sex:{6},cerType:{7},cerNum:{8}\r\n", SPID, CustID, mobile, realName, contactTel, email, sex, cerType, cerNum);

            #region 数据合法性判断
            if (CommonUtility.IsEmpty(SPID))
            {
                Result.Result = ErrorDefinition.CIP_IError_Result_SPIDInValid_Code;
                Result.ErrMsg = ErrorDefinition.CIP_IError_Result_SPIDInValid_Msg;
                return Result;
            }

            //IP是否允许访问
            Result.Result = CommonBizRules.CheckIPLimit(SPID, HttpContext.Current.Request.UserHostAddress, this.Context, out Result.ErrMsg);
            strLog.AppendFormat("请求方ip:{0}\r\n", HttpContext.Current.Request.UserHostAddress);
            strLog.AppendFormat("CheckIPLimit Result:{0},ErrMsg:{1}\r\n", Result.Result, Result.ErrMsg);
            if (Result.Result != 0)
            {
                return Result;
            }

            //接口访问权限判断
            Result.Result = CommonBizRules.CheckInterfaceLimit(SPID, "OpenBesttoneAccount", this.Context, out Result.ErrMsg);
            strLog.AppendFormat("CheckInterfaceLimit Result:{0},ErrMsg:{1}\r\n", Result.Result, Result.ErrMsg);
            if (Result.Result != 0)
            {
                return Result;
            }

            if (CommonUtility.IsEmpty(CustID))
            {
                Result.Result = ErrorDefinition.CIP_IError_Result_User_UserIDInValid_Code;
                Result.ErrMsg = ErrorDefinition.CIP_IError_Result_User_UserIDInValid_Msg;
                return Result;
            }
            if (CommonUtility.IsEmpty(mobile))
            {
                Result.Result = -7015;
                Result.ErrMsg = "账户名不能为空!";
                return Result;
            }
            if (!Utils.isMobilePhone(mobile))
            {
                Result.Result = -7015;
                Result.ErrMsg = "无效的手机号码!";
                return Result;
            }

            if (CommonUtility.IsEmpty(realName))
            {
                Result.Result = -7016;
                Result.ErrMsg = "用户名不能为空!";
                return Result;
            }
            if (CommonUtility.IsEmpty(sex))
            {
                Result.Result = -7017;
                Result.ErrMsg = "性别不能为空!";
                return Result;
            }
            if (!Utils.IsNumeric(sex))
            {
                Result.Result = -7017;
                Result.ErrMsg = "性别只能为数字!";
                return Result;
            }
            if ("0".Equals(sex) || "1".Equals(sex) || "2".Equals(sex))
            {
            }
            else
            {
                Result.Result = -7017;
                Result.ErrMsg = "性别只能为0和1,2!";
                return Result;
            }

            if (CommonUtility.IsEmpty(cerType))
            {
                Result.Result = -7018;
                Result.ErrMsg = "证件类型不能为空!";
                return Result;
            }

            if (cerType.Equals("1") || cerType.Equals("2") || cerType.Equals("3") || cerType.Equals("4") || cerType.Equals("5") || cerType.Equals("6") || cerType.Equals("7") || cerType.Equals("8") || cerType.Equals("9") || cerType.Equals("10") || cerType.Equals("X"))
            { }
            else
            {
                Result.Result = -7018;
                Result.ErrMsg = "非法证件类型!";
                return Result;
            }

            if (CommonUtility.IsEmpty(cerNum))
            {
                Result.Result = -7019;
                Result.ErrMsg = "证件号不能为空!";
                return Result;
            }

            if ("X".Equals(cerType))
            {
                if ("99999".Equals(cerNum))
                {
                }
                else
                {
                    Result.Result = -7019;
                    Result.ErrMsg = "证件类型为其他类型(X),则证件号必须是99999!";
                    return Result;
                }
            }

            if ("1".Equals(cerType))
            {
                if (!CommonUtility.CheckIDCard(cerNum))
                {
                    Result.Result = -7020;
                    Result.ErrMsg = "身份证不合法!";
                    return Result;
                }
            }

            #endregion

            String TransactionID = BesttoneAccountHelper.CreateTransactionID();
            BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
            strLog.AppendFormat("select * from besttoneaccount where custid={0}\r\n", CustID);
            BesttoneAccount besttoneAccountEntity = _besttoneAccount_dao.QueryByCustID(CustID);
            String ResponseCode = "";
            AccountItem ai = new AccountItem();
            if (besttoneAccountEntity == null)    // 未绑定
            {
                strLog.AppendFormat("0 records return\r\n");
                strLog.AppendFormat("未绑定\r\n");
                int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(mobile, out ai, out ResponseCode, out Result.ErrMsg);
                strLog.AppendFormat("BesttoneAccountHelper.BesttoneAccountInfoQuery QueryBesttoneAccountResult:{0},ErrMsg:{1}\r\n ", QueryBesttoneAccountResult, Result.ErrMsg);
                if (QueryBesttoneAccountResult == 0)
                {
                    if ("200010".Equals(ResponseCode))   // 未开户
                    {
                        strLog.AppendFormat("未绑定且未开户\r\n");
                        strLog.AppendFormat("准备去开户了\r\n");
                        strLog.AppendFormat("开户前日志,参数 SPID:{0},TransactionID:{1},CustID:{2},mobile:{3}", SPID, TransactionID, CustID, mobile);
                        UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, mobile, out  Result.ErrMsg);  //日志
                        strLog.AppendFormat("开户前日志完成\r\n");
                        strLog.AppendFormat("开户......\r\n");
                        strLog.AppendFormat("开户参数:mobile:{0},realName:{1},contactTel:{2},email:{3},sex:{4},cerType:{5},cerNum:{6},TransactionID:{7}", mobile, realName, contactTel, email, sex, cerType, cerNum, TransactionID);
                        Result.Result = BesttoneAccountHelper.RegisterBesttoneAccount(mobile, realName, contactTel, email, sex, cerType, cerNum, TransactionID, out Result.ErrMsg);
                        strLog.AppendFormat("开户后返回的状态 Result:{0},ErrMsg:{1}\r\n", Result.Result, Result.ErrMsg);
                        //绑定操作
                        strLog.AppendFormat("开完户准备进行绑定,将{0}绑定至{1}\r\n", mobile, CustID);
                        UserRegistry.CreateBesttoneAccount(SPID, CustID, mobile, out Result.ErrMsg);
                        strLog.AppendFormat("绑定后结果ErrMsg:{0}\r\n", Result.ErrMsg);
                        UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, mobile, out  Result.ErrMsg); //日志
                        strLog.AppendFormat("开户后日志\r\n");
                        UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, cerNum, out Result.ErrMsg);
                        strLog.AppendFormat("开户完成\r\n");
                    }
                    else
                    {  // 已开户
                        //绑定操作
                        if ("000000".Equals(ResponseCode))
                        {
                            strLog.AppendFormat("未绑定且 已开户\r\n");
                            strLog.AppendFormat("仅绑定.......\r\n");
                            UserRegistry.CreateBesttoneAccount(SPID, CustID, mobile, out Result.ErrMsg);
                            strLog.AppendFormat("将{0}绑定到{1}\r\n", mobile, CustID);
                            UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, CustID, mobile, out  Result.ErrMsg);
                            strLog.AppendFormat("记录绑定日志表,流水号:{0}", TransactionID);
                            strLog.AppendFormat("绑定后结果ErrMsg:{0}\r\n", Result.ErrMsg);
                        }
                        else
                        {
                            Result.Result = -25679;
                            Result.ErrMsg = ResponseCode;
                            return Result;
                        }
                    }
                }
                else
                {

                    Result.Result = QueryBesttoneAccountResult;
                    return Result;
                }
            }
            else
            {
                // 账户是否绑定到其他人身上
                strLog.AppendFormat("1 record return.\r\n");
                strLog.AppendFormat("该CustID:{1}上已经有绑定的账户号{1}\r\n", CustID, mobile);
                strLog.AppendFormat("检查改账户号{0}上是否绑定在别的CustID{1}上\r\n", mobile, CustID);
                BesttoneAccount besttoneCunsInfo = _besttoneAccount_dao.QueryByBestAccount(mobile);
                if (!besttoneCunsInfo.CustID.Equals(CustID))  // 绑定到了其他人身上
                {
                    strLog.AppendFormat("{0}绑定到了其他人身上,此人的CustID:{1}\r\n", mobile, CustID);
                    Result.Result = -12300;
                    Result.ErrMsg = mobile + "手机号已为其他客户(" + CustID + ")开通了号码百事通账户,您可以登录系统,进入您的账户中心,用另一手机号码开通号码百事通账户,也可以咨询客服人员帮助排查问题。";
                }
                strLog.AppendFormat("{0}没有绑定到其他人身上,此人的CustID:{1}\r\n", mobile, CustID);
                strLog.AppendFormat("去翼支付查询该账户号{0}是否存在\r\n", mobile);
                int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(mobile, out ai, out ResponseCode, out Result.ErrMsg);
                if (QueryBesttoneAccountResult != 0)   // 未开户
                {
                    strLog.AppendFormat("翼支付查询返回说该账户号{0}不存在\r\n", mobile);
                    strLog.AppendFormat("准备去为{0}开户........\r\n", mobile);
                    strLog.AppendFormat("开户前日志,参数 SPID:{0},TransactionID:{1},CustID:{2},mobile:{3}", SPID, TransactionID, CustID, mobile);
                    UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, mobile, out  Result.ErrMsg);  //日志
                    strLog.AppendFormat("开户前日志完成\r\n");
                    strLog.AppendFormat("开户........\r\n");
                    strLog.AppendFormat("开户参数:mobile:{0},realName:{1},contactTel:{2},email:{3},sex:{4},cerType:{5},cerNum:{6},TransactionID:{7}\r\n", mobile, realName, contactTel, email, sex, cerType, cerNum, TransactionID);
                    Result.Result = BesttoneAccountHelper.RegisterBesttoneAccount(mobile, realName, contactTel, email, sex, cerType, cerNum, TransactionID, out Result.ErrMsg);
                    strLog.AppendFormat("开户完成,返回结果:Result:{0},ErrMsg:{1}\r\n", Result.Result, Result.ErrMsg);
                    //绑定操作
                    strLog.AppendFormat("绑定{0}到{1}\r\n", mobile, CustID);
                    UserRegistry.CreateBesttoneAccount(SPID, CustID, mobile, out Result.ErrMsg);
                    strLog.AppendFormat("绑定完成,返回结果 ErrMsg:{0}\r\n", Result.ErrMsg);
                    strLog.AppendFormat("开户后日志\r\n");
                    UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, mobile, out  Result.ErrMsg); //日志
                    strLog.AppendFormat("开户后日志完成 ErrMsg:{0}\r\n", Result.ErrMsg);
                    UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, cerNum, out Result.ErrMsg);
                }
            }
            strLog.AppendFormat("End 开通号码百事通账户 Result:{0},ErrMsg{1}\r\n", Result.Result, Result.ErrMsg);
            //-99999 失败 0 成功

        }
        catch (Exception e)
        {
            Result.Result = ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Code;
            Result.ErrMsg = ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Msg + "," + e.Message;
        }
        finally
        {
            log(strLog.ToString());
        }
        return Result;
    }
Ejemplo n.º 38
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="SPID"></param>
    /// <param name="CustID"></param>
    /// <param name="Phone"></param>
    /// <param name="CheckPhoneCode"></param>
    /// <param name="wt"></param>
    /// <returns></returns>
    public String OpenBesttoneAccount(String SPID, String CustID, String Phone, String IDCard, String RealName, String ContactTel, String Email, String Sex,String AuthenCode, String wt)
    {
        //返回参数
        String ErrMsg = String.Empty;
        Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;

        StringBuilder ResponseMsg = new StringBuilder();

        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(CustID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(Phone))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "Phone不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "Phone不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(IDCard))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "IDCard不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "IDCard不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(RealName))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "999");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "RealName不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "999");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "RealName不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        //验证码校验
        Result = PhoneBO.SelSendSMSMassage(CustID, Phone, AuthenCode, out ErrMsg);
        if (Result != 0)
        {
            // 验证码未校验通过  return
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1000");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ErrMsg);
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1000");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ErrMsg);
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();

        }
        else
        {
            String t_custid = PhoneBO.IsAuthenPhone(Phone, SPID, out ErrMsg);
            // t_custid 可以为空,但不能是别人的custid,可以为空是说明此客户无认证电话
            if (!String.IsNullOrEmpty(t_custid))
            {
                if (CustID != t_custid)
                {
                    //是别人的手机号,不能用来开户  return
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1000");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", Phone + "(" + CustID + ")是别人的手机号(" + t_custid + "),不能用来开户!");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1000");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "是别人的手机号,不能用来开户!");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return ResponseMsg.ToString();
                }
            }

            if (!CommonUtility.CheckIDCard(IDCard))
            {
                //身份证不合法! return
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1001");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "身份证不合法!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1001");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "身份证不合法!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return ResponseMsg.ToString();

            }

            try
            {
                String TransactionID = CreateTransactionID();
                BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
                //strLog.AppendFormat("select * from besttoneaccount where custid={0}\r\n", CustID);
                BesttoneAccount besttoneAccountEntity = _besttoneAccount_dao.QueryByCustID(CustID);

                AccountItem ai = new AccountItem();
                String QueryBAResponseCode = "";

                if (besttoneAccountEntity == null)   // 未绑定
                {
                    //去翼支付查
                    int QueryBesttoneAccountResult = QueryBesttoneAccount(Phone, out ai, out QueryBAResponseCode, out ErrMsg);

                    //if (QueryBesttoneAccountResult == 0)
                    //{
                        if ("200010".Equals(QueryBAResponseCode))   // 未开户
                        {
                            UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, Phone, out  ErrMsg);  //日志
                            RegisterBesttoneAccount(Phone, RealName, ContactTel, Email, Sex, "1", IDCard, TransactionID, out ErrMsg);
                            UserRegistry.CreateBesttoneAccount(SPID, CustID, Phone, out ErrMsg);   //建立绑定关系
                            UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, Phone, out  ErrMsg); //日志
                            UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, RealName, IDCard, out ErrMsg);
                            ResponseMsg.Length = 0;
                            if ("json".Equals(wt))
                            {
                                ResponseMsg.Append("{");
                                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "开户成功,绑定成功!");
                                ResponseMsg.Append("}");
                            }
                            else
                            {
                                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                                ResponseMsg.Append("<PayPlatRequestParameter>");
                                ResponseMsg.Append("<PARAMETERS>");
                                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "开户成功,绑定成功!");
                                ResponseMsg.Append("</PARAMETERS>");
                                ResponseMsg.Append("</PayPlatRequestParameter>");
                            }
                            return ResponseMsg.ToString();
                        }
                        else
                        {   //可能在开过户
                            if ("000000".Equals(QueryBAResponseCode))
                            {
                                //绑定操作
                                UserRegistry.CreateBesttoneAccount(SPID, CustID, Phone, out ErrMsg);
                                UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, CustID, Phone, out  ErrMsg);

                                ResponseMsg.Length = 0;
                                if ("json".Equals(wt))
                                {
                                    ResponseMsg.Append("{");
                                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "仅仅绑定成功!");
                                    ResponseMsg.Append("}");
                                }
                                else
                                {
                                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                                    ResponseMsg.Append("<PayPlatRequestParameter>");
                                    ResponseMsg.Append("<PARAMETERS>");
                                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "仅仅绑定成功!");
                                    ResponseMsg.Append("</PARAMETERS>");
                                    ResponseMsg.Append("</PayPlatRequestParameter>");
                                }
                                return ResponseMsg.ToString();
                            }
                            else
                            {
                                //账户状态可能存在异常  return

                                ResponseMsg.Length = 0;
                                if ("json".Equals(wt))
                                {
                                    ResponseMsg.Append("{");
                                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1002");
                                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "账户状态可能存在异常!");
                                    ResponseMsg.Append("}");
                                }
                                else
                                {
                                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                                    ResponseMsg.Append("<PayPlatRequestParameter>");
                                    ResponseMsg.Append("<PARAMETERS>");
                                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1002");
                                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "账户状态可能存在异常!");
                                    ResponseMsg.Append("</PARAMETERS>");
                                    ResponseMsg.Append("</PayPlatRequestParameter>");
                                }
                                return ResponseMsg.ToString();
                            }
                        }
                    //}
                    //else
                    //{
                        ////账户查询过程中发生异常  return
                        //ResponseMsg.Length = 0;
                        //if ("json".Equals(wt))
                        //{
                        //    ResponseMsg.Append("{");
                        //    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1003");
                        //    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "账户查询过程中发生异常!");
                        //    ResponseMsg.Append("}");
                        //}
                        //else
                        //{
                        //    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        //    ResponseMsg.Append("<PayPlatRequestParameter>");
                        //    ResponseMsg.Append("<PARAMETERS>");
                        //    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1003");
                        //    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "账户查询过程中发生异常!");
                        //    ResponseMsg.Append("</PARAMETERS>");
                        //    ResponseMsg.Append("</PayPlatRequestParameter>");
                        //}
                        //return ResponseMsg.ToString();
                    //}

                }
                else
                {
                    //该手机号码已经开过户,账户所绑定的custid不管是不是自己的,都不允许再开户
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1004");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "该手机号码已经开过户!");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1004");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "该手机号码已经开过户!");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return ResponseMsg.ToString();
                }

            }
            catch (Exception ecp)
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1005");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ecp.ToString());
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1005");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ecp.ToString());
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return ResponseMsg.ToString();
            }

        }

        // 开户的前置条件
        //1.必须先登录(说明是合法号百客户,有CUSTID)
        //2.手机验证码校验  (如果是接口,仅校验手机验证码,如果是页面,则需校验页面验证码?)
        //3.检查手机号码是否是别人的登录账号 (登录后获得的custid和custphone 的custid比对)
        //4.验证身份证号是否合法
        //5.检查手机号码是否是别人的支付账户 (是否已经存在绑定关系,如果是,是否是绑定在自己的custid下)
        //6.去翼支付检查该手机号码是否开过户(直接调翼支付账户查询)

        //开户

        //IF 校验码未通过
        //    重定向到错误页面(如果是接口,则返回错误提示)
        //ELSE
        //      IF 根据PHONE 获得的CUSTID不是 登录CUSTID
        //           非法开户,重定向到错误页面 (如果是接口,则返回错误提示)  --
        //      ELSE
        //            IF PHONE 存在于账户绑定关系
        //    IF 账户对应的CUSTID 与登录后获得的CUSTID 不匹配   -- 说明该手机号码已经被别的客户开成账户了
        //           该手机号码已经被别的客户开成账户了,重定向到错误页面,如果是接口,则返回错误提示信息
        //                ELSE
        //                      该手机已经开过户,不需要再开户
        //    END
        //           ELSE
        //                     IF 翼支付没能能查到该手机的账户信息 --说明的确未开户
        //                              验证身份证号是否合法
        //                               开户 (调用翼支付开户接口)
        //                                插入绑定关系表
        //                     END
        //           END
        //       END
        //END
        return ResponseMsg.ToString();
    }
Ejemplo n.º 39
0
    public CancelBesttoneAccountResult CancelBesttoneAccount(string SPID, string BesttoneAccount)
    {
        CancelBesttoneAccountResult Result = new CancelBesttoneAccountResult();
        Result.Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
        Result.ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;
        StringBuilder strLog = new StringBuilder();

        try
        {
            strLog.AppendFormat("Begin 注销号码百事通账户:\r\n");
            #region 数据合法性判断
            if (CommonUtility.IsEmpty(SPID))
            {
                Result.Result = ErrorDefinition.CIP_IError_Result_SPIDInValid_Code;
                Result.ErrMsg = ErrorDefinition.CIP_IError_Result_SPIDInValid_Msg;
                return Result;
            }
            //IP是否允许访问
            Result.Result = CommonBizRules.CheckIPLimit(SPID, HttpContext.Current.Request.UserHostAddress, this.Context, out Result.ErrMsg);
            strLog.AppendFormat("请求方ip:{0}\r\n", HttpContext.Current.Request.UserHostAddress);
            strLog.AppendFormat("CheckIPLimit Result:{0},ErrMsg:{1}\r\n", Result.Result, Result.ErrMsg);
            if (Result.Result != 0)
            {
                return Result;
            }
            //接口访问权限判断
            Result.Result = CommonBizRules.CheckInterfaceLimit(SPID, "CancelBesttoneAccount", this.Context, out Result.ErrMsg);
            strLog.AppendFormat("CheckInterfaceLimit Result:{0},ErrMsg:{1}\r\n", Result.Result, Result.ErrMsg);
            if (Result.Result != 0)
            {
                return Result;
            }
            if (CommonUtility.IsEmpty(BesttoneAccount))
            {
                Result.Result = -7015;
                Result.ErrMsg = "账户名不能为空!";
                return Result;
            }
            if (!Utils.isMobilePhone(BesttoneAccount))
            {
                Result.Result = -7015;
                Result.ErrMsg = "无效的手机号码!";
                return Result;
            }
            #endregion
            Linkage.BestTone.Interface.Rule.CustInfo custInfo = new Linkage.BestTone.Interface.Rule.CustInfo();
            strLog.AppendFormat("去翼支付查询{0}的客户信息\r\n",BesttoneAccount);
            int QueryCustInfoResult = BesttoneAccountHelper.QueryCustInfo(BesttoneAccount, out custInfo, out Result.ErrMsg);
            strLog.AppendFormat("查询后返回结果:QueryCustinoResult:{0},ErrMsg:{1}\r\n",QueryCustInfoResult,Result.ErrMsg);
            strLog.AppendFormat("账户信息:CustomerNo:{0}, ProductNo:{1}, custinfo.CustomerName:{2}, custinfo.IdType:{3}, custinfo.IdNo:{4}\r\n", custInfo.CustomerNo, custInfo.ProductNo, custInfo.CustomerName, custInfo.IdType, custInfo.IdNo);
            strLog.AppendFormat("销户...");
            int CancelBesttoneAccountResult = BesttoneAccountHelper.CancelBesttoneAccount(custInfo.CustomerNo, custInfo.ProductNo, custInfo.CustomerName, custInfo.IdType, custInfo.IdNo, out  Result.ErrMsg);
            strLog.AppendFormat("销户返回结果:CancelBesttoneAccountResult{0},ErrMsg:{1}", CancelBesttoneAccountResult,Result.ErrMsg);
            String ResponseCode = "";
            AccountItem ai = new AccountItem();
            int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(BesttoneAccount, out ai, out ResponseCode, out Result.ErrMsg);
            if (QueryBesttoneAccountResult != 0) {
                BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
                bool ret = _besttoneAccount_dao.Delete(BesttoneAccount);
                if (ret)
                {
                    strLog.AppendFormat("解绑成功\r\n");
                }
                else {
                    strLog.AppendFormat("解绑失败\r\n");
                }
            }
            strLog.AppendFormat("End 注销号码百事通账户:\r\n");
        }
        catch (Exception ex)
        {
            Result.Result = ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Code;
            Result.ErrMsg = ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Msg + "," + ex.Message;
        }
        finally {
            log(strLog.ToString());
        }
        return Result;
    }
Ejemplo n.º 40
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        StringBuilder strLog = new StringBuilder();
        String Url = "";
        try
        {
            PassWord = Request.Form["password"].ToString().Trim();
            Mobile = Request.Form["mobile"].ToString().Trim();
            CheckPhoneCode = Request.Form["checkCode"].ToString().Trim();
            strLog.AppendFormat("接收到password:{0},Mobile:{1},CheckPhoneCode:{2}\r\n", PassWord, Mobile, CheckPhoneCode);

            string UserName = "";
            string Email = "";

            if (ViewState["phonestate"] == null)
            {
                strLog.AppendFormat("phonestate=null\r\n");
                ViewState["phonestate"] = Request.Form["phonestate"].ToString();
                string a = (string)ViewState["phonestate"];
            }
            if (((string)ViewState["phonestate"]).Equals("0"))
            {
                Result = PhoneBO.SelSendSMSMassage("", Mobile, CheckPhoneCode, out ErrMsg);
                if (Result != 0)
                {
                    strLog.AppendFormat("手机验证码校验未通过!\r\n");
                    return;
                }
            }

            strLog.AppendFormat("手机验证码校验通过!\r\n");
            Result = UserRegistry.quickUserRegistryWebV4(SPID, PassWord, Mobile, (string)ViewState["phonestate"], UserName, Email,Device, out CustID, out ErrMsg);
            if (Result != 0)
            {
                strLog.AppendFormat("注册失败!\r\n");
                return;
            }
            strLog.AppendFormat("注册成功!CustID:{0}\r\n", CustID);
            String hid_openAccount = Request.Form["hid_openAccount"].ToString().Trim();
            if ("1".Equals(hid_openAccount))
            {
                strLog.AppendFormat("开户过程\r\n");
                string BindedBestpayAccount = "";
                string CreateTime = "";

                int IsBesttoneAccountBindV5Result = CIP2BizRules.IsBesttoneAccountBindV5(CustID, out BindedBestpayAccount, out CreateTime, out ErrMsg);
                if (IsBesttoneAccountBindV5Result == 0)
                {
                    Response.Redirect("ErrorInfo.aspx?ErrorInfo=该账户绑定关系未解除,请联系管理人员!");
                }
                String TransactionID = BesttoneAccountHelper.CreateTransactionID();
                AccountItem ai = new AccountItem();
                string ResponseCode = "";
                string BestToneAccount = Request.Form["mobile"].ToString().Trim();
                realName = Request.Form["realName"].ToString().Trim();
                certnum = Request.Form["certnum"].ToString().Trim();
                int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(BestToneAccount, out ai, out ResponseCode, out ErrMsg);
                if (QueryBesttoneAccountResult == 0)
                {

                    if ("200010".Equals(ResponseCode))   // 未开户
                    {
                        strLog.AppendFormat("该号码未开过户:\r\n");
                        UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out  ErrMsg);
                        Result = BesttoneAccountHelper.RegisterBesttoneAccount(BestToneAccount, realName, BestToneAccount, "", sex, "1", certnum, TransactionID, out ErrMsg);
                        if (Result == 0)
                        {
                            strLog.AppendFormat("开户成功:\r\n");
                            int BindResult = UserRegistry.CreateBesttoneAccount(SPID, CustID, BestToneAccount, out ErrMsg);
                            if (BindResult == 0)
                            {
                                UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out  ErrMsg);
                                int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, certnum, out ErrMsg);
                                //
                                //Response.Redirect("NewOpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0&RegistryResponse=" + HttpUtility.UrlEncode(RegistryResponseValue), true);

                            }
                            else
                            {
                                Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                            }

                        }
                        else
                        {
                            Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                        }
                    }
                    else
                    {
                        UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out  ErrMsg);
                        int BindResult = UserRegistry.CreateBesttoneAccount(SPID, CustID, BestToneAccount, out ErrMsg);
                        if (BindResult == 0)
                        {
                            UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out  ErrMsg);
                            int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, certnum, out ErrMsg);
                            //Response.Redirect("NewOpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0&RegistryResponse=" + HttpUtility.UrlEncode(RegistryResponseValue), true);
                        }
                        else
                        {
                            Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                        }
                    }
                }
                else
                {
                    Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                }

            }

            if (ReturnUrl.IndexOf("?") > 0)
            {
                Url = ReturnUrl + "&CustID=" + CustID + "&welcomeName=" + Mobile;

            }
            else
            {
                Url = ReturnUrl + "?CustID=" + CustID + "&welcomeName=" + Mobile;
            }

            Response.Redirect(Url, true);
        }
        catch (Exception ex)
        {
            strLog.AppendFormat(ex.ToString());
        }
        finally
        {
            log(strLog.ToString());
        }
    }
Ejemplo n.º 41
0
    protected void Modify_Click(object sender, EventArgs e)
    {
        StringBuilder strLog = new StringBuilder();
        try
        {
            String oldPassWord = Request.Form["oldPassWord"];
            String newPassWord = Request.Form["newPassWord"];
            String confirmPassWord = Request.Form["confirmPassWord"];
            string BesttoneAccount = base.BestPayAccount;
            strLog.AppendFormat("【开始修改密码,事件:{0}】", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            strLog.AppendFormat("参数:oldPassWord:{0},newPassWord:{1},confirmPassWord:{2},BesttonePayAccount:{3}", oldPassWord, newPassWord, confirmPassWord, BesttoneAccount);

            BestPayEncryptService bpes = new BestPayEncryptService();
            string e_oldPassWord = "";
            string e_newPassWord = "";
            string e_confirmPassWord = "";

            AccountItem ai = new AccountItem();
            String ResCode = "";
            int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(BesttoneAccount, out ai,out ResCode, out ErrMsg);
            if (QueryBesttoneAccountResult == 0)
            {
                if (ai != null)
                {
                    e_oldPassWord = bpes.encryptNoKey(oldPassWord, ai.AccountNo);
                    e_newPassWord = bpes.encryptNoKey(newPassWord, ai.AccountNo);
                    e_confirmPassWord = bpes.encryptNoKey(confirmPassWord, ai.AccountNo);

                    strLog.AppendFormat("e_oldPassWord{0},e_newPassWord{1},e_confirmPassWord{2}", e_oldPassWord, e_newPassWord, e_confirmPassWord);

                    int ModifyBestPayPasswordResult = BesttoneAccountHelper.ModifyBestPayPassword(ai.AccountNo, e_oldPassWord, e_newPassWord, e_confirmPassWord, out ErrMsg);

                    if (ModifyBestPayPasswordResult == 0)
                    {
                        success = "0";
                        _ReturnUrl = base.ReturnUrl;
                    }
                    else
                    {
                        strLog.Append(",失败3");
                        Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                    }
                }
                else
                {
                    strLog.Append(",失败2");
                    Response.Redirect("ErrorInfo.aspx?ErrorInfo=账户信息未获取");
                }
            }
            else
            {
                strLog.Append(",失败1");
                Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
            }
        }
        catch (System.Exception ex)
        {
            log(ex.ToString());
        }
        finally
        {
            log(strLog.ToString());

        }
    }
Ejemplo n.º 42
0
    protected void register_Click(object sender, EventArgs e)
    {
        StringBuilder strLog = new StringBuilder();
        try
        {
            ParseSPTokenRequest();
            //CreateSPTokenRequest();

            Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
            String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;
            realName = Request["realName"];
            //contactMail = Request["contactMail"];
            sex = Request["sex"];
            certnum = Request["certnum"];
            checkCode = Request["checkCode"];
            CustID = this.myCustID.Value;
            strLog.AppendFormat("开户页面手机验证码:{0}", checkCode);

            //判断手机验证码
            if (checkCode != null && !"".Equals(checkCode))
            {
                Result = PhoneBO.SelSendSMSMassage("", this.mobile.Text, checkCode, out ErrMsg);
                if (Result != 0)
                {
                    hintCode.InnerHtml = "手机验证码错误,请重新输入";  // 这里如何控制样式

                    return;
                }
            }

            string BindedBestpayAccount = "";
            string CreateTime = "";
            int IsBesttoneAccountBindV5Result = CIP2BizRules.IsBesttoneAccountBindV5(this.myCustID.Value, out BindedBestpayAccount, out CreateTime, out ErrMsg);
            if (IsBesttoneAccountBindV5Result == 0)
            {
                Response.Redirect("ErrorInfo.aspx?ErrorInfo=该账户绑定关系未解除,请联系管理人员!");
            }

            TransactionID = BesttoneAccountHelper.CreateTransactionID();
            AccountItem ai = new AccountItem();
            string ResponseCode = "";
            int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(this.mobile.Text, out ai, out ResponseCode, out ErrMsg);
            strLog.AppendFormat("查询账户信息返回:{0},{1},{2}", QueryBesttoneAccountResult, ErrMsg, this.mobile.Text);
            if (QueryBesttoneAccountResult == 0)
            {
                if ("200010".Equals(ResponseCode))  // 200010 -> 客户不存在
                {

                    //todo 发起开户请求日志
                    UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, this.myCustID.Value, this.mobile.Text, out  ErrMsg);
                    strLog.AppendFormat("BeforeCreateBesttoneAccount:ErrMsg:{0}", ErrMsg);
                    //String realName,String contactTel,String sex,String certtype,String certnum,
                    Result = BesttoneAccountHelper.RegisterBesttoneAccount(this.mobile.Text, realName, this.mobile.Text, "", sex, "1", certnum, TransactionID, out ErrMsg);
                    if (Result == 0)
                    {

                        strLog.AppendFormat("开户结果:{0},{1},{2}", Result, ErrMsg, this.myCustID.Value);
                        // todo 建立绑定关系,插入绑定关系表
                        int ret = 0;

                        ret = UserRegistry.CreateBesttoneAccount(SPID, this.myCustID.Value, this.mobile.Text, out ErrMsg);
                        strLog.AppendFormat("CreateBesttoneAccount:ErrMsg:{0}", ErrMsg);
                        if (ret == 0)
                        {

                            //todo 开户完成 建立绑定关系 日志
                            UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, this.myCustID.Value, this.mobile.Text, out  ErrMsg);
                            strLog.AppendFormat("AfterCreateBesttoneAccount:ErrMsg:{0}", ErrMsg);
                            strLog.AppendFormat("绑定结果:ret:{0},ErrMsg:{1},ReturnUrl:{2}", ret, ErrMsg, ReturnUrl);

                            int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, this.myCustID.Value, realName, certnum, out ErrMsg);
                            strLog.AppendFormat("回写客户信息结果:retWriteBack:{0},ErrMsg:{1}", retWriteBack, ErrMsg);

                            strLog.AppendFormat("SPTokenRequest={0}", SPTokenRequest);
                            strLog.AppendFormat("Redirect to Url:{0}", "OpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0");
                            Response.Redirect("OpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0");

                        }
                        else
                        {
                            strLog.AppendFormat("绑定结果:{0},{1}", ret, ErrMsg);
                            Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                        }
                    }
                    else
                    {
                        strLog.AppendFormat("开户结果:{0},{1}", Result, ErrMsg);
                        Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);

                    }

                }
                else  // 账户已存在
                {
                    // todo 建立绑定关系,插入绑定关系表
                    UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, this.myCustID.Value, this.mobile.Text, out  ErrMsg);
                    strLog.AppendFormat("OnlyBindingBesttoneAccount:ErrMsg:{0}", ErrMsg);
                    int ret = 0;

                    ret = UserRegistry.CreateBesttoneAccount(SPID, this.myCustID.Value, this.mobile.Text, out ErrMsg);
                    if (ret == 0)
                    {
                        int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, this.myCustID.Value, realName, certnum, out ErrMsg);
                        strLog.AppendFormat("回写客户信息结果:retWriteBack:{0},ErrMsg:{1}", retWriteBack, ErrMsg);
                        strLog.AppendFormat("绑定结果:ret:{0},ErrMsg:{1},ReturnUrl:{2}", ret, ErrMsg, ReturnUrl);
                        strLog.AppendFormat(String.Format("SPTokenRequest={0}", SPTokenRequest));
                        Response.Redirect("OpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0");
                        //Response.Redirect(this.myReturnUrl.Value);
                    }
                    else
                    {
                        strLog.AppendFormat("绑定结果:{0},{1}", ret, ErrMsg);
                        Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                    }
                }
            }
            else
            {
                strLog.AppendFormat("查询账户信息返回:{0},{1},{2}", QueryBesttoneAccountResult, ErrMsg, this.mobile.Text);
                Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
            }

        }
        catch (System.Exception ex)
        {
            log(ex.ToString());
        }
        finally
        {
            log(strLog.ToString());
        }
    }
Ejemplo n.º 43
0
        /// <summary>
        /// Gets the accounts.
        /// </summary>
        private void GetAccounts()
        {
            var selectedGuids = GetAttributeValues( "Accounts" ).Select( Guid.Parse ).ToList();
            bool showAll = !selectedGuids.Any();

            bool additionalAccounts = true;
            if ( !bool.TryParse( GetAttributeValue( "AdditionalAccounts" ), out additionalAccounts ) )
            {
                additionalAccounts = true;
            }

            SelectedAccounts = new List<AccountItem>();
            AvailableAccounts = new List<AccountItem>();

            // Enumerate through all active accounts that have a public name
            foreach ( var account in new FinancialAccountService().Queryable()
                .Where( f =>
                    f.IsActive &&
                    f.PublicName != null &&
                    f.PublicName.Trim() != "" &&
                    ( f.StartDate == null || f.StartDate <= DateTime.Today ) &&
                    ( f.EndDate == null || f.EndDate >= DateTime.Today ) )
                .OrderBy( f => f.Order ) )
            {
                var accountItem = new AccountItem( account.Id, account.Order, account.Name, account.CampusId );
                if ( showAll )
                {
                    SelectedAccounts.Add( accountItem );
                }
                else
                {
                    if ( selectedGuids.Contains( account.Guid ) )
                    {
                        SelectedAccounts.Add( accountItem );
                    }
                    else
                    {
                        if ( additionalAccounts )
                        {
                            AvailableAccounts.Add( accountItem );
                        }
                    }
                }
            }
        }
Ejemplo n.º 44
0
    public String ChangePayPassword(String SPID, String CustID, String oldPassWord, String newPassWord, String confirmPassWord, String wt)
    {
        Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
        String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;
        StringBuilder ResponseMsg = new StringBuilder();

        #region
        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(CustID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(oldPassWord))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "oldPassword不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "oldPassword不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(newPassWord))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "newPassword不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "newPassword不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(confirmPassWord))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "confirmPassWord不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "confirmPassWord不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        #endregion

        try
        {
            string BindedBestpayAccount = "";
            string CreateTime = "";
            Result = CIP2BizRules.IsBesttoneAccountBindV5(CustID, out BindedBestpayAccount, out CreateTime, out ErrMsg);

            if (Result == 0 && !String.IsNullOrEmpty(BindedBestpayAccount))
            {

                BestPayEncryptService bpes = new BestPayEncryptService();
                string e_oldPassWord = "";
                string e_newPassWord = "";
                string e_confirmPassWord = "";

                AccountItem ai = new AccountItem();
                String ResCode = "";

                int QueryBesttoneAccountResult = BesttoneAccountInfoQuery(BindedBestpayAccount, out ai, out ResCode, out ErrMsg);
                if (QueryBesttoneAccountResult == 0)
                {
                    if (ai != null)
                    {
                        e_oldPassWord = bpes.encryptNoKey(oldPassWord, ai.AccountNo);
                        e_newPassWord = bpes.encryptNoKey(newPassWord, ai.AccountNo);
                        e_confirmPassWord = bpes.encryptNoKey(confirmPassWord, ai.AccountNo);

                        //strLog.AppendFormat("e_oldPassWord{0},e_newPassWord{1},e_confirmPassWord{2}", e_oldPassWord, e_newPassWord, e_confirmPassWord);

                        int ModifyBestPayPasswordResult = ModifyBestPayPassword(ai.AccountNo, e_oldPassWord, e_newPassWord, e_confirmPassWord, out ErrMsg);

                        if (ModifyBestPayPasswordResult == 0)
                        {
                            //success = "0";

                                // 返回错误信息
                                ResponseMsg.Length = 0;
                                if ("json".Equals(wt))
                                {
                                    ResponseMsg.Append("{");
                                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "修改密码成功!");
                                    ResponseMsg.Append("}");
                                }
                                else
                                {
                                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                                    ResponseMsg.Append("<PayPlatRequestParameter>");
                                    ResponseMsg.Append("<PARAMETERS>");
                                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改密码成功!");
                                    ResponseMsg.Append("</PARAMETERS>");
                                    ResponseMsg.Append("</PayPlatRequestParameter>");
                                }
                                return ResponseMsg.ToString();

                        }
                        else
                        {
                            //strLog.Append(",失败3");
                            //Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);

                                // 返回错误信息
                                ResponseMsg.Length = 0;
                                if ("json".Equals(wt))
                                {
                                    ResponseMsg.Append("{");
                                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "9916");
                                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "修改密码失败!");
                                    ResponseMsg.Append("}");
                                }
                                else
                                {
                                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                                    ResponseMsg.Append("<PayPlatRequestParameter>");
                                    ResponseMsg.Append("<PARAMETERS>");
                                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "9916");
                                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改密码失败!");
                                    ResponseMsg.Append("</PARAMETERS>");
                                    ResponseMsg.Append("</PayPlatRequestParameter>");
                                }
                                return ResponseMsg.ToString();

                        }
                    }
                    else
                    {
                        //strLog.Append(",失败2");
                        //Response.Redirect("ErrorInfo.aspx?ErrorInfo=账户信息未获取");

                            // 返回错误信息
                            ResponseMsg.Length = 0;
                            if ("json".Equals(wt))
                            {
                                ResponseMsg.Append("{");
                                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "9917");
                                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "修改密码失败!账户信息未能获取");
                                ResponseMsg.Append("}");
                            }
                            else
                            {
                                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                                ResponseMsg.Append("<PayPlatRequestParameter>");
                                ResponseMsg.Append("<PARAMETERS>");
                                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "9917");
                                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改密码失败!账户信息未能获取");
                                ResponseMsg.Append("</PARAMETERS>");
                                ResponseMsg.Append("</PayPlatRequestParameter>");
                            }
                            return ResponseMsg.ToString();

                    }
                }
                else
                {
                    //strLog.Append(",失败1");
                    //Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);

                        // 返回错误信息
                        ResponseMsg.Length = 0;
                        if ("json".Equals(wt))
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "9918");
                            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "修改密码失败2!");
                            ResponseMsg.Append("}");
                        }
                        else
                        {
                            ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                            ResponseMsg.Append("<PayPlatRequestParameter>");
                            ResponseMsg.Append("<PARAMETERS>");
                            ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "9918");
                            ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改密码失败2!");
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                        return ResponseMsg.ToString();

                }
            }
            else
            {
                // 未开通账户

                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "9919");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "修改密码失败!账户未开通");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "9919");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改密码失败!账户未开通");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return ResponseMsg.ToString();

            }
        }
        catch (Exception ecp)
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "9920");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ecp.ToString());
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "9920");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ecp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }
        return ResponseMsg.ToString();
    }