//编辑部门 protected void Button2_Click(object sender, EventArgs e) { CheckboxShowUser.Visible = false; DDL_COLUMN.Visible = true; Tr_3.Visible = false; ShowUser.Visible = false; //显示可供参与的部门信息 。 project_model = project_bll.GetModel(int.Parse(Session["Work_ProjectId"].ToString())); DataTable dt_dep = new DataTable(); string sql1 = " SELECT ID, NAME FROM USER_Groups WHERE (DELFLAG = 0) AND (TAGS = '部门') ORDER BY ISMOREN "; dt_dep = pagedosql.doSql(sql1).Tables[0]; if (dt_dep.Rows.Count > 0) { CB_DepartmentID.DataSource = dt_dep.DefaultView; CB_DepartmentID.DataTextField = "NAME"; CB_DepartmentID.DataValueField = "ID"; CB_DepartmentID.DataBind(); //在项目表中的部门字段 string DepartmentID = project_model.DepartmentID.ToString(); //因为在项目表中部门以‘,’分开。故以‘,’将其分割 string[] Department = DepartmentID.Split(','); for (int i = 0; i < dt_dep.Rows.Count; i++) { for (int j = 0; j < Department.Length; j++) { if (Department[j].ToString() == CB_DepartmentID.Items[i].Value.ToString()) { CB_DepartmentID.Items[i].Selected = true; } } } } else//因为参与部门是非空项,所以如果没有可供参与的部门的话,是不可以进行项目的申请的。 { CB_DepartmentID.Enabled = false; Button_sumbit2.Enabled = false; } }
/// <summary> /// 初始化下拉列表的值 /// </summary> protected void ShowDDLInfo() { try { string CashflagID = ""; //显示项目负责人下拉列表 DataTable dt = new DataTable(); string sql = " SELECT ID,DepartMentID, USERNAME, REALNAME FROM USER_Users WHERE (DELFLAG = 0) AND (IsManager = 1 or IsManager = 9) AND (WorkStats = 1) ORDER BY REALNAME,ID "; dt = pagecontrol.doSql(sql).Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string ID = dt.Rows[i]["ID"].ToString(); string DepartMentID = dt.Rows[i]["DepartMentID"].ToString(); string REALNAME = dt.Rows[i]["REALNAME"].ToString(); string USERNAME = dt.Rows[i]["USERNAME"].ToString(); ListItem li = new ListItem(REALNAME + "(" + USERNAME + ")", ID + "|" + DepartMentID); DDL_LeaderID.Items.Add(li); if (li.Value.ToString().Split('|')[0].ToString().Equals(project_model.LeaderID)) { li.Selected = true; CashflagID = li.Value.ToString().Split('|')[0].ToString(); } } } else//因为项目负责人是非空项,如果没有项目负责人的话是不可以进行项目的申请的。 { ListItem li = new ListItem("没有可选项目负责人", ""); DDL_LeaderID.Items.Add(li); DDL_LeaderID.Enabled = false; Button_applyfor.Enabled = false; Button_reset.Enabled = false; Button_draft.Enabled = false; } //显示可供参与的部门信息 。 DataTable dt_dep = new DataTable(); string sql1 = " SELECT ID, NAME FROM USER_Groups WHERE (DELFLAG = 0) AND (TAGS = '部门') ORDER BY ISMOREN "; dt_dep = pagecontrol.doSql(sql1).Tables[0]; if (dt_dep.Rows.Count > 0) { CB_DepartmentID.DataSource = dt_dep.DefaultView; CB_DepartmentID.DataTextField = "NAME"; CB_DepartmentID.DataValueField = "ID"; CB_DepartmentID.DataBind(); //在项目表中的部门字段 string DepartmentID = project_model.DepartmentID.ToString(); //因为在项目表中部门以‘,’分开。故以‘,’将其分割 string[] Department = DepartmentID.Split(','); for (int i = 0; i < dt_dep.Rows.Count; i++) { for (int j = 0; j < Department.Length; j++) { //如果项目表中的ID=STUDENTS_SetEnrollWork[总校的招生计划总表]中的专业ID。 if (Department[j].ToString() == CB_DepartmentID.Items[i].Value.ToString()) { CB_DepartmentID.Items[i].Selected = true; //--参与部门的编辑工作放在了项目成员的功能处-唐春龙-2011-02-17 //if (DDL_LeaderID.SelectedValue.ToString().Split('|')[1].ToString().Equals(Department[j].ToString())) //{ // CB_DepartmentID.Items[i].Enabled = false; //} } } } } else//因为参与部门是非空项,所以如果没有可供参与的部门的话,是不可以进行项目的申请的。 { CB_DepartmentID.Enabled = false; Label_dep.Visible = true; Button_applyfor.Enabled = false; Button_reset.Enabled = false; Button_draft.Enabled = false; } ////根据项目负责人来动态显示资金卡下拉列表 //if (!CashflagID.Equals("")) //{ // SetDDL_CashCardID(CashflagID); //} //显示所属分类的下拉列表 DataTable dt_col = new DataTable(); //string sql2 = " SELECT ID, Names FROM Project_Columns WHERE (DELFLAG = 0) AND (UpID <> 0) "; string sql2 = " SELECT * FROM Project_Columns WHERE (DELFLAG = 0) order by COLUMNSPATH"; dt_col = pagecontrol.doSql(sql2).Tables[0]; //if (dt_col.Rows.Count > 0) //{ // for (int i = 0; i < dt_col.Rows.Count; i++) // { // ListItem li = new ListItem(dt_col.Rows[i]["Names"].ToString(), dt_col.Rows[i]["ID"].ToString()); // DDL_COLUMN.Items.Add(li); // if (li.Value.ToString().Equals(project_model.ColumnsID.ToString())) // { // li.Selected = true; // } // } //} if (dt_col.Rows.Count > 0) { for (int i = 0; i < dt_col.Rows.Count; i++) { string parentid = dt_col.Rows[i]["UpID"].ToString(); string path = dt_col.Rows[i]["COLUMNSPATH"].ToString(); if (parentid != "0") { string kg = null; int lens = path.Split('/').Length; for (int x = 0; x < lens; x++) { kg += "··"; } dt_col.Rows[i]["Names"] = kg + "|--" + dt_col.Rows[i]["Names"].ToString() + " [ " + dt_col.Rows[i]["TYPES"].ToString() + " ]"; } ListItem L1 = new ListItem(); L1.Text = dt_col.Rows[i]["Names"].ToString(); L1.Value = dt_col.Rows[i]["ID"].ToString(); DDL_COLUMN.Items.Add(L1); if (L1.Value.ToString().Equals(project_model.ColumnsID.ToString())) { L1.Selected = true; if (L1.Text.Contains("总项目")) { LB_COLUMNINFO.Text = "<a href=\"javascript:window.showModalDialog('show.aspx?ID=" + L1.Value.ToString() + "','','dialogWidth=715px;dialogHeight=250px');\" style='text-decoration: none' title='总项目分类详细信息'>显示该总项目详细</a>"; LB_COLUMNINFO.Visible = true; } else { LB_COLUMNINFO.Text = ""; LB_COLUMNINFO.Visible = false; } } } //根据所属分类动态的显示这个分类的管理人,此管理即作为项目的审核人,供项目创建者来选择。 string sql3 = " SELECT * FROM Project_Columns WHERE ID = '" + DDL_COLUMN.SelectedValue.ToString() + "'"; DataTable dt_checkuser = pagecontrol.doSql(sql3).Tables[0]; if (dt_checkuser.Rows.Count > 0) { //如果项目管理人员不为空 if (null != dt_checkuser.Rows[0]["UserID"] && !(dt_checkuser.Rows[0]["UserID"].ToString().Equals(""))) { string[] CheckUserId = dt_checkuser.Rows[0]["UserID"].ToString().Split(','); string[] CheckUserName = dt_checkuser.Rows[0]["UserInfos"].ToString().Split(','); for (int k = 0; k < CheckUserId.Length; k++) { ListItem L = new ListItem(CheckUserName[k].ToString(), CheckUserId[k].ToString()); DDL_CheckUserID.Items.Add(L); if (L.Value.ToString().Equals(project_model.DoUserID)) { L.Selected = true; } } LB_CheckUserInfo.Visible = false; } else { ListItem L = new ListItem("暂无可供选择的审批人", ""); DDL_CheckUserID.Items.Add(L); LB_CheckUserInfo.Visible = true; Button_applyfor.Enabled = false; Button_draft.Enabled = false; } } else { ListItem L = new ListItem("暂无可供选择的审批人", ""); DDL_CheckUserID.Items.Add(L); LB_CheckUserInfo.Visible = true; Button_applyfor.Enabled = false; Button_draft.Enabled = false; } } else { ListItem li = new ListItem("暂无可选分类", ""); DDL_COLUMN.Items.Add(li); ListItem L = new ListItem("暂无可供选择的审批人", ""); DDL_CheckUserID.Items.Add(L); DDL_CheckUserID.Enabled = false; DDL_COLUMN.Enabled = false; Button_applyfor.Enabled = false; Button_draft.Enabled = false; } } catch { } }
/// <summary> /// 初始化下拉列表的值 /// </summary> protected void ShowDDLInfo() { try { string CashflagID = ""; //显示项目负责人下拉列表 DataTable dt = new DataTable(); Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"]; string sql = " SELECT ID,DepartMentID, USERNAME, REALNAME FROM USER_Users WHERE (DELFLAG = 0) AND (IsManager = 1 or IsManager = 9) AND (WorkStats = 1) ORDER BY REALNAME,ID "; dt = pagecontrol.doSql(sql).Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string ID = dt.Rows[i]["ID"].ToString(); string DepartMentID = dt.Rows[i]["DepartMentID"].ToString(); string REALNAME = dt.Rows[i]["REALNAME"].ToString(); string USERNAME = dt.Rows[i]["USERNAME"].ToString(); ListItem li = new ListItem(REALNAME + "(" + USERNAME + ")", ID + "|" + DepartMentID); DDL_LeaderID.Items.Add(li); if (user_model.ID.Equals(ID)) { li.Selected = true; } } CashflagID = dt.Rows[0]["ID"].ToString(); } else//因为项目负责人是非空项,如果没有项目负责人的话是不可以进行项目的申请的。 { ListItem li = new ListItem("没有可选项目负责人", ""); DDL_LeaderID.Items.Add(li); DDL_LeaderID.Enabled = false; Button_applyfor.Enabled = false; //Button_reset.Enabled = false; Button_draft.Enabled = false; } //显示可供参与的部门信息 。 DataTable dt_dep = new DataTable(); string sql1 = " SELECT ID, NAME FROM USER_Groups WHERE (DELFLAG = 0) AND (TAGS = '部门') ORDER BY ISMOREN "; dt_dep = pagecontrol.doSql(sql1).Tables[0]; if (dt_dep.Rows.Count > 0) { CB_DepartmentID.DataSource = dt_dep.DefaultView; CB_DepartmentID.DataTextField = "NAME"; CB_DepartmentID.DataValueField = "ID"; CB_DepartmentID.DataBind(); } else//因为参与部门是非空项,所以如果没有可供参与的部门的话,是不可以进行项目的申请的。 { CB_DepartmentID.Enabled = false; Label_dep.Visible = true; Button_applyfor.Enabled = false; // Button_reset.Enabled = false; Button_draft.Enabled = false; } //根据项目负责人来动态显示资金卡下拉列表 //if (!CashflagID.Equals("")) //{ // SetDDL_CashCardID(CashflagID); //} //显示所属分类的下拉列表 DataTable dt_col = new DataTable(); //string sql2 = " SELECT * FROM Project_Columns WHERE (DELFLAG = 0) AND (UpID <> 0) order by COLUMNSPATH"; string sql2 = " SELECT * FROM Project_Columns WHERE (DELFLAG = 0) order by COLUMNSPATH"; dt_col = pagecontrol.doSql(sql2).Tables[0]; //if (dt_col.Rows.Count>0) //{ // for (int i = 0; i < dt_col.Rows.Count;i++ ) // { // ListItem li = new ListItem(dt_col.Rows[i]["Names"].ToString(), dt_col.Rows[i]["ID"].ToString()); // DDL_COLUMN.Items.Add(li); // } if (dt_col.Rows.Count > 0) { for (int i = 0; i < dt_col.Rows.Count; i++) { string parentid = dt_col.Rows[i]["UpID"].ToString(); string path = dt_col.Rows[i]["COLUMNSPATH"].ToString(); if (parentid != "0") { string kg = null; int lens = path.Split('/').Length; for (int x = 0; x < lens; x++) { kg += "··"; } dt_col.Rows[i]["Names"] = kg + "|--" + dt_col.Rows[i]["Names"].ToString() + " [ " + dt_col.Rows[i]["TYPES"].ToString() + " ]"; } ListItem L1 = new ListItem(); L1.Text = dt_col.Rows[i]["Names"].ToString(); L1.Value = dt_col.Rows[i]["ID"].ToString(); DDL_COLUMN.Items.Add(L1); } //根据所属分类动态的显示这个分类的管理人,此管理即作为项目的审核人,供项目创建者来选择。 string sql3 = " SELECT * FROM Project_Columns WHERE ID = '" + DDL_COLUMN.SelectedValue.ToString() + "'"; DataTable dt_checkuser = pagecontrol.doSql(sql3).Tables[0]; if (dt_checkuser.Rows.Count > 0) { //如果项目管理人员不为空 if (null != dt_checkuser.Rows[0]["UserID"] && !(dt_checkuser.Rows[0]["UserID"].ToString().Equals(""))) { string[] CheckUserId = dt_checkuser.Rows[0]["UserID"].ToString().Split(','); string[] CheckUserName = dt_checkuser.Rows[0]["UserInfos"].ToString().Split(','); for (int k = 0; k < CheckUserId.Length; k++) { ListItem L = new ListItem(CheckUserName[k].ToString(), CheckUserId[k].ToString()); DDL_CheckUserID.Items.Add(L); } LB_CheckUserInfo.Visible = false; } else { ListItem L = new ListItem("暂无可供选择的审批人", ""); DDL_CheckUserID.Items.Add(L); LB_CheckUserInfo.Visible = true; Button_applyfor.Enabled = false; Button_draft.Enabled = false; } } else { ListItem L = new ListItem("暂无可供选择的审批人", ""); DDL_CheckUserID.Items.Add(L); LB_CheckUserInfo.Visible = true; Button_applyfor.Enabled = false; Button_draft.Enabled = false; } } else { ListItem li = new ListItem("暂无可选分类", ""); DDL_COLUMN.Items.Add(li); ListItem L = new ListItem("暂无可供选择的审批人", ""); DDL_CheckUserID.Items.Add(L); DDL_COLUMN.Enabled = false; DDL_CheckUserID.Enabled = false; Button_applyfor.Enabled = false; Button_draft.Enabled = false; } } catch { } }