protected void Button1_Click(object sender, EventArgs e) { if (hidAttachmentId.Value.Length != 0) { int attachmentId = 0; Attachments attachments = null; if (CommonUtility.SafeCheckByParams<string>(hidAttachmentId.Value, ref attachmentId)) { DalOperationAttachments dalOperationAttachments = new DalOperationAttachments(); attachments = dalOperationAttachments.FindAdminNotifyAttachmentById(attachmentId); } Thumbnails.CreateImage(Server.MapPath(attachments != null ? attachments.attachmentUrl : "avatar/1-1.gif")); DalOperationPatch dalpa = new DalOperationPatch(); UserCookiesInfo user = BllOperationAboutUser.GetUserCookiesInfo(); dalpa.SetAvatar(user.userNo, user.userType, attachments != null ? attachments.attachmentUrl : "avatar/1-1.gif"); Javascript.RefreshParentWindow("BBSUserinfo.aspx", Page); return; } else { Javascript.GoHistory(-1, "请选择上传文件!", Page); } }
protected void Page_Load(object sender, EventArgs e) { Master.ShowLiControl(this.Page, "liFragment4"); DalOperationPatch dalpa = new DalOperationPatch(); UserCookiesInfo user = BllOperationAboutUser.GetUserCookiesInfo(); string src = dalpa.GetAvatar(user.userNo, user.userType); ltavatar.Text = "<img src=\"" + src + "\">"; }
protected void Page_Load(object sender, EventArgs e) { DalOperationPatch dalpa = new DalOperationPatch(); if (Request["avatarUrl"]!=null) { UserCookiesInfo user=BllOperationAboutUser.GetUserCookiesInfo(); dalpa.SetAvatar(user.userNo, user.userType, Request["avatarUrl"].Trim()); Javascript.RefreshParentWindow("BBSUserinfo.aspx", Page); return; } DirectoryInfo di = new DirectoryInfo(Server.MapPath("avatar")); foreach (FileInfo file in di.GetFiles()) { if (file.Extension.ToLower() == ".gif" || file.Extension.ToLower() == ".jpg") { ltlAvatar.Text += "<a href=\"?avatarUrl=avatar/" + file.Name + "\" style=\"width:100px;height:100px;\">" + "<img src=\"avatar/" + file.Name + "\" border=\"0px\" title=\"点击即可修改成功~\" alt=\"点击即可修改成功~\" onmouseover=\"this.style.border='1px solid #CCCCCC';\" onmouseout=\"this.style.border='0px';\" /></a>"; } } }
protected void DataListBind() { DalOperationAboutBbs dalOperationAboutBbs = new DalOperationAboutBbs(); DataSet ds = dalOperationAboutBbs.GetAllTopicsByForumId(forumId); DataSet ds1 = dalOperationAboutBbs.GetTopicsTopByForumId(forumId); dlstTopTopic.DataSource = ds1.Tables[0]; dlstTopTopic.DataBind(); //填充HASHTABLE DataSet ds2 = dalOperationAboutBbs.GetLastPost(); DataTable dt0 = ds2.Tables["0"]; DataTable dt1 = ds2.Tables["1"]; foreach (DataRow dr0 in dt0.Rows) { ht0.Add(dr0["topicId"].ToString(), dr0["postsCount"].ToString()); } foreach (DataRow dr1 in dt1.Rows) { ht1.Add(dr1["topicId"].ToString(), dr1["postUserName"].ToString()); ht2.Add(dr1["topicId"].ToString(), dr1["updateTime"].ToString()); } DalOperationPatch dal = new DalOperationPatch(); DataSet dsNew = dal.GetLatestTopic(); DataSet dsTopicList = dal.GetLatestTopicAndPostsUpdateTime(); foreach (DataRow dr2 in dsTopicList.Tables[0].Rows) { ht3.Add(dr2["topicId"].ToString().Trim(), dr2["updateTime"].ToString().Trim()); } dlsttopics.DataSource = ds.Tables[0]; dlsttopics.DataBind(); }
protected void btnSubmit_Click(object sender, EventArgs e) { DalOperationPatch dal = new DalOperationPatch(); dal.UpdateBBSTopic(int.Parse(Request["topicId"]), txtTitle.Text, Textarea1.Value, hidAttachmentId.Value); Response.Write("<script>window.top.location.reload();</script>"); }
/// <summary> /// 获得头像 /// </summary> /// <param name="userNo"></param> /// <param name="userType"></param> /// <returns></returns> public string GetAvatar(string userNo, int userType) { DalOperationPatch dal = new DalOperationPatch(); return dal.GetAvatar(userNo, userType); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DalOperationAboutAdminNotifyType dalOperationAboutAdminNotifyType = new DalOperationAboutAdminNotifyType(); DataSet _ds = dalOperationAboutAdminNotifyType.FindAllParentAdminNotifyType(); string strLi = string.Empty; for (int i = 0; i < _ds.Tables[0].Rows.Count; i++) { strLi += "<li id=\"liFragment" + _ds.Tables[0].Rows[i]["notifyTypeId"].ToString().Trim() + "\" pid=\"" + _ds.Tables[0].Rows[i]["notifyTypeId"].ToString().Trim() + "\"><a href=\"?pid=" + _ds.Tables[0].Rows[i]["notifyTypeId"].ToString().Trim() + "\"><span>" + _ds.Tables[0].Rows[i]["notifyTypeName"].ToString().Trim() + "</span></a></li>"; if (i == 0 && notifyTypeParentId == -3) { notifyTypeParentId = int.Parse(_ds.Tables[0].Rows[i]["notifyTypeId"].ToString().Trim()); } } ltlNotifyTypeParent.Text = strLi; if (notifyTypeParentId > 0 || notifyTypeParentId == -3) { divFragment1.Attributes.Add("pid", notifyTypeParentId.ToString()); DataListBindNotifyType(notifyTypeParentId); divFragment1.Visible = true; } if (notifyTypeParentId == -1) { ViewAdminNotify(); } if (notifyTypeParentId == -2) { if (Request["notifyTypeId"] != null) { int typeId = -1; if (CommonUtility.SafeCheckByParams<string>(Request["notifyTypeId"], ref typeId)) { DataListBindNotifyByTypeId(typeId); } else { Javascript.GoHistory(-1, Page); } } } UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo(); isAdmin = UserCookiesInfo.userType.ToString(); if (UserCookiesInfo.userType == 3) { DalOperationUsers DalOperationUsers = new DalOperationUsers(); DataSet ds = DalOperationUsers.StudentTips(UserCookiesInfo.userNo); int examCount = ds.Tables[0].Rows.Count; int experimentsCount = ds.Tables[1].Rows.Count; int schoolWorksCount = ds.Tables[2].Rows.Count; int schoolworkpaperCount = ds.Tables[3].Rows.Count; int feedBackCount = ds.Tables[4].Rows.Count; DalOperationPatch dal = new DalOperationPatch(); DataSet ds1 = dal.GetLatestCourseNotify(UserCookiesInfo.userNo); int courseNotifyCount = ds1.Tables[0].Rows.Count; tbTip.Visible = true; if (feedBackCount == 0) { divFeedBack.Visible = false; tdFeedBack.Visible = false; } else { ltlFeedBack.Text = feedBackCount.ToString(); dlistFeedBack.DataSource = ds.Tables[4]; dlistFeedBack.DataBind(); } if (examCount == 0) { divExam.Visible = false; tdExam.Visible = false; } else { ltlExamTip.Text = examCount.ToString(); dlstExam.DataSource = ds.Tables[0]; dlstExam.DataBind(); } if (experimentsCount == 0) { divExperiments.Visible = false; tdExperiments.Visible = false; } else { ltlExperimentsTip.Text = experimentsCount.ToString(); dlstExpriment.DataSource = ds.Tables[1]; dlstExpriment.DataBind(); } if (schoolWorksCount == 0) { divSchoolWorks.Visible = false; tdSchoolWorks.Visible = false; } else { ltlSchoolWorksTip.Text = schoolWorksCount.ToString() + "次在线作业待提交"; dlstSchoolwork.DataSource = ds.Tables[2]; dlstSchoolwork.DataBind(); } if (schoolworkpaperCount == 0) { divSchoolWorksPaper.Visible = false; tdSchoolWorksPaper.Visible = false; } else { ltlschoolworkpaper.Text = "近期有" + schoolworkpaperCount.ToString() + "次书面作业待提交(此为提醒功能,并不表示未提交作业)"; dlstSchoolworkpa.DataSource = ds.Tables[3]; dlstSchoolworkpa.DataBind(); } if (courseNotifyCount == 0) { divNotify.Visible = false; tdNotify.Visible = false; } else { ltlnotify.Text = courseNotifyCount.ToString(); DataList1.DataSource = ds1.Tables[0]; DataList1.DataBind(); } } if (UserCookiesInfo.userType == 0 || UserCookiesInfo.userType == 1 || UserCookiesInfo.userType == 2) { DalOperationAboutArchivesConfig dalArchivesConfig = new DalOperationAboutArchivesConfig(); if (dalArchivesConfig.CheckArchivesNotifyTime()) { tdArchivesNotify.Visible = true; divArchivesNotify.Visible = true; } else { tdArchivesNotify.Visible = false; divArchivesNotify.Visible = false; } DalOperationAboutGameCategory dal = new DalOperationAboutGameCategory(); if (dal.GetGameCategoryIng(DateTime.Now).Tables[0].Rows.Count>0) { tdGameCategory.Visible = true; divGameCategory.Visible = true; } else { tdGameCategory.Visible = false; divGameCategory.Visible = false; } } } }