本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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
}
示例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 });
}