예제 #1
0
    protected void btnDelOK_Click(object sender, System.EventArgs e)
    {
        plMain.Visible = true;
        plDelete.Visible = false;

        PccMsg myMsg = new PccMsg(CheckRequestQueryString("Method"));
        PccMsg myReturnMsg = new PccMsg();
        string strUserID = myMsg.Query("Key");
        myMsg.LoadXml();
        myMsg.CreateFirstNode("user_id", strUserID);
        myMsg.CreateFirstNode("ap_id", CheckRequestQueryString("ApID"));

        //增加一個刪除e_userfact的關連 20040924
        myMsg.CreateFirstNode("upd_id", Session["UserID"].ToString());
        myMsg.CreateFirstNode("fact_id", "0");
        myMsg.CreateFirstNode("uf_id", "0");
        bs_UserFactManage mybs1 = new bs_UserFactManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]);
        string strReturn = mybs1.DoReturnStr("DeleteUserFactByUser", myMsg.GetXmlStr, "");
        myReturnMsg.LoadXml(strReturn);

        if (myReturnMsg.Query("returnValue") != "0")
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(),"New", "<script language=javascript>alert('" + myMsg.Query("errmsg") + "');</script>");
            return;
        }

        bs_UserManager mybs = new bs_UserManager(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]);
        strReturn = mybs.DoReturnStr("DeleteUserByApID", myMsg.GetXmlStr, "");

        myReturnMsg.LoadXml(strReturn);

        if (myReturnMsg.Query("returnValue") == "0")
        {
            GenMasterTable();
        }
        else
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(),"New", "<script language=javascript>alert('" + myMsg.Query("errmsg") + "');</script>");
        }
    }
예제 #2
0
    protected void btnApply_Click(object sender, System.EventArgs e)
    {
        if (!CheckVerifyNumber()) return;

        bs_UserManager mybs = new bs_UserManager(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]);
        string strReturn = GetSendXML();
        strReturn = mybs.DoReturnStr("InsertAskUser", strReturn, "");

        PccMsg myMsg = new PccMsg(strReturn);

        if (myMsg.Query("returnValue") == "0")
        {
            lblMsg.Font.Size = FontUnit.Medium;
            lblMsg.Text = "申請成功,請等待管理者Mail通知!";
            txtusr_pas.Attributes["value"] = txtusr_pas.Text;
            txtReusr_pas.Attributes["value"] = txtusr_pas.Text;
            SetTextColor();
            ddlApplcation.Enabled = false;
            btnApply.Enabled = false;
            //20050630新增可以給多個管理者
            string ap_id = ddlApplcation.SelectedItem.Value;
            string[] arrEmail = System.Configuration.ConfigurationManager.AppSettings[ap_id + "-Email"].ToString().Split(';');
            string[] arrName = System.Configuration.ConfigurationManager.AppSettings[ap_id + "-Name"].ToString().Split(';');

            for (int i = 0; i < arrEmail.Length; i++)
            {
                if (!SendMailToManager(arrEmail[i], arrName[i]))
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(),"new", "<script language=javascript>alert('寄送郵件失敗!');</script>");
                }
            }
            //-------------------------------

        }
        else
        {
            lblMsg.Font.Size = FontUnit.Medium;
            lblMsg.Text = myMsg.Query("errmsg");
        }
    }
