private void AboutBody() { PccRow myRow = new PccRow(); myRow.AddTextCell(" <font size=large color=blue><b>寶成國際集團系統網頁</b></font>", 100); tblBody.Rows.Add(myRow.Row); myRow.Reset(); myRow.AddTextCell("<br><font color=red>所有的權利屬於<font color=blue><b>寶成國際集團</b></font></font>", 100); tblBody.Rows.Add(myRow.Row); myRow.Reset(); myRow.AddTextCell("<br><font color=blue>版本:1.0</font>", 100); tblBody.Rows.Add(myRow.Row); }
private void DefaultPage() { //新增PccApHome中所要顯示的元素 20040525 PccRow myRow = new PccRow(); myRow.AddTextCell(" <font size=large color=blue><b>" + Session["UserName"] + "</b>Welcome to Pcc Ap Home</font>", 100); tblBody.Rows.Add(myRow.Row); myRow.Reset(); myRow.AddTextCell("<br><font color=red><b>如您需修改個人資料,可點選左上方第一個分區點選個人資料修改選單,以進行個人資料修改</b></font>", 100); tblBody.Rows.Add(myRow.Row); //設定中英文轉換之Button if (Session["CodePage"].ToString() == "CP950") //LinkButton1.Text = "Do you want transfer to English?"; LinkButton1.Text = "Ban co muon dich sang tieng Viet khong?"; else LinkButton1.Text = "您想要轉換到中文嗎?"; LinkButton1.Visible = true; }
private void GenMasterTableHader(ref PccErrMsg myLabel) { PccRow myRow = new PccRow("cssGridHeader", HorizontalAlign.Center, VerticalAlign.Middle, 0); //編號 myRow.AddTextCell(myLabel.GetErrMsg("lbl0007", "SysManager/ApManager"), 5); myRow.AddTextCell("姓名", 10); myRow.AddTextCell("電子郵件帳號", 33); myRow.AddTextCell("廠別", 22); //myRow.AddTextCell("Email",25); myRow.AddTextCell("分機", 5); myRow.AddTextCell("群組", 15); myRow.AddTextCell("核准", 5); myRow.AddTextCell("駁回", 5); tblCheckUser.CssClass = "cssGridTable"; tblCheckUser.Width = Unit.Percentage(100); tblCheckUser.HorizontalAlign = HorizontalAlign.Center; tblCheckUser.CellPadding = 2; tblCheckUser.CellSpacing = 1; tblCheckUser.Rows.Add(myRow.Row); }
private void GenMasterTableData(ref PccErrMsg myLabel) { #region 取得Login的使用者是否有刪除的權限 GetMenuAuth myAuth = new GetMenuAuth(); myAuth.AspxFile = "FactGroupManage104.aspx"; bool del_auth = myAuth.IsDeleteAuth(); //判斷是否為系統超級管理者 string superAdmin = "N"; if (ConfigurationManager.AppSettings["superAdminEmail"].Equals(Session["UserEMail"].ToString())) { superAdmin = "Y"; } #endregion #region 取得廠群組的主資料ByUpID bs_FactGroupManage mybs = new bs_FactGroupManage(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", Request.Params["ApID"]); myMsg.CreateFirstNode("LoginUser_Id", Session["UserID"].ToString()); myMsg.CreateFirstNode("SuperAdmin", superAdmin); myMsg.CreateFirstNode("CheckUser_Id", Request.Params["UserID"]); string strXML = myMsg.GetXmlStr; DataSet myDS_FGRPDs = mybs.DoReturnDataSet("GetFgrpByLoginUserAndCheck", strXML, ""); DataTable myDS_FGRPData = myDS_FGRPDs.Tables["FgrpByLoginUserAndCheck"]; #endregion if (myDS_FGRPData != null && myDS_FGRPData.Rows.Count > 0) { #region 定義基本變數 ViewState["group_org"] = ""; int MasterCount = 0; string MasterStyle = string.Empty; PccMsg myTempMsg; PccMsg myMsg1; PccRow myRow; #endregion #region 明細資料類別之共同參數 myMsg.LoadXml(); myMsg.CreateFirstNode("TableClass", "ActDocTB"); myMsg.CreateFirstNode("RowHeaderClass", "TDShowHeader"); myMsg.CreateFirstNode("RowClass1", "ffd000"); myMsg.CreateFirstNode("RowClass2", "fff000"); string strClassXML = myMsg.GetXmlStr; //要取得明細資料的Table變數 DataTable tblFactGroup; #endregion #region 內建廠別明細資料的欄位參數 string[] FFields = { "編號", "廠別", "廠別名稱", "事業群", "公司編號" }; int[] FFieldsPercent = { 5, 15, 40, 20, 20 }; string[] FFieldsItem = { "--NO--", "fact_no", "fact_nm", "fgrp_nm", "comp_no" }; string[] FFieldType = new string[5]; FFieldType[0] = "--NO--"; FFieldType[1] = "<PccMsg><Type>Text</Type></PccMsg>"; FFieldType[2] = "<PccMsg><Type>Text</Type></PccMsg>"; FFieldType[3] = "<PccMsg><Type>Text</Type></PccMsg>"; FFieldType[4] = "<PccMsg><Type>Text</Type></PccMsg>"; #endregion //再利用此Table再取得其每一列的資料,再Gen出主要的Table Row. foreach (DataRow myMasterRow in myDS_FGRPData.Rows) { #region 主要廠群組的資料列設定 if (MasterCount % 2 == 0) MasterStyle = "eee000"; else MasterStyle = "fff000"; myRow = new PccRow("", HorizontalAlign.Center, 0, 0); myRow.SetRowCss(MasterStyle); //編號 myRow.AddTextCell(MasterCount.ToString(), 5); //廠群組名稱 myRow.AddTextCell(myMasterRow["Fgrp_Nm"].ToString(), 60); //廠別檢視 myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("ToolTip", "檢視所屬廠別"); myTempMsg.CreateFirstNode("LinkID", "HLinkView" + myMasterRow["Fgrp_Id"].ToString()); myTempMsg.CreateFirstNode("Image", Session["PageLayer"] + "images/detal.gif"); myTempMsg.CreateFirstNode("ClickFun", "doSection(view_F" + MasterCount.ToString() + ")"); myRow.AddLinkCell(myTempMsg.GetXmlStr, 20); //選取 myTempMsg.LoadXml(); myTempMsg.CreateFirstNode("Checked", myMasterRow["IsChecked"].ToString()); myTempMsg.CreateFirstNode("Name", "JoinFgrpID"); myTempMsg.CreateFirstNode("Value", myMasterRow["Fgrp_Id"].ToString()); myRow.AddCheckBoxByValueCell(myTempMsg.GetXmlStr, 15); //設定原始的FgrpID的資料 if (myMasterRow["IsChecked"].ToString() == "Y") ViewState["Fgrp_Org"] += myMasterRow["Fgrp_Id"].ToString() + ","; TblDs_Fgrp.Rows.Add(myRow.Row); #endregion #region 內建廠別明細資料的欄位參數,此處會取得資料,並設定給主表格 //設定要取得廠別資料的XML myMsg1 = new PccMsg(); myMsg1.CreateFirstNode("Fgrp_Id", myMasterRow["Fgrp_Id"].ToString()); tblFactGroup = mybs.DoReturnDataSet("get_DS_FACTGRPByFgrpID", myMsg1.GetXmlStr, string.Empty).Tables["DS_FACTGRP"]; PccDetailTable myFDTable = new PccDetailTable("FDT" + myMasterRow["Fgrp_Id"].ToString()); myFDTable.ClassXML = strClassXML; myFDTable.Fields = FFields; myFDTable.FieldsPercent = FFieldsPercent; myFDTable.FieldsItem = FFieldsItem; myFDTable.FieldsType = FFieldType; myFDTable.NewDataTable = tblFactGroup; myFDTable.Create(); myRow.Reset(); myRow.SetRowCss("off"); myRow.SetRowID("view_F" + MasterCount); myRow.SetDefaultCellData("DGridTD", HorizontalAlign.Center, 0, 10); myRow.AddControl(myFDTable.NewTable, 100); TblDs_Fgrp.Rows.Add(myRow.Row); #endregion MasterCount += 1; } // end of foreach datarow if (ViewState["Fgrp_Org"] != null && ViewState["Fgrp_Org"].ToString() != "") ViewState["Fgrp_Org"] = ViewState["Fgrp_Org"].ToString().Substring(0, ViewState["Fgrp_Org"].ToString().Length - 1); else ViewState["Fgrp_Org"] = ""; }// end of if table count is 0 else { //PageControl1.TotalSize = "0"; //PageControl1.BuildPager(); } }
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) { #region 取得Login的使用者是否有刪除的權限 GetMenuAuth myAuth = new GetMenuAuth(); myAuth.AspxFile = "FactGroupManage104.aspx"; bool del_auth = myAuth.IsDeleteAuth(); #endregion #region 取得廠群組的主資料ByUpID bs_FactGroupManage mybs = new bs_FactGroupManage(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("Up_Id", m_SrcUp_Id); myMsg.CreateFirstNode("Ap_Id", m_ApID); myMsg.CreateFirstNode("Fgrp_Nm", TxtQueryFgrpNm.Text); string strXML = myMsg.GetXmlStr; DataSet myDS_FGRPDs = mybs.DoReturnDataSet("Get_DS_FGRPByUpID", strXML, ""); DataTable myDS_FGRPData = myDS_FGRPDs.Tables["DS_FGRPByUpID"]; #endregion if (myDS_FGRPData != null && myDS_FGRPData.Rows.Count > 0) { #region 定義基本變數 int MasterCount = 0; string MasterStyle = string.Empty; PccMsg myTempMsg; PccMsg myMsg1; PccRow myRow; //取出資料總筆數 PageControl1.TotalSize = myDS_FGRPDs.Tables["TCounts"].Rows[0]["Counts"].ToString(); PageControl1.BuildPager(); #endregion #region 明細資料類別之共同參數 myMsg.LoadXml(); myMsg.CreateFirstNode("TableClass", "ActDocTB"); myMsg.CreateFirstNode("RowHeaderClass", "TDShowHeader"); myMsg.CreateFirstNode("RowClass1", "ffd000"); myMsg.CreateFirstNode("RowClass2", "fff000"); string strClassXML = myMsg.GetXmlStr; XmlElement myNode; //要取得明細資料的Table變數 DataTable tblUserGroup, tblFactGroup; #endregion #region 內建廠別明細資料的欄位參數 string[] FFields = { "編號", "廠別", "廠別名稱", "事業群", "公司編號", "刪除" }; int[] FFieldsPercent = { 5, 15, 35, 20, 15, 10 }; string[] FFieldsItem = { "--NO--", "fact_no", "fact_nm", "fgrp_nm", "comp_no", "factgrp_id" }; string[] FFieldType = new string[6]; FFieldType[0] = "--NO--"; FFieldType[1] = "<PccMsg><Type>Text</Type></PccMsg>"; FFieldType[2] = "<PccMsg><Type>Text</Type></PccMsg>"; FFieldType[3] = "<PccMsg><Type>Text</Type></PccMsg>"; FFieldType[4] = "<PccMsg><Type>Text</Type></PccMsg>"; #endregion #region 內建使用者明細資料的欄位參數 string[] UFields = { "編號", "電子郵件帳號", "姓名", "廠別", "事業群", "分機", "刪除" }; int[] UFieldsPercent = { 5, 30, 15, 15, 15, 10, 10 }; string[] UFieldsItem = { "--NO--", "email", "user_desc", "fact_no", "fgrp_nm", "ext", "usergrp_id" }; string[] UFieldType = new string[7]; UFieldType[0] = "--NO--"; UFieldType[1] = "<PccMsg><Type>Text</Type></PccMsg>"; UFieldType[2] = "<PccMsg><Type>Text</Type></PccMsg>"; UFieldType[3] = "<PccMsg><Type>Text</Type></PccMsg>"; UFieldType[4] = "<PccMsg><Type>Text</Type></PccMsg>"; UFieldType[5] = "<PccMsg><Type>Text</Type></PccMsg>"; #endregion //再利用此Table再取得其每一列的資料,再Gen出主要的Table Row. foreach (DataRow myMasterRow in myDS_FGRPData.Rows) { #region 主要廠群組的資料列設定 if (MasterCount % 2 == 0) MasterStyle = "eee000"; else MasterStyle = "fff000"; myRow = new PccRow("", HorizontalAlign.Center, 0, 0); myRow.SetRowCss(MasterStyle); //編號 myRow.AddTextCell(PageControl1.ListCount, 5); //廠群組名稱 if (myAuth.IsAddAuth()) { myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("Href", PICKFACT + "?ApID=" + m_ApID + "&SrcUp_Id=" + m_SrcUp_Id + "&Up_Id=" + myMasterRow["Up_Id"].ToString() + "&Method=" + GetMethod("PickFactToFgrpFunc", "Fgrp_Id", "Fgrp_Nm", myMasterRow) + "&QueryCondition=" + GetQueryCondition()); myTempMsg.CreateFirstNode("Text", myMasterRow["Fgrp_Nm"].ToString().Trim()); myRow.AddLinkHrefCell(myTempMsg.GetXmlStr, 56); } else { myRow.AddTextCell(myMasterRow["Fgrp_Nm"].ToString(), 56); } //廠別檢視 myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("ToolTip", "檢視所屬廠別"); myTempMsg.CreateFirstNode("LinkID", "HLinkView" + myMasterRow["Fgrp_Id"].ToString()); myTempMsg.CreateFirstNode("Image", Session["PageLayer"] + "images/detal.gif"); myTempMsg.CreateFirstNode("ClickFun", "doSection(view_F" + MasterCount.ToString() + ")"); myRow.AddLinkCell(myTempMsg.GetXmlStr, 12); //使用者檢視 myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("ToolTip", "檢視所屬使用者"); myTempMsg.CreateFirstNode("LinkID", "HLinkView" + myMasterRow["Fgrp_Id"].ToString()); myTempMsg.CreateFirstNode("Image", Session["PageLayer"] + "images/detal.gif"); myTempMsg.CreateFirstNode("ClickFun", "doSection(view_U" + MasterCount.ToString() + ")"); myRow.AddLinkCell(myTempMsg.GetXmlStr, 12); //管理 myTempMsg = new PccMsg(); //判斷是否和上層ID是一樣的 if (myMasterRow["Fgrp_Id"].ToString() != Request.Params["SrcUp_Id"]) { //先加入修改的Item if (myAuth.IsUpdateAuth()) { myTempMsg.CreateNode("LinkButton"); myTempMsg.AddToNode("Image", Session["PageLayer"] + "images/edit.gif"); myTempMsg.AddToNode("ToolTip", myLabel.GetErrMsg("lbl0014", "SysManager/ApManager")); myTempMsg.AddToNode("href", MYURL + "?ApID=" + m_ApID + "&SrcUp_Id=" + m_SrcUp_Id + "&Up_Id=" + myMasterRow["Up_Id"].ToString()); myTempMsg.AddToNode("QueryCondition", GetQueryCondition()); myTempMsg.AddToNode("Method", GetMethod("MasterUpdateFunc", "Fgrp_Id", "Fgrp_Nm", myMasterRow)); myTempMsg.UpdateNode(); } if (del_auth) { //再加入刪除的Item myTempMsg.CreateNode("LinkButton"); myTempMsg.AddToNode("Image", Session["PageLayer"] + "images/del.gif"); myTempMsg.AddToNode("ToolTip", myLabel.GetErrMsg("lbl0015", "SysManager/ApManager")); myTempMsg.AddToNode("href", MYURL + "?ApID=" + m_ApID + "&SrcUp_Id=" + m_SrcUp_Id + "&Up_Id=" + myMasterRow["Up_Id"].ToString()); myTempMsg.AddToNode("QueryCondition", GetQueryCondition()); myTempMsg.AddToNode("Method", GetMethod("MasterDelFunc", "Fgrp_Id", "Fgrp_Nm", myMasterRow)); myTempMsg.UpdateNode(); } //再加入加入使用者的Item if (myAuth.IsAddAuth()) { myTempMsg.CreateNode("LinkButton"); myTempMsg.AddToNode("Image", Session["PageLayer"] + "images/add.gif"); myTempMsg.AddToNode("ToolTip", "加入使用者"); myTempMsg.AddToNode("href", PICKUSER + "?ApID=" + m_ApID + "&SrcUp_Id=" + m_SrcUp_Id + "&Up_Id=" + myMasterRow["Up_Id"].ToString()); myTempMsg.AddToNode("QueryCondition", GetQueryCondition()); myTempMsg.AddToNode("Method", GetMethod("AddUserFunc", "Fgrp_Id", "Fgrp_Nm", myMasterRow)); myTempMsg.UpdateNode(); } } myRow.AddMultiLinkCell(myTempMsg.GetXmlStr, 15); TblDs_Fgrp.Rows.Add(myRow.Row); #endregion #region 內建廠別明細資料的欄位參數,此處會取得資料,並設定給主表格 //設定廠別明細欄位中多個Link Image的參數 myMsg1 = new PccMsg(); if (del_auth && myMasterRow["Fgrp_Id"].ToString() != Request.Params["SrcUp_Id"]) { myMsg1.CreateFirstNode("Type", "MultiLink"); myMsg1.CreateNode("LinkButton"); myMsg1.AddToNode("Image", Session["PageLayer"] + "images/del.gif"); myMsg1.AddToNode("ToolTip", "刪除此廠別與此廠群組之關係"); myMsg1.AddToNode("href", MYURL + "?ApID=" + m_ApID + "&SrcUp_Id=" + m_SrcUp_Id + "&Up_Id=" + myMasterRow["Up_Id"].ToString() + "&Fgrp_Nm=" + myMasterRow["Fgrp_Nm"].ToString()); myMsg1.AddToNode("QueryCondition", GetQueryCondition()); myNode = myMsg1.CreateParentNode("Method"); myMsg1.AddToNode("MethodName", "FactDelFunc", ref myNode); myMsg1.AddToNode("Key", "factgrp_id", ref myNode); myMsg1.AddToNode("KeyOther", "fact_no", ref myNode); myMsg1.UpdateNode(myNode); myMsg1.UpdateNode(); } else { myMsg1.CreateFirstNode("Type", "Space"); } FFieldType[5] = myMsg1.GetXmlStr; //設定要取得廠別資料的XML myMsg1.LoadXml(); myMsg1.CreateFirstNode("Fgrp_Id", myMasterRow["Fgrp_Id"].ToString()); tblFactGroup = mybs.DoReturnDataSet("get_DS_FACTGRPByFgrpID", myMsg1.GetXmlStr, string.Empty).Tables["DS_FACTGRP"]; PccDetailTable myFDTable = new PccDetailTable("FDT" + myMasterRow["Fgrp_Id"].ToString()); myFDTable.ClassXML = strClassXML; myFDTable.Fields = FFields; myFDTable.FieldsPercent = FFieldsPercent; myFDTable.FieldsItem = FFieldsItem; myFDTable.FieldsType = FFieldType; myFDTable.NewDataTable = tblFactGroup; myFDTable.Create(); myRow.Reset(); myRow.SetRowCss("off"); myRow.SetRowID("view_F" + MasterCount); myRow.SetDefaultCellData("DGridTD", HorizontalAlign.Center, 0, 10); myRow.AddControl(myFDTable.NewTable, 100); TblDs_Fgrp.Rows.Add(myRow.Row); #endregion #region 內建使用者明細資料的欄位參數,此處會取得資料,並設定給主表格 //設定廠別明細欄位中多個Link Image的參數 myMsg1 = new PccMsg(); if (del_auth && myMasterRow["Fgrp_Id"].ToString() != Request.Params["SrcUp_Id"]) { myMsg1.CreateFirstNode("Type", "MultiLink"); myMsg1.CreateNode("LinkButton"); myMsg1.AddToNode("Image", Session["PageLayer"] + "images/del.gif"); myMsg1.AddToNode("ToolTip", "刪除此使用者與此廠群組之關係"); myMsg1.AddToNode("href", MYURL + "?ApID=" + m_ApID + "&SrcUp_Id=" + m_SrcUp_Id + "&Up_Id=" + myMasterRow["Up_Id"].ToString() + "&Fgrp_Nm=" + myMasterRow["Fgrp_Nm"].ToString()); myMsg1.AddToNode("QueryCondition", GetQueryCondition()); myNode = myMsg1.CreateParentNode("Method"); myMsg1.AddToNode("MethodName", "UserDelFunc", ref myNode); myMsg1.AddToNode("Key", "usergrp_id", ref myNode); myMsg1.AddToNode("KeyOther", "user_desc", ref myNode); myMsg1.UpdateNode(myNode); myMsg1.UpdateNode(); } else { myMsg1.CreateFirstNode("Type", "Space"); } UFieldType[6] = myMsg1.GetXmlStr; //設定要取得廠別資料的XML myMsg1.LoadXml(); myMsg1.CreateFirstNode("Fgrp_Id", myMasterRow["Fgrp_Id"].ToString()); tblUserGroup = mybs.DoReturnDataSet("get_DS_USERGRPByFgrpID", myMsg1.GetXmlStr, string.Empty).Tables["DS_USERGRP"]; PccDetailTable myUDTable = new PccDetailTable("UDT" + myMasterRow["Fgrp_Id"].ToString()); myUDTable.ClassXML = strClassXML; myUDTable.Fields = UFields; myUDTable.FieldsPercent = UFieldsPercent; myUDTable.FieldsItem = UFieldsItem; myUDTable.FieldsType = UFieldType; myUDTable.NewDataTable = tblUserGroup; myUDTable.Create(); myRow.Reset(); myRow.SetRowCss("off"); myRow.SetRowID("view_U" + MasterCount); myRow.SetDefaultCellData("DGridTD", HorizontalAlign.Center, 0, 10); myRow.AddControl(myUDTable.NewTable, 100); TblDs_Fgrp.Rows.Add(myRow.Row); #endregion MasterCount += 1; } // end of foreach datarow }// end of if table count is 0 else { PageControl1.TotalSize = "0"; PageControl1.BuildPager(); } }
private void GenMasterTableData(ref PccErrMsg myLabel) { //取得Login的使用者是否有刪除的權限 GetMenuAuth myAuth = new GetMenuAuth(); bool del_auth = myAuth.IsDeleteAuth(); PccBsSystemForC.bs_ApManager mybs = new PccBsSystemForC.bs_ApManager(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("Vpath", ConfigurationManager.AppSettings["vpath"].ToString()); myMsg.CreateFirstNode("ApName", txtApName.Text); string strXML = myMsg.GetXmlStr; DataSet myApDs = mybs.DoReturnDataSet("GetApByVpath", strXML, ""); DataTable myApData = myApDs.Tables["Ap"]; if (myApData.Rows.Count > 0) { int MasterCount = 0; string MasterStyle = ""; PccMsg myTempMsg; PccRow myRow; //取出資料總筆數 PageControl1.TotalSize = myApDs.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; XmlElement myNode; //明細資料的欄位參數 string strOrgFields5 = "link-新增選單-" + MENUADDNEW + "?ApID=" + Request.Params["ApID"].ToString() + "&Type=New&QueryCondition=" + GetQueryCondition(); string[] Fields = { "編號", "選單編碼", "選單名稱", "選單連結", "管理區", strOrgFields5 }; int[] FieldsPercent = { 5, 8, 17, 50, 10, 10 }; string[] FieldsItem = { "--NO--", "menu_no", "menu_nm", "menu_link", "manage_mk", "menu_id" }; string[] FieldsType = new string[6]; 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>Text</Type></PccMsg>"; //設定明細欄位中多個Link Image的參數 myMsg.LoadXml(); myMsg.CreateFirstNode("Type", "MultiLink"); //設定第一個更新選單的Image參數 myMsg.CreateNode("LinkButton"); myMsg.AddToNode("Image", Session["PageLayer"] + "images/edit.gif"); myMsg.AddToNode("ToolTip", "更新選單"); myMsg.AddToNode("href", MENUADDNEW + "?ApID=" + Request.Params["ApID"].ToString()); myMsg.AddToNode("QueryCondition", GetQueryCondition()); myNode = myMsg.CreateParentNode("Method"); myMsg.AddToNode("MethodName", "DetailUpdFunc", ref myNode); myMsg.AddToNode("Key", "menu_id", ref myNode); myMsg.AddToNode("KeyOther", "menu_nm", ref myNode); myMsg.UpdateNode(myNode); myMsg.UpdateNode(); if (del_auth) { //設定第二個刪除選單的Image參數 myMsg.CreateNode("LinkButton"); myMsg.AddToNode("Image", Session["PageLayer"] + "images/del.gif"); myMsg.AddToNode("ToolTip", "刪除選單"); myMsg.AddToNode("href", APMANAGE + "?ApID=" + Request.Params["ApID"].ToString()); myMsg.AddToNode("QueryCondition", GetQueryCondition()); myNode = myMsg.CreateParentNode("Method"); myMsg.AddToNode("MethodName", "DetailDelFunc", ref myNode); myMsg.AddToNode("Key", "menu_id", ref myNode); myMsg.AddToNode("KeyOther", "menu_nm", ref myNode); myMsg.UpdateNode(myNode); myMsg.UpdateNode(); } FieldsType[5] = myMsg.GetXmlStr; //要取得明細資料的Table變數 DataTable tblMenuByApID; //再利用此Table再取得其每一列的資料,再Gen出主要的Table Row. foreach (DataRow myMasterRow in myApData.Rows) { if (MasterCount % 2 == 0) MasterStyle = "eee000"; else MasterStyle = "fff000"; myRow = new PccRow(); myRow.SetRowCss(MasterStyle); //編號 myRow.AddTextCell(PageControl1.ListCount, 5); //應用程式編碼 myRow.AddTextCell(myMasterRow["ap_id"].ToString(), 10); //應用程式名稱 myRow.AddTextCell(myMasterRow["ap_name"].ToString(), 15); //應用程式連結 myRow.AddTextCell(myMasterRow["ap_link"].ToString(), 40); //應用程式目錄 myRow.AddTextCell(myMasterRow["ap_vpath"].ToString(), 15); //檢視 myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("ToolTip", myLabel.GetErrMsg("lbl0018", "SysManager/ApManager")); myTempMsg.CreateFirstNode("LinkID", "HLinkView" + myMasterRow["ap_id"].ToString()); myTempMsg.CreateFirstNode("Image", Session["PageLayer"] + "images/detal.gif"); myTempMsg.CreateFirstNode("ClickFun", "doSection(view_" + MasterCount.ToString() + ")"); myRow.AddLinkCell(myTempMsg.GetXmlStr, 5); //管理 myTempMsg.LoadXml(); //先加入修改的Item myTempMsg.CreateNode("LinkButton"); myTempMsg.AddToNode("Image", Session["PageLayer"] + "images/edit.gif"); myTempMsg.AddToNode("ToolTip", myLabel.GetErrMsg("lbl0014", "SysManager/ApManager")); myTempMsg.AddToNode("href", APADDNEW + "?ApID=" + Request.Params["ApID"].ToString()); myTempMsg.AddToNode("QueryCondition", GetQueryCondition()); myTempMsg.AddToNode("Method", GetMethod("MasterUpdateFunc", "ap_id", "ap_name", myMasterRow)); myTempMsg.UpdateNode(); if (del_auth) { //再加入刪除的Item myTempMsg.CreateNode("LinkButton"); myTempMsg.AddToNode("Image", Session["PageLayer"] + "images/del.gif"); myTempMsg.AddToNode("ToolTip", myLabel.GetErrMsg("lbl0015", "SysManager/ApManager")); myTempMsg.AddToNode("href", APMANAGE + "?ApID=" + Request.Params["ApID"].ToString()); myTempMsg.AddToNode("QueryCondition", GetQueryCondition()); myTempMsg.AddToNode("Method", GetMethod("MasterDelFunc", "ap_id", "ap_name", myMasterRow)); myTempMsg.UpdateNode(); } myRow.AddMultiLinkCell(myTempMsg.GetXmlStr, 5); tblAp.Rows.Add(myRow.Row); tblMenuByApID = mybs.DoReturnDataSet("GetMenuByApID", "<PccMsg><ap_id>" + myMasterRow["ap_id"].ToString() + "</ap_id></PccMsg>", "").Tables["Menu"]; //設定選單明細資料類別之參數 PccDetailTable myDTable = new PccDetailTable("DT" + myMasterRow["ap_id"].ToString()); myDTable.ClassXML = strClassXML; Fields[5] = strOrgFields5 + "&Key=" + myMasterRow["ap_id"].ToString(); myDTable.Fields = Fields; myDTable.FieldsPercent = FieldsPercent; myDTable.FieldsItem = FieldsItem; myDTable.FieldsType = FieldsType; myDTable.NewDataTable = tblMenuByApID; myDTable.Create(); myRow.Reset(); myRow.SetRowCss("off"); myRow.SetRowID("view_" + MasterCount); myRow.SetDefaultCellData("DGridTD", HorizontalAlign.Center, 0, 10); myRow.AddControl(myDTable.NewTable, 100); tblAp.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 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 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 GenMasterTableHader(ref PccErrMsg myLabel) { PccRow myRow = new PccRow("cssGridHeader", HorizontalAlign.Center, VerticalAlign.Middle, 0); //註記 myRow.AddTextCell(myLabel.GetErrMsg("lbl0031", "SysManager/UserManager"), 4); //姓名 myRow.AddTextCell(myLabel.GetErrMsg("lbl0019", "SysManager/UserManager"), 8); //部門 //myRow.AddTextCell(myLabel.GetErrMsg("lbl0022","SysManager/UserManager"),10); //廠別 myRow.AddTextCell("廠別", 10); //帳號 //myRow.AddTextCell(myLabel.GetErrMsg("lbl0032","SysManager/UserManager"),10); //電子郵件 myRow.AddTextCell(myLabel.GetErrMsg("lbl0033", "SysManager/UserManager"), 48); //分機 myRow.AddTextCell(myLabel.GetErrMsg("lbl0034", "SysManager/UserManager"), 5); //檢視 myRow.AddTextCell(myLabel.GetErrMsg("lbl0035", "SysManager/UserManager"), 5); //管理 myRow.AddTextCell(myLabel.GetErrMsg("lbl0036", "SysManager/UserManager"), 5); //群組 myRow.AddTextCell(myLabel.GetErrMsg("lbl0037", "SysManager/UserManager"), 5); //使用者管理 myRow.AddTextCell(myLabel.GetErrMsg("lbl0038", "SysManager/UserManager"), 10); tblApUser.CssClass = "cssGridTable"; tblApUser.Width = Unit.Percentage(100); tblApUser.HorizontalAlign = HorizontalAlign.Center; tblApUser.CellPadding = 2; //tblApUser.CellSpacing = 1; tblApUser.Rows.Add(myRow.Row); }
private void GenMasterTableData(ref PccErrMsg myLabel) { 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"]); 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("fact_no", ddlFact.SelectedItem.Value); myMsg.CreateFirstNode("order", "user_desc"); myMsg.CreateFirstNode("orderType", "desc"); if (ddlUserType.SelectedItem.Value.ToString() == "All") myMsg.CreateFirstNode("mana_mk", ""); else myMsg.CreateFirstNode("mana_mk", ddlUserType.SelectedItem.Value.ToString()); if (ddlQuerySelect.SelectedItem.Value.ToString() == "1") { myMsg.CreateFirstNode("user_desc", txtUserName.Text); myMsg.CreateFirstNode("user_nm", string.Empty); } else { myMsg.CreateFirstNode("user_desc", string.Empty); myMsg.CreateFirstNode("user_nm", txtUserName.Text); } //加入判斷是否要有事業群之判斷20041116 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"); } 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"); } string strXML = myMsg.GetXmlStr; DataSet myUserDs = mybs.DoReturnDataSet("GetUserAndMarkByApID_V1", strXML, ""); DataTable myUserData = myUserDs.Tables["UserAndMark"]; if (myUserData != null && myUserData.Rows.Count > 0) { int MasterCount = 0; string MasterStyle = ""; PccMsg myTempMsg; PccRow myRow; //取出資料總筆數 PageControl1.TotalSize = myUserDs.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; //判斷是否為超級管理者,若是則不控管自己Menu的CheckBox權限 20041116 string strcheckbox = ""; if (Session["UserEMail"].ToString() != ConfigurationManager.AppSettings["superAdminEmail"].ToString()) strcheckbox = "CheckBoxByValueJudgeUserRight"; else strcheckbox = "CheckBoxByValue"; //明細資料的欄位參數 string strOrgFields8 = "btn-更新送出-Return_ClickM(this)"; string[] Fields = { "編號", "選單名稱", "顯示權限", "新增權限", "更新權限", "刪除權限", "報表權限", "發信權限", strOrgFields8 }; int[] FieldsPercent = { 5, 25, 10, 10, 10, 10, 10, 10, 10 }; string[] FieldsItem = { "--NO--", "menu_nm", "show_mk", "add_mk", "upd_mk", "del_mk", "rpt_mk", "send_mk", "menud_id" }; string[] FieldsType = new string[9]; FieldsType[0] = "--NO--"; FieldsType[1] = "<PccMsg><Type>Text</Type></PccMsg>"; FieldsType[2] = "<PccMsg><Type>" + strcheckbox + "</Type><Value>menu_id</Value></PccMsg>"; FieldsType[3] = "<PccMsg><Type>" + strcheckbox + "</Type><Value>menu_id</Value></PccMsg>"; FieldsType[4] = "<PccMsg><Type>" + strcheckbox + "</Type><Value>menu_id</Value></PccMsg>"; FieldsType[5] = "<PccMsg><Type>" + strcheckbox + "</Type><Value>menu_id</Value></PccMsg>"; FieldsType[6] = "<PccMsg><Type>" + strcheckbox + "</Type><Value>menu_id</Value></PccMsg>"; FieldsType[7] = "<PccMsg><Type>" + strcheckbox + "</Type><Value>menu_id</Value></PccMsg>"; FieldsType[8] = "<PccMsg><Type>Space</Type></PccMsg>"; //要取得明細資料的Table變數 DataTable tblMenuByUserID; //再利用此Table再取得其每一列的資料,再Gen出主要的Table Row. foreach (DataRow myMasterRow in myUserData.Rows) { if (MasterCount % 2 == 0) MasterStyle = "cssGridRowAlternating"; else MasterStyle = "cssGridRow"; myRow = new PccRow("", HorizontalAlign.Center, 0, 0); myRow.SetRowCss(MasterStyle); //註記 if (myMasterRow["remark"].ToString() == "N") myRow.AddTextCell("", 4); else myRow.AddTextCell("*", 4); //姓名 myRow.AddTextCell(myMasterRow["user_desc"].ToString(), 8); //部門 //myRow.AddTextCell(myMasterRow["dept_desc"].ToString(),10); //廠別 myRow.AddTextCell(myMasterRow["fact_nm"].ToString(), 10); //帳號 //myRow.AddTextCell(myMasterRow["user_nm"].ToString(),10); //電子郵件 myRow.AddTextCell(CheckDBNull(myMasterRow["email"]), 48); //分機 myRow.AddTextCell(CheckDBNull(myMasterRow["ext"]), 5); //檢視 myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("ToolTip", myLabel.GetErrMsg("lbl0026", "ADTPurDoc/GroupManage")); myTempMsg.CreateFirstNode("LinkID", "HLinkView" + ((int)((decimal)myMasterRow["user_id"])).ToString()); myTempMsg.CreateFirstNode("Image", Session["PageLayer"] + "images/detal.gif"); myTempMsg.CreateFirstNode("ClickFun", "doSection(view_M" + MasterCount.ToString() + ")"); myRow.AddLinkCell(myTempMsg.GetXmlStr, 5); //管理 if (myMasterRow["mana_mk"].ToString() == "N") myRow.AddTextCell("<input type=checkbox value=N disabled>", 5); else myRow.AddTextCell("<input type=checkbox value=Y checked disabled>", 5); //群組 myTempMsg.LoadXml(); //加入群組的Item myTempMsg.CreateNode("LinkButton"); myTempMsg.AddToNode("Image", Session["PageLayer"] + "images/add.gif"); myTempMsg.AddToNode("ToolTip", myLabel.GetErrMsg("lbl0001", "ADTPurDoc/GroupManage")); myTempMsg.AddToNode("href", USERJOINGROUP + "?ApID=" + Request.Params["ApID"].ToString()); myTempMsg.AddToNode("QueryCondition", GetQueryCondition()); myTempMsg.AddToNode("Method", GetMethod("MasterGroupFunc", "user_id", "user_desc", myMasterRow)); myTempMsg.UpdateNode(); myRow.AddMultiLinkCell(myTempMsg.GetXmlStr, 5); //使用者管理 myTempMsg.LoadXml(); //先加入修改的Item if (myAuth.IsUpdateAuth()) //判斷是否有修改使用者的權限 20041118 { myTempMsg.CreateNode("LinkButton"); myTempMsg.AddToNode("Image", Session["PageLayer"] + "images/edit.gif"); myTempMsg.AddToNode("ToolTip", myLabel.GetErrMsg("lbl0028", "ADTPurDoc/GroupManage")); //myTempMsg.AddToNode("href",USERADDNEW + "?ApID=" + Request.Params["ApID"].ToString()); //Modify by Lemor Beacause must redirect to PfsBaseWeb myTempMsg.AddToNode("href", USERADDNEW + "?ApID=" + Request.Params["ApID"].ToString() + "&UserID=" + myMasterRow["user_id"].ToString() + "&AcctionType=UpdByAdmin&UserAccount=" + CheckDBNull(myMasterRow["email"]) + "&ul=" + ConfigurationManager.AppSettings["myServer"] + ConfigurationManager.AppSettings["vpath"] + "/SysManager/UserManage/UserManage104.aspx?ApID=" + Request.Params["ApID"].ToString()); myTempMsg.AddToNode("Method", GetMethod("MasterUpdateFunc", "user_id", "user_desc", myMasterRow)); myTempMsg.UpdateNode(); } //再加入刪除的Item if (myAuth.IsDeleteAuth()) //判斷是否有修改使用者的權限 20041118 { myTempMsg.CreateNode("LinkButton"); myTempMsg.AddToNode("Image", Session["PageLayer"] + "images/del.gif"); myTempMsg.AddToNode("ToolTip", myLabel.GetErrMsg("lbl0029", "ADTPurDoc/GroupManage")); myTempMsg.AddToNode("href", USERMANAGE + "?ApID=" + Request.Params["ApID"].ToString()); myTempMsg.AddToNode("QueryCondition", GetQueryCondition()); myTempMsg.AddToNode("Method", GetMethod("MasterDelFunc", "user_id", "user_desc", myMasterRow)); myTempMsg.UpdateNode(); } if (myMasterRow["remark"].ToString() != "N") { //如果是不受群組管控則再加入回歸群組的Item myTempMsg.CreateNode("LinkButton"); myTempMsg.AddToNode("Image", Session["PageLayer"] + "images/mana.gif"); myTempMsg.AddToNode("ToolTip", myLabel.GetErrMsg("lbl0027", "ADTPurDoc/GroupManage")); myTempMsg.AddToNode("href", USERMANAGE + "?ApID=" + Request.Params["ApID"].ToString()); myTempMsg.AddToNode("QueryCondition", GetQueryCondition()); myTempMsg.AddToNode("Method", GetMethod("MasterReturnFunc", "user_id", "user_desc", myMasterRow)); myTempMsg.UpdateNode(); } myRow.AddMultiLinkCell(myTempMsg.GetXmlStr, 5); tblApUser.Rows.Add(myRow.Row); tblMenuByUserID = mybs.DoReturnDataSet("GetMenudByUserID", "<PccMsg><ap_id>" + Request.QueryString["ApID"] + "</ap_id><user_id>" + myMasterRow["user_id"].ToString() + "</user_id></PccMsg>", "").Tables["MenuByUser"]; //設定選單明細資料類別之參數 PccDetailTable myDTable = new PccDetailTable("MDT" + ((int)((decimal)myMasterRow["user_id"])).ToString()); myDTable.ClassXML = strClassXML; myDTable.Fields = Fields; myDTable.FieldsPercent = FieldsPercent; myDTable.FieldsItem = FieldsItem; myDTable.FieldsType = FieldsType; myDTable.NewDataTable = tblMenuByUserID; myDTable.Create(); if (m_menuIDArray == null) { m_menuIDArray = myDTable.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(myDTable.NewTable, 100); tblApUser.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 GenMasterTableHeader(ref PccErrMsg myLabel) { PccRow myRow = new PccRow("cssGridHeader", HorizontalAlign.Center, VerticalAlign.Middle, 0); myRow.AddTextCell("編號", 5); myRow.AddTextCell("電子郵件帳號", 40); myRow.AddTextCell("廠別", 10); myRow.AddTextCell("姓名", 30); myRow.AddTextCell("事業群", 15); //myRow.AddTextCell("Email",40); myRow.AddTextCell("檢視", 10); tblUser.CssClass = "cssGridTable"; tblUser.Width = Unit.Percentage(100); tblUser.HorizontalAlign = HorizontalAlign.Center; tblUser.CellPadding = 2; tblUser.CellSpacing = 1; tblUser.Rows.Add(myRow.Row); }
private void DefaultPage() { //新增PccApHome中所要顯示的元素 20040525 PccRow myRow = new PccRow(); myRow.AddTextCell(" <font size=large color=blue><b>" + Session["UserName"] + "</b>Welcome to Pcc Ap Home</font>",100); tblBody.Rows.Add(myRow.Row); myRow.Reset(); //myRow.AddTextCell("<br><img src='../../Images/ImgBanner/PARTION.gif' border='0'>",100); tblBody.Rows.Add(myRow.Row); myRow.Reset(); myRow.AddTextCell("<br><font color=red><b>如您需修改個人資料,可點選左上方個人名字處,進行個人資料修改</b></font>",100); tblBody.Rows.Add(myRow.Row); //設定中英文轉換之Button if (Session["CodePage"].ToString() == "CP950") { LinkButton1.Text = "Bạn có muốn chuyển sang tiếng Việt?"; LinkButton1.ToolTip="您想要轉換到越文嗎?"; } else { LinkButton1.Text = "您想要轉換到中文嗎?"; LinkButton1.ToolTip="Bạn có muốn chuyển sang tiếng Hoa?"; } //LinkButton1.Visible = true; ImageButton1.Visible = true; }
private void GenMasterTableData(ref PccErrMsg myLabel) { PccErrMsg myErrMsg = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"), Session["CodePage"].ToString(), "Error"); bs_FactGroupManage mybs = new bs_FactGroupManage(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 = new PccMsg(); myMsg.CreateFirstNode("Ap_Id", Request.QueryString["ApID"]); myMsg.CreateFirstNode("Upd_Id", Session["UserID"].ToString()); myMsg.CreateFirstNode("Fact_No", txtfactno.Text); myMsg.CreateFirstNode("User_Desc", txtusernm.Text); myMsg.CreateFirstNode("OrderBy", "a.user_desc"); myMsg.CreateFirstNode("StartRecord", PageControl1.StartRecord.ToString()); myMsg.CreateFirstNode("PageSize", PageControl1.PageSize.ToString()); GetMenuAuth myAuth = new GetMenuAuth(); myAuth.AspxFile = FACTGROUPMANAGE; string strXML = myMsg.GetXmlStr; DataSet myUserDs = mybs.DoReturnDataSet("getAllUserInFgrp", strXML, ""); DataTable myUserData = myUserDs.Tables["UserInFgrp"]; DataTable myFgrpData, myFactData; Table myFgrpTable, myFactTable; PccRow myRow; if (myUserData.Rows.Count > 0) { int MasterCount = 0; string MasterStyle = ""; //取出資料總筆數 PageControl1.TotalSize = myUserDs.Tables["TCounts"].Rows[0]["Counts"].ToString(); PageControl1.BuildPager(); //再利用此Table再取得其每一列的資料,再Gen出主要的Table Row. foreach (DataRow myMasterRow in myUserData.Rows) { if (MasterCount % 2 == 0) MasterStyle = "eee000"; else MasterStyle = "fff000"; myRow = new PccRow(MasterStyle, HorizontalAlign.Center, VerticalAlign.Middle, 0); //編號 myRow.AddTextCell(PageControl1.ListCount, 5); //電子郵件帳號 myRow.AddTextCell(myMasterRow["email"].ToString(), 40); //廠別 myRow.AddTextCell(myMasterRow["fact_no"].ToString(), 10); //姓名 if (myAuth.IsAddAuth()) { myTempMsg.CreateFirstNode("Href", PICKFGRP + "?ApID=" + m_ap_id + "&UserID=" + myMasterRow["user_id"] + "&UserDesc=" + myMasterRow["user_desc"].ToString().Trim() + "&QueryCondition=" + GetQueryCondition()); myTempMsg.CreateFirstNode("Text", myMasterRow["user_desc"].ToString().Trim()); myRow.AddLinkHrefCell(myTempMsg.GetXmlStr, 30); } else { myRow.AddTextCell(myMasterRow["user_desc"].ToString(), 30); } //事業群 myRow.AddTextCell(myMasterRow["fgrp_nm"].ToString(), 15); //檢視 myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("ToolTip", "檢視所屬的廠群組"); myTempMsg.CreateFirstNode("LinkID", "HLinkView" + myMasterRow["user_id"].ToString()); myTempMsg.CreateFirstNode("Image", Session["PageLayer"] + "images/detal.gif"); myTempMsg.CreateFirstNode("ClickFun", "doSection(view_" + MasterCount.ToString() + ")"); myRow.AddLinkCell(myTempMsg.GetXmlStr, 10); tblUser.Rows.Add(myRow.Row); //要取得明細資料的Table變數 myTempMsg.ClearContext(); myTempMsg.CreateFirstNode("Ap_Id", m_ap_id); myTempMsg.CreateFirstNode("User_Id", myMasterRow["user_id"].ToString()); myTempMsg.CreateFirstNode("LoginUser_Id", Session["UserID"].ToString()); myFgrpData = mybs.DoReturnDataSet("get_DS_FGRPByUserID", myTempMsg.GetXmlStr, string.Empty).Tables["FgrpInUser"]; myFgrpTable = new Table(); GenFgrpTableHeader(ref myFgrpTable); int DetailCount = 1; foreach (DataRow myDetailRow in myFgrpData.Rows) { if (DetailCount % 2 == 0) MasterStyle = "eee000"; else MasterStyle = "ffd000"; myRow = new PccRow(MasterStyle, HorizontalAlign.Center, VerticalAlign.Middle, 0); //編號 myRow.AddTextCell(DetailCount.ToString(), 10); //廠群組名稱 myRow.AddTextCell(myDetailRow["Fgrp_Nm"].ToString(), 70); //檢視 myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("ToolTip", "檢視所屬廠別"); myTempMsg.CreateFirstNode("LinkID", "HLinkView" + myDetailRow["Fgrp_Id"].ToString()); myTempMsg.CreateFirstNode("Image", Session["PageLayer"] + "images/detal.gif"); myTempMsg.CreateFirstNode("ClickFun", "doSection(view_D" + MasterCount.ToString() + "_" + DetailCount.ToString() + ")"); myRow.AddLinkCell(myTempMsg.GetXmlStr, 10); //管理 myTempMsg = new PccMsg(); //先加入修改的Item if (myAuth.IsDeleteAuth()) { //再加入刪除的Item myTempMsg.CreateNode("LinkButton"); myTempMsg.AddToNode("Image", Session["PageLayer"] + "images/del.gif"); myTempMsg.AddToNode("ToolTip", "刪除此使用者與廠群組的關係"); myTempMsg.AddToNode("href", MYURL + "?ApID=" + m_ap_id + "&User_Desc=" + myMasterRow["user_desc"].ToString() + "&User_Id=" + myMasterRow["user_id"].ToString()); myTempMsg.AddToNode("QueryCondition", GetQueryCondition()); myTempMsg.AddToNode("Method", GetMethod("DetailDelFunc", "Fgrp_Id", "Fgrp_Nm", myDetailRow)); myTempMsg.UpdateNode(); } myRow.AddMultiLinkCell(myTempMsg.GetXmlStr, 10); myFgrpTable.Controls.Add(myRow.Row); //要取得廠別明細資料的Table變數 myTempMsg.ClearContext(); myTempMsg.CreateFirstNode("Fgrp_Id", myDetailRow["Fgrp_Id"].ToString()); myTempMsg.CreateFirstNode("LoginUser_Id", Session["UserID"].ToString()); myFactData = mybs.DoReturnDataSet("get_DS_FACTGRPByFgrpID", myTempMsg.GetXmlStr, string.Empty).Tables["DS_FACTGRP"]; myFactTable = new Table(); GenFactTableHeader(ref myFactTable); int FactDetailCount = 1; foreach (DataRow myFactDetailRow in myFactData.Rows) { if (DetailCount % 2 == 0) MasterStyle = "eee000"; else MasterStyle = "ffd000"; myRow = new PccRow(MasterStyle, HorizontalAlign.Center, VerticalAlign.Middle, 0); //編號 myRow.AddTextCell(FactDetailCount.ToString(), 10); //廠別 myRow.AddTextCell(myFactDetailRow["Fact_No"].ToString(), 10); //廠別名稱 myRow.AddTextCell(myFactDetailRow["Fact_Nm"].ToString(), 40); //事業群 myRow.AddTextCell(myFactDetailRow["Fgrp_Nm"].ToString(), 20); //公司編號 myRow.AddTextCell(myFactDetailRow["Comp_No"].ToString(), 20); myFactTable.Controls.Add(myRow.Row); FactDetailCount += 1; } myRow.Reset(); myRow.SetRowCss("off"); myRow.SetRowID("view_D" + MasterCount.ToString() + "_" + DetailCount); myRow.SetDefaultCellData("DGridTD", HorizontalAlign.Center, 0, 10); myRow.AddControl(myFactTable, 100); myFgrpTable.Controls.Add(myRow.Row); DetailCount += 1; } myRow.Reset(); myRow.SetRowCss("off"); myRow.SetRowID("view_" + MasterCount); myRow.SetDefaultCellData("DGridTD", HorizontalAlign.Center, 0, 10); myRow.AddControl(myFgrpTable, 100); tblUser.Controls.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); tblUser.Controls.Add(myRow.Row); } }
private void GenFgrpTableHeader(ref Table myRefTable) { PccRow myRow = new PccRow("TDShowHeader", HorizontalAlign.Center, VerticalAlign.Middle, 0); myRow.AddTextCell("編號", 10); myRow.AddTextCell("廠群組名稱", 70); myRow.AddTextCell("檢視", 10); myRow.AddTextCell("管理", 10); myRefTable.CssClass = "ActDocTB"; myRefTable.Width = Unit.Percentage(100); myRefTable.HorizontalAlign = HorizontalAlign.Center; myRefTable.CellPadding = 2; myRefTable.CellSpacing = 1; myRefTable.Rows.Add(myRow.Row); }
public bool Create() { bool bReturn = false; if (m_Table == null) return bReturn; GenDetailTableHeader(); int i, Start_SC = 1; string Style_SC; PccRow myRow; PccMsg myMsg; PccMsg myTempMsg; GetMenuAuth myAuth = new GetMenuAuth(); if (m_myDTableData != null) { foreach (DataRow myDRow in m_myDTableData.Rows) { if (Start_SC % 2 == 0) Style_SC = m_RowClass1; else Style_SC = m_RowClass2; myRow = new PccRow("", HorizontalAlign.Center, VerticalAlign.Middle, 0); myRow.SetRowCss(Style_SC); string strData = ""; for (i = 0; i < m_FieldsItem.Length; i++) { if (m_FieldsItem[i] != "--NO--") { myMsg = new PccMsg(m_FieldsType[i]); if (myMsg.Query("Type") != "Space") { if (Convert.IsDBNull(myDRow[m_FieldsItem[i]])) { strData = ""; } else { if (m_TransFunc.Length != 0) { try { strData = CallTrnasFunc(m_objThis, m_TransFunc[i], myDRow[m_FieldsItem[i]].ToString()); } catch (Exception ex) { strData = myDRow[m_FieldsItem[i]].ToString() + ex.Message; } } else { strData = myDRow[m_FieldsItem[i]].ToString(); } } } switch (myMsg.Query("Type")) { case "Text": //myRow.AddTextCell(myDRow[m_FieldsItem[i]].ToString(),m_FieldsPercent[i]); //myRow.AddTextCell(strData,m_FieldsPercent[i]); if (myMsg.Query("HAlign").Equals(string.Empty)) myRow.AddTextCell(strData, m_FieldsPercent[i]); else { switch (myMsg.Query("HAlign")) { case "Center": myRow.AddTextCell(strData, m_FieldsPercent[i], HorizontalAlign.Center); break; case "Right": if ((myMsg.Query("Round").Equals(string.Empty)) || (strData.Equals(string.Empty))) { myRow.AddTextCell(strData, m_FieldsPercent[i], HorizontalAlign.Right); } else { int round = int.Parse(myMsg.Query("Round")); decimal temp = decimal.Parse(strData); temp = Math.Round(temp, round); myRow.AddTextCell(temp.ToString(), m_FieldsPercent[i], HorizontalAlign.Right); } break; case "Left": myRow.AddTextCell(strData, m_FieldsPercent[i], HorizontalAlign.Left); break; } } break; case "ImageButton": break; case "HyperLink": break; case "LinkButton": break; case "CheckBox": myTempMsg = new PccMsg(); //myTempMsg.CreateFirstNode("Checked",myDRow[m_FieldsItem[i]].ToString()); myTempMsg.CreateFirstNode("Checked", strData); myTempMsg.CreateFirstNode("Name", m_TableName); myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString()); myRow.AddCheckBoxByValueCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]); break; case "CheckBoxReadOnly": myTempMsg = new PccMsg(); //myTempMsg.CreateFirstNode("Checked",myDRow[m_FieldsItem[i]].ToString()); myTempMsg.CreateFirstNode("Checked", strData); myTempMsg.CreateFirstNode("Name", m_FieldsItem[i] + m_TableName); myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString()); myRow.AddCheckBoxReadOnlyCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]); break; case "CheckBoxByValue": myTempMsg = new PccMsg(); //myTempMsg.CreateFirstNode("Checked",myDRow[m_FieldsItem[i]].ToString()); myTempMsg.CreateFirstNode("Checked", strData); myTempMsg.CreateFirstNode("Name", m_FieldsItem[i] + m_TableName); myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString()); myRow.AddCheckBoxByValueCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]); break; case "CheckBoxByValueJudgeUserRight": myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("Checked", strData); myTempMsg.CreateFirstNode("Name", m_FieldsItem[i] + m_TableName); myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString()); myAuth.Url = myDRow["menu_link"].ToString(); if (myAuth.GetAuth(m_FieldsItem[i]) == "Y") myRow.AddCheckBoxByValueCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]); else myRow.AddCheckBoxReadOnlyCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]); break; case "MultiLink": myRow.AddMultiLinkCell(GenMultiLinkXML(myDRow, m_FieldsType[i]), m_FieldsPercent[i]); break; case "Space": myRow.AddTextCell("", m_FieldsPercent[i]); break; default: break; } } else { myRow.AddTextCell(Start_SC.ToString(), m_FieldsPercent[i]); } } m_Table.Controls.Add(myRow.Row); Start_SC += 1; } } else { foreach (DataRow myDRow in m_myRows) { if (Start_SC % 2 == 0) Style_SC = m_RowClass1; else Style_SC = m_RowClass2; myRow = new PccRow("", HorizontalAlign.Center, VerticalAlign.Middle, 0); myRow.SetRowCss(Style_SC); string strData = ""; for (i = 0; i < m_FieldsItem.Length; i++) { if (m_FieldsItem[i] != "--NO--") { myMsg = new PccMsg(m_FieldsType[i]); if (myMsg.Query("Type") != "Space") { if (Convert.IsDBNull(myDRow[m_FieldsItem[i]])) { strData = ""; } else { if (m_TransFunc.Length != 0) { try { strData = CallTrnasFunc(m_objThis, m_TransFunc[i], myDRow[m_FieldsItem[i]].ToString()); } catch (Exception ex) { strData = myDRow[m_FieldsItem[i]].ToString() + ex.Message; } } else { strData = myDRow[m_FieldsItem[i]].ToString(); } } } switch (myMsg.Query("Type")) { case "Text": //myRow.AddTextCell(myDRow[m_FieldsItem[i]].ToString(),m_FieldsPercent[i]); if (myMsg.Query("HAlign").Equals(string.Empty)) myRow.AddTextCell(strData, m_FieldsPercent[i]); else { switch (myMsg.Query("HAlign")) { case "Center": myRow.AddTextCell(strData, m_FieldsPercent[i], HorizontalAlign.Center); break; case "Right": if ((myMsg.Query("Round").Equals(string.Empty)) || (strData.Equals(string.Empty))) { myRow.AddTextCell(strData, m_FieldsPercent[i], HorizontalAlign.Right); } else { int round = int.Parse(myMsg.Query("Round")); decimal temp = decimal.Parse(strData); temp = Math.Round(temp, round); myRow.AddTextCell(temp.ToString(), m_FieldsPercent[i], HorizontalAlign.Right); } break; case "Left": myRow.AddTextCell(strData, m_FieldsPercent[i], HorizontalAlign.Left); break; } } break; case "ImageButton": break; case "HyperLink": break; case "LinkButton": break; case "CheckBox": myTempMsg = new PccMsg(); //myTempMsg.CreateFirstNode("Checked",myDRow[m_FieldsItem[i]].ToString()); myTempMsg.CreateFirstNode("Checked", strData); myTempMsg.CreateFirstNode("Name", m_TableName); myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString()); myRow.AddCheckBoxByValueCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]); break; case "CheckBoxReadOnly": myTempMsg = new PccMsg(); //myTempMsg.CreateFirstNode("Checked",myDRow[m_FieldsItem[i]].ToString()); myTempMsg.CreateFirstNode("Checked", strData); myTempMsg.CreateFirstNode("Name", m_FieldsItem[i] + m_TableName); myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString()); myRow.AddCheckBoxReadOnlyCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]); break; case "CheckBoxByValue": myTempMsg = new PccMsg(); //myTempMsg.CreateFirstNode("Checked",myDRow[m_FieldsItem[i]].ToString()); myTempMsg.CreateFirstNode("Checked", strData); myTempMsg.CreateFirstNode("Name", m_FieldsItem[i] + m_TableName); myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString()); myRow.AddCheckBoxByValueCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]); break; case "CheckBoxByValueJudgeUserRight": myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("Checked", strData); myTempMsg.CreateFirstNode("Name", m_FieldsItem[i] + m_TableName); myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString()); myAuth.Url = myDRow["menu_link"].ToString(); if (myAuth.GetAuth(m_FieldsItem[i]) == "Y") myRow.AddCheckBoxByValueCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]); else myRow.AddCheckBoxReadOnlyCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]); break; case "MultiLink": myRow.AddMultiLinkCell(GenMultiLinkXML(myDRow, m_FieldsType[i]), m_FieldsPercent[i]); break; case "Space": myRow.AddTextCell("", m_FieldsPercent[i]); break; default: break; } } else { myRow.AddTextCell(Start_SC.ToString(), m_FieldsPercent[i]); } } m_Table.Controls.Add(myRow.Row); Start_SC += 1; } } bReturn = true; return bReturn; }
private void GenDetailTableHeader() { m_Table.Width = Unit.Percentage(100); m_Table.CssClass = m_TableClass; m_Table.CellSpacing = 1; m_Table.CellPadding = 0; int i; string[] SplitArray; string strTemp = ""; PccRow myRow = new PccRow(m_RowHeaderClass, HorizontalAlign.Center, VerticalAlign.Middle, 0); for (i = 0; i < m_Fields.Length; i++) { //SplitArray = m_Fields[i].Split("--".ToCharArray()); SplitArray = m_Fields[i].Split(new char[] { '-' }); if (SplitArray.Length == 3) { switch (SplitArray[0]) { case "btn": strTemp = "<input type=button class=button id='btn-" + m_TableName + "' value='" + SplitArray[1] + "' onClick='" + SplitArray[2] + "'>"; break; case "link": strTemp = "<A id='link-" + m_TableName + "' href='" + SplitArray[2] + "' >" + SplitArray[1] + "</A>"; break; default: strTemp = m_Fields[i]; break; } } else { strTemp = m_Fields[i]; } myRow.AddTextCell(strTemp, m_FieldsPercent[i]); } m_Table.Controls.Add(myRow.Row); }
private void GenMasterTableHeader(ref PccErrMsg myLabel) { PccRow myRow = new PccRow("cssGridHeader", HorizontalAlign.Center, VerticalAlign.Middle, 0); myRow.AddTextCell("編號", 5); myRow.AddTextCell("廠別編號", 10); myRow.AddTextCell("廠別名稱", 50); myRow.AddTextCell("事業群", 15); myRow.AddTextCell("檢視", 10); myRow.AddTextCell("取消", 10); tblFact.CssClass = "cssGridTable"; tblFact.Width = Unit.Percentage(100); tblFact.HorizontalAlign = HorizontalAlign.Center; tblFact.CellPadding = 2; tblFact.CellSpacing = 1; tblFact.Rows.Add(myRow.Row); }
private void GenMasterTableHader(ref PccErrMsg myLabel) { PccRow myRow = new PccRow("cssGridHeader", HorizontalAlign.Center, VerticalAlign.Middle, 0); //編號 myRow.AddTextCell(myLabel.GetErrMsg("lbl0004", "ADTPurDoc/GroupManage"), 10); //群組名稱(點選群組名稱可把使用者加入此群組) myRow.AddTextCell(myLabel.GetErrMsg("lbl0022", "ADTPurDoc/GroupManage"), 60); //檢視使用者 myRow.AddTextCell(myLabel.GetErrMsg("lbl0020", "ADTPurDoc/GroupManage"), 10); //檢視選單 myRow.AddTextCell(myLabel.GetErrMsg("lbl0021", "ADTPurDoc/GroupManage"), 10); //群組管理 myRow.AddTextCell(myLabel.GetErrMsg("lbl0001", "ADTPurDoc/GroupManage"), 10); tblGroup.CssClass = "cssGridTable"; tblGroup.Width = Unit.Percentage(100); tblGroup.HorizontalAlign = HorizontalAlign.Center; tblGroup.CellPadding = 2; tblGroup.CellSpacing = 1; tblGroup.Rows.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 GenMasterTableHader(ref PccErrMsg myLabel) { PccRow myRow = new PccRow("DListHeaderTD", HorizontalAlign.Center, VerticalAlign.Middle, 0); //編號 myRow.AddTextCell(myLabel.GetErrMsg("lbl0007", "SysManager/ApManager"), 5); //應用程式編碼 myRow.AddTextCell(myLabel.GetErrMsg("lbl0008", "SysManager/ApManager"), 10); //應用程式名稱 myRow.AddTextCell(myLabel.GetErrMsg("lbl0009", "SysManager/ApManager"), 15); //應用程式連結 myRow.AddTextCell(myLabel.GetErrMsg("lbl0010", "SysManager/ApManager"), 40); //應用程式目錄 myRow.AddTextCell(myLabel.GetErrMsg("lbl0012", "SysManager/ApManager"), 15); //檢視 myRow.AddTextCell(myLabel.GetErrMsg("lbl0017", "SysManager/ApManager"), 5); //管理 myRow.AddTextCell(myLabel.GetErrMsg("lbl0013", "SysManager/ApManager"), 5); tblAp.CssClass = "ActDocTB"; tblAp.Width = Unit.Percentage(100); tblAp.HorizontalAlign = HorizontalAlign.Center; tblAp.CellPadding = 2; tblAp.CellSpacing = 1; tblAp.Rows.Add(myRow.Row); }
private void GenMasterTableData(ref PccErrMsg myLabel) { PccMsg myMsg = new PccMsg(); string strUserID = ""; if (CheckQueryString("Method") != "") { myMsg.LoadXml(CheckQueryString("Method")); strUserID = myMsg.Query("Key"); ViewState["UserID"] = strUserID; } else { lblMsg.Text = "Load Error!!!"; return; } bs_GroupManage mybs = new PccBsSystemForC.bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); myMsg.LoadXml(); myMsg.CreateFirstNode("ap_id", CheckQueryString("ApID")); myMsg.CreateFirstNode("user_id", strUserID); myMsg.CreateFirstNode("StartRecord", "0"); myMsg.CreateFirstNode("PageSize", "3000"); myMsg.CreateFirstNode("group_nm", ""); //加入判斷是否要有事業群之判斷20041116 myMsg.CreateFirstNode("page_check", "UserJoinGroup104"); myMsg.CreateFirstNode("login_user_id", Session["UserID"].ToString()); GetMenuAuth myAuth = new GetMenuAuth(); myAuth.AspxFile = "UserManage104.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 myGroupDs = mybs.DoReturnDataSet("GetGroupAndUserCheckByApID", myMsg.GetXmlStr, ""); DataTable myGroupData = myGroupDs.Tables["Group"]; if (myGroupData.Rows.Count > 0) { ViewState["group_org"] = ""; int MasterCount = 0; string MasterStyle = ""; PccMsg myTempMsg; PccRow myRow; //明細資料類別之共同參數 myMsg.LoadXml(); myMsg.CreateFirstNode("TableClass", "ActDocTB"); myMsg.CreateFirstNode("RowHeaderClass", "TDShowHeader"); myMsg.CreateFirstNode("RowClass1", "ffd000"); myMsg.CreateFirstNode("RowClass2", "fff000"); string strClassXML = myMsg.GetXmlStr; //明細資料的欄位參數 string[] Fields = { "編號", "選單名稱", "顯示權限", "新增權限", "更新權限", "刪除權限", "報表權限", "發信權限" }; int[] FieldsPercent = { 5, 35, 10, 10, 10, 10, 10, 10 }; string[] FieldsItem = { "--NO--", "menu_nm", "show_mk", "add_mk", "upd_mk", "del_mk", "rpt_mk", "send_mk" }; string[] FieldsType = new string[8]; FieldsType[0] = "--NO--"; FieldsType[1] = "<PccMsg><Type>Text</Type></PccMsg>"; FieldsType[2] = "<PccMsg><Type>CheckBoxReadOnly</Type><Value>menu_id</Value></PccMsg>"; FieldsType[3] = "<PccMsg><Type>CheckBoxReadOnly</Type><Value>menu_id</Value></PccMsg>"; FieldsType[4] = "<PccMsg><Type>CheckBoxReadOnly</Type><Value>menu_id</Value></PccMsg>"; FieldsType[5] = "<PccMsg><Type>CheckBoxReadOnly</Type><Value>menu_id</Value></PccMsg>"; FieldsType[6] = "<PccMsg><Type>CheckBoxReadOnly</Type><Value>menu_id</Value></PccMsg>"; FieldsType[7] = "<PccMsg><Type>CheckBoxReadOnly</Type><Value>menu_id</Value></PccMsg>"; //要取得明細資料的Table變數 DataTable tblMenuByGroupID; //再利用此Table再取得其每一列的資料,再Gen出主要的Table Row. foreach (DataRow myMasterRow in myGroupData.Rows) { if (MasterCount % 2 == 0) MasterStyle = "eee000"; else MasterStyle = "fff000"; myRow = new PccRow("", HorizontalAlign.Center, 0, 0); myRow.SetRowCss(MasterStyle); //編號 myRow.AddTextCell(ListCount, 10); //群組名稱 myRow.AddTextCell(myMasterRow["group_nm"].ToString(), 60); //檢視 myTempMsg = new PccMsg(); myTempMsg.CreateFirstNode("ToolTip", myLabel.GetErrMsg("lbl0021", "ADTPurDoc/GroupManage")); myTempMsg.CreateFirstNode("LinkID", "HlinkView" + myMasterRow["group_id"].ToString()); myTempMsg.CreateFirstNode("Image", Session["PageLayer"] + "images/detal.gif"); myTempMsg.CreateFirstNode("ClickFun", "doSection(view_" + MasterCount.ToString() + ")"); myRow.AddLinkCell(myTempMsg.GetXmlStr, 20); //選擇 myTempMsg.LoadXml(); myTempMsg.CreateFirstNode("Checked", myMasterRow["UserCheck"].ToString()); myTempMsg.CreateFirstNode("Name", "JoinGroupID"); myTempMsg.CreateFirstNode("Value", myMasterRow["group_id"].ToString()); myRow.AddCheckBoxByValueCell(myTempMsg.GetXmlStr, 10); //設定原始的GroupID的資料 if (myMasterRow["UserCheck"].ToString() == "Y") ViewState["group_org"] += myMasterRow["group_id"].ToString() + ","; tblGroup.Rows.Add(myRow.Row); tblMenuByGroupID = mybs.DoReturnDataSet("GetMenuByGroupID", "<PccMsg><group_id>" + myMasterRow["group_id"].ToString() + "</group_id></PccMsg>", "").Tables["MenuGroup"]; //設定選單明細資料類別之參數 PccDetailTable myDTable = new PccDetailTable("DT" + myMasterRow["group_id"].ToString()); myDTable.ClassXML = strClassXML; myDTable.Fields = Fields; myDTable.FieldsPercent = FieldsPercent; myDTable.FieldsItem = FieldsItem; myDTable.FieldsType = FieldsType; myDTable.NewDataTable = tblMenuByGroupID; myDTable.Create(); myRow.Reset(); myRow.SetRowCss("off"); myRow.SetRowID("view_" + MasterCount); myRow.SetDefaultCellData("DGridTD", HorizontalAlign.Center, 0, 10); myRow.AddControl(myDTable.NewTable, 100); tblGroup.Rows.Add(myRow.Row); MasterCount += 1; } // end of foreach datarow if (ViewState["group_org"].ToString() != "") ViewState["group_org"] = ViewState["group_org"].ToString().Substring(0, ViewState["group_org"].ToString().Length - 1); else ViewState["group_org"] = ""; } // end of if table count is 0 }
private void GenMasterTableHader(ref PccErrMsg myLabel) { PccRow myRow = new PccRow("DListHeaderTD", HorizontalAlign.Center, VerticalAlign.Middle, 0); //編號 myRow.AddTextCell(myLabel.GetErrMsg("lbl0007", "SysManager/ApManager"), 5); //廠群組名稱 myRow.AddTextCell("廠群組名稱(點選群組名稱可加入廠別)", 56); //廠別檢視 myRow.AddTextCell("廠別檢視", 12); //使用者檢視 myRow.AddTextCell("使用者檢視", 12); //管理 myRow.AddTextCell(myLabel.GetErrMsg("lbl0013", "SysManager/ApManager"), 15); TblDs_Fgrp.CssClass = "ActDocTB"; TblDs_Fgrp.Width = Unit.Percentage(100); TblDs_Fgrp.HorizontalAlign = HorizontalAlign.Center; TblDs_Fgrp.CellPadding = 2; TblDs_Fgrp.CellSpacing = 1; TblDs_Fgrp.Rows.Add(myRow.Row); }
private void GenMasterTableHader(ref PccErrMsg myLabel) { PccRow myRow = new PccRow("DListHeaderTD", HorizontalAlign.Center, VerticalAlign.Middle, 0); //編號 myRow.AddTextCell(myLabel.GetErrMsg("lbl0004", "ADTPurDoc/GroupManage"), 10); //群組名稱 myRow.AddTextCell(myLabel.GetErrMsg("lbl0025", "ADTPurDoc/GroupManage"), 60); //檢視選單權限 myRow.AddTextCell(myLabel.GetErrMsg("lbl0026", "ADTPurDoc/GroupManage"), 20); //選取 myRow.AddTextCell(myLabel.GetErrMsg("lbl0008", "ADTPurDoc/GroupManage"), 10); tblGroup.CssClass = "ActDocTB"; tblGroup.Width = Unit.Percentage(100); tblGroup.HorizontalAlign = HorizontalAlign.Center; tblGroup.CellPadding = 2; tblGroup.CellSpacing = 1; tblGroup.Rows.Add(myRow.Row); }
private void GenMasterTableData(ref PccErrMsg myLabel) { PccErrMsg myErrMsg = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"), Session["CodePage"].ToString(), "Error"); bs_FactGroupManage mybs = new bs_FactGroupManage(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("Fgrp_Id", m_Fgrp_Id); myMsg.CreateFirstNode("Fact_No", txtfactno.Text); myMsg.CreateFirstNode("Fact_Nm", txtfactnm.Text); myMsg.CreateFirstNode("Fgrp_Nm", txtfgrpnm.Text); myMsg.CreateFirstNode("StartRecord", PageControl1.StartRecord.ToString()); myMsg.CreateFirstNode("PageSize", PageControl1.PageSize.ToString()); DataSet ds; //以後可以加入若是有Report和Send的權限,表示是群管理者,所以可以看到這個群的所有資料 20041125 GetMenuAuth myAuth = new GetMenuAuth(); myAuth.AspxFile = FACTGROUPMANAGE; ds = mybs.DoReturnDataSet("getFactByFgrpId", myMsg.GetXmlStr, ""); DataTable myTable = ds.Tables["FactByFgrp"]; PccRow myRow; if (myTable.Rows.Count > 0) { int MasterCount = 1; string MasterStyle = ""; //取出資料總筆數 PageControl1.TotalSize = ds.Tables["TCounts"].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["FactFgrpTemporary"] != null && Session["FactFgrpTemporary"].ToString() != "") { string[] chkarray = Session["FactFgrpTemporary"].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(), 25); //公司名稱 myRow.AddTextCell(myMasterRow["comp_nm"].ToString(), 30); //事業群 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 GenMasterTableData(ref PccErrMsg myLabel) { PccBsSystemForC.bs_UserManager mybs = new PccBsSystemForC.bs_UserManager(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", m_apid); myMsg.CreateFirstNode("user_desc", user_desc.Text); //string strXML = myMsg.GetXmlStr; GetMenuAuth myAuth = new GetMenuAuth(); //判斷是否要利用事業群來分設權限 20041118 myMsg.CreateFirstNode("user_id", Session["UserID"].ToString()); myMsg.CreateFirstNode("order", ""); 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 myAskDs = mybs.DoReturnDataSet("GetAskByApID", myMsg.GetXmlStr, ""); PccMsg myTempMsg = new PccMsg(); DataTable myAskData = myAskDs.Tables["Ask"]; if (myAskData != null && myAskData.Rows.Count > 0) { int MasterCount = 0; string MasterStyle = ""; PccRow myRow; //取出資料總筆數 PageControl1.TotalSize = myAskDs.Tables["TCounts"].Rows[0]["Counts"].ToString(); PageControl1.BuildPager(); //再利用此Table再取得其每一列的資料,再Gen出主要的Table Row. foreach (DataRow myMasterRow in myAskData.Rows) { if (MasterCount % 2 == 0) MasterStyle = "cssGridRowAlternating"; else MasterStyle = "cssGridRow"; myRow = new PccRow(); myRow.SetRowCss(MasterStyle); //編號 myRow.AddTextCell(PageControl1.ListCount, 5); //姓名 myRow.AddTextCell(myMasterRow["user_desc"].ToString(), 10); //電子郵件帳號 myRow.AddTextCell(myMasterRow["email"].ToString(), 33); //廠別 myRow.AddTextCell(myMasterRow["fact_nm"].ToString(), 22); //Email //myRow.AddTextCell(myMasterRow["email"].ToString(),25); //分機 myRow.AddTextCell(myMasterRow["ext"].ToString(), 5); //群組 myRow.SetDefaultCellData("", HorizontalAlign.Center, 0, 0); myRow.AddControl(GetGroup(myMasterRow["ask_id"].ToString()), 15); //核準 myRow.AddTextCell(GetCheck(myMasterRow["ask_id"].ToString()), 5); //駁回 myTempMsg.LoadXml(); myTempMsg.CreateNode("LinkButton"); myTempMsg.AddToNode("Image", Session["PageLayer"] + "images/del.gif"); myTempMsg.AddToNode("ToolTip", "駁回此使用者之申請"); myTempMsg.AddToNode("href", CHECKUSERMANAGE + "?ApID=" + Request.Params["ApID"].ToString()); myTempMsg.AddToNode("QueryCondition", GetQueryCondition()); myTempMsg.AddToNode("Method", GetMethod("MasterDelFunc", "ask_id", "user_desc", myMasterRow)); myTempMsg.UpdateNode(); myRow.AddMultiLinkCell(myTempMsg.GetXmlStr, 5); tblCheckUser.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 GenMasterTableHeader(ref PccErrMsg myLabel) { PccRow myRow = new PccRow("DListHeaderTD", HorizontalAlign.Center, VerticalAlign.Middle, 0); myRow.AddTextCell("編號", 5); myRow.AddTextCell("使用者名稱", 10); myRow.AddTextCell("廠別", 35); myRow.AddTextCell("事業群", 15); myRow.AddTextCell("電子郵件帳號", 30); myRow.AddTextCell("挑選", 5); tab_user.CssClass = "ActDocTB"; tab_user.Width = Unit.Percentage(100); tab_user.HorizontalAlign = HorizontalAlign.Center; tab_user.CellPadding = 2; tab_user.CellSpacing = 1; tab_user.Rows.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); } }