protected void btnOK_Click(object sender, System.EventArgs e) { if (CheckForm("JoinGroupID") == "") { ClientScript.RegisterClientScriptBlock(this.GetType(),"New", "<script language=javascript>alert('You not yet select group!');</script>"); GenMasterTable(); return; } string strReturn = ""; PccMsg myMsg = new PccMsg(); myMsg.CreateFirstNode("user_id", ViewState["UserID"].ToString()); myMsg.CreateFirstNode("ap_id", CheckQueryString("ApID")); myMsg.CreateFirstNode("group_str", CheckForm("JoinGroupID")); myMsg.CreateFirstNode("group_org", ViewState["group_org"].ToString()); bs_GroupManage mybs = new bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); strReturn = mybs.DoReturnStr("JoinGroupByUserID", myMsg.GetXmlStr, ""); myMsg.LoadXml(strReturn); if (myMsg.Query("returnValue") != "0") { lblMsg.Font.Size = FontUnit.Large; lblMsg.Text = myMsg.Query("errmsg"); GenMasterTable(); } else { Response.Redirect(USERMANAGE + "?ApID=" + CheckQueryString("ApID") + "&QueryCondition=" + CheckQueryString("QueryCondition")); } }
protected void btnDelOK_Click(object sender, System.EventArgs e) { plMain.Visible = true; plDelete.Visible = false; PccMsg myMsg = new PccMsg(CheckQueryString("Method")); string strGroupID = myMsg.Query("Key"); myMsg.LoadXml(); myMsg.CreateFirstNode("group_id", strGroupID); myMsg.CreateFirstNode("ap_id", CheckQueryString("ApID")); bs_GroupManage mybs = new bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); string strReturn = mybs.DoReturnStr("DeleteGroupByGroupID", myMsg.GetXmlStr, ""); myMsg.LoadXml(strReturn); if (myMsg.Query("returnValue") == "0") { GenMasterTable(); } else { ClientScript.RegisterClientScriptBlock(this.GetType(),"New", "<script language=javascript>alert('" + myMsg.Query("errmsg") + "');</script>"); } }
protected void btnOK_Click(object sender, System.EventArgs e) { if (txtGroupName.Text == "") { PccErrMsg myLabel = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"), Session["CodePage"].ToString(), "Label"); lblMsg.Text = myLabel.GetErrMsg("lbl0010", "ADTPurDoc/GroupManage"); return; } //先判斷是Insert or Update bool bUpdate = false; string group_id = ""; PccMsg myMsg = new PccMsg(); if (Request.Params["Method"] != null) { bUpdate = true; myMsg.LoadXml(Request.Params["Method"].ToString()); group_id = myMsg.Query("Key"); } myMsg.ClearContext(); myMsg.CreateFirstNode("group_id", group_id); myMsg.CreateFirstNode("ap_id", CheckQueryString("ApID")); myMsg.CreateFirstNode("group_nm", txtGroupName.Text); myMsg.CreateFirstNode("group_type", ddlGroupType.SelectedItem.Value); bs_GroupManage mybs = new bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); string strReturn = ""; if (bUpdate) { myMsg.CreateFirstNode("upd_id", Session["UserID"].ToString()); strReturn = mybs.DoReturnStr("UpdateGroupByGroupID", myMsg.GetXmlStr, ""); } else { myMsg.CreateFirstNode("add_id", Session["UserID"].ToString()); strReturn = mybs.DoReturnStr("InsertGroupByApID", myMsg.GetXmlStr, ""); } myMsg.LoadXml(strReturn); if (myMsg.Query("returnValue") == "0") { Response.Redirect(GROUPMANAGE + "?ApID=" + CheckQueryString("ApID")); } else { lblMsg.Font.Size = FontUnit.Large; lblMsg.Text = myMsg.Query("errmsg"); } }
protected void btnAddComeOn_Click(object sender, System.EventArgs e) { bs_GroupManage mybs = new bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); PccMsg myMsg = new PccMsg(); string strUserID = "", strReturn = ""; for (int i = 0; i < DataGrid1.Items.Count; i++) { if (((CheckBox)DataGrid1.Items[i].Cells[6].Controls[1]).Checked) { strUserID += DataGrid1.Items[i].Cells[1].Text + ","; } } if (strUserID != "") { strUserID = strUserID.Substring(0, strUserID.Length - 1); myMsg.LoadXml(); myMsg.CreateFirstNode("group_id", CheckQueryString("GroupID")); myMsg.CreateFirstNode("user_str", strUserID); strReturn = mybs.DoReturnStr("InsertUGrp", myMsg.GetXmlStr, ""); myMsg.LoadXml(strReturn); if (myMsg.Query("returnValue") == "0") { Response.Redirect(GROUPMANAGE + "?ApID=" + CheckQueryString("ApID") + "&QueryCondition=" + CheckQueryString("QueryCondition")); } else { lblMsg.Font.Size = FontUnit.Large; lblMsg.Text = myMsg.Query("errmsg"); } } else { PccErrMsg myLabel = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"), Session["CodePage"].ToString(), "Label"); lblMsg.Font.Size = FontUnit.Large; lblMsg.Text = myLabel.GetErrMsg("lbl0014", "SysManager/UserManager"); } }
private void UpdateMenuByGroup(string strXML) { string menu_id = ""; int i; m_menuIDArray = (string[])ViewState["MenuID"]; for (i = 0; i < m_menuIDArray.Length; i++) { menu_id += m_menuIDArray[i] + ","; } if (menu_id != "") { menu_id = menu_id.Substring(0, menu_id.Length - 1); } else { GenMasterTable(); return; } PccMsg myMsg = new PccMsg(strXML); string strRequestFormName = myMsg.Query("btnID").Split('-')[1]; string strShow = CheckForm("show_mk" + strRequestFormName); string strAdd = CheckForm("add_mk" + strRequestFormName); string strUpd = CheckForm("upd_mk" + strRequestFormName); string strDel = CheckForm("del_mk" + strRequestFormName); string strRpt = CheckForm("rpt_mk" + strRequestFormName); string strSend = CheckForm("send_mk" + strRequestFormName); string show_mk, add_mk, upd_mk, del_mk, rpt_mk, send_mk; string group_id = strRequestFormName.Substring(3); show_mk = CompareTwoStrArray(m_menuIDArray, strShow, "Y,", "N,"); add_mk = CompareTwoStrArray(m_menuIDArray, strAdd, "Y,", "N,"); upd_mk = CompareTwoStrArray(m_menuIDArray, strUpd, "Y,", "N,"); del_mk = CompareTwoStrArray(m_menuIDArray, strDel, "Y,", "N,"); rpt_mk = CompareTwoStrArray(m_menuIDArray, strRpt, "Y,", "N,"); send_mk = CompareTwoStrArray(m_menuIDArray, strSend, "Y,", "N,"); myMsg.LoadXml(); myMsg.CreateFirstNode("group_id", group_id); myMsg.CreateFirstNode("menu_str", menu_id); myMsg.CreateFirstNode("show_str", show_mk); myMsg.CreateFirstNode("add_str", add_mk); myMsg.CreateFirstNode("upd_str", upd_mk); myMsg.CreateFirstNode("del_str", del_mk); myMsg.CreateFirstNode("rpt_str", rpt_mk); myMsg.CreateFirstNode("send_str", send_mk); bs_GroupManage mybs = new bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); string strReturn = mybs.DoReturnStr("UpdateGroupdByGroupID", myMsg.GetXmlStr, ""); myMsg.LoadXml(strReturn); if (myMsg.Query("returnValue") == "0") { GenMasterTable(); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "New","<script language=javascript>alert('" + myMsg.Query("errmsg") + "');</script>"); } }
private void GenMasterTableData(ref PccErrMsg myLabel) { bs_GroupManage mybs = new bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); PccMsg myMsg = new PccMsg(); myMsg.CreateFirstNode("StartRecord", PageControl1.StartRecord.ToString()); myMsg.CreateFirstNode("PageSize", PageControl1.PageSize.ToString()); myMsg.CreateFirstNode("ap_id", Request.QueryString["ApID"]); myMsg.CreateFirstNode("group_nm", txtGroupName.Text); //加入判斷是否要有事業群之判斷20041116 string strGroupFilter = "N", strFactFilter = "N"; string strTemp = ""; myMsg.CreateFirstNode("user_id", Session["UserID"].ToString()); GetMenuAuth myAuth = new GetMenuAuth(); //判斷是否要利用事業群來分設權限 if (ConfigurationManager.AppSettings[m_apid + "-FactByGroup"] != null && ConfigurationManager.AppSettings[m_apid + "-FactByGroup"].ToString() == "Y") { //判斷此使用者是否可以分配不同的事業群權限 if (!myAuth.IsReportAuth()) { //表示他必須區分事業群 myMsg.CreateFirstNode("GroupFilter", "Y"); strGroupFilter = "Y"; } else { myMsg.CreateFirstNode("GroupFilter", "N"); } } else { myMsg.CreateFirstNode("GroupFilter", "N"); } if (ConfigurationManager.AppSettings[m_apid + "-FactFilter"] != null && ConfigurationManager.AppSettings[m_apid + "-FactFilter"].ToString() == "Y") { //表示他必須區分廠管理 20041118 注意要區別廠管理的先決條件是要區分事業群 myMsg.CreateFirstNode("FactFilter", "Y"); strFactFilter = "Y"; } string strXML = myMsg.GetXmlStr; DataSet myGroupDs = mybs.DoReturnDataSet("GetGroupbyApID", strXML, ""); DataTable myGroupData = myGroupDs.Tables["Group"]; if (myGroupData.Rows.Count > 0) { int MasterCount = 0; string MasterStyle = ""; PccMsg myTempMsg; PccRow myRow; //取出資料總筆數 PageControl1.TotalSize = myGroupDs.Tables["TCounts"].Rows[0]["Counts"].ToString(); PageControl1.BuildPager(); //明細資料類別之共同參數 myMsg.LoadXml(); myMsg.CreateFirstNode("TableClass", "ActDocTB"); myMsg.CreateFirstNode("RowHeaderClass", "TDShowHeader"); myMsg.CreateFirstNode("RowClass1", "ffd000"); myMsg.CreateFirstNode("RowClass2", "fff000"); string strClassXML = myMsg.GetXmlStr; //使用者明細資料類別之參數 string strOrgFields5 = ""; if (myAuth.IsDeleteAuth()) { strOrgFields5 = "btn-刪除-Return_Click(this)"; } string[] Fields = { "編號", "電子郵件帳號", "使用者名稱", "廠別", strOrgFields5 }; int[] FieldsPercent = { 5, 30, 20, 35, 10 }; string[] FieldsItem = { "--NO--", "email", "user_desc", "fact_nm", "user_id" }; //string[] TransFunc = {"","TransUserNm","TransUserDesc","TransFactNm",""}; string[] FieldsType = new string[5]; FieldsType[0] = "--NO--"; FieldsType[1] = "<PccMsg><Type>Text</Type></PccMsg>"; FieldsType[2] = "<PccMsg><Type>Text</Type></PccMsg>"; FieldsType[3] = "<PccMsg><Type>Text</Type></PccMsg>"; FieldsType[4] = "<PccMsg><Type>CheckBox</Type><Value>user_id</Value></PccMsg>"; //選單明細資料類別之參數 string strOrgFields8 = ""; if (myAuth.IsUpdateAuth()) { strOrgFields8 = "btn-更新送出-Return_ClickM(this)"; ; } //判斷是否為超級管理者,若是則不控管自己Menu的CheckBox權限 20041119 string strcheckbox = ""; if (Session["UserEMail"].ToString() != ConfigurationManager.AppSettings["superAdminEmail"].ToString()) strcheckbox = "CheckBoxByValueJudgeUserRight"; else strcheckbox = "CheckBoxByValue"; string[] MFields = { "編號", "選單名稱", "顯示權限", "新增權限", "更新權限", "刪除權限", "報表權限", "發信權限", strOrgFields8 }; int[] MFieldsPercent = { 5, 25, 10, 10, 10, 10, 10, 10, 10 }; string[] MFieldsItem = { "--NO--", "menu_nm", "show_mk", "add_mk", "upd_mk", "del_mk", "rpt_mk", "send_mk", "groupd_id" }; string[] MFieldsType = new string[9]; MFieldsType[0] = "--NO--"; MFieldsType[1] = "<PccMsg><Type>Text</Type></PccMsg>"; MFieldsType[2] = "<PccMsg><Type>" + strcheckbox + "</Type><Value>menu_id</Value></PccMsg>"; MFieldsType[3] = "<PccMsg><Type>" + strcheckbox + "</Type><Value>menu_id</Value></PccMsg>"; MFieldsType[4] = "<PccMsg><Type>" + strcheckbox + "</Type><Value>menu_id</Value></PccMsg>"; MFieldsType[5] = "<PccMsg><Type>" + strcheckbox + "</Type><Value>menu_id</Value></PccMsg>"; MFieldsType[6] = "<PccMsg><Type>" + strcheckbox + "</Type><Value>menu_id</Value></PccMsg>"; MFieldsType[7] = "<PccMsg><Type>" + strcheckbox + "</Type><Value>menu_id</Value></PccMsg>"; MFieldsType[8] = "<PccMsg><Type>Space</Type></PccMsg>"; //要取得明細資料的Table變數 DataTable tblUserGroup, tblMenuGroup; //再利用此Table再取得其每一列的資料,再Gen出主要的Table Row. foreach (DataRow myMasterRow in myGroupData.Rows) { if (MasterCount % 2 == 0) MasterStyle = "cssGridRowAlternating"; else MasterStyle = "cssGridRow"; myRow = new PccRow("", HorizontalAlign.Center, 0, 0); myRow.SetRowCss(MasterStyle); //編號 myRow.AddTextCell(PageControl1.ListCount, 10); //群組名稱(點選群組名稱可把使用者加入此群組) myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("ToolTip", myMasterRow["group_nm"].ToString()); myTempMsg.CreateFirstNode("LinkID", "ULink" + myMasterRow["group_id"].ToString()); myTempMsg.CreateFirstNode("Href", USERADDCOMEON + "?ApID=" + CheckQueryString("ApID") + "&GroupID=" + myMasterRow["group_id"].ToString() + "&GroupNm=" + myMasterRow["group_nm"].ToString() + "&QueryCondition=" + GetQueryCondition()); myTempMsg.CreateFirstNode("Text", myMasterRow["group_nm"].ToString()); myRow.AddLinkHrefCell(myTempMsg.GetXmlStr, 60); //檢視使用者 myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("ToolTip", myLabel.GetErrMsg("lbl0020", "ADTPurDoc/GroupManage")); myTempMsg.CreateFirstNode("LinkID", "HLinkViewU" + myMasterRow["group_id"].ToString()); myTempMsg.CreateFirstNode("Image", Session["PageLayer"] + "images/detal.gif"); myTempMsg.CreateFirstNode("ClickFun", "doSection(view_U" + MasterCount.ToString() + ")"); myRow.AddLinkCell(myTempMsg.GetXmlStr, 10); //檢視選單 myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("ToolTip", myLabel.GetErrMsg("lbl0021", "ADTPurDoc/GroupManage")); myTempMsg.CreateFirstNode("LinkID", "HLinkViewM" + myMasterRow["group_id"].ToString()); myTempMsg.CreateFirstNode("Image", Session["PageLayer"] + "images/detal.gif"); myTempMsg.CreateFirstNode("ClickFun", "doSection(view_M" + MasterCount.ToString() + ")"); myRow.AddLinkCell(myTempMsg.GetXmlStr, 10); //群組管理 myTempMsg.LoadXml(); //加入群組管理修改及刪除的Item if (myAuth.IsUpdateAuth()) { myTempMsg.CreateNode("LinkButton"); myTempMsg.AddToNode("Image", Session["PageLayer"] + "images/edit.gif"); myTempMsg.AddToNode("ToolTip", "修改群組"); myTempMsg.AddToNode("href", GROUPADDNEW + "?ApID=" + Request.Params["ApID"].ToString()); myTempMsg.AddToNode("QueryCondition", GetQueryCondition()); myTempMsg.AddToNode("Method", GetMethod("MasterUpdateFunc", "group_id", "group_nm", myMasterRow)); myTempMsg.UpdateNode(); } if (myAuth.IsDeleteAuth()) { myTempMsg.CreateNode("LinkButton"); myTempMsg.AddToNode("Image", Session["PageLayer"] + "images/del.gif"); myTempMsg.AddToNode("ToolTip", "刪除群組"); myTempMsg.AddToNode("href", GROUPMANAGE + "?ApID=" + Request.Params["ApID"].ToString()); myTempMsg.AddToNode("QueryCondition", GetQueryCondition()); myTempMsg.AddToNode("Method", GetMethod("MasterDelFunc", "group_id", "group_nm", myMasterRow)); myTempMsg.UpdateNode(); } myRow.AddMultiLinkCell(myTempMsg.GetXmlStr, 10); tblGroup.Rows.Add(myRow.Row); //設定使用者明細資料類別之參數 strTemp = "<PccMsg>"; strTemp += "<group_id>" + myMasterRow["group_id"].ToString() + "</group_id>"; strTemp += "<ap_id>" + m_apid + "</ap_id>"; strTemp += "<user_id>" + Session["UserID"].ToString() + "</user_id>"; strTemp += "<GroupFilter>" + strGroupFilter + "</GroupFilter>"; strTemp += "<FactFilter>" + strFactFilter + "</FactFilter>"; strTemp += "</PccMsg>"; tblUserGroup = mybs.DoReturnDataSet("GetUserByGroupID", strTemp, "").Tables["UserGroup"]; PccDetailTable myDTable = new PccDetailTable("UDT" + myMasterRow["group_id"].ToString()); myDTable.ClassXML = strClassXML; myDTable.Fields = Fields; myDTable.FieldsPercent = FieldsPercent; myDTable.FieldsItem = FieldsItem; myDTable.FieldsType = FieldsType; myDTable.NewDataTable = tblUserGroup; //myDTable.TransFunc = TransFunc; //myDTable.objThis = this; myDTable.Create(); myRow.Reset(); myRow.SetRowCss("off"); myRow.SetRowID("view_U" + MasterCount); myRow.SetDefaultCellData("DGridTD", HorizontalAlign.Center, 0, 10); myRow.AddControl(myDTable.NewTable, 100); tblGroup.Rows.Add(myRow.Row); //設定選單明細資料類別之參數 tblMenuGroup = mybs.DoReturnDataSet("GetMenuByGroupID", "<PccMsg><group_id>" + myMasterRow["group_id"].ToString() + "</group_id></PccMsg>", "").Tables["MenuGroup"]; PccDetailTable myMDTable = new PccDetailTable("MDT" + myMasterRow["group_id"].ToString()); myMDTable.ClassXML = strClassXML; myMDTable.Fields = MFields; myMDTable.FieldsPercent = MFieldsPercent; myMDTable.FieldsItem = MFieldsItem; myMDTable.FieldsType = MFieldsType; myMDTable.NewDataTable = tblMenuGroup; myMDTable.Create(); if (m_menuIDArray == null) { m_menuIDArray = myMDTable.GetDataArray("menu_id"); ViewState["MenuID"] = m_menuIDArray; } myRow.Reset(); myRow.SetRowCss("off"); myRow.SetRowID("view_M" + MasterCount); myRow.SetDefaultCellData("DGridTD", HorizontalAlign.Center, 0, 10); myRow.AddControl(myMDTable.NewTable, 100); tblGroup.Rows.Add(myRow.Row); MasterCount += 1; } // end of foreach datarow } // end of if table count is 0 else { PageControl1.TotalSize = "0"; PageControl1.BuildPager(); } }
private void DeleteUserByGroup(string strXML) { PccMsg myMsg = new PccMsg(strXML); string strRequestFormName = myMsg.Query("btnID"); strRequestFormName = strRequestFormName.Split('-')[1]; string strUserID = CheckForm(strRequestFormName); if (strUserID != "") { string group_id = strRequestFormName.Substring(3); myMsg.ClearContext(); myMsg.CreateFirstNode("group_id", group_id); myMsg.CreateFirstNode("user_str", strUserID); bs_GroupManage mybs = new bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); string strReturn = mybs.DoReturnStr("DeleteUGrp", myMsg.GetXmlStr, ""); myMsg.LoadXml(strReturn); if (myMsg.Query("returnValue") == "0") { GenMasterTable(); } else { ClientScript.RegisterClientScriptBlock(this.GetType(),"New", "<script language=javascript>alert('" + myMsg.Query("errmsg") + "');</script>"); } } else { GenMasterTable(); } }
private void SetData(ref PccCommonForC.PccMsg myMsg) { PccMsg myMsg1 = new PccMsg(); myMsg1.CreateFirstNode("group_id", myMsg.Query("Key")); bs_GroupManage mybs = new bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); DataSet dsReturn = mybs.DoReturnDataSet("GetGroupByGroupID", myMsg1.GetXmlStr, ""); if (dsReturn != null) { DataTable dt = dsReturn.Tables["Group"]; txtGroupName.Text = dt.Rows[0]["group_nm"].ToString(); ddlGroupType.SelectedIndex = -1; ddlGroupType.Items.FindByValue(dt.Rows[0]["group_type"].ToString()).Selected = true; } else { lblMsg.Font.Size = FontUnit.Large; lblMsg.Text = "載入資料錯誤"; } }
private DropDownList GetGroup(string ask_id) { PccMsg myMsg = new PccMsg(); myMsg.CreateFirstNode("ap_id", m_apid); myMsg.CreateFirstNode("group_nm", ""); GetMenuAuth myAuth = new GetMenuAuth(); //判斷是否要利用事業群來分設權限 20041118 myMsg.CreateFirstNode("user_id", Session["UserID"].ToString()); if (ConfigurationManager.AppSettings[m_apid + "-FactByGroup"] != null && ConfigurationManager.AppSettings[m_apid + "-FactByGroup"].ToString() == "Y") { //判斷此使用者是否可以分配不同的事業群權限 if (!myAuth.IsReportAuth()) { //表示他必須區分事業群 myMsg.CreateFirstNode("GroupFilter", "Y"); } else { myMsg.CreateFirstNode("GroupFilter", "N"); } } else { myMsg.CreateFirstNode("GroupFilter", "N"); } bs_GroupManage mybsGroup = new bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); DataTable dt = mybsGroup.DoReturnDataSet("GetAllGroupByApID", myMsg.GetXmlStr, "").Tables["Group"]; DataRow myRow = dt.NewRow(); myRow["group_id"] = 0; myRow["group_nm"] = "--請選擇--"; myRow["group_type"] = "0"; dt.Rows.InsertAt(myRow, 0); DropDownList myddlGroup = new DropDownList(); myddlGroup.ID = "ddlGroup"; myddlGroup.Attributes.Add("onChange", "GroupChange(this)"); //myddlGroup.Enabled = false; myddlGroup.DataSource = dt.DefaultView; myddlGroup.DataTextField = "group_nm"; myddlGroup.DataValueField = "group_id"; myddlGroup.DataBind(); return myddlGroup; }
protected void btnQuery_Click(object sender, System.EventArgs e) { bs_GroupManage mybs = new bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); //BindDataGrid("user_desc",txtUserDesc.Text,ddldept_id.SelectedItem.Value,ref mybs); BindDataGrid("user_desc", txtUserDesc.Text, ddlfact_id.SelectedItem.Value, ref mybs); }
private void BindDataGrid(string strOrder, string strUserDesc, string strFactID, ref bs_GroupManage mybs) { PccMsg myMsg = new PccMsg(); myMsg.CreateFirstNode("ap_id", CheckQueryString("ApID")); myMsg.CreateFirstNode("group_id", CheckQueryString("GroupID")); myMsg.CreateFirstNode("fact_id", strFactID); myMsg.CreateFirstNode("user_desc", strUserDesc); myMsg.CreateFirstNode("order", strOrder); //加入判斷是否要有事業群之判斷20041116 myMsg.CreateFirstNode("user_id", Session["UserID"].ToString()); GetMenuAuth myAuth = new GetMenuAuth(); myAuth.AspxFile = "GroupManage104.aspx"; //判斷是否要利用事業群來分設權限 if (ConfigurationManager.AppSettings[m_apid + "-FactByGroup"] != null && ConfigurationManager.AppSettings[m_apid + "-FactByGroup"].ToString() == "Y") { //判斷此使用者是否可以分配不同的事業群權限 if (!myAuth.IsReportAuth()) { //表示他必須區分事業群 myMsg.CreateFirstNode("GroupFilter", "Y"); } else { myMsg.CreateFirstNode("GroupFilter", "N"); } } else { myMsg.CreateFirstNode("GroupFilter", "N"); } if (ConfigurationManager.AppSettings[m_apid + "-FactFilter"] != null && ConfigurationManager.AppSettings[m_apid + "-FactFilter"].ToString() == "Y") { //表示他必須區分廠管理 20041118 注意要區別廠管理的先決條件是要區分事業群 myMsg.CreateFirstNode("FactFilter", "Y"); } DataSet ds = mybs.DoReturnDataSet("GetAnotherUserByGroup", myMsg.GetXmlStr, ""); ViewState["order"] = strOrder; if (ds != null) { DataGrid1.DataSource = ds.Tables["AnotherUserByGroup"].DefaultView; DataGrid1.DataBind(); } else { btnAddComeOn.Visible = false; } }
protected void Page_Load(object sender, System.EventArgs e) { if (Session["UserID"] == null) return; // 將使用者程式碼置於此以初始化網頁 m_apid = Request.QueryString["ApID"].ToString(); if (!IsPostBack) { //lblTitle.Text = "請選擇欲加入<font color=blue>" + Request.Params["GroupNm"] + "</font>群組的使用者"; //設定抬頭 20040607 for (int i = 0; i < Header1.Controls.Count; i++) { if (Header1.Controls[i].ID == "PccTitle") { Label mylblTitle = (Label)(Header1.Controls[i]); mylblTitle.Text = "請選擇欲加入<font color=blue>" + Request.Params["GroupNm"] + "</font>群組的使用者"; } } PccErrMsg myLabel = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"), Session["CodePage"].ToString(), "Label"); bs_GroupManage mybs = new bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); bs_UserManager myUbs = new bs_UserManager(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); SetLabel(ref myLabel); BindFactData(ref myLabel, ref myUbs); //SetddlDept(ref myLabel,ref myUbs); BindDataGrid("user_desc", "", "0", ref mybs); } else { PanelGrid.Visible = true; } }