コード例 #1
0
        /// <summary>
        /// 发放单个支部的经费
        /// </summary>
        /// <param name="OID"></param>
        /// <param name="OP_ADMIN"></param>
        /// <param name="OL_NUM"></param>
        /// <returns></returns>
        public int PublishOne(string OL_OID)
        {
            PublishOneCommand.Parameters[0].Value = OL_OID;
            PublishOneCommand.Parameters[1].Value = AuthenUser.GetCurrentUser().UserID;

            return(AdapterHelper.ExecuteCommand(PublishOneCommand));
        }
コード例 #2
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        try
        {
            if (AuthenUserToken(txtUsername.Text, txtPassword.Text))
            {
                authCookie = AuthenUser.GetTicketCookie(txtUsername.Text, chkPersist.Checked);
                Response.Cookies.Add(authCookie);

                //--记录登录名,保存在Cookie中一个月
                HttpCookie loginCookie = new HttpCookie("YouthOneLoginName", HttpUtility.UrlEncode(txtUsername.Text));
                loginCookie.Expires = DateTime.Now.AddMonths(1);
                Response.Cookies.Add(loginCookie);

                String redirectUrl = FormsAuthentication.GetRedirectUrl(txtUsername.Text, false);
                if (redirectUrl.EndsWith("Logout.aspx"))
                {
                    redirectUrl = "~/Default.aspx";
                }

                Response.Redirect(redirectUrl);
            }
            else
            {
                errorLabel.Text = "登录失败,请检查用户名和密码!";
            }
        }
        catch (System.Exception ex)
        {
            errorLabel.Text = "登录失败: " + ex.Message;
        }
    }
コード例 #3
0
        /// <summary>
        /// 更新支部的年度金费
        /// </summary>
        /// <param name="OID"></param>
        /// <param name="OP_ADMIN"></param>
        /// <param name="OL_NUM"></param>
        /// <returns></returns>
        public int MyUpdate(string YG_NAME, decimal OL_NUM, string OID)
        {
            MyUpdateCommand.Parameters[0].Value = OID;
            MyUpdateCommand.Parameters[1].Value = AuthenUser.GetCurrentUser().UserID;
            MyUpdateCommand.Parameters[2].Value = OL_NUM;

            return(AdapterHelper.ExecuteCommand(MyUpdateCommand));
        }
コード例 #4
0
ファイル: BasePage.cs プロジェクト: tonywanggit/YouthOne
    /// <summary>
    /// 初始化授权用户
    /// </summary>
    void InitAuthenUser()
    {
        authenUser = AuthenUser.GetCurrentUser();

        if (authenUser == null)
        {
            AdapterHelper.AlertLogout();
        }
    }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie authCookies = Request.Cookies[FormsAuthentication.FormsCookieName];
        FormsAuthenticationTicket authenTicket = FormsAuthentication.Decrypt(authCookies.Value);
        AuthenUser.RemoveAuthenUserOnline(authenTicket.Name);

        System.Web.Security.FormsAuthentication.SignOut();
        System.Web.Security.FormsAuthentication.RedirectToLoginPage();
    }
コード例 #6
0
    /// <summary>
    /// 将授权用户加入在线列表
    /// </summary>
    /// <param name="authenUser"></param>
    /// <returns></returns>
    public static AuthenUser PushAuthenUserOnline(AuthenUser authenUser)
    {
        if (AuthenUser.OnlineAuthenUserList.ContainsKey(authenUser.LoginName))
        {
            return(AuthenUser.OnlineAuthenUserList[authenUser.LoginName] as AuthenUser);
        }

        AuthenUser.OnlineAuthenUserList.Add(authenUser.LoginName, authenUser);
        return(authenUser);
    }
