當前位置: 首頁>>代碼示例>>C#>>正文


C# Account.Save方法代碼示例

本文整理匯總了C#中Account.Save方法的典型用法代碼示例。如果您正苦於以下問題:C# Account.Save方法的具體用法?C# Account.Save怎麽用?C# Account.Save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Account的用法示例。


在下文中一共展示了Account.Save方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetItem

        public void GetItem()
        {
            const int ID = 1;

            AccountList list = AccountList.getInstance();

            Account account = list.getItem(ID);

            Assert.AreEqual("1", account.IDPolicyType);

            account = new Account();
            account.IDPolicyType = "2";
            account.Save();

            list.Add(account);

            account = list.getItem(ID);

            Assert.AreEqual("2", account.IDPolicyType);
        }
開發者ID:NextStalker,項目名稱:BBAuto,代碼行數:20,代碼來源:ListTest.cs

示例2: TestAccountCRUD

        public void TestAccountCRUD()
        {
            // 刪除無用的測試數據
            List<Account> list = Account.Query("code = 'testcode'");
            foreach (Account acc in list)
            {
                Assert.IsTrue(acc.Destory());
            }

            GlobalSet.Current_User = User.Query()[0];

            // 新增
            Account a = new Account();
            a.In_CompanyDetail_ID = CompanyDetail.Query("parent_id in (select id from m_company where input = 'X')")[0].ID;
            a.Out_CompanyDetail_ID = CompanyDetail.Query("parent_id in (select id from m_company where output = 'X')")[0].ID;
            a.Money = 12345;
            a.SignedDate = DateTime.Now;

            for (int i = 1; i < 10; i ++ )
            {
                AccountDetail d = new AccountDetail();
                d.FundsID = Funds.Query()[0].ID;
                d.Money = i;
                d.Usage = i.ToString();
                a.DetailList.Add(d);
            }

            Assert.IsTrue(a.Save());
            Assert.IsTrue(a.ID > 0);

            // 查詢
            list = Account.Query(string.Format("id = {0}", a.ID));
            Assert.IsTrue(list.Count == 1);
            Assert.IsTrue(list[0].ID == a.ID);
            Assert.IsTrue(list[0].DetailList.Count == 9);

            // 刪除
            Assert.IsTrue(list[0].Destory());
            list = Account.Query(string.Format("id = {0}", list[0].ID));
            Assert.IsTrue(list.Count == 0);
        }
開發者ID:hmxiaoxiao,項目名稱:haimenlg,代碼行數:41,代碼來源:TestAccount.cs

示例3: Session

        public Session(Account account)
        {
            Account = account;
            IsActive = true;

            _connections = new List<Connection>();

            var defaultRoom = Program.Settings.DefaultRoom;
            var roomsList = new List<string>(Account.Rooms ?? new string[0]);

            roomsList.RemoveAll(r => Program.RoomManager.Get(r) == null);

            var defaultIdx = roomsList.IndexOf(defaultRoom);
            if (roomsList.Count == 0)
            {
                roomsList.Add(defaultRoom);
            }
            else if (defaultIdx == -1)
            {
                roomsList.Insert(0, defaultRoom);
            }
            else if (defaultIdx > 0)
            {
                roomsList.RemoveAt(defaultIdx);
                roomsList.Insert(0, defaultRoom);
            }

            if (!roomsList.SequenceEqual(Account.Rooms ?? new string[0]))
            {
                Account.Rooms = roomsList.ToArray();
                Account.Save();
            }

            _rooms = new OrderedSet<string>(Account.Rooms);
            _firstConnection = true;
            _timeWithoutConnection = 0;
        }
開發者ID:krixalis,項目名稱:RohBot,代碼行數:37,代碼來源:Session.cs

示例4: AddLoginCredit

        private void AddLoginCredit(Account account)
        {
            #region 添加登錄積分

            int loginCredit;
            int maxLoginCreditInDay;
            if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditLogin", out loginCredit) &&
                (loginCredit != 0) &&
                CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditLoginMaxInDay", out maxLoginCreditInDay))
            {
                DateTime now = DateTime.Now;
                DateTime startOfDay = new DateTime(now.Year, now.Month, now.Day);
                // 獲取用戶當日內由登錄而獲得的積分
                int creditsAlreadyGainToday;
                List<CY.UME.Core.Business.CreditHistory> creditHistories =
                    CY.UME.Core.Business.CreditHistory.GetCreditHistory(
                        "login",
                        account.Id,
                        new long?(),
                        string.Empty,
                        startOfDay,
                        startOfDay.AddDays(1),
                        new CY.UME.Core.PagingInfo
                        {
                            CurrentPage = 1,
                            PageSize = int.MaxValue
                        }
                    );
                creditsAlreadyGainToday = creditHistories.Sum<CY.UME.Core.Business.CreditHistory>(ch => ch.Variation);
                if (creditsAlreadyGainToday < maxLoginCreditInDay)
                {
                    loginCredit = (creditsAlreadyGainToday + loginCredit > maxLoginCreditInDay) ? (maxLoginCreditInDay - creditsAlreadyGainToday) : loginCredit;

                    int orgCredit = account.Credit;
                    int modifiedCredit = orgCredit + loginCredit;

                    account.Credit = modifiedCredit;
                    account.Save();

                    CreditHistory ch = new CreditHistory();
                    ch.AccountId = account.Id;
                    ch.DateCreated = DateTime.Now;
                    ch.Id = Guid.NewGuid();
                    ch.InstanceId = account.Id.ToString();
                    ch.Original = orgCredit;
                    ch.Modified = modifiedCredit;
                    ch.Variation = loginCredit;
                    ch.Type = "login";
                    ch.Description = "用戶登錄";
                    ch.Save();
                }
            }
            #endregion
        }
開發者ID:dalinhuang,項目名稱:ume-v3,代碼行數:54,代碼來源:Login2.ascx.cs

示例5: SaveAccount

        public ActionResult SaveAccount(AdminMyAccount m)
        {
            Account myAccount = new Account();
            try
            {
                if (ModelState.IsValid)
                {
                    if (m.Password != m.RetypePassword)
                        throw new Exception("Password and Retype Password must match.");

                    myAccount.AccountID = m.AccountID;
                    myAccount.UserName = m.UserName;
                    myAccount.Password = PasswordHash.CreateHash(m.Password);
                    myAccount.Save();
                }
                else
                {
                    return View("MyAccount", m);
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return View("MyAccount", m);
            }
            return RedirectToRoute("AdminHome", new { musicalID = m.MusicalID });
        }
開發者ID:jpatchak,項目名稱:BayviewMusical,代碼行數:27,代碼來源:AdminController.cs


注:本文中的Account.Save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。