예제 #3
0
    protected void btnAddComeOn_Click(object sender, System.EventArgs e)
    {
        bs_UserManager mybs = new bs_UserManager(ConfigurationSettings.AppSettings["ConnectionType"] , ConfigurationSettings.AppSettings["ConnectionServer"], ConfigurationSettings.AppSettings["ConnectionDB"], ConfigurationSettings.AppSettings["ConnectionUser"], ConfigurationSettings.AppSettings["ConnectionPwd"],Session["UserIDAndName"].ToString(),ConfigurationSettings.AppSettings["EventLogPath"]);
            PccMsg myMsg = new PccMsg();
            string strUserID,strReturn,errormsg = "",strXML = "";
            bool bSelect = false;

            for (int i = 0; i < DataGrid1.Items.Count ; i++)
            {
                if (((CheckBox)DataGrid1.Items[i].Cells[6].Controls[1]).Checked)
                {
                    strUserID = DataGrid1.Items[i].Cells[1].Text;
                    myMsg.LoadXml();
                    myMsg.CreateFirstNode("ap_id",Request.QueryString["ApID"]);
                    myMsg.CreateFirstNode("user_id",strUserID);
                    myMsg.CreateFirstNode("mana_mk","N");
                    myMsg.CreateFirstNode("upd_id",Session["UserID"].ToString());

                    //strXML = GetUserXML(strUserID);

                    strReturn = mybs.DoReturnStr("JoinUserToAp",myMsg.GetXmlStr,"");

                    myMsg.LoadXml(strReturn);

                    if (myMsg.Query("returnValue") != "0")
                    {
                        lblMsg.Font.Size = FontUnit.Large;
                        lblMsg.Text = myMsg.Query("errmsg");
                        break;
                    }

                    bSelect = true;
                }
            }

            if (bSelect)
            {
                if (myMsg.Query("returnValue") == "0")
                {
                    Response.Redirect(USERMANAGE + "?ApID=" + Request.QueryString["ApID"] + "&QueryCondition=" + Request.QueryString["QueryCondition"]);
                }
                else
                {
                    lblMsg.Font.Size = FontUnit.Large;
                    if (errormsg == "")
                        lblMsg.Text = myMsg.Query("errmsg");
                    else
                        lblMsg.Text = errormsg;

                }
            }
            else
            {
                PccErrMsg myLabel = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"),Session["CodePage"].ToString() ,"Label");
                lblMsg.Font.Size = FontUnit.Large;
                if (errormsg == "")
                    lblMsg.Text = myLabel.GetErrMsg("lbl0014","SysManager/UserManager");
                else
                    lblMsg.Text = errormsg;

            }
    }
예제 #4
0
    private void SetddlDept(ref PccCommonForC.PccErrMsg myLabel,ref bs_UserManager mybs)
    {
        DataTable dt = mybs.DoReturnDataSet("GetDeptAllData","","").Tables["Dept"];

            DataRow myRow = dt.NewRow();
            myRow["dept_id"] = 0;
            myRow["dept_no"] = "aaa";
            myRow["dept_nm"] = "bbb";
            myRow["dept_desc"] = myLabel.GetErrMsg("SelectPlease") ;
            dt.Rows.InsertAt(myRow,0);

            //			ddldept_id.DataSource = dt.DefaultView;
            //			ddldept_id.DataTextField = "dept_desc";
            //			ddldept_id.DataValueField = "dept_id";
            //			ddldept_id.DataBind();
    }