コード例 #7
0
    /// <summary>
    /// 此方法用于调试
    /// </summary>
    protected void AutoLogin()
    {
        string loginName = "admin";

        AuthenUser.PushAuthenUserOnline(AuthenUser.GetAuthenUserByLoginName(loginName));

        authCookie = AuthenUser.GetTicketCookie(loginName, chkPersist.Checked);
        Response.Cookies.Add(authCookie);
        Response.Redirect(FormsAuthentication.GetRedirectUrl(txtUsername.Text, false));
    }
コード例 #8
0
    /// <summary>
    /// 实现ESB用户到授权用户的装换
    /// </summary>
    /// <param name="person"></param>
    /// <returns></returns>
    public static AuthenUser GetAuthenUser(个人 person)
    {
        AuthenUser authenUser = new AuthenUser();

        authenUser.IsSystemAdmin = (person.权限 == 0);
        authenUser.UserID        = person.个人编码;
        authenUser.UserName      = person.姓名;
        authenUser.LoginName     = person.帐号;

        return(authenUser);
    }
コード例 #9
0
    /// <summary>
    /// Esb授权校验
    /// </summary>
    /// <param name="userName"></param>
    private void EsbAuthen(string userName)
    {
        AuthenUser authenUser = AuthenUser.GetAuthenUserByLoginName(userName);

        if (null == authenUser)
        {
            string strValue = "您是未授权的用户!";
            string strAll   = "<SCRIPT lanquage='JScript'>window.alert('" + strValue + "');window.location.href='Logout.aspx'<" + "/SCRIPT>";
            Response.Write(strAll);
            Response.End();
        }
    }
コード例 #10
0
ファイル: AuthenUser.cs プロジェクト: rebider/soa
    /// <summary>
    /// 实现ESB用户到授权用户的装换
    /// </summary>
    /// <param name="person"></param>
    /// <returns></returns>
    public static AuthenUser GetAuthenUser(Personal person)
    {
        AuthenUser authenUser = new AuthenUser();

        authenUser.IsSystemAdmin = (person.permission == 0);
        authenUser.UserID        = person.PersonalID;
        authenUser.UserName      = person.PersonalName;
        authenUser.LoginName     = person.PersonalAccount;
        authenUser.IsVisitor     = false;

        return(authenUser);
    }
コード例 #11
0
    /// <summary>
    /// 验证用户口令
    /// </summary>
    /// <param name="userName"></param>
    private Boolean AuthenUserToken(string userName, string passWord)
    {
        AuthenUser authenUser = AuthenUser.CheckUserPasswrod(userName, passWord);

        if (null == authenUser)
        {
            return(false);
        }
        else
        {
            AdapterHelper.WriteLog(LogType.System, "登录", authenUser.UserName, authenUser.UserID.ToString(), authenUser.UserName);
            return(true);
        }
    }
コード例 #12
0
        /// <summary>
        /// 修改支部月度预算
        /// </summary>
        /// <param name="YG_OID"></param>
        /// <param name="BA_NUM"></param>
        /// <param name="BA_DESC"></param>
        /// <param name="BA_STATUS"></param>
        /// <param name="OID"></param>
        /// <returns></returns>
        public int MyUpdate(string YG_OID, DateTime CRE_DATE, decimal BA_NUM, string YJ_MONTH, string BA_DESC, string BA_STATUS, string SP_REASON, string OID)
        {
            string roleName = AuthenUser.GetCurrentUser().RoleName;

            //if (roleName != AuthenUserType.TW_Finance && roleName != AuthenUserType.Admin && roleName != AuthenUserType.TW_Admin
            //    && BA_STATUS != "等待审核中")
            //    return 0;

            MyUpdateSqlComand.Parameters[0].Value = OID;
            MyUpdateSqlComand.Parameters[1].Value = BA_NUM;
            MyUpdateSqlComand.Parameters[2].Value = BA_DESC;
            MyUpdateSqlComand.Parameters[3].Value = BA_STATUS;
            MyUpdateSqlComand.Parameters[4].Value = AuthenUser.GetCurrentUser().UserID;
            MyUpdateSqlComand.Parameters[5].Value = YJ_MONTH;
            MyUpdateSqlComand.Parameters[6].Value = String.IsNullOrEmpty(SP_REASON) ? String.Empty : SP_REASON;

            return(AdapterHelper.ExecuteCommand(MyUpdateSqlComand));
        }
