/// <summary> /// 创建团队信息 /// </summary> /// <param name="teaminfo">信息实体</param> /// <returns>团队ID</returns> public static int CreateTeam(TeamInfo teaminfo, out string result) { int teamID = 0; string teammember = teaminfo.TeamMember; teaminfo.TeamMember = ""; teamID = Data.DbProvider.GetInstance().CreateTeams(teaminfo); result = SetTeamMember(teamID, teammember); SASCache.GetCacheService().RemoveObject("/Sirius/TeamInfoList"); return teamID; }
private void UpdateUserGroupInf_Click(object sender, EventArgs e) { #region 更新团队信息 if (this.CheckCookie()) { teamin = spb.GetTeamByTeamID(SASRequest.GetInt("teamID", 0)); teamin.Name = name.Text.Trim(); teamin.Teamdomain = teamurl.Text.Trim(); teamin.Templateid = Convert.ToInt32(templateid.SelectedValue); teamin.Imgs = teamImg.Text.Trim(); teamin.Bio = teamBio.Text.Trim(); teamin.UpdateDate = System.DateTime.Now.ToString(); teamin.Content1 = content1.Text; teamin.Content2 = content2.Text; teamin.Content3 = content3.Text; teamin.TeamMember = moderators.Text.Trim(); teamin.Stutas = Convert.ToInt16(status.SelectedValue); teamin.Displayorder = 0; teamin.Seodescription = seodescription.Text.Trim(); teamin.Seokeywords = seokeywords.Text.Trim(); string message = ""; if (spb.UpdateTeamInfo(teamin,out message)) { if (message == "") { base.RegisterStartupScript("PAGE", "self.location.href='sirius_manageteam.aspx';"); } else { base.RegisterStartupScript("PAGE", "alert('用户:" + message + "不存在或不是指定用户组,因为无法设为团队成员');self.location.href='sirius_manageteam.aspx';"); } AdminVistLogs.InsertLog(userid, username, usergroupid, grouptitle, ip, "修改团队信息", "更新团队团队信息:" + teamin.Name); } else { base.RegisterStartupScript("PAGE", "alert('更新团队信息失败!');self.location.href='sirius_manageteam.aspx';"); } } #endregion }
public void LoadTeamInfo(int tid) { teamin = spb.GetTeamByTeamID(tid); templateid.AddTableData(Templates.GetValidTemplateList(), "tp_name", "tp_id"); templateid.SelectedValue = teamin.Templateid.ToString(); teamurl.Text = teamin.Teamdomain; name.Text = teamin.Name; status.SelectedValue = teamin.Stutas.ToString(); moderators.Text = teamin.TeamMember.ToString().Trim(); teamImg.Text = teamin.Imgs.ToString(); seokeywords.Text = teamin.Seokeywords; seodescription.Text = teamin.Seodescription; teamBio.Text = teamin.Bio; content1.Text = teamin.Content1; content2.Text = teamin.Content2; content3.Text = teamin.Content3; }
private TeamInfo CreateTeamInfo() { TeamInfo teaminfo = new TeamInfo(); teaminfo.Name = name.Text; teaminfo.Teamdomain = teamurl.Text.Trim(); teaminfo.Templateid = Convert.ToInt32(templateid.SelectedValue); teaminfo.Imgs = teamImg.Text.Trim(); teaminfo.Bio = teamBio.Text.Trim(); teaminfo.Content1 = content1.Text; teaminfo.Content2 = content2.Text; teaminfo.Content3 = content3.Text; teaminfo.TeamMember = moderators.Text.Trim(); teaminfo.Stutas = Convert.ToInt16(status.SelectedValue); teaminfo.Displayorder = 0; teaminfo.Seodescription = seodescription.Text.Trim(); teaminfo.Seokeywords = seokeywords.Text.Trim(); teaminfo.Creater = username; return teaminfo; }
public int CreateTeams(TeamInfo teaminfo) { DbParameter[] parms = { DbHelper.MakeInParam("@name",(DbType)SqlDbType.NVarChar,255,teaminfo.Name), DbHelper.MakeInParam("@teamdomain",(DbType)SqlDbType.NVarChar,255,teaminfo.Teamdomain), DbHelper.MakeInParam("@templateid",(DbType)SqlDbType.Int,4,teaminfo.Templateid), DbHelper.MakeInParam("@imgs",(DbType)SqlDbType.NVarChar,255,teaminfo.Imgs), DbHelper.MakeInParam("@bio",(DbType)SqlDbType.NVarChar,255,teaminfo.Bio), DbHelper.MakeInParam("@content1",(DbType)SqlDbType.NText,0,teaminfo.Content1), DbHelper.MakeInParam("@content2",(DbType)SqlDbType.NText,0,teaminfo.Content2), DbHelper.MakeInParam("@content3",(DbType)SqlDbType.NText,0,teaminfo.Content3), DbHelper.MakeInParam("@content4",(DbType)SqlDbType.NText,0,teaminfo.Content4), DbHelper.MakeInParam("@teammember",(DbType)SqlDbType.NText,0,teaminfo.TeamMember), DbHelper.MakeInParam("@stutas",(DbType)SqlDbType.Int,4,teaminfo.Stutas), DbHelper.MakeInParam("@displayorder",(DbType)SqlDbType.Int,4,teaminfo.Displayorder), DbHelper.MakeInParam("@seokeywords",(DbType)SqlDbType.NText,0,teaminfo.Seokeywords), DbHelper.MakeInParam("@seodescription",(DbType)SqlDbType.NText,0,teaminfo.Seodescription), DbHelper.MakeInParam("@creater",(DbType)SqlDbType.VarChar,50,teaminfo.Creater) }; string commandText = String.Format("INSERT INTO [{0}teamInfo] ([name],[teamdomain],[templateid],[imgs],[bio],[content1],[content2],[content3],[content4],[stutas],[displayorder],[teamMember],[seokeywords],[seodescription],[creater]) VALUES (@name,@teamdomain,@templateid,@imgs,@bio,@content1,@content2,@content3,@content4,@stutas,@displayorder,@teamMember,@seokeywords,@seodescription,@creater);SELECT SCOPE_IDENTITY()", BaseConfigs.GetTablePrefix); return TypeConverter.ObjectToInt(DbHelper.ExecuteScalar(CommandType.Text, commandText, parms)); }
/// <summary> /// 获取团队信息实体 /// </summary> /// <param name="reader"></param> /// <returns></returns> public static TeamInfo GetTeamInfoEntity(IDataReader reader) { if (reader.Read()) { TeamInfo team = new TeamInfo(); team.TeamID = TypeConverter.ObjectToInt(reader["teamID"].ToString(), 0); team.Name = reader["name"].ToString(); team.Teamdomain = reader["teamdomain"].ToString(); team.Templateid = TypeConverter.ObjectToInt(reader["templateid"].ToString(), 0); team.BuildDate = Utils.GetStandardDate(reader["builddate"].ToString()); team.CreateDate = Utils.GetStandardDate(reader["createdate"].ToString()); team.UpdateDate = Utils.GetStandardDate(reader["updatedate"].ToString()); team.Imgs = reader["imgs"].ToString(); team.Bio = reader["bio"].ToString(); team.Content1 = reader["content1"].ToString(); team.Content2 = reader["content2"].ToString(); team.Content3 = reader["content3"].ToString(); team.Content4 = reader["content4"].ToString(); team.Stutas = TypeConverter.ObjectToInt(reader["stutas"], 0); team.Pageviews = TypeConverter.ObjectToInt(reader["pageviews"], 0); team.Displayorder = TypeConverter.ObjectToInt(reader["displayorder"], 0); team.TeamMember = reader["teammember"].ToString(); team.Seokeywords = reader["seokeywords"].ToString(); team.Seodescription = reader["seodescription"].ToString(); team.Creater = reader["creater"].ToString(); reader.Close(); return team; } return null; }
/// <summary> /// 创建团队信息 /// </summary> /// <param name="teaminfo">信息实体</param> public override int CreateTeamInfo(TeamInfo teaminfo,out string result) { return Sirius.CreateTeam(teaminfo, out result); }
public override bool UpdateTeamInfo(TeamInfo teaminfo, out string result) { return Sirius.UpdateTeamInfo(teaminfo, out result); }
public SAS.Common.Generic.List<TeamInfo> GetAllTeamList() { string commandText = string.Format("SELECT * FROM [{0}teamInfo] ORDER BY [createdate]", BaseConfigs.GetTablePrefix); IDataReader reader = DbHelper.ExecuteReader(CommandType.Text, commandText); SAS.Common.Generic.List<TeamInfo> tlist = new SAS.Common.Generic.List<TeamInfo>(); while (reader.Read()) { TeamInfo team = new TeamInfo(); team.TeamID = TypeConverter.ObjectToInt(reader["teamID"], 0); team.Name = reader["name"].ToString(); team.Teamdomain = reader["teamdomain"].ToString(); team.Templateid = TypeConverter.ObjectToInt(reader["templateid"].ToString(), 0); team.BuildDate = Utils.GetStandardDate(reader["builddate"].ToString()); team.CreateDate = Utils.GetStandardDate(reader["createdate"].ToString()); team.UpdateDate = Utils.GetStandardDate(reader["updatedate"].ToString()); team.Imgs = reader["imgs"].ToString(); team.Bio = reader["bio"].ToString(); team.Content1 = reader["content1"].ToString(); team.Content2 = reader["content2"].ToString(); team.Content3 = reader["content3"].ToString(); team.Content4 = reader["content4"].ToString(); team.Stutas = TypeConverter.ObjectToInt(reader["stutas"], 0); team.Pageviews = TypeConverter.ObjectToInt(reader["pageviews"], 0); team.Displayorder = TypeConverter.ObjectToInt(reader["displayorder"], 0); team.TeamMember = reader["teammember"].ToString(); team.Seokeywords = reader["seokeywords"].ToString(); team.Seodescription = reader["seodescription"].ToString(); team.Creater = reader["creater"].ToString(); tlist.Add(team); } reader.Close(); return tlist; }
public bool UpdateTeamInfo(TeamInfo teaminfo) { DbParameter[] parms = { DbHelper.MakeInParam("@teamID",(DbType)SqlDbType.Int,4,teaminfo.TeamID), DbHelper.MakeInParam("@name",(DbType)SqlDbType.NVarChar,255,teaminfo.Name), DbHelper.MakeInParam("@teamdomain",(DbType)SqlDbType.NVarChar,255,teaminfo.Teamdomain), DbHelper.MakeInParam("@templateid",(DbType)SqlDbType.Int,4,teaminfo.Templateid), DbHelper.MakeInParam("@imgs",(DbType)SqlDbType.NVarChar,255,teaminfo.Imgs), DbHelper.MakeInParam("@updateDate",(DbType)SqlDbType.DateTime,8,teaminfo.UpdateDate), DbHelper.MakeInParam("@bio",(DbType)SqlDbType.NVarChar,255,teaminfo.Bio), DbHelper.MakeInParam("@content1",(DbType)SqlDbType.NText,0,teaminfo.Content1), DbHelper.MakeInParam("@content2",(DbType)SqlDbType.NText,0,teaminfo.Content2), DbHelper.MakeInParam("@content3",(DbType)SqlDbType.NText,0,teaminfo.Content3), DbHelper.MakeInParam("@content4",(DbType)SqlDbType.NText,0,teaminfo.Content4), DbHelper.MakeInParam("@teammember",(DbType)SqlDbType.NText,0,teaminfo.TeamMember), DbHelper.MakeInParam("@stutas",(DbType)SqlDbType.Int,4,teaminfo.Stutas), DbHelper.MakeInParam("@displayorder",(DbType)SqlDbType.Int,4,teaminfo.Displayorder), DbHelper.MakeInParam("@seokeywords",(DbType)SqlDbType.NText,0,teaminfo.Seokeywords), DbHelper.MakeInParam("@seodescription",(DbType)SqlDbType.NText,0,teaminfo.Seodescription) }; string commandText = String.Format("UPDATE [{0}teamInfo] SET [name] = @name,[teamdomain] = @teamdomain,[templateid] = @templateid,[updateDate] = @updateDate,[imgs] = @imgs,[bio] = @bio,[content1] = @content1,[content2] = @content2,[content3] = @content3,[content4] = @content4,[stutas] = @stutas,[displayorder] = @displayorder,[teamMember] = @teamMember,[seokeywords] = @seokeywords,[seodescription] = @seodescription WHERE [teamID]=@teamID ",BaseConfigs.GetTablePrefix); int result = DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms); if (result == 0) { return false; } return true; }
/// <summary> /// 创建团队信息 /// </summary> /// <param name="teaminfo">信息实体</param> /// <param name="result">返回成员信息</param> public abstract int CreateTeamInfo(TeamInfo teaminfo, out string result);
/// <summary> /// 更新团队信息 /// </summary> /// <param name="teaminfo"></param> public abstract bool UpdateTeamInfo(TeamInfo teaminfo,out string result);
/// <summary> /// 更新团队信息 /// </summary> /// <param name="team"></param> /// <returns></returns> public static bool UpdateTeamInfo(TeamInfo team, out string result) { string teammember = team.TeamMember; team.TeamMember = ""; if (!Data.DbProvider.GetInstance().UpdateTeamInfo(team)) { result = ""; return false; } result = SetTeamMember(team.TeamID, teammember); SASCache.GetCacheService().RemoveObject("/Sirius/TeamInfoList"); return true; }
/// <summary> /// 获取团队信息缓存 /// </summary> public static TeamInfo GetTeamInfoCache(int tid) { List<TeamInfo> tlist = GetAllTeamInfoList(); if (tlist.Count > 0) { TeamInfo tinfo = new TeamInfo(); tinfo = tlist.Find(new Predicate<TeamInfo>(delegate(TeamInfo info) { return info.TeamID == tid; })); return tinfo; } return null; }