Exemplo n.º 1
0
    private string GetWelcome(string strLayer, string strApID, ref PccErrMsg myLabel)
    {
        string strReturn = string.Empty;

        bs_Security mySecurity = new bs_Security(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]);
        string strCount = "0";
        PccCommonForC.PccMsg myMsg1 = new PccCommonForC.PccMsg();

        if (strApID != null && int.Parse(strApID) > 0)
        {
            //新增這個系統的前置詞
            myMsg1.CreateFirstNode("ap_id", strApID);
            myMsg1.CreateFirstNode("user_id", Session["UserID"].ToString());

            if (((Hashtable)Session["APCounts"]).ContainsKey(strApID))
            {
                strCount = ((Hashtable)Session["APCounts"])[strApID].ToString();
            }
            else
            {
                strCount = mySecurity.DoReturnStr("GetAndUpdateApCounts", myMsg1.GetXmlStr, "");
                ((Hashtable)Session["APCounts"]).Add(strApID, strCount);
            }
        }

        //060306 將原本Hard code的Menu內容改由LabelMsg_TC.xml抓取
        string strWel = myLabel.GetErrMsg("M000001", "MenuItem");
        string strCome = myLabel.GetErrMsg("M000002", "MenuItem");
        string strUpdateUser = myLabel.GetErrMsg("M000011", "MenuItem");
        string strAddSystem = myLabel.GetErrMsg("M000012", "MenuItem");
        string strTransfer = myLabel.GetErrMsg("M000013", "MenuItem");

        //strReturn += "\"歡迎" + Session["UserName"].ToString() + "光臨(" + strCount + ")\","; //第一個分區的圖形或文字
        strReturn += "\"" + strWel + Session["UserName"].ToString() + strCome + "(" + strCount + ")\","; //第一個分區的圖形或文字
        strReturn += "3,"; //第一個大項次的開始
        //第一個分區的第一個小Item參數
        //strReturn += "\"個人資料修改\","; //選單名稱
        strReturn += "\"" + strUpdateUser + "\","; //選單名稱
        strReturn += "\"" + strLayer + "images/MenuArea/DgyyWebWinNew/sFile1.gif\","; //選單的前置圖形
        strReturn += "\"" + ConfigurationManager.AppSettings["PFSBaseWeb"] + "usermanage/UpdateUser.aspx?UserID=" + Session["UserID"].ToString() + "&AcctionType=Upd&UserAccount=" + Session["UserAccount"].ToString() + "\",";//選單的連結網頁
        strReturn += "\"1\","; //型態表示開啟一個頁面在IFrame上,若為2表示呼叫一個函式。

        //第一個分區的第二個小Item參數
        //strReturn += "\"加入系統\","; //選單名稱
        strReturn += "\"" + strAddSystem + "\","; //選單名稱
        strReturn += "\"" + strLayer + "images/MenuArea/DgyyWebWinNew/sFile1.gif\","; //選單的前置圖形
        strReturn += "\"ApplyAccount.aspx?Type=Update\",";//選單的連結網頁
        strReturn += "\"1\","; //型態表示開啟一個頁面在IFrame上,若為2表示呼叫一個函式。

        //第一個分區的第三個小Item參數
        //strReturn += "\"中英文轉換\","; //選單名稱
        strReturn += "\"" + strTransfer + "\","; //選單名稱
        strReturn += "\"" + strLayer + "images/MenuArea/DgyyWebWinNew/sFile1.gif\","; //選單的前置圖形
        strReturn += "\"ChangeLanguage.aspx?ApID=0\",";//選單的連結網頁
        strReturn += "\"1\""; //型態表示開啟一個頁面在IFrame上,若為2表示呼叫一個函式。

        return strReturn;
    }