コード例 #13
0
ファイル: Utils.cs プロジェクト: rebider/soa
    /// <summary>
    /// 初始化授权用户
    /// </summary>
    void InitAuthenUser()
    {
        HttpCookie authCookies = Request.Cookies[FormsAuthentication.FormsCookieName];

        if (authCookies == null || String.IsNullOrEmpty(authCookies.Value))
        {
            string strValue = "您的授权已经失效,请重新登陆!";
            string strAll   = "<SCRIPT lanquage='JScript'>window.alert('" + strValue + "');window.location.href='/Portal/Logout.aspx'<" + "/SCRIPT>";

            Response.Write(strAll);
            Response.End();
        }
        else
        {
            FormsAuthenticationTicket authenTicket = FormsAuthentication.Decrypt(authCookies.Value);
            authenUser = AuthenUser.GetAuthenUserByLoginName(authenTicket.Name);
        }
    }
コード例 #14
0
ファイル: Demo.master.cs プロジェクト: tonywanggit/YouthOne
    void callbackChangePassword_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
    {
        string oldPassWord = e.Parameter.Split('-')[0];
        string newPassWord = e.Parameter.Split('-')[1];

        if (AdapterHelper.Hash(oldPassWord) != AuthenUser.GetCurrentUser().PassWord)
        {
            e.Result = "您输入的旧密码不正确!";
        }
        else
        {
            try
            {
                AuthenUser.ChangePassword(newPassWord);
                e.Result = "修改密码成功!";
            }
            catch (Exception ex)
            {
                e.Result = "修改密码失败:" + ex.Message;
            }
        }
    }
コード例 #15
0
    /// <summary>
    /// Esb授权校验
    /// </summary>
    /// <param name="userName"></param>
    private void EsbAuthen(String loginName)
    {
        AuthenUser authenUser = AuthenUser.GetAuthenUserByLoginName(loginName);

        if (null == authenUser)
        {
            //string strValue = "您是未授权的用户!";
            //string strAll = "<SCRIPT lanquage='JScript'>window.alert('" + strValue + "');window.location.href='Logout.aspx'<" + "/SCRIPT>";
            //Response.Write(strAll);
            //Response.End();

            authenUser = new AuthenUser();

            authenUser.IsSystemAdmin = false;
            authenUser.IsVisitor     = true; //--访客模式
            authenUser.LoginName     = loginName;
            authenUser.UserName      = loginName;
            authenUser.UserID        = loginName;

            AuthenUser.PushAuthenUserOnline(authenUser);
        }

        Session["ESB_MENU"] = authenUser.Menu;
    }
コード例 #16
0
ファイル: Utils.cs プロジェクト: BiYiTuan/soa
    /// <summary>
    /// 初始化授权用户
    /// </summary>
    void InitAuthenUser()
    {
        HttpCookie authCookies = Request.Cookies[FormsAuthentication.FormsCookieName];

        if (authCookies == null || String.IsNullOrEmpty(authCookies.Value))
        {
            string strValue = "您的授权已经失效,请重新登陆!";
            string strAll = "<SCRIPT lanquage='JScript'>window.alert('" + strValue + "');window.location.href='/Portal/Logout.aspx'<" + "/SCRIPT>";

            Response.Write(strAll);
            Response.End();
        }
        else
        {
            FormsAuthenticationTicket authenTicket = FormsAuthentication.Decrypt(authCookies.Value);
            authenUser = AuthenUser.GetAuthenUserByLoginName(authenTicket.Name);
        }
    }