예제 #5
0
    private void BindDataGrid(string strOrder, string strUserDesc, string strUserNm, string strDeptID, ref bs_UserManager mybs, int iPage)
    {
        PccMsg myMsg = new PccMsg();
            myMsg.CreateFirstNode("ap_id", Request.QueryString["ApID"]);
            myMsg.CreateFirstNode("dept_id", strDeptID);
            myMsg.CreateFirstNode("user_desc", strUserDesc);
            myMsg.CreateFirstNode("user_nm", strUserNm);
            myMsg.CreateFirstNode("order", strOrder);

            //加入判斷是否要有事業群之判斷20041116
            myMsg.CreateFirstNode("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 ds = mybs.DoReturnDataSet("GetAnotherUser", myMsg.GetXmlStr, "");
            ViewState["order"] = strOrder;

            if (ds != null)
            {
                DataGrid1.DataSource = ds.Tables["AnotherUser"].DefaultView;
                //  DataGrid1.DataBind();
                PageControl1.BindDataGrid = DataGrid1;
                PageControl1.CurrentPageIndex = iPage;

            }
            else
            {
                btnAddComeOn.Visible = false;
            }
    }
예제 #6
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        if (Session["UserID"] == null) return;

            // 將使用者程式碼置於此以初始化網頁
            m_apid = Request.QueryString["ApID"].ToString();
            if (! IsPostBack)
            {
                PccErrMsg myLabel = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"),Session["CodePage"].ToString() ,"Label");
                bs_UserManager mybs = new bs_UserManager(ConfigurationSettings.AppSettings["ConnectionType"] , ConfigurationSettings.AppSettings["ConnectionServer"], ConfigurationSettings.AppSettings["ConnectionDB"], ConfigurationSettings.AppSettings["ConnectionUser"], ConfigurationSettings.AppSettings["ConnectionPwd"],Session["UserIDAndName"].ToString(),ConfigurationSettings.AppSettings["EventLogPath"]);
                SetLabel(ref myLabel);
                //SetddlDept(ref myLabel,ref mybs);
                BindFactData(ref myLabel,ref mybs);
            //	BindDataGrid("user_desc",string.Empty,string.Empty,"0",ref mybs);
            }
            else
            {
                PanelGrid.Visible = true;
            }
    }
예제 #7
0
 protected void PageControl1_PageIndexChanged(object sender, System.EventArgs e)
 {
     bs_UserManager mybs = new bs_UserManager(ConfigurationSettings.AppSettings["ConnectionType"], ConfigurationSettings.AppSettings["ConnectionServer"], ConfigurationSettings.AppSettings["ConnectionDB"], ConfigurationSettings.AppSettings["ConnectionUser"], ConfigurationSettings.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationSettings.AppSettings["EventLogPath"]);
         BindDataGrid("user_desc", txtUserDesc.Text, string.Empty, ddlfact_id.SelectedItem.Value, ref mybs, PageControl1.NewPageIndex);
 }
