public int AddWish(long accountId, string content, string wallColor, string fontColor, int credit, int isFirstDay) { CY.UME.Core.Business.Account account = CY.UME.Core.Business.Account.Load(accountId); CY.UME.Core.Business.Wishing wishtemp = new CY.UME.Core.Business.Wishing(); if (account == null) { return 1; } if (content.Trim().Length > 250 || wallColor.Trim().Length > 10 || fontColor.Length > 10) { return 3; } if (credit > account.Credit) { return 2; } if (credit > 0 && wishtemp.ValidateIsAdd() == 0) { return 4; } bool isTop = false; int days = 0; if (credit != 0) { switch (credit) { case 100: days = 1; break; default: days = -1; break; } if (days == -1) { return 0; } isTop = true; } try { CY.UME.Core.Business.Wishing wish = new CY.UME.Core.Business.Wishing(); DateTime dt = DateTime.Now; wish.AccountId = accountId; wish.WallColor = wallColor; wish.FontColor = fontColor; wish.Content = content.Trim(); wish.DateCreated = dt; wish.EndDate = dt.AddDays(days); wish.IsTop = isTop; wish.ReplyNum = 0; wish.Credit = credit; wish.Save(); /***********第一天活动****************/ if (isFirstDay.ToString() == "1") { CY.UME.Core.Business.WishingExtend we = new CY.UME.Core.Business.WishingExtend(); we.AccountId = wish.AccountId; we.ActivityId = "myfirstday"; we.Id = wish.Id; we.Save(); } /************第一天活动结束**************/ return 1; } catch { return 0; } }
public ArrayList GetCreditByAccountId(long accountId) { ArrayList al = new ArrayList(); CY.UME.Core.Business.Account account = CY.UME.Core.Business.Account.Load(accountId); if (account == null) { al.Add(-1); return al; } CY.UME.Core.Business.Wishing wish = new CY.UME.Core.Business.Wishing(); al.Add(account.Credit); al.Add(wish.ValidateIsAdd()); return al; }