コード例 #17
0
ファイル: AuthenUser.cs プロジェクト: vebin/soa
    /// <summary>
    /// 实现ESB用户到授权用户的装换
    /// </summary>
    /// <param name="person"></param>
    /// <returns></returns>
    public static AuthenUser GetAuthenUser(Personal person)
    {
        AuthenUser authenUser = new AuthenUser();

        authenUser.IsSystemAdmin = (person.permission == 0);
        authenUser.UserID = person.PersonalID;
        authenUser.UserName = person.PersonalName;
        authenUser.LoginName = person.PersonalAccount;
        authenUser.IsVisitor = false;

        return authenUser;
    }
コード例 #18
0
ファイル: Login.aspx.cs プロジェクト: vebin/soa
    /// <summary>
    /// Esb授权校验
    /// </summary>
    /// <param name="userName"></param>
    private void EsbAuthen(String loginName)
    {
        AuthenUser authenUser = AuthenUser.GetAuthenUserByLoginName(loginName);

        if (null == authenUser){
            //string strValue = "您是未授权的用户!";
            //string strAll = "<SCRIPT lanquage='JScript'>window.alert('" + strValue + "');window.location.href='Logout.aspx'<" + "/SCRIPT>";
            //Response.Write(strAll);
            //Response.End();

            authenUser = new AuthenUser();

            authenUser.IsSystemAdmin = false;
            authenUser.IsVisitor = true;    //--访客模式
            authenUser.LoginName = loginName;
            authenUser.UserName = loginName;
            authenUser.UserID = loginName;

            AuthenUser.PushAuthenUserOnline(authenUser);
        }

        Session["ESB_MENU"] = authenUser.Menu;
    }
コード例 #19
0
ファイル: BasePage.cs プロジェクト: tonywanggit/YouthOne
 /// <summary>
 /// 为页面增加日志模块
 /// </summary>
 /// <param name="logType"></param>
 /// <param name="opName"></param>
 /// <param name="opDesc"></param>
 protected void WriteLog(LogType logType, String opName, String opDesc)
 {
     AdapterHelper.WriteLog(logType, opName, opDesc, AuthenUser.GetCurrentUser().UserID, AuthenUser.GetCurrentUser().UserName);
 }
コード例 #20
0
        /// <summary>
        /// 发放单个支部的经费
        /// </summary>
        /// <param name="OID"></param>
        /// <param name="OP_ADMIN"></param>
        /// <param name="OL_NUM"></param>
        /// <returns></returns>
        public int PublishAll()
        {
            PublishAllCommand.Parameters[0].Value = AuthenUser.GetCurrentUser().UserID;

            return(AdapterHelper.ExecuteCommand(PublishAllCommand));
        }
コード例 #21
0
 /// <summary>
 /// 新增支部月度预算
 /// </summary>
 /// <returns></returns>
 public int MyInsert(string YG_OID, DateTime CRE_DATE, decimal BA_NUM, string YJ_MONTH, string BA_DESC)
 {
     return(Insert(Guid.NewGuid().ToString(), YG_OID, CRE_DATE, BA_NUM, BA_DESC, "等待审核中",
                   AuthenUser.GetCurrentUser().UserID, "", new DateTime(1900, 1, 1), YJ_MONTH, String.Empty));
 }
コード例 #22
0
ファイル: AuthenUser.cs プロジェクト: vebin/soa
    /// <summary>
    /// 将授权用户加入在线列表
    /// </summary>
    /// <param name="authenUser"></param>
    /// <returns></returns>
    public static AuthenUser PushAuthenUserOnline(AuthenUser authenUser)
    {
        if (AuthenUser.OnlineAuthenUserList.ContainsKey(authenUser.LoginName))
            return AuthenUser.OnlineAuthenUserList[authenUser.LoginName] as AuthenUser;

        AuthenUser.OnlineAuthenUserList.Add(authenUser.LoginName, authenUser);
        return authenUser;
    }