예제 #8
0
 protected void btnQuery_Click(object sender, System.EventArgs e)
 {
     bs_UserManager mybs = new bs_UserManager(ConfigurationSettings.AppSettings["ConnectionType"] , ConfigurationSettings.AppSettings["ConnectionServer"], ConfigurationSettings.AppSettings["ConnectionDB"], ConfigurationSettings.AppSettings["ConnectionUser"], ConfigurationSettings.AppSettings["ConnectionPwd"],Session["UserIDAndName"].ToString(),ConfigurationSettings.AppSettings["EventLogPath"]);
         //BindDataGrid("user_desc",txtUserDesc.Text,ddldept_id.SelectedItem.Value,ref mybs);
         if (ddlQuerySelect.SelectedItem.Value.ToString() == "1")
         {
             BindDataGrid("user_desc",txtUserDesc.Text,string.Empty,ddlfact_id.SelectedItem.Value,ref mybs,-1);
         }
         else
         {
             BindDataGrid("user_desc",string.Empty,txtUserDesc.Text,ddlfact_id.SelectedItem.Value,ref mybs,-1);
         }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserID"] == null) return;

        // 將使用者程式碼置於此以初始化網頁
        for (int i = 0; i < Header1.Controls.Count; i++)
        {
            if (Header1.Controls[i].ID == TITLE)
            {
                Label mylblTitle = (Label)(Header1.Controls[i]);
                mylblTitle.Text = "挑選使用者至<font color=red><b>" + Request.Params["FactName"] + "</b></font>中";
            }
        }
        m_ap_id = Request.Params["ApID"];
        m_fact_id = Request.Params["FactID"];

        if (!IsPostBack)
        {
            //清除Session
            Session["Usertemporary"] = string.Empty;

            PccErrMsg myLabel = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"), Session["CodePage"].ToString(), "Label");
            bs_UserManager mybsS = new bs_UserManager(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]);
            BindFactData(ref myLabel, ref mybsS);
            SetLabel(ref myLabel);
            GenMasterTable();
        }
    }
    private void AddCheckUser()
    {
        string[] tempAsk_id, tempGroup_id;
        string ask_str = Request.Params["CheckAsk"].ToString();
        tempAsk_id = ask_str.Split(',');
        tempGroup_id = Request.Params["ddlGroup"].ToString().Split(',');

        string check_str = "";
        int i = 0;

        for (i = 0; i < tempAsk_id.Length; i++)
        {
            check_str += "Y,";
        }

        check_str = check_str.Substring(0, check_str.Length - 1);

        string group_str = "";
        for (i = 0; i < tempGroup_id.Length; i++)
        {
            if (tempGroup_id[i] != "0")
            {
                group_str += tempGroup_id[i] + ",";
            }
        }

        group_str = group_str.Substring(0, group_str.Length - 1);

        PccMsg myMsg = new PccMsg();
        myMsg.CreateFirstNode("ask_str", ask_str);
        myMsg.CreateFirstNode("check_str", check_str);
        myMsg.CreateFirstNode("group_str", group_str);
        myMsg.CreateFirstNode("check_id", Session["UserID"].ToString());
        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"]);
        string strReturn = mybs.DoReturnStr("AuditUser", myMsg.GetXmlStr, "");

        myMsg.LoadXml(strReturn);

        DataTable dt;

        if (myMsg.Query("returnValue") == "0")
        {
            //要送信給每位申請者 20040418
            for (i = 0; i < tempAsk_id.Length; i++)
            {
                dt = mybs.DoReturnDataSet("GetAskByAskID", "", tempAsk_id[i]).Tables["Ask"];
                if (!SendMailToManager(dt.Rows[0]["ap_id"].ToString(), dt.Rows[0]["ap_name"].ToString(), dt.Rows[0]["user_desc"].ToString(), dt.Rows[0]["email"].ToString()))
                {
                    return;
                }

            }
            Response.Redirect(CHECKUSERMANAGE + "?ApID=" + Request.Params["ApID"].ToString());
        }
        else
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(),"New", "<script language=javascript>alert('" + myMsg.Query("errmsg") + "');</script>");
        }
    }
    protected void Page_Load(object sender, System.EventArgs e)
    {
        if (Session["UserID"] == null) return;

        // 將使用者程式碼置於此以初始化網頁
        m_apid = Request.QueryString["ApID"].ToString();
        if (!IsPostBack)
        {
            //lblTitle.Text = "請選擇欲加入<font color=blue>" + Request.Params["GroupNm"] + "</font>群組的使用者";
            //設定抬頭 20040607
            for (int i = 0; i < Header1.Controls.Count; i++)
            {
                if (Header1.Controls[i].ID == "PccTitle")
                {
                    Label mylblTitle = (Label)(Header1.Controls[i]);
                    mylblTitle.Text = "請選擇欲加入<font color=blue>" + Request.Params["GroupNm"] + "</font>群組的使用者";
                }
            }

            PccErrMsg myLabel = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"), Session["CodePage"].ToString(), "Label");
            bs_GroupManage mybs = new bs_GroupManage(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]);
            bs_UserManager myUbs = new bs_UserManager(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]);
            SetLabel(ref myLabel);
            BindFactData(ref myLabel, ref myUbs);
            //SetddlDept(ref myLabel,ref myUbs);
            BindDataGrid("user_desc", "", "0", ref mybs);
        }
        else
        {
            PanelGrid.Visible = true;
        }
    }