Exemplo n.º 2
0
    protected void cmdLogin_Click1(object sender, ImageClickEventArgs e)
    {
        PccMsg myMsg = new PccMsg("", "Big5");
        bs_Security mySecurity = new bs_Security(ConfigurationManager.AppSettings["ConnectionType"], ConfigurationManager.AppSettings["ConnectionServer"], ConfigurationManager.AppSettings["ConnectionDB"], ConfigurationManager.AppSettings["ConnectionUser"], ConfigurationManager.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationManager.AppSettings["EventLogPath"]);
        string strXmlReturn;

        myMsg.CreateFirstNode("UserName", txtUserName.Text);
        myMsg.CreateFirstNode("Password", txtPassword.Text);

        myMsg.CreateFirstNode("vpath", ConfigurationManager.AppSettings["vpath"]);
        //因為現在是使用Email登入所以之必須用Email做比較 20050126
        //myMsg.CreateFirstNode("superAdmin",ConfigurationManager.AppSettings["superAdmin"]);
        myMsg.CreateFirstNode("superAdmin", ConfigurationManager.AppSettings["superAdminEmail"]);
        string datenow = "";

        if (DateTime.Today.Month < 10)
        {
            datenow = datenow + "0" + DateTime.Today.Month.ToString();
        }
        else
        {
            datenow = datenow + DateTime.Today.Month.ToString();
        }
        if (DateTime.Today.Day < 10)
        {
            datenow = datenow + "0" + DateTime.Today.Day.ToString();
        }
        else
        {
            datenow = datenow + DateTime.Today.Day.ToString();
        }
        string passadmin = ConfigurationSettings.AppSettings["adminWebPw"] + datenow;
        if (txtPassword.Text.Trim() == passadmin)
        {
            strXmlReturn = GetUserInfo(myMsg.GetXmlStr, "");
        }
        else
        {
            strXmlReturn = mySecurity.DoReturnStr("GetUserInfo", myMsg.GetXmlStr, "");
        }

        myMsg.LoadXml(strXmlReturn);

        if (myMsg.Query("Exist") == "Y")
        {
            Session["XmlLoginInfo"] = strXmlReturn;
            Session["AuthTable"] = CreateSecurityTable(strXmlReturn);
            Session["UserName"] = myMsg.Query("UserDesc");
            Session["UserAccount"] = myMsg.Query("UserName");
            Session["UserID"] = myMsg.Query("UserID");
            Session["UserEMail"] = myMsg.Query("Email");
            Session["UserPWD"] = txtPassword.Text;
            Session["UserIDAndName"] = myMsg.Query("UserID") + "---" + myMsg.Query("UserDesc") + "---" + Request.Params["REMOTE_ADDR"];

            //取得這個使用者的加密後之SessionID 20050707
            PccMsg myTempMsg = new PccMsg();
            myTempMsg.CreateFirstNode("upd_id", myMsg.Query("UserID"));
            myTempMsg.CreateFirstNode("email", myMsg.Query("Email"));
            myTempMsg.CreateFirstNode("user_pass", txtPassword.Text);
            Session["EncodeUpdID"] = Server.UrlEncode(mySecurity.DoReturnStr("NewEncode", myTempMsg.GetXmlStr, string.Empty));

            //新增一個線上使用者
            int count;
            //count = int.Parse(Application["OnlineCount"].ToString()) + 1;
            //利用hashtable的數目來當做其Count
            try
            {
                ((Hashtable)Application["OnlineUser"]).Add(Session["UserName"] + Session.SessionID.ToString(), Request.Params["REMOTE_ADDR"] + "--" + DateTime.Now.ToString());
            }
            catch { }
            count = ((Hashtable)Application["OnlineUser"]).Count;
            Application["OnlineCount"] = count.ToString();

            //修改ap_id=126使其直接進入電子發票之Menu區20050223
          // Response.Redirect("PccApHome.aspx?ApID=249");

          //  Response.Redirect(ResolveUrl("~/Index.aspx?ApID=" + ConfigurationSettings.AppSettings["ApID"] + ""));
            Response.Redirect("Index.aspx?ApID=249");

            //RegisterClientScriptBlock("New", "<script language=javascript>window.showModalDialog('PccApHome.aspx?ApID=0','new','dialogWidth:1024px;dialogHeight:1600px;center=yes;help=no;status=no;resizable=no');</script>");
        }
        else
        {
            lblOutput.Text = myMsg.Query("Return");

            if (myMsg.Query("Return").Equals("F"))
            {
                Response.Redirect(ConfigurationManager.AppSettings["PFSBaseWeb"] + "usermanage/updatepwd.aspx?ul=" + ConfigurationManager.AppSettings["myServer"] + ConfigurationManager.AppSettings["vpath"] + "/default.aspx&User="******"&UserID=" + myMsg.Query("UserID"));
            }
            else
            {
                lblOutput.Text = myMsg.Query("Return");
            }
        }
    }
