Exemplo n.º 1
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();
    }
Exemplo n.º 2
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;
            }
    }
Exemplo n.º 3
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();
        }
    }
    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>");
        }
    }
Exemplo n.º 5
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();
    }