public bool AddExp(UsersExpModel model, int inviteuid) { if (inviteuid > 0) { string nickName = new Maticsoft.BLL.Members.Users().GetNickName(inviteuid); if (!string.IsNullOrWhiteSpace(nickName)) { int pointScore = new Maticsoft.BLL.Members.PointsDetail().AddPoints("Invite", inviteuid, "邀请用户", ""); return this.dal.AddEx(model, inviteuid, nickName, pointScore); } } return this.dal.Add(model); }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack && (base.CurrentUser != null)) { this.CurrentUserName = base.CurrentUser.UserName; this.uModel = this.uBll.GetUsersExpModel(base.CurrentUser.UserID); if (this.uModel != null) { this.LitLastLoginTime.Text = this.uModel.LastLoginTime.ToString("yyyy-MM-dd HH:mm:ss"); } else { this.LitLastLoginTime.Text = base.CurrentUser.User_dateCreate.ToString("yyyy-MM-dd HH:mm:ss"); } this.ShowInfo(); } }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { if (!string.IsNullOrWhiteSpace(base.CurrentUser.TrueName)) { this.CurrentUserName = base.CurrentUser.TrueName; } else { this.CurrentUserName = base.CurrentUser.UserName; } if ((DateTime.Now.Hour > 6) && (DateTime.Now.Hour < 12)) { this.GetDateTime = "早上好"; } else if ((DateTime.Now.Hour >= 12) && (DateTime.Now.Hour < 0x12)) { this.GetDateTime = "下午好"; } else { this.GetDateTime = "晚上好"; } this.uModel = this.uBll.GetUsersExpModel(base.CurrentUser.UserID); if (this.uModel != null) { this.LitLastLoginTime.Text = this.uModel.LastLoginTime.ToString("yyyy-MM-dd HH:mm:ss"); } else { this.LitLastLoginTime.Text = base.CurrentUser.User_dateCreate.ToString("yyyy-MM-dd HH:mm:ss"); } this.lblUrl.Text = "http://" + Globals.DomainFullName + "/wcapi.aspx"; this.litProductLine.Text = Maticsoft.Components.MvcApplication.ProductInfo + " " + Maticsoft.Components.MvcApplication.Version; this.litOperatingSystem.Text = SystemInfo.OperatingSystemSimple; this.litServerDomain.Text = SystemInfo.ServerDomain; this.litDotNetVersion.Text = SystemInfo.DotNetVersion.ToString(); this.litWebServerVersion.Text = SystemInfo.WebServerVersion; } }
protected void Page_Load(object sender, EventArgs e) { if (this.Session[Globals.SESSIONKEY_SUPPLIER] != null) { User user = (User) this.Session[Globals.SESSIONKEY_SUPPLIER]; LogHelp.AddUserLog(user.UserName, user.UserType, "退出系统", this); UsersExp exp = new UsersExp(); UsersExpModel usersExpModel = new UsersExpModel(); usersExpModel = exp.GetUsersExpModel(user.UserID); if (usersExpModel != null) { usersExpModel.LastAccessIP = base.Request.UserHostAddress; usersExpModel.LastLoginTime = DateTime.Now; exp.UpdateUsersExp(usersExpModel); } } FormsAuthentication.SignOut(); this.Session.Clear(); this.Session.Abandon(); base.Response.Clear(); base.Response.Redirect(PageBaseSupplier.DefaultLoginSupplier); base.Response.End(); }
public bool UpdateUsersExp(UsersExpModel model) { return this.dal.Update(model); }
public List<UsersExpModel> DataTableToList(DataTable dt) { List<UsersExpModel> list = new List<UsersExpModel>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { UsersExpModel item = new UsersExpModel(); if ((dt.Rows[i]["UserID"] != null) && (dt.Rows[i]["UserID"].ToString() != "")) { item.UserID = int.Parse(dt.Rows[i]["UserID"].ToString()); } if ((dt.Rows[i]["Gravatar"] != null) && (dt.Rows[i]["Gravatar"].ToString() != "")) { item.Gravatar = dt.Rows[i]["Gravatar"].ToString(); } if ((dt.Rows[i]["Singature"] != null) && (dt.Rows[i]["Singature"].ToString() != "")) { item.Singature = dt.Rows[i]["Singature"].ToString(); } if ((dt.Rows[i]["TelPhone"] != null) && (dt.Rows[i]["TelPhone"].ToString() != "")) { item.TelPhone = dt.Rows[i]["TelPhone"].ToString(); } if ((dt.Rows[i]["QQ"] != null) && (dt.Rows[i]["QQ"].ToString() != "")) { item.QQ = dt.Rows[i]["QQ"].ToString(); } if ((dt.Rows[i]["MSN"] != null) && (dt.Rows[i]["MSN"].ToString() != "")) { item.MSN = dt.Rows[i]["MSN"].ToString(); } if ((dt.Rows[i]["HomePage"] != null) && (dt.Rows[i]["HomePage"].ToString() != "")) { item.HomePage = dt.Rows[i]["HomePage"].ToString(); } if ((dt.Rows[i]["Birthday"] != null) && (dt.Rows[i]["Birthday"].ToString() != "")) { item.Birthday = new DateTime?(DateTime.Parse(dt.Rows[i]["Birthday"].ToString())); } if ((dt.Rows[i]["BirthdayVisible"] != null) && (dt.Rows[i]["BirthdayVisible"].ToString() != "")) { item.BirthdayVisible = int.Parse(dt.Rows[i]["BirthdayVisible"].ToString()); } if ((dt.Rows[i]["BirthdayIndexVisible"] != null) && (dt.Rows[i]["BirthdayIndexVisible"].ToString() != "")) { if ((dt.Rows[i]["BirthdayIndexVisible"].ToString() == "1") || (dt.Rows[i]["BirthdayIndexVisible"].ToString().ToLower() == "true")) { item.BirthdayIndexVisible = true; } else { item.BirthdayIndexVisible = false; } } if ((dt.Rows[i]["Constellation"] != null) && (dt.Rows[i]["Constellation"].ToString() != "")) { item.Constellation = dt.Rows[i]["Constellation"].ToString(); } if ((dt.Rows[i]["ConstellationVisible"] != null) && (dt.Rows[i]["ConstellationVisible"].ToString() != "")) { item.ConstellationVisible = int.Parse(dt.Rows[i]["ConstellationVisible"].ToString()); } if ((dt.Rows[i]["ConstellationIndexVisible"] != null) && (dt.Rows[i]["ConstellationIndexVisible"].ToString() != "")) { if ((dt.Rows[i]["ConstellationIndexVisible"].ToString() == "1") || (dt.Rows[i]["ConstellationIndexVisible"].ToString().ToLower() == "true")) { item.ConstellationIndexVisible = true; } else { item.ConstellationIndexVisible = false; } } if ((dt.Rows[i]["NativePlace"] != null) && (dt.Rows[i]["NativePlace"].ToString() != "")) { item.NativePlace = dt.Rows[i]["NativePlace"].ToString(); } if ((dt.Rows[i]["NativePlaceVisible"] != null) && (dt.Rows[i]["NativePlaceVisible"].ToString() != "")) { item.NativePlaceVisible = int.Parse(dt.Rows[i]["NativePlaceVisible"].ToString()); } if ((dt.Rows[i]["NativePlaceIndexVisible"] != null) && (dt.Rows[i]["NativePlaceIndexVisible"].ToString() != "")) { if ((dt.Rows[i]["NativePlaceIndexVisible"].ToString() == "1") || (dt.Rows[i]["NativePlaceIndexVisible"].ToString().ToLower() == "true")) { item.NativePlaceIndexVisible = true; } else { item.NativePlaceIndexVisible = false; } } if ((dt.Rows[i]["RegionId"] != null) && (dt.Rows[i]["RegionId"].ToString() != "")) { item.RegionId = new int?(int.Parse(dt.Rows[i]["RegionId"].ToString())); } if ((dt.Rows[i]["Address"] != null) && (dt.Rows[i]["Address"].ToString() != "")) { item.Address = dt.Rows[i]["Address"].ToString(); } if ((dt.Rows[i]["AddressVisible"] != null) && (dt.Rows[i]["AddressVisible"].ToString() != "")) { item.AddressVisible = int.Parse(dt.Rows[i]["AddressVisible"].ToString()); } if ((dt.Rows[i]["AddressIndexVisible"] != null) && (dt.Rows[i]["AddressIndexVisible"].ToString() != "")) { if ((dt.Rows[i]["AddressIndexVisible"].ToString() == "1") || (dt.Rows[i]["AddressIndexVisible"].ToString().ToLower() == "true")) { item.AddressIndexVisible = true; } else { item.AddressIndexVisible = false; } } if ((dt.Rows[i]["BodilyForm"] != null) && (dt.Rows[i]["BodilyForm"].ToString() != "")) { item.BodilyForm = dt.Rows[i]["BodilyForm"].ToString(); } if ((dt.Rows[i]["BodilyFormVisible"] != null) && (dt.Rows[i]["BodilyFormVisible"].ToString() != "")) { item.BodilyFormVisible = int.Parse(dt.Rows[i]["BodilyFormVisible"].ToString()); } if ((dt.Rows[i]["BodilyFormIndexVisible"] != null) && (dt.Rows[i]["BodilyFormIndexVisible"].ToString() != "")) { if ((dt.Rows[i]["BodilyFormIndexVisible"].ToString() == "1") || (dt.Rows[i]["BodilyFormIndexVisible"].ToString().ToLower() == "true")) { item.BodilyFormIndexVisible = true; } else { item.BodilyFormIndexVisible = false; } } if ((dt.Rows[i]["BloodType"] != null) && (dt.Rows[i]["BloodType"].ToString() != "")) { item.BloodType = dt.Rows[i]["BloodType"].ToString(); } if ((dt.Rows[i]["BloodTypeVisible"] != null) && (dt.Rows[i]["BloodTypeVisible"].ToString() != "")) { item.BloodTypeVisible = int.Parse(dt.Rows[i]["BloodTypeVisible"].ToString()); } if ((dt.Rows[i]["BloodTypeIndexVisible"] != null) && (dt.Rows[i]["BloodTypeIndexVisible"].ToString() != "")) { if ((dt.Rows[i]["BloodTypeIndexVisible"].ToString() == "1") || (dt.Rows[i]["BloodTypeIndexVisible"].ToString().ToLower() == "true")) { item.BloodTypeIndexVisible = true; } else { item.BloodTypeIndexVisible = false; } } if ((dt.Rows[i]["Marriaged"] != null) && (dt.Rows[i]["Marriaged"].ToString() != "")) { item.Marriaged = dt.Rows[i]["Marriaged"].ToString(); } if ((dt.Rows[i]["MarriagedVisible"] != null) && (dt.Rows[i]["MarriagedVisible"].ToString() != "")) { item.MarriagedVisible = int.Parse(dt.Rows[i]["MarriagedVisible"].ToString()); } if ((dt.Rows[i]["MarriagedIndexVisible"] != null) && (dt.Rows[i]["MarriagedIndexVisible"].ToString() != "")) { if ((dt.Rows[i]["MarriagedIndexVisible"].ToString() == "1") || (dt.Rows[i]["MarriagedIndexVisible"].ToString().ToLower() == "true")) { item.MarriagedIndexVisible = true; } else { item.MarriagedIndexVisible = false; } } if ((dt.Rows[i]["PersonalStatus"] != null) && (dt.Rows[i]["PersonalStatus"].ToString() != "")) { item.PersonalStatus = dt.Rows[i]["PersonalStatus"].ToString(); } if ((dt.Rows[i]["PersonalStatusVisible"] != null) && (dt.Rows[i]["PersonalStatusVisible"].ToString() != "")) { item.PersonalStatusVisible = int.Parse(dt.Rows[i]["PersonalStatusVisible"].ToString()); } if ((dt.Rows[i]["PersonalStatusIndexVisible"] != null) && (dt.Rows[i]["PersonalStatusIndexVisible"].ToString() != "")) { if ((dt.Rows[i]["PersonalStatusIndexVisible"].ToString() == "1") || (dt.Rows[i]["PersonalStatusIndexVisible"].ToString().ToLower() == "true")) { item.PersonalStatusIndexVisible = true; } else { item.PersonalStatusIndexVisible = false; } } if ((dt.Rows[i]["Grade"] != null) && (dt.Rows[i]["Grade"].ToString() != "")) { item.Grade = new int?(int.Parse(dt.Rows[i]["Grade"].ToString())); } if ((dt.Rows[i]["Balance"] != null) && (dt.Rows[i]["Balance"].ToString() != "")) { item.Balance = new decimal?(decimal.Parse(dt.Rows[i]["Balance"].ToString())); } if ((dt.Rows[i]["Points"] != null) && (dt.Rows[i]["Points"].ToString() != "")) { item.Points = new int?(int.Parse(dt.Rows[i]["Points"].ToString())); } if ((dt.Rows[i]["PvCount"] != null) && (dt.Rows[i]["PvCount"].ToString() != "")) { item.PvCount = new int?(int.Parse(dt.Rows[i]["PvCount"].ToString())); } if ((dt.Rows[i]["LastAccessTime"] != null) && (dt.Rows[i]["LastAccessTime"].ToString() != "")) { item.LastAccessTime = new DateTime?(DateTime.Parse(dt.Rows[i]["LastAccessTime"].ToString())); } if ((dt.Rows[i]["LastAccessIP"] != null) && (dt.Rows[i]["LastAccessIP"].ToString() != "")) { item.LastAccessIP = dt.Rows[i]["LastAccessIP"].ToString(); } if ((dt.Rows[i]["LastPostTime"] != null) && (dt.Rows[i]["LastPostTime"].ToString() != "")) { item.LastPostTime = new DateTime?(DateTime.Parse(dt.Rows[i]["LastPostTime"].ToString())); } if ((dt.Rows[i]["LastLoginTime"] != null) && (dt.Rows[i]["LastLoginTime"].ToString() != "")) { item.LastLoginTime = DateTime.Parse(dt.Rows[i]["LastLoginTime"].ToString()); } if ((dt.Rows[i]["Remark"] != null) && (dt.Rows[i]["Remark"].ToString() != "")) { item.Remark = dt.Rows[i]["Remark"].ToString(); } if ((dt.Rows[i]["NickName"] != null) && (dt.Rows[i]["NickName"].ToString() != "")) { item.NickName = dt.Rows[i]["NickName"].ToString(); } if ((dt.Rows[i]["FellowCount"] != null) && (dt.Rows[i]["FellowCount"].ToString() != "")) { item.FellowCount = new int?(int.Parse(dt.Rows[i]["FellowCount"].ToString())); } if ((dt.Rows[i]["FansCount"] != null) && (dt.Rows[i]["FansCount"].ToString() != "")) { item.FansCount = new int?(int.Parse(dt.Rows[i]["FansCount"].ToString())); } if ((dt.Rows[i]["AblumsCount"] != null) && (dt.Rows[i]["AblumsCount"].ToString() != "")) { item.AblumsCount = new int?(int.Parse(dt.Rows[i]["AblumsCount"].ToString())); } if ((dt.Rows[i]["ShareCount"] != null) && (dt.Rows[i]["ShareCount"].ToString() != "")) { item.ShareCount = new int?(int.Parse(dt.Rows[i]["ShareCount"].ToString())); } if ((dt.Rows[i]["IsUserDPI"] != null) && (dt.Rows[i]["IsUserDPI"].ToString() != "")) { if ((dt.Rows[i]["IsUserDPI"].ToString() == "1") || (dt.Rows[i]["IsUserDPI"].ToString().ToLower() == "true")) { item.IsUserDPI = true; } else { item.IsUserDPI = false; } } if (dt.Rows[i]["PayAccount"] != null) { item.PayAccount = dt.Rows[i]["PayAccount"].ToString(); } list.Add(item); } } return list; }
public UsersExpModel GetUsersModel(int UserID) { UsersExpModel model = this.dal.GetModel(UserID); if (model == null) { model = new UsersExpModel(); } User user = new User(UserID); model.Activity = user.Activity; model.DepartmentID = user.DepartmentID; model.Email = user.Email; model.EmployeeID = user.EmployeeID; model.Phone = user.Phone; if (user.Sex != null) { model.Sex = user.Sex.Trim(); } model.Style = user.Style; model.TrueName = user.TrueName; model.NickName = user.NickName; model.User_cLang = user.User_cLang; model.User_dateApprove = user.User_dateApprove; model.User_dateCreate = user.User_dateCreate; model.User_dateExpire = user.User_dateExpire; model.User_dateValid = user.User_dateValid; model.User_iApprover = user.User_iApprover; model.User_iApproveState = user.User_iApproveState; model.User_iCreator = user.User_iCreator; model.UserID = user.UserID; model.UserName = user.UserName; model.UserType = user.UserType; return model; }
public bool AddUsersExp(UsersExpModel model) { return this.dal.Add(model); }
public bool AddEx(UsersExpModel model, int inviteID, string inviteNick, int pointScore) { return this.dal.AddEx(model, inviteID, inviteNick, pointScore); }
public bool AddEx(UsersExpModel model, int inviteID, string inviteNick, int pointScore) { StringBuilder builder = new StringBuilder(); builder.Append("insert into Accounts_UsersExp("); builder.Append("UserID,Gravatar,Singature,TelPhone,QQ,MSN,HomePage,Birthday,BirthdayVisible,BirthdayIndexVisible,Constellation,ConstellationVisible,ConstellationIndexVisible,NativePlace,NativePlaceVisible,NativePlaceIndexVisible,RegionId,Address,AddressVisible,AddressIndexVisible,BodilyForm,BodilyFormVisible,BodilyFormIndexVisible,BloodType,BloodTypeVisible,BloodTypeIndexVisible,Marriaged,MarriagedVisible,MarriagedIndexVisible,PersonalStatus,PersonalStatusVisible,PersonalStatusIndexVisible,Grade,Balance,Points,TopicCount,ReplyTopicCount,FavTopicCount,PvCount,FansCount,FellowCount,AblumsCount,FavouritesCount,FavoritedCount,ShareCount,ProductsCount,PersonalDomain,LastAccessTime,LastAccessIP,LastPostTime,LastLoginTime,Remark,IsUserDPI,PayAccount)"); builder.Append(" values ("); builder.Append("@UserID,@Gravatar,@Singature,@TelPhone,@QQ,@MSN,@HomePage,@Birthday,@BirthdayVisible,@BirthdayIndexVisible,@Constellation,@ConstellationVisible,@ConstellationIndexVisible,@NativePlace,@NativePlaceVisible,@NativePlaceIndexVisible,@RegionId,@Address,@AddressVisible,@AddressIndexVisible,@BodilyForm,@BodilyFormVisible,@BodilyFormIndexVisible,@BloodType,@BloodTypeVisible,@BloodTypeIndexVisible,@Marriaged,@MarriagedVisible,@MarriagedIndexVisible,@PersonalStatus,@PersonalStatusVisible,@PersonalStatusIndexVisible,@Grade,@Balance,@Points,@TopicCount,@ReplyTopicCount,@FavTopicCount,@PvCount,@FansCount,@FellowCount,@AblumsCount,@FavouritesCount,@FavoritedCount,@ShareCount,@ProductsCount,@PersonalDomain,@LastAccessTime,@LastAccessIP,@LastPostTime,@LastLoginTime,@Remark,@IsUserDPI,@PayAccount)"); SqlParameter[] para = new SqlParameter[] { new SqlParameter("@UserID", SqlDbType.Int, 4), new SqlParameter("@Gravatar", SqlDbType.NVarChar, 200), new SqlParameter("@Singature", SqlDbType.NVarChar, 200), new SqlParameter("@TelPhone", SqlDbType.NVarChar, 20), new SqlParameter("@QQ", SqlDbType.NVarChar, 30), new SqlParameter("@MSN", SqlDbType.NVarChar, 30), new SqlParameter("@HomePage", SqlDbType.NVarChar, 50), new SqlParameter("@Birthday", SqlDbType.DateTime), new SqlParameter("@BirthdayVisible", SqlDbType.SmallInt, 2), new SqlParameter("@BirthdayIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@Constellation", SqlDbType.NVarChar, 10), new SqlParameter("@ConstellationVisible", SqlDbType.SmallInt, 2), new SqlParameter("@ConstellationIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@NativePlace", SqlDbType.NVarChar, 300), new SqlParameter("@NativePlaceVisible", SqlDbType.SmallInt, 2), new SqlParameter("@NativePlaceIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@RegionId", SqlDbType.Int, 4), new SqlParameter("@Address", SqlDbType.NVarChar, 300), new SqlParameter("@AddressVisible", SqlDbType.SmallInt, 2), new SqlParameter("@AddressIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@BodilyForm", SqlDbType.NVarChar, 10), new SqlParameter("@BodilyFormVisible", SqlDbType.SmallInt, 2), new SqlParameter("@BodilyFormIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@BloodType", SqlDbType.NVarChar, 10), new SqlParameter("@BloodTypeVisible", SqlDbType.SmallInt, 2), new SqlParameter("@BloodTypeIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@Marriaged", SqlDbType.NVarChar, 10), new SqlParameter("@MarriagedVisible", SqlDbType.SmallInt, 2), new SqlParameter("@MarriagedIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@PersonalStatus", SqlDbType.NVarChar, 10), new SqlParameter("@PersonalStatusVisible", SqlDbType.SmallInt, 2), new SqlParameter("@PersonalStatusIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@Grade", SqlDbType.Int, 4), new SqlParameter("@Balance", SqlDbType.Money, 8), new SqlParameter("@Points", SqlDbType.Int, 4), new SqlParameter("@TopicCount", SqlDbType.Int, 4), new SqlParameter("@ReplyTopicCount", SqlDbType.Int, 4), new SqlParameter("@FavTopicCount", SqlDbType.Int, 4), new SqlParameter("@PvCount", SqlDbType.Int, 4), new SqlParameter("@FansCount", SqlDbType.Int, 4), new SqlParameter("@FellowCount", SqlDbType.Int, 4), new SqlParameter("@AblumsCount", SqlDbType.Int, 4), new SqlParameter("@FavouritesCount", SqlDbType.Int, 4), new SqlParameter("@FavoritedCount", SqlDbType.Int, 4), new SqlParameter("@ShareCount", SqlDbType.Int, 4), new SqlParameter("@ProductsCount", SqlDbType.Int, 4), new SqlParameter("@PersonalDomain", SqlDbType.NVarChar, 50), new SqlParameter("@LastAccessTime", SqlDbType.DateTime), new SqlParameter("@LastAccessIP", SqlDbType.NVarChar, 50), new SqlParameter("@LastPostTime", SqlDbType.DateTime), new SqlParameter("@LastLoginTime", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.NVarChar), new SqlParameter("@IsUserDPI", SqlDbType.Bit, 1), new SqlParameter("@PayAccount", SqlDbType.NVarChar, 200) }; para[0].Value = model.UserID; para[1].Value = model.Gravatar; para[2].Value = model.Singature; para[3].Value = model.TelPhone; para[4].Value = model.QQ; para[5].Value = model.MSN; para[6].Value = model.HomePage; para[7].Value = model.Birthday; para[8].Value = model.BirthdayVisible; para[9].Value = model.BirthdayIndexVisible; para[10].Value = model.Constellation; para[11].Value = model.ConstellationVisible; para[12].Value = model.ConstellationIndexVisible; para[13].Value = model.NativePlace; para[14].Value = model.NativePlaceVisible; para[15].Value = model.NativePlaceIndexVisible; para[0x10].Value = model.RegionId; para[0x11].Value = model.Address; para[0x12].Value = model.AddressVisible; para[0x13].Value = model.AddressIndexVisible; para[20].Value = model.BodilyForm; para[0x15].Value = model.BodilyFormVisible; para[0x16].Value = model.BodilyFormIndexVisible; para[0x17].Value = model.BloodType; para[0x18].Value = model.BloodTypeVisible; para[0x19].Value = model.BloodTypeIndexVisible; para[0x1a].Value = model.Marriaged; para[0x1b].Value = model.MarriagedVisible; para[0x1c].Value = model.MarriagedIndexVisible; para[0x1d].Value = model.PersonalStatus; para[30].Value = model.PersonalStatusVisible; para[0x1f].Value = model.PersonalStatusIndexVisible; para[0x20].Value = model.Grade; para[0x21].Value = model.Balance; para[0x22].Value = model.Points; para[0x23].Value = model.TopicCount; para[0x24].Value = model.ReplyTopicCount; para[0x25].Value = model.FavTopicCount; para[0x26].Value = model.PvCount; para[0x27].Value = model.FansCount; para[40].Value = model.FellowCount; para[0x29].Value = model.AblumsCount; para[0x2a].Value = model.FavouritesCount; para[0x2b].Value = model.FavoritedCount; para[0x2c].Value = model.ShareCount; para[0x2d].Value = model.ProductsCount; para[0x2e].Value = model.PersonalDomain; para[0x2f].Value = model.LastAccessTime; para[0x30].Value = model.LastAccessIP; para[0x31].Value = model.LastPostTime; para[50].Value = model.LastLoginTime; para[0x33].Value = model.Remark; para[0x34].Value = model.IsUserDPI; para[0x35].Value = model.PayAccount; List<CommandInfo> cmdList = new List<CommandInfo>(); CommandInfo item = new CommandInfo(builder.ToString(), para); cmdList.Add(item); StringBuilder builder2 = new StringBuilder(); builder2.Append("insert into Accounts_UserInvite("); builder2.Append("UserId,UserNick,InviteUserId,InviteNick,IsRebate,IsNew,CreatedDate,RebateDesc)"); builder2.Append(" values ("); builder2.Append("@UserId,@UserNick,@InviteUserId,@InviteNick,@IsRebate,@IsNew,@CreatedDate,@RebateDesc)"); builder2.Append(";select @@IDENTITY"); SqlParameter[] parameterArray2 = new SqlParameter[] { new SqlParameter("@UserId", SqlDbType.Int, 4), new SqlParameter("@UserNick", SqlDbType.NVarChar, 200), new SqlParameter("@InviteUserId", SqlDbType.Int, 4), new SqlParameter("@InviteNick", SqlDbType.NVarChar, 200), new SqlParameter("@IsRebate", SqlDbType.Bit, 1), new SqlParameter("@IsNew", SqlDbType.Bit, 1), new SqlParameter("@CreatedDate", SqlDbType.DateTime), new SqlParameter("@RebateDesc", SqlDbType.NVarChar, 200) }; parameterArray2[0].Value = model.UserID; parameterArray2[1].Value = model.NickName; parameterArray2[2].Value = inviteID; parameterArray2[3].Value = inviteNick; parameterArray2[4].Value = true; parameterArray2[5].Value = true; parameterArray2[6].Value = DateTime.Now; parameterArray2[7].Value = "邀请用户+" + pointScore + "积分"; item = new CommandInfo(builder2.ToString(), parameterArray2); cmdList.Add(item); return (DbHelperSQL.ExecuteSqlTran(cmdList) > 0); }
public bool Update(UsersExpModel model) { StringBuilder builder = new StringBuilder(); builder.Append("update Accounts_UsersExp set "); builder.Append("Gravatar=@Gravatar,"); builder.Append("Singature=@Singature,"); builder.Append("TelPhone=@TelPhone,"); builder.Append("QQ=@QQ,"); builder.Append("MSN=@MSN,"); builder.Append("HomePage=@HomePage,"); builder.Append("Birthday=@Birthday,"); builder.Append("BirthdayVisible=@BirthdayVisible,"); builder.Append("BirthdayIndexVisible=@BirthdayIndexVisible,"); builder.Append("Constellation=@Constellation,"); builder.Append("ConstellationVisible=@ConstellationVisible,"); builder.Append("ConstellationIndexVisible=@ConstellationIndexVisible,"); builder.Append("NativePlace=@NativePlace,"); builder.Append("NativePlaceVisible=@NativePlaceVisible,"); builder.Append("NativePlaceIndexVisible=@NativePlaceIndexVisible,"); builder.Append("RegionId=@RegionId,"); builder.Append("Address=@Address,"); builder.Append("AddressVisible=@AddressVisible,"); builder.Append("AddressIndexVisible=@AddressIndexVisible,"); builder.Append("BodilyForm=@BodilyForm,"); builder.Append("BodilyFormVisible=@BodilyFormVisible,"); builder.Append("BodilyFormIndexVisible=@BodilyFormIndexVisible,"); builder.Append("BloodType=@BloodType,"); builder.Append("BloodTypeVisible=@BloodTypeVisible,"); builder.Append("BloodTypeIndexVisible=@BloodTypeIndexVisible,"); builder.Append("Marriaged=@Marriaged,"); builder.Append("MarriagedVisible=@MarriagedVisible,"); builder.Append("MarriagedIndexVisible=@MarriagedIndexVisible,"); builder.Append("PersonalStatus=@PersonalStatus,"); builder.Append("PersonalStatusVisible=@PersonalStatusVisible,"); builder.Append("PersonalStatusIndexVisible=@PersonalStatusIndexVisible,"); builder.Append("Grade=@Grade,"); builder.Append("Balance=@Balance,"); builder.Append("Points=@Points,"); builder.Append("TopicCount=@TopicCount,"); builder.Append("ReplyTopicCount=@ReplyTopicCount,"); builder.Append("FavTopicCount=@FavTopicCount,"); builder.Append("PvCount=@PvCount,"); builder.Append("FansCount=@FansCount,"); builder.Append("FellowCount=@FellowCount,"); builder.Append("AblumsCount=@AblumsCount,"); builder.Append("FavouritesCount=@FavouritesCount,"); builder.Append("FavoritedCount=@FavoritedCount,"); builder.Append("ShareCount=@ShareCount,"); builder.Append("ProductsCount=@ProductsCount,"); builder.Append("PersonalDomain=@PersonalDomain,"); builder.Append("LastAccessTime=@LastAccessTime,"); builder.Append("LastAccessIP=@LastAccessIP,"); builder.Append("LastPostTime=@LastPostTime,"); builder.Append("LastLoginTime=@LastLoginTime,"); builder.Append("Remark=@Remark,"); builder.Append("IsUserDPI=@IsUserDPI,"); builder.Append("PayAccount=@PayAccount"); builder.Append(" where UserID=@UserID "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@Gravatar", SqlDbType.NVarChar, 200), new SqlParameter("@Singature", SqlDbType.NVarChar, 200), new SqlParameter("@TelPhone", SqlDbType.NVarChar, 20), new SqlParameter("@QQ", SqlDbType.NVarChar, 30), new SqlParameter("@MSN", SqlDbType.NVarChar, 30), new SqlParameter("@HomePage", SqlDbType.NVarChar, 50), new SqlParameter("@Birthday", SqlDbType.DateTime), new SqlParameter("@BirthdayVisible", SqlDbType.SmallInt, 2), new SqlParameter("@BirthdayIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@Constellation", SqlDbType.NVarChar, 10), new SqlParameter("@ConstellationVisible", SqlDbType.SmallInt, 2), new SqlParameter("@ConstellationIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@NativePlace", SqlDbType.NVarChar, 300), new SqlParameter("@NativePlaceVisible", SqlDbType.SmallInt, 2), new SqlParameter("@NativePlaceIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@RegionId", SqlDbType.Int, 4), new SqlParameter("@Address", SqlDbType.NVarChar, 300), new SqlParameter("@AddressVisible", SqlDbType.SmallInt, 2), new SqlParameter("@AddressIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@BodilyForm", SqlDbType.NVarChar, 10), new SqlParameter("@BodilyFormVisible", SqlDbType.SmallInt, 2), new SqlParameter("@BodilyFormIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@BloodType", SqlDbType.NVarChar, 10), new SqlParameter("@BloodTypeVisible", SqlDbType.SmallInt, 2), new SqlParameter("@BloodTypeIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@Marriaged", SqlDbType.NVarChar, 10), new SqlParameter("@MarriagedVisible", SqlDbType.SmallInt, 2), new SqlParameter("@MarriagedIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@PersonalStatus", SqlDbType.NVarChar, 10), new SqlParameter("@PersonalStatusVisible", SqlDbType.SmallInt, 2), new SqlParameter("@PersonalStatusIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@Grade", SqlDbType.Int, 4), new SqlParameter("@Balance", SqlDbType.Money, 8), new SqlParameter("@Points", SqlDbType.Int, 4), new SqlParameter("@TopicCount", SqlDbType.Int, 4), new SqlParameter("@ReplyTopicCount", SqlDbType.Int, 4), new SqlParameter("@FavTopicCount", SqlDbType.Int, 4), new SqlParameter("@PvCount", SqlDbType.Int, 4), new SqlParameter("@FansCount", SqlDbType.Int, 4), new SqlParameter("@FellowCount", SqlDbType.Int, 4), new SqlParameter("@AblumsCount", SqlDbType.Int, 4), new SqlParameter("@FavouritesCount", SqlDbType.Int, 4), new SqlParameter("@FavoritedCount", SqlDbType.Int, 4), new SqlParameter("@ShareCount", SqlDbType.Int, 4), new SqlParameter("@ProductsCount", SqlDbType.Int, 4), new SqlParameter("@PersonalDomain", SqlDbType.NVarChar, 50), new SqlParameter("@LastAccessTime", SqlDbType.DateTime), new SqlParameter("@LastAccessIP", SqlDbType.NVarChar, 50), new SqlParameter("@LastPostTime", SqlDbType.DateTime), new SqlParameter("@LastLoginTime", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.NVarChar), new SqlParameter("@IsUserDPI", SqlDbType.Bit, 1), new SqlParameter("@PayAccount", SqlDbType.NVarChar, 200), new SqlParameter("@UserID", SqlDbType.Int, 4) }; cmdParms[0].Value = model.Gravatar; cmdParms[1].Value = model.Singature; cmdParms[2].Value = model.TelPhone; cmdParms[3].Value = model.QQ; cmdParms[4].Value = model.MSN; cmdParms[5].Value = model.HomePage; cmdParms[6].Value = model.Birthday; cmdParms[7].Value = model.BirthdayVisible; cmdParms[8].Value = model.BirthdayIndexVisible; cmdParms[9].Value = model.Constellation; cmdParms[10].Value = model.ConstellationVisible; cmdParms[11].Value = model.ConstellationIndexVisible; cmdParms[12].Value = model.NativePlace; cmdParms[13].Value = model.NativePlaceVisible; cmdParms[14].Value = model.NativePlaceIndexVisible; cmdParms[15].Value = model.RegionId; cmdParms[0x10].Value = model.Address; cmdParms[0x11].Value = model.AddressVisible; cmdParms[0x12].Value = model.AddressIndexVisible; cmdParms[0x13].Value = model.BodilyForm; cmdParms[20].Value = model.BodilyFormVisible; cmdParms[0x15].Value = model.BodilyFormIndexVisible; cmdParms[0x16].Value = model.BloodType; cmdParms[0x17].Value = model.BloodTypeVisible; cmdParms[0x18].Value = model.BloodTypeIndexVisible; cmdParms[0x19].Value = model.Marriaged; cmdParms[0x1a].Value = model.MarriagedVisible; cmdParms[0x1b].Value = model.MarriagedIndexVisible; cmdParms[0x1c].Value = model.PersonalStatus; cmdParms[0x1d].Value = model.PersonalStatusVisible; cmdParms[30].Value = model.PersonalStatusIndexVisible; cmdParms[0x1f].Value = model.Grade; cmdParms[0x20].Value = model.Balance; cmdParms[0x21].Value = model.Points; cmdParms[0x22].Value = model.TopicCount; cmdParms[0x23].Value = model.ReplyTopicCount; cmdParms[0x24].Value = model.FavTopicCount; cmdParms[0x25].Value = model.PvCount; cmdParms[0x26].Value = model.FansCount; cmdParms[0x27].Value = model.FellowCount; cmdParms[40].Value = model.AblumsCount; cmdParms[0x29].Value = model.FavouritesCount; cmdParms[0x2a].Value = model.FavoritedCount; cmdParms[0x2b].Value = model.ShareCount; cmdParms[0x2c].Value = model.ProductsCount; cmdParms[0x2d].Value = model.PersonalDomain; cmdParms[0x2e].Value = model.LastAccessTime; cmdParms[0x2f].Value = model.LastAccessIP; cmdParms[0x30].Value = model.LastPostTime; cmdParms[0x31].Value = model.LastLoginTime; cmdParms[50].Value = model.Remark; cmdParms[0x33].Value = model.IsUserDPI; cmdParms[0x34].Value = model.PayAccount; cmdParms[0x35].Value = model.UserID; return (DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public UsersExpModel GetModel(int UserID) { StringBuilder builder = new StringBuilder(); builder.Append("select top 1 UserID,Gravatar,Singature,TelPhone,QQ,MSN,HomePage,Birthday,BirthdayVisible,BirthdayIndexVisible,Constellation,ConstellationVisible,ConstellationIndexVisible,NativePlace,NativePlaceVisible,NativePlaceIndexVisible,RegionId,Address,AddressVisible,AddressIndexVisible,BodilyForm,BodilyFormVisible,BodilyFormIndexVisible,BloodType,BloodTypeVisible,BloodTypeIndexVisible,Marriaged,MarriagedVisible,MarriagedIndexVisible,PersonalStatus,PersonalStatusVisible,PersonalStatusIndexVisible,Grade,Balance,Points,TopicCount,ReplyTopicCount,FavTopicCount,PvCount,FansCount,FellowCount,AblumsCount,FavouritesCount,FavoritedCount,ShareCount,ProductsCount,PersonalDomain,LastAccessTime,LastAccessIP,LastPostTime,LastLoginTime,Remark,IsUserDPI,PayAccount from Accounts_UsersExp "); builder.Append(" where UserID=@UserID "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@UserID", SqlDbType.Int, 4) }; cmdParms[0].Value = UserID; UsersExpModel model = new UsersExpModel(); DataSet set = DbHelperSQL.Query(builder.ToString(), cmdParms); if (set.Tables[0].Rows.Count <= 0) { return null; } if ((set.Tables[0].Rows[0]["UserID"] != null) && (set.Tables[0].Rows[0]["UserID"].ToString() != "")) { model.UserID = int.Parse(set.Tables[0].Rows[0]["UserID"].ToString()); } if ((set.Tables[0].Rows[0]["Gravatar"] != null) && (set.Tables[0].Rows[0]["Gravatar"].ToString() != "")) { model.Gravatar = set.Tables[0].Rows[0]["Gravatar"].ToString(); } if ((set.Tables[0].Rows[0]["Singature"] != null) && (set.Tables[0].Rows[0]["Singature"].ToString() != "")) { model.Singature = set.Tables[0].Rows[0]["Singature"].ToString(); } if ((set.Tables[0].Rows[0]["TelPhone"] != null) && (set.Tables[0].Rows[0]["TelPhone"].ToString() != "")) { model.TelPhone = set.Tables[0].Rows[0]["TelPhone"].ToString(); } if ((set.Tables[0].Rows[0]["QQ"] != null) && (set.Tables[0].Rows[0]["QQ"].ToString() != "")) { model.QQ = set.Tables[0].Rows[0]["QQ"].ToString(); } if ((set.Tables[0].Rows[0]["MSN"] != null) && (set.Tables[0].Rows[0]["MSN"].ToString() != "")) { model.MSN = set.Tables[0].Rows[0]["MSN"].ToString(); } if ((set.Tables[0].Rows[0]["HomePage"] != null) && (set.Tables[0].Rows[0]["HomePage"].ToString() != "")) { model.HomePage = set.Tables[0].Rows[0]["HomePage"].ToString(); } if ((set.Tables[0].Rows[0]["Birthday"] != null) && (set.Tables[0].Rows[0]["Birthday"].ToString() != "")) { model.Birthday = new DateTime?(DateTime.Parse(set.Tables[0].Rows[0]["Birthday"].ToString())); } if ((set.Tables[0].Rows[0]["BirthdayVisible"] != null) && (set.Tables[0].Rows[0]["BirthdayVisible"].ToString() != "")) { model.BirthdayVisible = int.Parse(set.Tables[0].Rows[0]["BirthdayVisible"].ToString()); } if ((set.Tables[0].Rows[0]["BirthdayIndexVisible"] != null) && (set.Tables[0].Rows[0]["BirthdayIndexVisible"].ToString() != "")) { if ((set.Tables[0].Rows[0]["BirthdayIndexVisible"].ToString() == "1") || (set.Tables[0].Rows[0]["BirthdayIndexVisible"].ToString().ToLower() == "true")) { model.BirthdayIndexVisible = true; } else { model.BirthdayIndexVisible = false; } } if ((set.Tables[0].Rows[0]["Constellation"] != null) && (set.Tables[0].Rows[0]["Constellation"].ToString() != "")) { model.Constellation = set.Tables[0].Rows[0]["Constellation"].ToString(); } if ((set.Tables[0].Rows[0]["ConstellationVisible"] != null) && (set.Tables[0].Rows[0]["ConstellationVisible"].ToString() != "")) { model.ConstellationVisible = int.Parse(set.Tables[0].Rows[0]["ConstellationVisible"].ToString()); } if ((set.Tables[0].Rows[0]["ConstellationIndexVisible"] != null) && (set.Tables[0].Rows[0]["ConstellationIndexVisible"].ToString() != "")) { if ((set.Tables[0].Rows[0]["ConstellationIndexVisible"].ToString() == "1") || (set.Tables[0].Rows[0]["ConstellationIndexVisible"].ToString().ToLower() == "true")) { model.ConstellationIndexVisible = true; } else { model.ConstellationIndexVisible = false; } } if ((set.Tables[0].Rows[0]["NativePlace"] != null) && (set.Tables[0].Rows[0]["NativePlace"].ToString() != "")) { model.NativePlace = set.Tables[0].Rows[0]["NativePlace"].ToString(); } if ((set.Tables[0].Rows[0]["NativePlaceVisible"] != null) && (set.Tables[0].Rows[0]["NativePlaceVisible"].ToString() != "")) { model.NativePlaceVisible = int.Parse(set.Tables[0].Rows[0]["NativePlaceVisible"].ToString()); } if ((set.Tables[0].Rows[0]["NativePlaceIndexVisible"] != null) && (set.Tables[0].Rows[0]["NativePlaceIndexVisible"].ToString() != "")) { if ((set.Tables[0].Rows[0]["NativePlaceIndexVisible"].ToString() == "1") || (set.Tables[0].Rows[0]["NativePlaceIndexVisible"].ToString().ToLower() == "true")) { model.NativePlaceIndexVisible = true; } else { model.NativePlaceIndexVisible = false; } } if ((set.Tables[0].Rows[0]["RegionId"] != null) && (set.Tables[0].Rows[0]["RegionId"].ToString() != "")) { model.RegionId = new int?(int.Parse(set.Tables[0].Rows[0]["RegionId"].ToString())); } if ((set.Tables[0].Rows[0]["Address"] != null) && (set.Tables[0].Rows[0]["Address"].ToString() != "")) { model.Address = set.Tables[0].Rows[0]["Address"].ToString(); } if ((set.Tables[0].Rows[0]["AddressVisible"] != null) && (set.Tables[0].Rows[0]["AddressVisible"].ToString() != "")) { model.AddressVisible = int.Parse(set.Tables[0].Rows[0]["AddressVisible"].ToString()); } if ((set.Tables[0].Rows[0]["AddressIndexVisible"] != null) && (set.Tables[0].Rows[0]["AddressIndexVisible"].ToString() != "")) { if ((set.Tables[0].Rows[0]["AddressIndexVisible"].ToString() == "1") || (set.Tables[0].Rows[0]["AddressIndexVisible"].ToString().ToLower() == "true")) { model.AddressIndexVisible = true; } else { model.AddressIndexVisible = false; } } if ((set.Tables[0].Rows[0]["BodilyForm"] != null) && (set.Tables[0].Rows[0]["BodilyForm"].ToString() != "")) { model.BodilyForm = set.Tables[0].Rows[0]["BodilyForm"].ToString(); } if ((set.Tables[0].Rows[0]["BodilyFormVisible"] != null) && (set.Tables[0].Rows[0]["BodilyFormVisible"].ToString() != "")) { model.BodilyFormVisible = int.Parse(set.Tables[0].Rows[0]["BodilyFormVisible"].ToString()); } if ((set.Tables[0].Rows[0]["BodilyFormIndexVisible"] != null) && (set.Tables[0].Rows[0]["BodilyFormIndexVisible"].ToString() != "")) { if ((set.Tables[0].Rows[0]["BodilyFormIndexVisible"].ToString() == "1") || (set.Tables[0].Rows[0]["BodilyFormIndexVisible"].ToString().ToLower() == "true")) { model.BodilyFormIndexVisible = true; } else { model.BodilyFormIndexVisible = false; } } if ((set.Tables[0].Rows[0]["BloodType"] != null) && (set.Tables[0].Rows[0]["BloodType"].ToString() != "")) { model.BloodType = set.Tables[0].Rows[0]["BloodType"].ToString(); } if ((set.Tables[0].Rows[0]["BloodTypeVisible"] != null) && (set.Tables[0].Rows[0]["BloodTypeVisible"].ToString() != "")) { model.BloodTypeVisible = int.Parse(set.Tables[0].Rows[0]["BloodTypeVisible"].ToString()); } if ((set.Tables[0].Rows[0]["BloodTypeIndexVisible"] != null) && (set.Tables[0].Rows[0]["BloodTypeIndexVisible"].ToString() != "")) { if ((set.Tables[0].Rows[0]["BloodTypeIndexVisible"].ToString() == "1") || (set.Tables[0].Rows[0]["BloodTypeIndexVisible"].ToString().ToLower() == "true")) { model.BloodTypeIndexVisible = true; } else { model.BloodTypeIndexVisible = false; } } if ((set.Tables[0].Rows[0]["Marriaged"] != null) && (set.Tables[0].Rows[0]["Marriaged"].ToString() != "")) { model.Marriaged = set.Tables[0].Rows[0]["Marriaged"].ToString(); } if ((set.Tables[0].Rows[0]["MarriagedVisible"] != null) && (set.Tables[0].Rows[0]["MarriagedVisible"].ToString() != "")) { model.MarriagedVisible = int.Parse(set.Tables[0].Rows[0]["MarriagedVisible"].ToString()); } if ((set.Tables[0].Rows[0]["MarriagedIndexVisible"] != null) && (set.Tables[0].Rows[0]["MarriagedIndexVisible"].ToString() != "")) { if ((set.Tables[0].Rows[0]["MarriagedIndexVisible"].ToString() == "1") || (set.Tables[0].Rows[0]["MarriagedIndexVisible"].ToString().ToLower() == "true")) { model.MarriagedIndexVisible = true; } else { model.MarriagedIndexVisible = false; } } if ((set.Tables[0].Rows[0]["PersonalStatus"] != null) && (set.Tables[0].Rows[0]["PersonalStatus"].ToString() != "")) { model.PersonalStatus = set.Tables[0].Rows[0]["PersonalStatus"].ToString(); } if ((set.Tables[0].Rows[0]["PersonalStatusVisible"] != null) && (set.Tables[0].Rows[0]["PersonalStatusVisible"].ToString() != "")) { model.PersonalStatusVisible = int.Parse(set.Tables[0].Rows[0]["PersonalStatusVisible"].ToString()); } if ((set.Tables[0].Rows[0]["PersonalStatusIndexVisible"] != null) && (set.Tables[0].Rows[0]["PersonalStatusIndexVisible"].ToString() != "")) { if ((set.Tables[0].Rows[0]["PersonalStatusIndexVisible"].ToString() == "1") || (set.Tables[0].Rows[0]["PersonalStatusIndexVisible"].ToString().ToLower() == "true")) { model.PersonalStatusIndexVisible = true; } else { model.PersonalStatusIndexVisible = false; } } if ((set.Tables[0].Rows[0]["Grade"] != null) && (set.Tables[0].Rows[0]["Grade"].ToString() != "")) { model.Grade = new int?(int.Parse(set.Tables[0].Rows[0]["Grade"].ToString())); } if ((set.Tables[0].Rows[0]["Balance"] != null) && (set.Tables[0].Rows[0]["Balance"].ToString() != "")) { model.Balance = new decimal?(decimal.Parse(set.Tables[0].Rows[0]["Balance"].ToString())); } if ((set.Tables[0].Rows[0]["Points"] != null) && (set.Tables[0].Rows[0]["Points"].ToString() != "")) { model.Points = new int?(int.Parse(set.Tables[0].Rows[0]["Points"].ToString())); } if ((set.Tables[0].Rows[0]["PvCount"] != null) && (set.Tables[0].Rows[0]["PvCount"].ToString() != "")) { model.PvCount = new int?(int.Parse(set.Tables[0].Rows[0]["PvCount"].ToString())); } if ((set.Tables[0].Rows[0]["FansCount"] != null) && (set.Tables[0].Rows[0]["FansCount"].ToString() != "")) { model.FansCount = new int?(int.Parse(set.Tables[0].Rows[0]["FansCount"].ToString())); } if ((set.Tables[0].Rows[0]["FellowCount"] != null) && (set.Tables[0].Rows[0]["FellowCount"].ToString() != "")) { model.FellowCount = new int?(int.Parse(set.Tables[0].Rows[0]["FellowCount"].ToString())); } if ((set.Tables[0].Rows[0]["AblumsCount"] != null) && (set.Tables[0].Rows[0]["AblumsCount"].ToString() != "")) { model.AblumsCount = new int?(int.Parse(set.Tables[0].Rows[0]["AblumsCount"].ToString())); } if ((set.Tables[0].Rows[0]["FavouritesCount"] != null) && (set.Tables[0].Rows[0]["FavouritesCount"].ToString() != "")) { model.FavouritesCount = new int?(int.Parse(set.Tables[0].Rows[0]["FavouritesCount"].ToString())); } if ((set.Tables[0].Rows[0]["ShareCount"] != null) && (set.Tables[0].Rows[0]["ShareCount"].ToString() != "")) { model.ShareCount = new int?(int.Parse(set.Tables[0].Rows[0]["ShareCount"].ToString())); } if ((set.Tables[0].Rows[0]["PersonalDomain"] != null) && (set.Tables[0].Rows[0]["PersonalDomain"].ToString() != "")) { model.PersonalDomain = set.Tables[0].Rows[0]["PersonalDomain"].ToString(); } if ((set.Tables[0].Rows[0]["LastAccessTime"] != null) && (set.Tables[0].Rows[0]["LastAccessTime"].ToString() != "")) { model.LastAccessTime = new DateTime?(DateTime.Parse(set.Tables[0].Rows[0]["LastAccessTime"].ToString())); } if ((set.Tables[0].Rows[0]["LastAccessIP"] != null) && (set.Tables[0].Rows[0]["LastAccessIP"].ToString() != "")) { model.LastAccessIP = set.Tables[0].Rows[0]["LastAccessIP"].ToString(); } if ((set.Tables[0].Rows[0]["LastPostTime"] != null) && (set.Tables[0].Rows[0]["LastPostTime"].ToString() != "")) { model.LastPostTime = new DateTime?(DateTime.Parse(set.Tables[0].Rows[0]["LastPostTime"].ToString())); } if ((set.Tables[0].Rows[0]["LastLoginTime"] != null) && (set.Tables[0].Rows[0]["LastLoginTime"].ToString() != "")) { model.LastLoginTime = DateTime.Parse(set.Tables[0].Rows[0]["LastLoginTime"].ToString()); } if ((set.Tables[0].Rows[0]["Remark"] != null) && (set.Tables[0].Rows[0]["Remark"].ToString() != "")) { model.Remark = set.Tables[0].Rows[0]["Remark"].ToString(); } if (set.Tables[0].Rows[0]["PayAccount"] != null) { model.PayAccount = set.Tables[0].Rows[0]["PayAccount"].ToString(); } if ((set.Tables[0].Rows[0]["IsUserDPI"] != null) && (set.Tables[0].Rows[0]["IsUserDPI"].ToString() != "")) { if ((set.Tables[0].Rows[0]["IsUserDPI"].ToString() == "1") || (set.Tables[0].Rows[0]["IsUserDPI"].ToString().ToLower() == "true")) { model.IsUserDPI = true; return model; } model.IsUserDPI = false; return model; } model.IsUserDPI = false; return model; }
public bool Add(UsersExpModel model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into Accounts_UsersExp("); builder.Append("UserID,Gravatar,Singature,TelPhone,QQ,MSN,HomePage,Birthday,BirthdayVisible,BirthdayIndexVisible,Constellation,ConstellationVisible,ConstellationIndexVisible,NativePlace,NativePlaceVisible,NativePlaceIndexVisible,RegionId,Address,AddressVisible,AddressIndexVisible,BodilyForm,BodilyFormVisible,BodilyFormIndexVisible,BloodType,BloodTypeVisible,BloodTypeIndexVisible,Marriaged,MarriagedVisible,MarriagedIndexVisible,PersonalStatus,PersonalStatusVisible,PersonalStatusIndexVisible,Grade,Balance,Points,TopicCount,ReplyTopicCount,FavTopicCount,PvCount,FansCount,FellowCount,AblumsCount,FavouritesCount,FavoritedCount,ShareCount,ProductsCount,PersonalDomain,LastAccessTime,LastAccessIP,LastPostTime,LastLoginTime,Remark,IsUserDPI,PayAccount)"); builder.Append(" values ("); builder.Append("@UserID,@Gravatar,@Singature,@TelPhone,@QQ,@MSN,@HomePage,@Birthday,@BirthdayVisible,@BirthdayIndexVisible,@Constellation,@ConstellationVisible,@ConstellationIndexVisible,@NativePlace,@NativePlaceVisible,@NativePlaceIndexVisible,@RegionId,@Address,@AddressVisible,@AddressIndexVisible,@BodilyForm,@BodilyFormVisible,@BodilyFormIndexVisible,@BloodType,@BloodTypeVisible,@BloodTypeIndexVisible,@Marriaged,@MarriagedVisible,@MarriagedIndexVisible,@PersonalStatus,@PersonalStatusVisible,@PersonalStatusIndexVisible,@Grade,@Balance,@Points,@TopicCount,@ReplyTopicCount,@FavTopicCount,@PvCount,@FansCount,@FellowCount,@AblumsCount,@FavouritesCount,@FavoritedCount,@ShareCount,@ProductsCount,@PersonalDomain,@LastAccessTime,@LastAccessIP,@LastPostTime,@LastLoginTime,@Remark,@IsUserDPI,@PayAccount)"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@UserID", SqlDbType.Int, 4), new SqlParameter("@Gravatar", SqlDbType.NVarChar, 200), new SqlParameter("@Singature", SqlDbType.NVarChar, 200), new SqlParameter("@TelPhone", SqlDbType.NVarChar, 20), new SqlParameter("@QQ", SqlDbType.NVarChar, 30), new SqlParameter("@MSN", SqlDbType.NVarChar, 30), new SqlParameter("@HomePage", SqlDbType.NVarChar, 50), new SqlParameter("@Birthday", SqlDbType.DateTime), new SqlParameter("@BirthdayVisible", SqlDbType.SmallInt, 2), new SqlParameter("@BirthdayIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@Constellation", SqlDbType.NVarChar, 10), new SqlParameter("@ConstellationVisible", SqlDbType.SmallInt, 2), new SqlParameter("@ConstellationIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@NativePlace", SqlDbType.NVarChar, 300), new SqlParameter("@NativePlaceVisible", SqlDbType.SmallInt, 2), new SqlParameter("@NativePlaceIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@RegionId", SqlDbType.Int, 4), new SqlParameter("@Address", SqlDbType.NVarChar, 300), new SqlParameter("@AddressVisible", SqlDbType.SmallInt, 2), new SqlParameter("@AddressIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@BodilyForm", SqlDbType.NVarChar, 10), new SqlParameter("@BodilyFormVisible", SqlDbType.SmallInt, 2), new SqlParameter("@BodilyFormIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@BloodType", SqlDbType.NVarChar, 10), new SqlParameter("@BloodTypeVisible", SqlDbType.SmallInt, 2), new SqlParameter("@BloodTypeIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@Marriaged", SqlDbType.NVarChar, 10), new SqlParameter("@MarriagedVisible", SqlDbType.SmallInt, 2), new SqlParameter("@MarriagedIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@PersonalStatus", SqlDbType.NVarChar, 10), new SqlParameter("@PersonalStatusVisible", SqlDbType.SmallInt, 2), new SqlParameter("@PersonalStatusIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@Grade", SqlDbType.Int, 4), new SqlParameter("@Balance", SqlDbType.Money, 8), new SqlParameter("@Points", SqlDbType.Int, 4), new SqlParameter("@TopicCount", SqlDbType.Int, 4), new SqlParameter("@ReplyTopicCount", SqlDbType.Int, 4), new SqlParameter("@FavTopicCount", SqlDbType.Int, 4), new SqlParameter("@PvCount", SqlDbType.Int, 4), new SqlParameter("@FansCount", SqlDbType.Int, 4), new SqlParameter("@FellowCount", SqlDbType.Int, 4), new SqlParameter("@AblumsCount", SqlDbType.Int, 4), new SqlParameter("@FavouritesCount", SqlDbType.Int, 4), new SqlParameter("@FavoritedCount", SqlDbType.Int, 4), new SqlParameter("@ShareCount", SqlDbType.Int, 4), new SqlParameter("@ProductsCount", SqlDbType.Int, 4), new SqlParameter("@PersonalDomain", SqlDbType.NVarChar, 50), new SqlParameter("@LastAccessTime", SqlDbType.DateTime), new SqlParameter("@LastAccessIP", SqlDbType.NVarChar, 50), new SqlParameter("@LastPostTime", SqlDbType.DateTime), new SqlParameter("@LastLoginTime", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.NVarChar), new SqlParameter("@IsUserDPI", SqlDbType.Bit, 1), new SqlParameter("@PayAccount", SqlDbType.NVarChar, 200) }; cmdParms[0].Value = model.UserID; cmdParms[1].Value = model.Gravatar; cmdParms[2].Value = model.Singature; cmdParms[3].Value = model.TelPhone; cmdParms[4].Value = model.QQ; cmdParms[5].Value = model.MSN; cmdParms[6].Value = model.HomePage; cmdParms[7].Value = model.Birthday; cmdParms[8].Value = model.BirthdayVisible; cmdParms[9].Value = model.BirthdayIndexVisible; cmdParms[10].Value = model.Constellation; cmdParms[11].Value = model.ConstellationVisible; cmdParms[12].Value = model.ConstellationIndexVisible; cmdParms[13].Value = model.NativePlace; cmdParms[14].Value = model.NativePlaceVisible; cmdParms[15].Value = model.NativePlaceIndexVisible; cmdParms[0x10].Value = model.RegionId; cmdParms[0x11].Value = model.Address; cmdParms[0x12].Value = model.AddressVisible; cmdParms[0x13].Value = model.AddressIndexVisible; cmdParms[20].Value = model.BodilyForm; cmdParms[0x15].Value = model.BodilyFormVisible; cmdParms[0x16].Value = model.BodilyFormIndexVisible; cmdParms[0x17].Value = model.BloodType; cmdParms[0x18].Value = model.BloodTypeVisible; cmdParms[0x19].Value = model.BloodTypeIndexVisible; cmdParms[0x1a].Value = model.Marriaged; cmdParms[0x1b].Value = model.MarriagedVisible; cmdParms[0x1c].Value = model.MarriagedIndexVisible; cmdParms[0x1d].Value = model.PersonalStatus; cmdParms[30].Value = model.PersonalStatusVisible; cmdParms[0x1f].Value = model.PersonalStatusIndexVisible; cmdParms[0x20].Value = model.Grade; cmdParms[0x21].Value = model.Balance; cmdParms[0x22].Value = model.Points; cmdParms[0x23].Value = model.TopicCount; cmdParms[0x24].Value = model.ReplyTopicCount; cmdParms[0x25].Value = model.FavTopicCount; cmdParms[0x26].Value = model.PvCount; cmdParms[0x27].Value = model.FansCount; cmdParms[40].Value = model.FellowCount; cmdParms[0x29].Value = model.AblumsCount; cmdParms[0x2a].Value = model.FavouritesCount; cmdParms[0x2b].Value = model.FavoritedCount; cmdParms[0x2c].Value = model.ShareCount; cmdParms[0x2d].Value = model.ProductsCount; cmdParms[0x2e].Value = model.PersonalDomain; cmdParms[0x2f].Value = model.LastAccessTime; cmdParms[0x30].Value = model.LastAccessIP; cmdParms[0x31].Value = model.LastPostTime; cmdParms[50].Value = model.LastLoginTime; cmdParms[0x33].Value = model.Remark; cmdParms[0x34].Value = model.IsUserDPI; cmdParms[0x35].Value = model.PayAccount; return (DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public void btnSave_Click(object sender, EventArgs e) { User user = new User(); string msg = ""; if (user.HasUserByUserName(this.txtUserName.Text)) { msg = msg + Site.TooltipUserExist; } if (msg != "") { MessageBox.ShowSuccessTip(this, msg); } else { user.UserName = this.txtUserName.Text; user.Password = AccountsPrincipal.EncryptPassword(this.txtPassword.Text); user.NickName = user.UserName; user.TrueName = this.txtTrueName.Text; user.Sex = "1"; user.Phone = this.txtPhone.Text.Trim(); user.Email = this.txtEmail.Text; user.EmployeeID = 0; user.Activity = true; user.UserType = this.radbtnlistUserType.SelectedValue; user.Style = 1; user.User_dateCreate = DateTime.Now; user.User_iCreator = base.CurrentUser.UserID; user.User_dateValid = DateTime.Now; user.User_cLang = "zh-CN"; int num = user.Create(); if (num == -100) { MessageBox.ShowSuccessTip(this, Site.TooltipUserExist); } else { UsersExp exp = new UsersExp(); UsersExpModel model = new UsersExpModel { UserID = num, LastAccessTime = new DateTime?(DateTime.Now), LastLoginTime = DateTime.Now, LastPostTime = new DateTime?(DateTime.Now) }; exp.AddUsersExp(model); LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, string.Format("添加用户:【{0}】", this.txtUserName.Text), this); base.Response.Redirect("RoleAssignment.aspx?UserID=" + num); } } }
public bool AddUserExp(UsersExpModel model) { SqlConnection connection = new SqlConnection(this.ConnectionString); SqlCommand command = new SqlCommand { CommandType = CommandType.Text, Connection = connection }; StringBuilder builder = new StringBuilder(); builder.Append("insert into Accounts_UsersExp("); builder.Append("UserID,Gravatar,Singature,TelPhone,QQ,MSN,HomePage,Birthday,BirthdayVisible,BirthdayIndexVisible,Constellation,ConstellationVisible,ConstellationIndexVisible,NativePlace,NativePlaceVisible,NativePlaceIndexVisible,RegionId,Address,AddressVisible,AddressIndexVisible,BodilyForm,BodilyFormVisible,BodilyFormIndexVisible,BloodType,BloodTypeVisible,BloodTypeIndexVisible,Marriaged,MarriagedVisible,MarriagedIndexVisible,PersonalStatus,PersonalStatusVisible,PersonalStatusIndexVisible,Grade,Balance,Points,TopicCount,ReplyTopicCount,FavTopicCount,PvCount,FansCount,FellowCount,AblumsCount,FavouritesCount,FavoritedCount,ShareCount,ProductsCount,PersonalDomain,LastAccessTime,LastAccessIP,LastPostTime,LastLoginTime,Remark,IsUserDPI,PayAccount)"); builder.Append(" values ("); builder.Append("@UserID,@Gravatar,@Singature,@TelPhone,@QQ,@MSN,@HomePage,@Birthday,@BirthdayVisible,@BirthdayIndexVisible,@Constellation,@ConstellationVisible,@ConstellationIndexVisible,@NativePlace,@NativePlaceVisible,@NativePlaceIndexVisible,@RegionId,@Address,@AddressVisible,@AddressIndexVisible,@BodilyForm,@BodilyFormVisible,@BodilyFormIndexVisible,@BloodType,@BloodTypeVisible,@BloodTypeIndexVisible,@Marriaged,@MarriagedVisible,@MarriagedIndexVisible,@PersonalStatus,@PersonalStatusVisible,@PersonalStatusIndexVisible,@Grade,@Balance,@Points,@TopicCount,@ReplyTopicCount,@FavTopicCount,@PvCount,@FansCount,@FellowCount,@AblumsCount,@FavouritesCount,@FavoritedCount,@ShareCount,@ProductsCount,@PersonalDomain,@LastAccessTime,@LastAccessIP,@LastPostTime,@LastLoginTime,@Remark,@IsUserDPI,@PayAccount)"); SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@UserID", SqlDbType.Int, 4), new SqlParameter("@Gravatar", SqlDbType.VarChar, 200), new SqlParameter("@Singature", SqlDbType.NVarChar, 200), new SqlParameter("@TelPhone", SqlDbType.VarChar, 20), new SqlParameter("@QQ", SqlDbType.VarChar, 30), new SqlParameter("@MSN", SqlDbType.VarChar, 30), new SqlParameter("@HomePage", SqlDbType.VarChar, 50), new SqlParameter("@Birthday", SqlDbType.DateTime), new SqlParameter("@BirthdayVisible", SqlDbType.SmallInt, 2), new SqlParameter("@BirthdayIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@Constellation", SqlDbType.VarChar, 10), new SqlParameter("@ConstellationVisible", SqlDbType.SmallInt, 2), new SqlParameter("@ConstellationIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@NativePlace", SqlDbType.NVarChar, 300), new SqlParameter("@NativePlaceVisible", SqlDbType.SmallInt, 2), new SqlParameter("@NativePlaceIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@RegionId", SqlDbType.Int, 4), new SqlParameter("@Address", SqlDbType.NVarChar, 300), new SqlParameter("@AddressVisible", SqlDbType.SmallInt, 2), new SqlParameter("@AddressIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@BodilyForm", SqlDbType.NVarChar, 10), new SqlParameter("@BodilyFormVisible", SqlDbType.SmallInt, 2), new SqlParameter("@BodilyFormIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@BloodType", SqlDbType.NVarChar, 10), new SqlParameter("@BloodTypeVisible", SqlDbType.SmallInt, 2), new SqlParameter("@BloodTypeIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@Marriaged", SqlDbType.NVarChar, 10), new SqlParameter("@MarriagedVisible", SqlDbType.SmallInt, 2), new SqlParameter("@MarriagedIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@PersonalStatus", SqlDbType.NVarChar, 10), new SqlParameter("@PersonalStatusVisible", SqlDbType.SmallInt, 2), new SqlParameter("@PersonalStatusIndexVisible", SqlDbType.Bit, 1), new SqlParameter("@Grade", SqlDbType.Int, 4), new SqlParameter("@Balance", SqlDbType.Money, 8), new SqlParameter("@Points", SqlDbType.Int, 4), new SqlParameter("@TopicCount", SqlDbType.Int, 4), new SqlParameter("@ReplyTopicCount", SqlDbType.Int, 4), new SqlParameter("@FavTopicCount", SqlDbType.Int, 4), new SqlParameter("@PvCount", SqlDbType.Int, 4), new SqlParameter("@FansCount", SqlDbType.Int, 4), new SqlParameter("@FellowCount", SqlDbType.Int, 4), new SqlParameter("@AblumsCount", SqlDbType.Int, 4), new SqlParameter("@FavouritesCount", SqlDbType.Int, 4), new SqlParameter("@FavoritedCount", SqlDbType.Int, 4), new SqlParameter("@ShareCount", SqlDbType.Int, 4), new SqlParameter("@ProductsCount", SqlDbType.Int, 4), new SqlParameter("@PersonalDomain", SqlDbType.NVarChar, 50), new SqlParameter("@LastAccessTime", SqlDbType.DateTime), new SqlParameter("@LastAccessIP", SqlDbType.VarChar, 50), new SqlParameter("@LastPostTime", SqlDbType.DateTime), new SqlParameter("@LastLoginTime", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.VarChar), new SqlParameter("@IsUserDPI", SqlDbType.Bit, 1), new SqlParameter("@PayAccount", SqlDbType.NVarChar, 200) }; parameterArray[0].Value = model.UserID; parameterArray[1].Value = model.Gravatar; parameterArray[2].Value = model.Singature; parameterArray[3].Value = model.TelPhone; parameterArray[4].Value = model.QQ; parameterArray[5].Value = model.MSN; parameterArray[6].Value = model.HomePage; parameterArray[7].Value = model.Birthday; parameterArray[8].Value = model.BirthdayVisible; parameterArray[9].Value = model.BirthdayIndexVisible; parameterArray[10].Value = model.Constellation; parameterArray[11].Value = model.ConstellationVisible; parameterArray[12].Value = model.ConstellationIndexVisible; parameterArray[13].Value = model.NativePlace; parameterArray[14].Value = model.NativePlaceVisible; parameterArray[15].Value = model.NativePlaceIndexVisible; parameterArray[0x10].Value = model.RegionId; parameterArray[0x11].Value = model.Address; parameterArray[0x12].Value = model.AddressVisible; parameterArray[0x13].Value = model.AddressIndexVisible; parameterArray[20].Value = model.BodilyForm; parameterArray[0x15].Value = model.BodilyFormVisible; parameterArray[0x16].Value = model.BodilyFormIndexVisible; parameterArray[0x17].Value = model.BloodType; parameterArray[0x18].Value = model.BloodTypeVisible; parameterArray[0x19].Value = model.BloodTypeIndexVisible; parameterArray[0x1a].Value = model.Marriaged; parameterArray[0x1b].Value = model.MarriagedVisible; parameterArray[0x1c].Value = model.MarriagedIndexVisible; parameterArray[0x1d].Value = model.PersonalStatus; parameterArray[30].Value = model.PersonalStatusVisible; parameterArray[0x1f].Value = model.PersonalStatusIndexVisible; parameterArray[0x20].Value = model.Grade; parameterArray[0x21].Value = model.Balance; parameterArray[0x22].Value = model.Points; parameterArray[0x23].Value = model.TopicCount; parameterArray[0x24].Value = model.ReplyTopicCount; parameterArray[0x25].Value = model.FavTopicCount; parameterArray[0x26].Value = model.PvCount; parameterArray[0x27].Value = model.FansCount; parameterArray[40].Value = model.FellowCount; parameterArray[0x29].Value = model.AblumsCount; parameterArray[0x2a].Value = model.FavouritesCount; parameterArray[0x2b].Value = model.FavoritedCount; parameterArray[0x2c].Value = model.ShareCount; parameterArray[0x2d].Value = model.ProductsCount; parameterArray[0x2e].Value = model.PersonalDomain; parameterArray[0x2f].Value = model.LastAccessTime; parameterArray[0x30].Value = model.LastAccessIP; parameterArray[0x31].Value = model.LastPostTime; parameterArray[50].Value = model.LastLoginTime; parameterArray[0x33].Value = model.Remark; parameterArray[0x34].Value = model.IsUserDPI; parameterArray[0x35].Value = model.PayAccount; command.CommandText = builder.ToString(); foreach (SqlParameter parameter in parameterArray) { if (((parameter.Direction == ParameterDirection.InputOutput) || (parameter.Direction == ParameterDirection.Input)) && (parameter.Value == null)) { parameter.Value = DBNull.Value; } command.Parameters.Add(parameter); } connection.Open(); int num = command.ExecuteNonQuery(); connection.Close(); return (num > 0); }