protected void Button1_Click(object sender, System.EventArgs e) { if (ViewState["CurrentValue"] == null && tab_fact.Rows.Count == 0) return; Temporary(); string strFactNo = ""; bs_UserFactManage mybs = new bs_UserFactManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); strFactNo = Session["Facttemporary"].ToString(); if (strFactNo.Length == 0) { ClientScript.RegisterClientScriptBlock(this.GetType(),"New", "<script language=javascript>alert('您還未選擇任何廠別唷!');</script>"); GenMasterTable(); return; } PccMsg myMsg = new PccMsg(); myMsg.CreateFirstNode("ap_id", m_ap_id); myMsg.CreateFirstNode("no_str", strFactNo); myMsg.CreateFirstNode("upd_id", Session["UserID"].ToString()); string strReturn = mybs.DoReturnStr("PickMultiFact", myMsg.GetXmlStr, ""); myMsg.LoadXml(strReturn); if (myMsg.Query("returnValue") != "0") { lblMsg.Font.Size = 12; lblMsg.Text = myMsg.Query("errmsg"); } else { Response.Redirect(USERFACTMANAGE + "?ApID=" + m_ap_id); } }
protected void Button1_Click(object sender, System.EventArgs e) { if (ViewState["CurrentValue"] == null && tab_user.Rows.Count == 0) return; Temporary(); string strUser = ""; bs_UserFactManage mybs = new bs_UserFactManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); strUser = Session["Usertemporary"].ToString(); if (strUser.Length == 0) { ClientScript.RegisterClientScriptBlock(this.GetType(),"New", "<script language=javascript>alert('您還未選擇任何使用者唷!');</script>"); GenMasterTable(); return; } PccMsg myMsg = new PccMsg(); myMsg.CreateFirstNode("ap_id", m_ap_id); myMsg.CreateFirstNode("fact_id", m_fact_id); myMsg.CreateFirstNode("user_str", strUser); if (ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"] != null) //myMsg.CreateFirstNode("FactByGroup",ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"].ToString()); // ting myMsg.CreateFirstNode("FactByGroup", ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"].ToString() + "&QueryCondition=" + Request.QueryString["QueryCondition"]); else myMsg.CreateFirstNode("FactByGroup", "N"); myMsg.CreateFirstNode("upd_id", Session["UserID"].ToString()); string strReturn = mybs.DoReturnStr("PickMultiUserFact", myMsg.GetXmlStr, ""); myMsg.LoadXml(strReturn); if (myMsg.Query("returnValue") != "0") { lblMsg.Font.Size = 12; lblMsg.Text = myMsg.Query("errmsg"); return; } else { //Response.Redirect(PICKUSER + "?ApID=" + m_ap_id); // ting Response.Redirect(PICKUSER + "?ApID=" + m_ap_id + "&QueryCondition=" + Request.QueryString["QueryCondition"]); } }
protected void btnDelOK_Click(object sender, System.EventArgs e) { plMain.Visible = true; plDelete.Visible = false; PccMsg myMsg = new PccMsg(CheckRequestQueryString("Method")); PccMsg myReturnMsg = new PccMsg(); string strUserID = myMsg.Query("Key"); myMsg.LoadXml(); myMsg.CreateFirstNode("user_id", strUserID); myMsg.CreateFirstNode("ap_id", CheckRequestQueryString("ApID")); //增加一個刪除e_userfact的關連 20040924 myMsg.CreateFirstNode("upd_id", Session["UserID"].ToString()); myMsg.CreateFirstNode("fact_id", "0"); myMsg.CreateFirstNode("uf_id", "0"); bs_UserFactManage mybs1 = new bs_UserFactManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); string strReturn = mybs1.DoReturnStr("DeleteUserFactByUser", myMsg.GetXmlStr, ""); myReturnMsg.LoadXml(strReturn); if (myReturnMsg.Query("returnValue") != "0") { ClientScript.RegisterClientScriptBlock(this.GetType(),"New", "<script language=javascript>alert('" + myMsg.Query("errmsg") + "');</script>"); return; } bs_UserManager mybs = new bs_UserManager(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); strReturn = mybs.DoReturnStr("DeleteUserByApID", myMsg.GetXmlStr, ""); myReturnMsg.LoadXml(strReturn); if (myReturnMsg.Query("returnValue") == "0") { GenMasterTable(); } else { ClientScript.RegisterClientScriptBlock(this.GetType(),"New", "<script language=javascript>alert('" + myMsg.Query("errmsg") + "');</script>"); } }
private string GetFactNoByFactID(string fact_id) { PccMsg myMsg = new PccMsg(); myMsg.CreateFirstNode("ap_id","0"); myMsg.CreateFirstNode("fact_no",""); myMsg.CreateFirstNode("fact_nm",""); bs_UserFactManage mybs = new bs_UserFactManage(ConfigurationSettings.AppSettings["ConnectionType"] , ConfigurationSettings.AppSettings["ConnectionServer"], ConfigurationSettings.AppSettings["ConnectionDB"], ConfigurationSettings.AppSettings["ConnectionUser"], ConfigurationSettings.AppSettings["ConnectionPwd"],Session["UserIDAndName"].ToString(),ConfigurationSettings.AppSettings["EventLogPath"]); DataSet ds = mybs.DoReturnDataSet("GetQFactByApID",myMsg.GetXmlStr,""); DataTable dt = ds.Tables["QFact"]; DataRow[] drs = dt.Select("fact_id = " + fact_id); return drs[0]["fact_no"].ToString(); }
private void GenMasterTableData(ref PccErrMsg myLabel) { PccErrMsg myErrMsg = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"), Session["CodePage"].ToString(), "Error"); bs_UserFactManage mybs = new bs_UserFactManage(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("ap_id", m_ap_id); myMsg.CreateFirstNode("fact_id", m_fact_id); myMsg.CreateFirstNode("Ufact_id", listfact.SelectedItem.Value.ToString()); myMsg.CreateFirstNode("user_desc", txtuser.Text); if (ConfigurationManager.AppSettings[m_ap_id + "-UserMultiFact"] != null) myMsg.CreateFirstNode("UserMultiFact", ConfigurationManager.AppSettings[m_ap_id + "-UserMultiFact"]); else myMsg.CreateFirstNode("UserMultiFact", "Y"); myMsg.CreateFirstNode("StartRecord", PageControl1.StartRecord.ToString()); myMsg.CreateFirstNode("PageSize", PageControl1.PageSize.ToString()); myMsg.CreateFirstNode("user_id", Session["UserID"].ToString()); DataSet ds; //判斷是否要利用事業群來分設權限 20041125 GetMenuAuth myAuth = new GetMenuAuth(); myAuth.AspxFile = PICKUSER; myMsg.CreateFirstNode("order", ""); if (ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"] != null && ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"].ToString() == "Y") { //判斷此使用者是否可以分配不同的事業群權限 if (!myAuth.IsReportAuth()) { //表示他必須區分事業群 myMsg.CreateFirstNode("GroupFilter", "Y"); } else { myMsg.CreateFirstNode("GroupFilter", "N"); } } else { myMsg.CreateFirstNode("GroupFilter", "N"); } if (ConfigurationManager.AppSettings[m_ap_id + "-FactFilter"] != null && ConfigurationManager.AppSettings[m_ap_id + "-FactFilter"].ToString() == "Y") { //表示他必須區分廠管理 20041125 注意要區別廠管理的先決條件是要區分事業群 if (myAuth.IsSendAuth()) //表示若有Report及Send的權限則其為群管理者 { myMsg.CreateFirstNode("FactFilter", "N"); } else { myMsg.CreateFirstNode("FactFilter", "Y"); } } else { myMsg.CreateFirstNode("FactFilter", "N"); } ds = mybs.DoReturnDataSet("GetUserByApIDAndUserGroupIn", myMsg.GetXmlStr, ""); /*string strSp = ""; //判斷是否要利用事業群來分設權限 if (ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"] != null && ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"].ToString() == "Y") { //判斷此使用者是否可以分配不同的事業群權限 if (myAuth.IsReportAuth()) strSp = "GetUserForAp"; else strSp = "GetUserForUserGroupAndAp"; } else { strSp = "GetUserForAp"; } ds = mybs.DoReturnDataSet(strSp, myMsg.GetXmlStr, "");*/ DataTable myTable = ds.Tables["User"]; PccRow myRow; if (myTable.Rows.Count > 0) { int MasterCount = 1; string MasterStyle = ""; //取出資料總筆數 PageControl1.TotalSize = ds.Tables["GetUserCount"].Rows[0]["Counts"].ToString(); PageControl1.BuildPager(); string cVal = ""; foreach (DataRow myMasterRow in myTable.Rows) { if (MasterCount % 2 == 0) MasterStyle = "eee000"; else MasterStyle = "fff000"; myRow = new PccRow(MasterStyle, HorizontalAlign.Center, VerticalAlign.Middle, 0); //勾選值 == string chk = ""; string userid = ""; //session("")不是Nothing 也不是 ""時則執行 if (Session["Usertemporary"] != null && Session["Usertemporary"].ToString() != "") { string[] chkarray = Session["Usertemporary"].ToString().Split(','); userid = ((int)decimal.Parse(myMasterRow["user_id"].ToString())).ToString(); for (int i = 0; i < chkarray.Length; i++) { if (userid == chkarray[i].ToString()) { chk = "checked"; cVal += userid + ","; } } } //編號 myRow.AddTextCell(PageControl1.ListCount, 5); //管理者名稱 myRow.AddTextCell(myMasterRow["user_desc"].ToString(), 10); //廠別 myRow.AddTextCell(myMasterRow["fact_nm"].ToString(), 35); //事業群 myRow.AddTextCell(myMasterRow["fgrp_nm"].ToString(), 15); //Email myRow.AddTextCell(myMasterRow["email"].ToString(), 30); //選取 myRow.AddTextCell("<input type=checkbox name=user_id id=user_id" + MasterCount + " value=" + ((int)decimal.Parse(myMasterRow["user_id"].ToString())).ToString() + " " + chk + ">", 5); tab_user.Controls.Add(myRow.Row); MasterCount += 1; } Session["chkcount"] = MasterCount; ViewState["CurrentValue"] = ""; if (cVal != "") { ViewState["CurrentValue"] = cVal.Substring(0, cVal.Length - 1); } } else { PageControl1.TotalSize = "0"; Session["chkcount"] = 0; PageControl1.BuildPager(); myRow = new PccRow("DGridTD", HorizontalAlign.Center, VerticalAlign.Middle, 5); myRow.AddTextCell("<b><font color='darkred'>" + myErrMsg.GetErrMsg("AdtWeb/msg0073") + "</font></b>", 100); tab_user.Controls.Add(myRow.Row); } }
private void GenMasterTableData(ref PccErrMsg myLabel) { PccErrMsg myErrMsg = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"), Session["CodePage"].ToString(), "Error"); bs_UserFactManage mybs = new bs_UserFactManage(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("ap_id", m_ap_id); myMsg.CreateFirstNode("user_id", Session["UserID"].ToString()); //取得要設定的這個使用者 20041125 myMsg.CreateFirstNode("set_user_id", m_user_id); myMsg.CreateFirstNode("fact_no", txtfactno.Text); myMsg.CreateFirstNode("fact_nm", txtfactnm.Text); if (ConfigurationManager.AppSettings[m_ap_id + "-UserMultiFact"] != null) myMsg.CreateFirstNode("UserMultiFact", ConfigurationManager.AppSettings[m_ap_id + "-UserMultiFact"]); else myMsg.CreateFirstNode("UserMultiFact", "Y"); myMsg.CreateFirstNode("StartRecord", PageControl1.StartRecord.ToString()); myMsg.CreateFirstNode("PageSize", PageControl1.PageSize.ToString()); DataSet ds; //以後可以加入若是有Report和Send的權限,表示是群管理者,所以可以看到這個群的所有資料 20041125 GetMenuAuth myAuth = new GetMenuAuth(); myAuth.AspxFile = USERFACTMANAGE; myMsg.CreateFirstNode("order", ""); //判斷是否要利用事業群來分設權限 20041124 if (ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"] != null && ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"].ToString() == "Y") { //判斷此使用者是否可以分配不同的事業群權限 if (!myAuth.IsReportAuth()) { //表示他必須區分事業群 myMsg.CreateFirstNode("GroupFilter", "Y"); } else { myMsg.CreateFirstNode("GroupFilter", "N"); } } else { myMsg.CreateFirstNode("GroupFilter", "N"); } if (ConfigurationManager.AppSettings[m_ap_id + "-FactFilter"] != null && ConfigurationManager.AppSettings[m_ap_id + "-FactFilter"].ToString() == "Y") { //表示他必須區分廠管理 20041125 注意要區別廠管理的先決條件是要區分事業群 if (myAuth.IsSendAuth()) //表示若有Report及Send的權限則其為群管理者 myMsg.CreateFirstNode("FactFilter", "N"); else myMsg.CreateFirstNode("FactFilter", "Y"); } else { myMsg.CreateFirstNode("FactFilter", "N"); } /*GetMenuAuth myAuth = new GetMenuAuth(); myAuth.AspxFile = USERFACTMANAGE; string strSp = ""; bool isGroupFilter = true; //判斷是否要利用事業群來分設權限 if (ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"] != null && ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"].ToString() == "Y") { //判斷此使用者是否可以分配不同的事業群權限 if (myAuth.IsReportAuth()) isGroupFilter = false; else isGroupFilter = true; } else { isGroupFilter = false; } //再判斷廠別和使用者是否只能一對一 if (ConfigurationManager.AppSettings[m_ap_id + "-UserMultiFact"] != null && ConfigurationManager.AppSettings[m_ap_id + "-UserMultiFact"].ToString() != "Y") { if (isGroupFilter) strSp = "GetQFactForGroupUserAndApJustOnly"; //要分事業群又要一對一 else strSp = "GetQFactForApJustOnly"; //不要分事業群但要一對一 } else { if (isGroupFilter) strSp = "GetQFactByUserGroupAndApID"; //要分事業群多對多 else strSp = "GetQFactByApID"; //不要分事業群多對多 } ds = mybs.DoReturnDataSet(strSp, myMsg.GetXmlStr, "");*/ ds = mybs.DoReturnDataSet("GetQFactByApIDAndUserGroupIn", myMsg.GetXmlStr, ""); DataTable myTable = ds.Tables["QFact"]; PccRow myRow; if (myTable.Rows.Count > 0) { int MasterCount = 1; string MasterStyle = ""; //取出資料總筆數 PageControl1.TotalSize = ds.Tables["GetQFactCount"].Rows[0]["Counts"].ToString(); PageControl1.BuildPager(); string cVal = ""; foreach (DataRow myMasterRow in myTable.Rows) { if (MasterCount % 2 == 0) MasterStyle = "eee000"; else MasterStyle = "fff000"; myRow = new PccRow(MasterStyle, HorizontalAlign.Center, VerticalAlign.Middle, 0); //勾選值 == string chk = ""; string factid = ""; //session("")不是Nothing 也不是 ""時則執行 if (Session["Fact1Temporary"] != null && Session["Fact1Temporary"].ToString() != "") { string[] chkarray = Session["Fact1Temporary"].ToString().Split(','); factid = myMasterRow["fact_id"].ToString().Trim(); for (int i = 0; i < chkarray.Length; i++) { if (factid == chkarray[i].ToString()) { chk = "checked"; cVal += factid + ","; } } } //編號 myRow.AddTextCell(PageControl1.ListCount, 5); //廠別編號 myRow.AddTextCell(myMasterRow["fact_no"].ToString(), 20); //廠別名稱 myRow.AddTextCell(myMasterRow["fact_nm"].ToString(), 55); //事業群 myRow.AddTextCell(myMasterRow["fgrp_nm"].ToString(), 15); //選取 myRow.AddTextCell("<input type=checkbox name=fact_id id=fact_id" + MasterCount + " value=" + ((int)decimal.Parse(myMasterRow["fact_id"].ToString())).ToString() + " " + chk + ">", 5); tab_fact.Controls.Add(myRow.Row); MasterCount += 1; } Session["chkcount"] = MasterCount; ViewState["CurrentValue"] = ""; if (cVal != "") { ViewState["CurrentValue"] = cVal.Substring(0, cVal.Length - 1); } } else { PageControl1.TotalSize = "0"; Session["chkcount"] = 0; PageControl1.BuildPager(); myRow = new PccRow("DGridTD", HorizontalAlign.Center, VerticalAlign.Middle, 5); myRow.AddTextCell("<b><font color='darkred'>" + myErrMsg.GetErrMsg("AdtWeb/msg0073") + "</font></b>", 100); tab_fact.Controls.Add(myRow.Row); } }
private void SendToBsByDelUser() { bs_UserFactManage mybs = new bs_UserFactManage(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("ap_id", m_ap_id); myMsg.CreateFirstNode("user_id", "0"); myMsg.CreateFirstNode("fact_id", "0"); myMsg.CreateFirstNode("uf_id", txtfact.Value); myMsg.CreateFirstNode("upd_id", Session["UserID"].ToString()); string strReturn = mybs.DoReturnStr("DeleteUserFactByUser", myMsg.GetXmlStr, ""); myMsg.LoadXml(strReturn); if (myMsg.Query("returnValue") == "0") { lblMsg.Text = ""; //Response.Redirect(USERFACTMANAGE + "?ApID=" + m_ap_id); // ting Response.Redirect(USERFACTMANAGE + "?ApID=" + m_ap_id + "&QueryCondition=" + GetQueryCondition()); } else { lblMsg.Font.Size = 12; lblMsg.Text = myMsg.Query("errmsg"); } }
private void GenMasterTableData(ref PccErrMsg myLabel) { PccErrMsg myErrMsg = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"), Session["CodePage"].ToString(), "Error"); bs_UserFactManage mybs = new bs_UserFactManage(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(); PccMsg myTempMsg; myMsg.CreateFirstNode("ap_id", m_ap_id); myMsg.CreateFirstNode("fact_no", txtfactno.Text); myMsg.CreateFirstNode("fact_nm", txtfactnm.Text); myMsg.CreateFirstNode("StartRecord", PageControl1.StartRecord.ToString()); myMsg.CreateFirstNode("PageSize", PageControl1.PageSize.ToString()); myMsg.CreateFirstNode("user_id", Session["UserID"].ToString()); //以後可以加入若是有Report和Send的權限,表示是群管理者,所以可以看到這個群的所有資料 20041125 string strGroupFilter = "Y", strFactFilter = "Y"; GetMenuAuth myAuth = new GetMenuAuth(); myMsg.CreateFirstNode("order", ""); //判斷是否要利用事業群來分設權限 20041124 if (ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"] != null && ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"].ToString() == "Y") { //判斷此使用者是否可以分配不同的事業群權限 if (!myAuth.IsReportAuth()) { //表示他必須區分事業群 myMsg.CreateFirstNode("GroupFilter", "Y"); strGroupFilter = "Y"; } else { myMsg.CreateFirstNode("GroupFilter", "N"); strGroupFilter = "N"; } } else { myMsg.CreateFirstNode("GroupFilter", "N"); strGroupFilter = "N"; } if (ConfigurationManager.AppSettings[m_ap_id + "-FactFilter"] != null && ConfigurationManager.AppSettings[m_ap_id + "-FactFilter"].ToString() == "Y") { //表示他必須區分廠管理 20041125 注意要區別廠管理的先決條件是要區分事業群 if (myAuth.IsSendAuth()) //表示若有Report及Send的權限則其為群管理者 { myMsg.CreateFirstNode("FactFilter", "N"); strFactFilter = "N"; } else { myMsg.CreateFirstNode("FactFilter", "Y"); strFactFilter = "Y"; } } else { myMsg.CreateFirstNode("FactFilter", "N"); strFactFilter = "N"; } DataSet ds = mybs.DoReturnDataSet("GetQFactByApIDAndUserGroup", myMsg.GetXmlStr, ""); DataTable myTable = ds.Tables["QFact"]; PccRow myRow; if (myTable.Rows.Count > 0) { int MasterCount = 0; string MasterStyle = ""; //取出資料總筆數 PageControl1.TotalSize = ds.Tables["GetQFactCount"].Rows[0]["Counts"].ToString(); PageControl1.BuildPager(); //明細資料類別之共同參數 myMsg.LoadXml(); myMsg.CreateFirstNode("TableClass", "cssGridTable"); myMsg.CreateFirstNode("RowHeaderClass", "TDShowHeader"); myMsg.CreateFirstNode("RowClass1", "ffd000"); myMsg.CreateFirstNode("RowClass2", "cssGridRow"); string strClassXML = myMsg.GetXmlStr; //XmlElement myNode; //明細資料的欄位參數 string[] MFields = { "編號", "使用者", "廠別", "電子郵件帳號", "刪除" }; int[] MFieldsPercent = { 5, 15, 40, 30, 10 }; //string[] MFieldsItem = {"--NO--", "user_desc","fact_nm","email","uf_id$user_desc"}; string[] MFieldsItem = { "--NO--", "user_desc", "fact_nm", "email", "uf_id" }; string[] MFieldType = new string[5]; MFieldType[0] = "--NO--"; MFieldType[1] = "<PccMsg><Type>Text</Type></PccMsg>"; MFieldType[2] = "<PccMsg><Type>Text</Type></PccMsg>"; MFieldType[3] = "<PccMsg><Type>Text</Type></PccMsg>"; //設定明細欄位中多個Link Image的參數 myMsg.LoadXml(); //因為要設定其相關權限已改由廠群組來設定,所以在此不能再有刪除的動作了 20050529 /*if (myAuth.IsDeleteAuth()) { myMsg.CreateFirstNode("Type","MultiLink"); myMsg.CreateNode("LinkButton"); myMsg.AddToNode("Image",Session["PageLayer"] + "images/del.gif"); myMsg.AddToNode("ToolTip","刪除此使用者與此廠別之關係"); myMsg.AddToNode("href",USERFACTMANAGE + "?ApID=" + m_ap_id); myMsg.AddToNode("QueryCondition",GetQueryCondition()); myNode = myMsg.CreateParentNode("Method"); myMsg.AddToNode("MethodName","MasterDelFunc",ref myNode); myMsg.AddToNode("Key","uf_id",ref myNode); myMsg.AddToNode("KeyOther","user_desc",ref myNode); myMsg.UpdateNode(myNode); myMsg.UpdateNode(); } else { myMsg.CreateFirstNode("Type","Space"); }*/ myMsg.CreateFirstNode("Type", "Space"); MFieldType[4] = myMsg.GetXmlStr; //再利用此Table再取得其每一列的資料,再Gen出主要的Table Row. foreach (DataRow myMasterRow in myTable.Rows) { if (MasterCount % 2 == 0) MasterStyle = "cssGridRowAlternating"; else MasterStyle = "cssGridRow"; myTempMsg = new PccMsg(); myRow = new PccRow(MasterStyle, HorizontalAlign.Center, VerticalAlign.Middle, 0); //編號 myRow.AddTextCell(PageControl1.ListCount, 5); //廠別編號 myRow.AddTextCell(myMasterRow["fact_no"].ToString(), 10); //廠別名稱 //因為要設定其相關權限已改由廠群組來設定,所以在此不能再有新增的動作了 20050529 /*if (myAuth.IsAddAuth()) { // ting //原本的寫法 myRow.AddTextCell("<A href=" + PICKUSER + "?ApID=" + m_ap_id + "&FactID=" + myMasterRow["fact_id"] + "&FactName=" + myMasterRow["fact_no"].ToString().Trim() + myMasterRow["fact_nm"].ToString().Trim() +"&QueryCondition1=" + GetQueryCondition1() +">" + myMasterRow["fact_nm"].ToString().Trim() + "</A>",50);//+ "&QueryCondition=" + txtfactno.Text myTempMsg.CreateFirstNode("Href",PICKUSER + "?ApID=" + m_ap_id + "&FactID=" + myMasterRow["fact_id"] + "&FactName=" + myMasterRow["fact_no"].ToString().Trim() + myMasterRow["fact_nm"].ToString().Trim() +"&QueryCondition=" + GetQueryCondition()); myTempMsg.CreateFirstNode("Text",myMasterRow["fact_nm"].ToString().Trim()); myRow.AddLinkHrefCell(myTempMsg.GetXmlStr,50); } else { myRow.AddTextCell(myMasterRow["fact_nm"].ToString(),10); }*/ myRow.AddTextCell(myMasterRow["fact_nm"].ToString(), 10); //事業群 myRow.AddTextCell(myMasterRow["fgrp_nm"].ToString(), 15); //檢視 myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("ToolTip", myLabel.GetErrMsg("lbl0005", "AdtWeb/MaintainArea")); myTempMsg.CreateFirstNode("LinkID", "HLinkView" + myMasterRow["fact_id"].ToString()); myTempMsg.CreateFirstNode("Image", Session["PageLayer"] + "images/detal.gif"); myTempMsg.CreateFirstNode("ClickFun", "doSection(view_" + MasterCount.ToString() + ")"); myRow.AddLinkCell(myTempMsg.GetXmlStr, 10); //取消 myTempMsg.LoadXml(); myTempMsg.CreateNode("LinkButton"); myTempMsg.AddToNode("Image", Session["PageLayer"] + "images/del.gif"); myTempMsg.AddToNode("ToolTip", "刪除此廠別在此系統中的使用"); myTempMsg.AddToNode("href", USERFACTMANAGE + "?ApID=" + m_ap_id); myTempMsg.AddToNode("QueryCondition", GetQueryCondition()); myTempMsg.AddToNode("Method", GetMethod("DelQFact", "fact_id", "fact_nm", myMasterRow)); myTempMsg.UpdateNode(); if (myAuth.IsDeleteAuth()) myRow.AddMultiLinkCell(myTempMsg.GetXmlStr, 10); else myRow.AddTextCell("", 10); tblFact.Rows.Add(myRow.Row); //要取得明細資料的Table變數 DataTable myDTable; string StrXml = "<PccMsg><ap_id>" + m_ap_id + "</ap_id><fact_id>" + myMasterRow["fact_id"] + "</fact_id>"; StrXml += "<user_id>" + Session["UserID"].ToString() + "</user_id>"; StrXml += "<GroupFilter>" + strGroupFilter + "</GroupFilter>"; StrXml += "<FactFilter>" + strFactFilter + "</FactFilter>"; StrXml += "<order></order>"; StrXml += "</PccMsg>"; myDTable = mybs.DoReturnDataSet("GetUserByFactIDAndUserGroup", StrXml, "").Tables["UserFact"]; //設定選單明細資料類別之參數 PccDetailTable myMDTable = new PccDetailTable(myMasterRow["fact_id"].ToString()); myMDTable.Fields = MFields; myMDTable.FieldsItem = MFieldsItem; myMDTable.FieldsPercent = MFieldsPercent; myMDTable.FieldsType = MFieldType; myMDTable.ClassXML = strClassXML; myMDTable.NewDataTable = myDTable; myMDTable.Create(); myRow.Reset(); myRow.SetRowCss("off"); myRow.SetRowID("view_" + MasterCount); myRow.SetDefaultCellData("DGridTD", HorizontalAlign.Center, 0, 6); myRow.AddControl(myMDTable.NewTable, 100); tblFact.Rows.Add(myRow.Row); MasterCount += 1; } } else { PageControl1.TotalSize = "0"; PageControl1.BuildPager(); myRow = new PccRow("DGridTD", HorizontalAlign.Center, VerticalAlign.Middle, 6); myRow.AddTextCell("<b><font color='darkred'>" + myErrMsg.GetErrMsg("AdtWeb/msg0072") + "</font></b>", 100); tblFact.Controls.Add(myRow.Row); } }
private void GenMasterTableData(ref PccErrMsg myLabel) { PccErrMsg myErrMsg = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"), Session["CodePage"].ToString(), "Error"); bs_UserFactManage mybs = new bs_UserFactManage(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("ap_id", m_ap_id); myMsg.CreateFirstNode("fact_no", txtfactno.Text); myMsg.CreateFirstNode("fact_nm", txtfactnm.Text); myMsg.CreateFirstNode("StartRecord", PageControl1.StartRecord.ToString()); myMsg.CreateFirstNode("PageSize", PageControl1.PageSize.ToString()); myMsg.CreateFirstNode("user_id", Session["UserID"].ToString()); DataSet ds; GetMenuAuth myAuth = new GetMenuAuth(); myAuth.AspxFile = USERFACTMANAGE; string strSp = ""; //判斷是否要利用事業群來分設權限 if (ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"] != null && ConfigurationManager.AppSettings[m_ap_id + "-FactByGroup"].ToString() == "Y") { //判斷此使用者是否可以分配不同的事業群權限 if (myAuth.IsReportAuth()) strSp = "GetPubFactByApID"; else strSp = "GetPubFactByUserGroupAndApID"; } else { strSp = "GetPubFactByApID"; } ds = mybs.DoReturnDataSet(strSp, myMsg.GetXmlStr, ""); DataTable myTable = ds.Tables["PubFact"]; PccRow myRow; if (myTable.Rows.Count > 0) { int MasterCount = 1; string MasterStyle = ""; //取出資料總筆數 PageControl1.TotalSize = ds.Tables["GetPubFactCount"].Rows[0]["Counts"].ToString(); PageControl1.BuildPager(); string cVal = ""; foreach (DataRow myMasterRow in myTable.Rows) { if (MasterCount % 2 == 0) MasterStyle = "eee000"; else MasterStyle = "fff000"; myRow = new PccRow(MasterStyle, HorizontalAlign.Center, VerticalAlign.Middle, 0); //勾選值 == string chk = ""; string factno = ""; //session("")不是Nothing 也不是 ""時則執行 if (Session["Facttemporary"] != null && Session["Facttemporary"].ToString() != "") { string[] chkarray = Session["Facttemporary"].ToString().Split(','); factno = myMasterRow["fact_no"].ToString().Trim(); for (int i = 0; i < chkarray.Length; i++) { if (factno == chkarray[i].ToString()) { chk = "checked"; cVal += factno + ","; } } } //編號 myRow.AddTextCell(PageControl1.ListCount, 5); //廠別編號 myRow.AddTextCell(myMasterRow["fact_no"].ToString(), 10); //廠別名稱 myRow.AddTextCell(myMasterRow["fact_nm"].ToString(), 60); //事業群 myRow.AddTextCell(myMasterRow["fgrp_nm"].ToString(), 20); //選取 myRow.AddTextCell("<input type=checkbox name=fact_no id=fact_no" + MasterCount + " value=" + myMasterRow["fact_no"].ToString().Trim() + " " + chk + ">", 5); tab_fact.Controls.Add(myRow.Row); MasterCount += 1; } Session["chkcount"] = MasterCount; ViewState["CurrentValue"] = ""; if (cVal != "") { ViewState["CurrentValue"] = cVal.Substring(0, cVal.Length - 1); } } else { PageControl1.TotalSize = "0"; PageControl1.BuildPager(); myRow = new PccRow("DGridTD", HorizontalAlign.Center, VerticalAlign.Middle, 5); myRow.AddTextCell("<b><font color='darkred'>" + myErrMsg.GetErrMsg("AdtWeb/msg0072") + "</font></b>", 100); tab_fact.Controls.Add(myRow.Row); } }