예제 #12
0
    private void UpdateMenuByUser(string strXML)
    {
        string menu_id = "";
        int i;

        m_menuIDArray = (string[])ViewState["MenuID"];
        for (i = 0; i < m_menuIDArray.Length; i++)
        {
            menu_id += m_menuIDArray[i] + ",";
        }

        if (menu_id == "")
        {
            GenMasterTable();
            return;
        }
        else
        {
            menu_id = menu_id.Substring(0, menu_id.Length - 1);
        }

        PccMsg myMsg = new PccMsg(strXML);
        string strRequestFormName = myMsg.Query("btnID").Split('-')[1];
        string strShow = CheckRequestForm("show_mk" + strRequestFormName);
        string strAdd = CheckRequestForm("add_mk" + strRequestFormName);
        string strUpd = CheckRequestForm("upd_mk" + strRequestFormName);
        string strDel = CheckRequestForm("del_mk" + strRequestFormName);
        string strRpt = CheckRequestForm("rpt_mk" + strRequestFormName);
        string strSend = CheckRequestForm("send_mk" + strRequestFormName);

        string show_mk, add_mk, upd_mk, del_mk, rpt_mk, send_mk;
        string user_id;

        user_id = strRequestFormName.Substring(3);
        show_mk = CompareTwoStrArray(m_menuIDArray, strShow, "Y,", "N,");
        add_mk = CompareTwoStrArray(m_menuIDArray, strAdd, "Y,", "N,");
        upd_mk = CompareTwoStrArray(m_menuIDArray, strUpd, "Y,", "N,");
        del_mk = CompareTwoStrArray(m_menuIDArray, strDel, "Y,", "N,");
        rpt_mk = CompareTwoStrArray(m_menuIDArray, strRpt, "Y,", "N,");
        send_mk = CompareTwoStrArray(m_menuIDArray, strSend, "Y,", "N,");

        myMsg.LoadXml();

        myMsg.CreateFirstNode("user_id", user_id);
        myMsg.CreateFirstNode("menu_str", menu_id);
        myMsg.CreateFirstNode("show_str", show_mk);
        myMsg.CreateFirstNode("add_str", add_mk);
        myMsg.CreateFirstNode("upd_str", upd_mk);
        myMsg.CreateFirstNode("del_str", del_mk);
        myMsg.CreateFirstNode("rpt_str", rpt_mk);
        myMsg.CreateFirstNode("send_str", send_mk);

        bs_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"]);
        string strReturn = mybs.DoReturnStr("UpdateMenudByUserID", 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>");
        }
    }
예제 #13
0
    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();
        }
    }
예제 #14
0
    private void BindFactData(ref PccCommonForC.PccErrMsg myLabel)
    {
        DataSet ds;
        DataTable dt;
        DataRow myRow;

        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("ap_id", Request.QueryString["ApID"]);

        ds = mybs.DoReturnDataSet("GetFactsRelUsersByApID", myMsg.GetXmlStr, "");
        dt = ds.Tables["FactsRelUsersByAp"];

        myRow = dt.NewRow();
        myRow["fact_id"] = 0;
        myRow["fact_no"] = string.Empty;
        myRow["fact_desc"] = myLabel.GetErrMsg("SelectPlease");
        dt.Rows.InsertAt(myRow, 0);

        ddlFact.DataSource = dt.DefaultView;
        ddlFact.DataTextField = "fact_desc";
        ddlFact.DataValueField = "fact_no";

        ddlFact.DataBind();
    }
예제 #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //PccErrMsg myLabel = new PccErrMsg(Server.MapPath(Session["PageLayer"] + "../../XmlDoc"),Session["CodePage"].ToString() ,"Label");
         PccErrMsg myLabel = new PccErrMsg(Server.MapPath("../../XmlDoc"), Session["CodePage"].ToString(), "Label");
         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"]);
         SetLabel(ref myLabel);
         BindFactData(ref myLabel, ref mybs);
         //SetddlDept(ref myLabel,ref mybs);
         SetddlApplication(ref myLabel, ref mybs);
         btnApply.Enabled = false;
         if (Request.Params["Type"] != null && Request.Params["Type"].ToString() == "Update")
         {
             btnReLogin.Text = "回上頁";
             GetUserData(ref myLabel, ref mybs);
         }
     }
 }