//绑定文章类型列表 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) { //控制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 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()));//默认全部绑定 }
//初始化编辑页面 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; } } }