protected void btnOK_Click(object sender, System.EventArgs e) { if (txtGroupName.Text == "") { PccErrMsg myLabel = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"), Session["CodePage"].ToString(), "Label"); lblMsg.Text = myLabel.GetErrMsg("lbl0010", "ADTPurDoc/GroupManage"); return; } //先判斷是Insert or Update bool bUpdate = false; string group_id = ""; PccMsg myMsg = new PccMsg(); if (Request.Params["Method"] != null) { bUpdate = true; myMsg.LoadXml(Request.Params["Method"].ToString()); group_id = myMsg.Query("Key"); } myMsg.ClearContext(); myMsg.CreateFirstNode("group_id", group_id); myMsg.CreateFirstNode("ap_id", CheckQueryString("ApID")); myMsg.CreateFirstNode("group_nm", txtGroupName.Text); myMsg.CreateFirstNode("group_type", ddlGroupType.SelectedItem.Value); bs_GroupManage mybs = new bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); string strReturn = ""; if (bUpdate) { myMsg.CreateFirstNode("upd_id", Session["UserID"].ToString()); strReturn = mybs.DoReturnStr("UpdateGroupByGroupID", myMsg.GetXmlStr, ""); } else { myMsg.CreateFirstNode("add_id", Session["UserID"].ToString()); strReturn = mybs.DoReturnStr("InsertGroupByApID", myMsg.GetXmlStr, ""); } myMsg.LoadXml(strReturn); if (myMsg.Query("returnValue") == "0") { Response.Redirect(GROUPMANAGE + "?ApID=" + CheckQueryString("ApID")); } else { lblMsg.Font.Size = FontUnit.Large; lblMsg.Text = myMsg.Query("errmsg"); } }
public string db_InsUpdApplyCheck(string strXML) { PccMsg myMsg = new PccMsg(strXML); string ac_id = myMsg.Query("ac_id").ToString().Trim(); string fact_no = myMsg.Query("fact_no").ToString().Trim(); string dept_no = myMsg.Query("dept_no").ToString().Trim(); string sec_no = myMsg.Query("sec_no").ToString().Trim(); string type_check = myMsg.Query("type_check").ToString().Trim(); string vou_no = myMsg.Query("vou_no").ToString().Trim(); string total = myMsg.Query("total").ToString().Trim(); string floor = myMsg.Query("floor").ToString().Trim(); string build_no = myMsg.Query("build_no").ToString().Trim(); string myType = myMsg.Query("Type").ToString().Trim(); if (ac_id == "") ac_id = "0"; if (total == "") total = "0"; SqlParameter[] parameters = { new SqlParameter("@ac_id",SqlDbType.Int), new SqlParameter("@fact_no",SqlDbType.Char,4), new SqlParameter("@dept_no",SqlDbType.Char,10), new SqlParameter("@sec_no",SqlDbType.Char,10), new SqlParameter("@type_check",SqlDbType.Char,1), new SqlParameter("@vou_no",SqlDbType.VarChar,50), new SqlParameter("@total",SqlDbType.Int), new SqlParameter("@floor",SqlDbType.Char,1), new SqlParameter("@build_no",SqlDbType.Char,2), new SqlParameter("@Type",SqlDbType.Char,1), new SqlParameter("@Err",SqlDbType.NVarChar,100) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = fact_no; parameters[2].Value = dept_no; parameters[3].Value = sec_no; parameters[4].Value = type_check; parameters[5].Value = vou_no; parameters[6].Value = total; parameters[7].Value = floor; parameters[8].Value = build_no; parameters[9].Value = myType; parameters[10].Direction = ParameterDirection.Output; try { int iReturn = 0, rowsAffected = 0; iReturn = RunProcedure("Pro_InsUpdApplyCheck", parameters, ref rowsAffected); myMsg.ClearContext(); myMsg.CreateFirstNode("ReturnValue", iReturn.ToString()); myMsg.CreateFirstNode("RowsAffected", rowsAffected.ToString()); myMsg.CreateFirstNode("Err", parameters[10].Value.ToString()); myMsg.CreateFirstNode("ac_id", parameters[0].Value.ToString()); } catch (Exception e) { myMsg.ClearContext(); myMsg.CreateFirstNode("Err", e.Message.ToString()); } return myMsg.GetXmlStr; }
public string db_InsUpdApplyRatingDetail(string strXML) { PccMsg myMsg = new PccMsg(strXML); string id = myMsg.Query("id").ToString().Trim(); string AcRat_id = myMsg.Query("AcRat_id").ToString().Trim(); string bad_no = myMsg.Query("bad_no").ToString().Trim(); string bad_desc = myMsg.Query("bad_desc").ToString().Trim(); string bad_descVN = myMsg.Query("bad_descVN").ToString().Trim(); string qty = myMsg.Query("qty").ToString().Trim(); string qtyOKitem = myMsg.Query("qtyOKitem").ToString().Trim(); string add_id = myMsg.Query("add_id").ToString().Trim(); string myType = myMsg.Query("Type").ToString().Trim(); if (id == "") id = "0"; if (AcRat_id == "") AcRat_id = "0"; if (qty == "") qty = "0"; if (qtyOKitem == "") qtyOKitem = "0"; if (add_id == "") add_id = "0"; SqlParameter[] parameters = { new SqlParameter("@id",SqlDbType.Decimal,18), new SqlParameter("@AcRat_id",SqlDbType.Int), new SqlParameter("@bad_no",SqlDbType.Char,10), new SqlParameter("@bad_desc",SqlDbType.NVarChar,100), new SqlParameter("@bad_descVN",SqlDbType.NVarChar,100), new SqlParameter("@qty",SqlDbType.Int), new SqlParameter("@qtyOKitem",SqlDbType.Int), new SqlParameter("@add_id",SqlDbType.Decimal,18), new SqlParameter("@Type",SqlDbType.Char,1), new SqlParameter("@Err",SqlDbType.NVarChar,100) }; parameters[0].Value = id; parameters[1].Value = AcRat_id; parameters[2].Value = bad_no; parameters[3].Value = bad_desc; parameters[4].Value = bad_descVN; parameters[5].Value = qty; parameters[6].Value = qtyOKitem; parameters[7].Value = add_id; parameters[8].Value = myType; parameters[9].Direction = ParameterDirection.Output; try { int iReturn = 0, rowsAffected = 0; iReturn = RunProcedure("Pro_InsUpdApplyRatingDetail", parameters, ref rowsAffected); myMsg.ClearContext(); myMsg.CreateFirstNode("ReturnValue", iReturn.ToString()); myMsg.CreateFirstNode("RowsAffected", rowsAffected.ToString()); myMsg.CreateFirstNode("Err", parameters[9].Value.ToString()); } catch (Exception e) { myMsg.ClearContext(); myMsg.CreateFirstNode("Err", e.Message.ToString()); } return myMsg.GetXmlStr; }
private void DeleteUserByGroup(string strXML) { PccMsg myMsg = new PccMsg(strXML); string strRequestFormName = myMsg.Query("btnID"); strRequestFormName = strRequestFormName.Split('-')[1]; string strUserID = CheckForm(strRequestFormName); if (strUserID != "") { string group_id = strRequestFormName.Substring(3); myMsg.ClearContext(); myMsg.CreateFirstNode("group_id", group_id); myMsg.CreateFirstNode("user_str", strUserID); bs_GroupManage mybs = new bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]); string strReturn = mybs.DoReturnStr("DeleteUGrp", myMsg.GetXmlStr, ""); myMsg.LoadXml(strReturn); if (myMsg.Query("returnValue") == "0") { GenMasterTable(); } else { ClientScript.RegisterClientScriptBlock(this.GetType(),"New", "<script language=javascript>alert('" + myMsg.Query("errmsg") + "');</script>"); } } else { GenMasterTable(); } }
private string GetUserInfo(string strXML, string strOther) { string xmlStr = ""; PccMsg msg = new PccMsg("", "Big5"); try { msg.LoadXml(strXML); string userName = msg.Query("UserName"); string password = msg.Query("Password"); string vpath = msg.Query("vpath"); string superAdmin = msg.Query("superAdmin"); xmlStr = new db_Security(ConfigurationSettings.AppSettings["ConnectionType"], ConfigurationSettings.AppSettings["ConnectionServer"], ConfigurationSettings.AppSettings["ConnectionDB"], ConfigurationSettings.AppSettings["ConnectionUser"], ConfigurationSettings.AppSettings["ConnectionPwd"]).GetUserInfo(userName, password, vpath, superAdmin); } catch (Exception exception) { msg.ClearContext(); msg.CreateFirstNode("Exist", "N"); msg.CreateFirstNode("Return", exception.Message); xmlStr = msg.GetXmlStr; } return xmlStr; }
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); } }