protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DalOperationAboutAdminNotifyType dalNotifyType = new DalOperationAboutAdminNotifyType(); AdminNotifyType type = dalNotifyType.FindAdminNotifyTypeById(int.Parse(Request["notifyTypeId"].ToString().Trim())); txtTypeName.Text = type.notifyTypeName.ToString().Trim(); txtSequence.Text = type.sequence.ToString().Trim(); DataTable dt = dalNotifyType.FindAllParentAdminNotifyType().Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { ListItem _item = new ListItem(dt.Rows[i]["notifyTypeName"].ToString().Trim(), dt.Rows[i]["notifyTypeId"].ToString().Trim()); _item.Attributes.Add("parentId", "0"); ddlNotifyTypeManage.Items.Add(_item); } for (int i = 0; i < ddlNotifyTypeManage.Items.Count; i++) { if (ddlNotifyTypeManage.Items[i].Value.ToString().Trim() == type.parentId.ToString().Trim()) { ddlNotifyTypeManage.SelectedIndex = i; } } } }
//绑定文章类型列表 protected void DataListBindNotifyType(int notifyTypeParentId) { DalOperationAboutAdminNotifyType dalOperationAboutAdminNotifyType = new DalOperationAboutAdminNotifyType(); DataSet ds = dalOperationAboutAdminNotifyType.FindAllAdminNotifyTypeByParentId(notifyTypeParentId); this.dlstNotifyType.DataSource = ds; this.dlstNotifyType.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DalOperationAboutAdminNotifyType dalNotifyType = new DalOperationAboutAdminNotifyType(); AdminNotifyType type = dalNotifyType.FindAdminNotifyTypeById(int.Parse(Request["notifyTypeId"].ToString().Trim())); txtTypeName.Text = type.notifyTypeName.ToString().Trim(); txtSequence.Text = type.sequence.ToString().Trim(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DalOperationAboutAdminNotifyType dalNotifyType = new DalOperationAboutAdminNotifyType(); DataTable dt = dalNotifyType.FindAllParentAdminNotifyType().Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { ListItem _item = new ListItem(dt.Rows[i]["notifyTypeName"].ToString().Trim(), dt.Rows[i]["notifyTypeId"].ToString().Trim()); _item.Attributes.Add("parentId", "0"); ddlNotifyTypeManage.Items.Add(_item); } } }
//****第3个标签:管理文章类型-------开始------------ protected void btnSubmit_Click(object sender, EventArgs e) { //若为浮点数则返回去 if (txtSequence.Text.Trim().IndexOf(".") != -1) { Javascript.GoHistory(-1, "显示顺序,请输入整数!", Page); return; } DalOperationAboutAdminNotifyType dalNotifyType = new DalOperationAboutAdminNotifyType(); AdminNotifyType type = new AdminNotifyType(); type.notifyTypeId = int.Parse(Request["notifyTypeId"].ToString().Trim()); type.notifyTypeName = txtTypeName.Text.Trim(); type.sequence = int.Parse(txtSequence.Text.Trim()); dalNotifyType.UpdateAdminNotifyType(type); Javascript.RefreshParentWindow("修改成功", "/Administrator/NotifyInfoManage.aspx?fragment=3", Page); }
protected void Page_Load(object sender, EventArgs e) { //控制Tab的显示 string fragmentFlag = "1"; if (Request["fragment"] != null) { fragmentFlag = Request["fragment"]; } CommonUtility.ShowLiControl(fragmentFlag, liFragment1, liFragment2, liFragment3 , divFragment1, divFragment2, divFragment3); if (fragmentFlag.Equals("1")) { if (!IsPostBack) { DalOperationAboutAdminNotifyType dalNotifyType = new DalOperationAboutAdminNotifyType(); DataTable dt = dalNotifyType.FindAllParentAdminNotifyType().Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { ListItem _item = new ListItem(dt.Rows[i]["notifyTypeName"].ToString().Trim(), dt.Rows[i]["notifyTypeId"].ToString().Trim()); ddlNotifyTypeManage.Items.Add(_item); } if (ddlNotifyTypeManage.Items.Count > 0) { DataTable _dt = dalNotifyType.FindAllAdminNotifyTypeByParentId(int.Parse(ddlNotifyTypeManage.SelectedValue)).Tables[0]; for (int j = 0; j < _dt.Rows.Count; j++) { ddlNotifyTypeManageChild.Items.Add(new ListItem(_dt.Rows[j]["notifyTypeName"].ToString().Trim(), _dt.Rows[j]["notifyTypeId"].ToString().Trim())); } } if (ddlNotifyTypeManageChild.Items.Count > 0) { DataListBindAdminNotify(int.Parse(ddlNotifyTypeManageChild.SelectedValue.ToString().Trim()));//默认全部绑定 } } } if (fragmentFlag.Equals("2")) { if (!IsPostBack) { //Javascript.ExcuteJavascriptCode("initBeforeUnloadEvent('温馨提示:当前页面数据可能未保存哟~(此为提示,并不代表您真正未保存数据),确定离开吗?');", Page); DalOperationAboutAdminNotifyType dalNotifyType = new DalOperationAboutAdminNotifyType(); DataTable dt = dalNotifyType.FindAllParentAdminNotifyType().Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { ListItem _item = new ListItem(dt.Rows[i]["notifyTypeName"].ToString().Trim(), dt.Rows[i]["notifyTypeId"].ToString().Trim()); ddlNotifyType.Items.Add(_item); } if (ddlNotifyType.Items.Count > 0) { DataTable _dt = dalNotifyType.FindAllAdminNotifyTypeByParentId(int.Parse(ddlNotifyType.SelectedValue)).Tables[0]; for (int j = 0; j < _dt.Rows.Count; j++) { ddlNotifyTypeChild.Items.Add(new ListItem(_dt.Rows[j]["notifyTypeName"].ToString().Trim(), _dt.Rows[j]["notifyTypeId"].ToString().Trim())); } } txtTitle.Attributes.Add("class", "required"); } } if (fragmentFlag.Equals("3")) { if (!IsPostBack) { DalOperationAboutAdminNotifyType dalNotifyType = new DalOperationAboutAdminNotifyType(); DataTable dt = dalNotifyType.FindAllParentAdminNotifyType().Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { ListItem _item = new ListItem(dt.Rows[i]["notifyTypeName"].ToString().Trim(), dt.Rows[i]["notifyTypeId"].ToString().Trim()); _item.Attributes.Add("parentId", "0"); _item.Attributes.Add("disabled", "true"); ddlNotifyType.Items.Add(_item); } if (Request["del"] != null && Request["del"] == "true" && Request["notifyTypeId"] != null) { dalNotifyType.DeleteAdminNotifyTypeById(int.Parse(Request["notifyTypeId"].ToString().Trim())); } NotifyTypeDataBind(); } } }
protected void NotifyTypeDataBind() { DalOperationAboutAdminNotifyType dalNotifyType = new DalOperationAboutAdminNotifyType(); DataView dv = dalNotifyType.FindAllParentAdminNotifyType().Tables[0].DefaultView; this.dlstNotifyTypeParent.DataSource = dv; this.dlstNotifyTypeParent.DataBind(); }
//依据文章类型,绑定第类的文章列表 protected void dlstNotifyTypeParent_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataList dataList = (DataList)e.Item.FindControl("dlstNotifyType"); DataRowView rowv = (DataRowView)e.Item.DataItem; int mainID = Convert.ToInt32(rowv["notifyTypeId"]); DalOperationAboutAdminNotifyType dalOperationAboutAdminNotifyType = new DalOperationAboutAdminNotifyType(); DataSet ds = dalOperationAboutAdminNotifyType.FindAllAdminNotifyTypeByParentId(mainID); dataList.DataSource = ds.Tables[0].DefaultView; dataList.DataBind(); } }
//第1个标签;开始 protected void ddlNotifyType_SelectedIndexChanged(object sender, EventArgs e) { while (ddlNotifyTypeChild.Items.Count > 0) { ddlNotifyTypeChild.Items.RemoveAt(0); } DalOperationAboutAdminNotifyType dalNotifyType = new DalOperationAboutAdminNotifyType(); DataTable _dt = dalNotifyType.FindAllAdminNotifyTypeByParentId(int.Parse(ddlNotifyType.SelectedValue)).Tables[0]; for (int j = 0; j < _dt.Rows.Count; j++) { ddlNotifyTypeChild.Items.Add(new ListItem(_dt.Rows[j]["notifyTypeName"].ToString().Trim(), _dt.Rows[j]["notifyTypeId"].ToString().Trim())); } }
//第1个标签;开始 protected void ddlNotifyTypeManage_SelectedIndexChanged(object sender, EventArgs e) { Javascript.ExcuteJavascriptCode("deleteBeforeUnloadEvent();", Page); while (ddlNotifyTypeManageChild.Items.Count > 0) { ddlNotifyTypeManageChild.Items.RemoveAt(0); } DalOperationAboutAdminNotifyType dalNotifyType = new DalOperationAboutAdminNotifyType(); DataTable _dt = dalNotifyType.FindAllAdminNotifyTypeByParentId(int.Parse(ddlNotifyTypeManage.SelectedValue)).Tables[0]; for (int j = 0; j < _dt.Rows.Count; j++) { ddlNotifyTypeManageChild.Items.Add(new ListItem(_dt.Rows[j]["notifyTypeName"].ToString().Trim(), _dt.Rows[j]["notifyTypeId"].ToString().Trim())); } DataListBindAdminNotify(int.Parse(ddlNotifyTypeManageChild.SelectedValue.ToString().Trim()));//默认全部绑定 }
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; } } } }
//初始化编辑页面 public void InitialNotifyEdit(int notifyId) { DalOperationAboutAdminNotify doan = new DalOperationAboutAdminNotify(); AdminNotifyInfo notify = doan.FindNotifyByNo(notifyId); if (notify == null) { Javascript.AlertAndRedirect("要修改的信息不存在,请检查!", "/Administrator/NotifyInfoManage.aspx", Page); } else { //通知或办事流程 ddlNotifyType.SelectedValue = notify.notifyTypeId.ToString().Trim(); txtTitle.Text = notify.notifyTitle; this.Textarea1.Value = notify.notifyContent; hidAttachmentId.Value = notify.attachmentIds; if (notify.attachmentIds.Length > 0) { DalOperationAttachments dalOperationAttachments = new DalOperationAttachments(); ltlAttachment.Text = dalOperationAttachments.GetAttachmentsList(notify.attachmentIds, ref iframeCount, true,string.Empty); } } DalOperationAboutAdminNotifyType dalNotifyType = new DalOperationAboutAdminNotifyType(); DataTable dt = dalNotifyType.FindAllParentAdminNotifyType().Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { ListItem _item = new ListItem(dt.Rows[i]["notifyTypeName"].ToString().Trim(), dt.Rows[i]["notifyTypeId"].ToString().Trim()); ddlNotifyType.Items.Add(_item); } if (dalNotifyType.FindParentIdById(notify.notifyTypeId).Tables[0].Rows.Count > 0) { for (int i = 0; i < ddlNotifyType.Items.Count; i++) { if (ddlNotifyType.Items[i].Value.ToString().Trim() == dalNotifyType.FindParentIdById(notify.notifyTypeId).Tables[0].Rows[0]["parentId"].ToString().Trim()) { ddlNotifyType.SelectedIndex = i; } } DataTable _dt = dalNotifyType.FindAllAdminNotifyTypeByParentId(int.Parse(ddlNotifyType.SelectedValue)).Tables[0]; for (int j = 0; j < _dt.Rows.Count; j++) { ddlNotifyTypeChild.Items.Add(new ListItem(_dt.Rows[j]["notifyTypeName"].ToString().Trim(), _dt.Rows[j]["notifyTypeId"].ToString().Trim())); } } for (int i = 0; i < ddlNotifyTypeChild.Items.Count; i++) { if (ddlNotifyTypeChild.Items[i].Value.ToString().Trim() == notify.notifyTypeId.ToString().Trim()) { ddlNotifyTypeChild.SelectedIndex = i; } } }