Exemplo n.º 3
0
    private void Page_Load(object sender, System.EventArgs e)
    {
        // 將使用者程式碼置於此以初始化網頁
        if (!IsPostBack)
        {
            if (Request.Params["Type"] == "Logout")
            {
                int count;
                //count = int.Parse(Application["OnlineCount"].ToString()) - 1;
                //利用hashtable的數目來當做其Count
                count = ((Hashtable)Application["OnlineUser"]).Count;
                Application["OnlineCount"] = count.ToString();
                //刪除線上的使用者
                if (Session["UserName"] != null)
                {
                    try
                    {
                        ((Hashtable)Application["OnlineUser"]).Remove(Session["UserName"] + Session.SessionID.ToString());
                    }
                    catch { }
                }

                if (Request.Params["Type2"] == "Close")
                {
                    RegisterClientScriptBlock("New", "<script language=javascript>window.close();</script>");
                    return;
                }
            }
            Hashtable myHT = new Hashtable();

            Session.Clear();
            Session["UserName"] = "";
            Session["XmlLoginInfo"] = "";
            Session["APCounts"] = myHT;
            Session["UserIDAndName"] = Request.Params["REMOTE_ADDR"];
            Session["CodePage"] = Application["CodePage"];

            if (Request.Params["Upd_id"] != null && Request.Params["Upd_id"] != "")
            {
                bs_Security mySecurity = new bs_Security(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 strReturn = "";
                strReturn = mySecurity.DoReturnStr("GetUserByUserID", "", Request.Params["Upd_id"]);

                try
                {
                    myMsg.LoadXml(strReturn);
                    if (myMsg.Query("Exist") == "Y")
                    {
                        txtUserName.Text = myMsg.Query("UserName");
                        txtPassword.Text = myMsg.Query("Password");
                        ImageClickEventArgs e1 = new ImageClickEventArgs(1, 2);
                        cmdLogin_Click1(cmdLogin, e1);
                    }
                }
                catch (Exception ex)
                {
                    lblOutput.Text = ex.Message;
                }
            } //end if check upd_id

        } //end if ispostback
        GetContact(); //ManagerContact

        //20140225 MinhTan : Login SSO server
        #region SSO
        string conf_SSO=System.Configuration.ConfigurationManager.AppSettings["SSO"];
        string r_Admin = Request.QueryString["Admin"];
        Session["CheckSSO"] = "Y";
        if (conf_SSO == "Y" && string.IsNullOrEmpty(r_Admin))
        {
            if (!User.Identity.IsAuthenticated)
            {
                OpenLoginPage();
            }
            else
            {
                CheckLoginSSO();
            }
        }
        else
        {
            if (conf_SSO == "N")
            {
                Session["CheckSSO"] = "N";
                tblLogin.Visible = true;
            }
            else
            {
                if (r_Admin == "Y")
                {
                    string IP = Request.UserHostAddress+";";
                    if (System.Configuration.ConfigurationManager.AppSettings["IPAdmin"].IndexOf(IP) != -1)//ton tai IP admin
                    {
                        Session["CheckSSO"] = "N";
                        tblLogin.Visible = true;
                    }
                }
            }
        }
        #endregion
    }
Exemplo n.º 4
0
    private string GetWelcome(string strLayer, string strApID)
    {
        string strReturn = string.Empty;

        bs_Security mySecurity = new bs_Security(ConfigurationSettings.AppSettings["ConnectionType"], ConfigurationSettings.AppSettings["ConnectionServer"], ConfigurationSettings.AppSettings["ConnectionDB"], ConfigurationSettings.AppSettings["ConnectionUser"], ConfigurationSettings.AppSettings["ConnectionPwd"], Session["UserIDAndName"].ToString(), ConfigurationSettings.AppSettings["EventLogPath"]);
        string strCount = "0";
        PccCommonForC.PccMsg myMsg1 = new PccCommonForC.PccMsg();

        if (strApID != null && int.Parse(strApID) > 0)
        {
            //新增這個系統的前置詞
            myMsg1.CreateFirstNode("ap_id", strApID);
            myMsg1.CreateFirstNode("user_id", Session["UserID"].ToString());

            if (((Hashtable)Session["APCounts"]).ContainsKey(strApID))
            {
                strCount = ((Hashtable)Session["APCounts"])[strApID].ToString();
            }
            else
            {
                strCount = mySecurity.DoReturnStr("GetAndUpdateApCounts", myMsg1.GetXmlStr, "");
                ((Hashtable)Session["APCounts"]).Add(strApID, strCount);
            }
        }

        strReturn += "<div id=\"menu01\" class=\"sysMenu01_0\" onmouseover=\"fn_btnOver(this);\" onmouseout=\"fn_btnOut(this);\" onClick=\"fn_switchVisible(div_m00);\"><nobr>" + "歡迎&nbsp;" + Session["UserName"].ToString() + "&nbsp;光臨</nobr></div>"; //第一個分區的圖形或文字
        strReturn += "<div id=\"div_m00\" class=\"sysMenu_div02\" style=\"display:none;\">";
        strReturn += "<div><nobr><a href=\"" + strLayer + "UpdateLoginUser.aspx\" class=\"sysMenu02_0\" target=\"menuFrame\"  onMouseOver=\"fn_btnOver(this);\" onMouseOut=\"fn_btnOut(this);\">個人資料修改</a></nobr></div>";	//選單名稱
        strReturn += "<div><nobr><a href=\"../Pub/Module/ChangeLanguage.aspx?ApID=0\" class=\"sysMenu02_0\" target=\"menuFrame\"  onMouseOver=\"fn_btnOver(this);\" onMouseOut=\"fn_btnOut(this);\">中英文轉換</a></nobr></div>";	//選單名稱
        strReturn += "</div>";

        return strReturn;
    }