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 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 (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 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 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(); } }