当前位置: 首页>>代码示例>>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;未经允许,请勿转载。