예제 #1
0
    private void DataPlay()
    {
        if (this.Session["hyuid"].ToString() != "")
        {
            //根据用户ID得到信息
            this.txtuserid.Text = this.Session["hyuid"].ToString();
            HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
            DataTable dtuser = Hyoa_user.Getuserallinfo(this.txtuserid.Text);
            if (dtuser.Rows.Count > 0)
            {
                this.txtusername.Text = dtuser.Rows[0]["hy_username"].ToString();
            }
            dtuser.Clear();
            this.txtuserid.Enabled = false;
            this.txtusername.Enabled = false;

            //读取选择风格数据
            HyoaClass.Hyoa_mystyle Hyoa_mystyle = new HyoaClass.Hyoa_mystyle();
            DataTable dt = Hyoa_mystyle.Getstylebyuserid(this.txtuserid.Text);
            if (dt.Rows.Count > 0)
            {
                ddlhy_style.SelectedValue = dt.Rows[0]["hy_style"].ToString();
                this.txtdocid.Value = dt.Rows[0]["ID"].ToString();
            }
        }
    }
예제 #2
0
    //保存
    protected void Button_Save_Click(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() == "")
            this.Response.Redirect("../login.aspx");

        string ls_tip = "设置成功,系统将自动转至首页!";

        //新文档时
        HyoaClass.Hyoa_mystyle Hyoa_mystyle = new HyoaClass.Hyoa_mystyle();
        if (this.txtdocid.Value == "")
        {
            HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
            Hyoa_mystyle.ID = Hyoa_global.GetRandom();
            Hyoa_mystyle.hy_userid = this.txtuserid.Text;
            Hyoa_mystyle.hy_style = this.ddlhy_style.SelectedValue.ToString();
            Hyoa_mystyle.Insert();
        }
        else
        {
            Hyoa_mystyle.ID = this.txtdocid.Value;
            Hyoa_mystyle.hy_userid = this.txtuserid.Text;
            Hyoa_mystyle.hy_style = this.ddlhy_style.SelectedValue.ToString();
            Hyoa_mystyle.Update();
        }

        Session["mystyle"] = ddlhy_style.SelectedValue.ToString();
        Response.Write("<script>alert('" + ls_tip + "');window.top.location='/'</script>");
    }
예제 #3
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        if (this.txt_username.Value == "")
        {
            this.RegisterClientScriptBlock("scripterror", "<script language=javascript>alert('请输入用户名!')</script>");
            return;
        }
        if (this.txt_password.Value == "")
        {
            this.RegisterClientScriptBlock("scripterror", "<script language=javascript>alert('请输入密码!')</script>");
            return;
        }

        String password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txt_password.Value, "MD5");
        HyoaClass.Hyoa_user Users = new HyoaClass.Hyoa_user();

        if (Users.Login(this.txt_username.Value, password))
        {
            DataTable dt = Users.Getuserallinfo(this.txt_username.Value);
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["hy_isenabled"].ToString() == "否")
                {
                    //账号被禁用了
                    this.RegisterClientScriptBlock("scripterror", "<script language=javascript>alert('该账号已被禁用,请联系管理员!')</script>");
                    return;
                }
                else
                {
                    Session["hyuid"] = this.txt_username.Value;
                    Session["hyuname"] = dt.Rows[0]["hy_username"].ToString();
                    Session["hydeptid"] = dt.Rows[0]["hy_deptid"].ToString();
                    Session["hydeptname"] = dt.Rows[0]["hy_deptname"].ToString();
                    Session["hypost"] = dt.Rows[0]["hy_post"].ToString(); ;
                    //得到风格
                    HyoaClass.Hyoa_mystyle Hyoa_mystyle = new HyoaClass.Hyoa_mystyle();
                    DataTable dt_mystyle = Hyoa_mystyle.Getstylebyuserid(this.txt_username.Value);
                    if (dt_mystyle.Rows.Count > 0 && dt_mystyle.Rows[0]["hy_style"].ToString() != "")
                        Session["mystyle"] = dt_mystyle.Rows[0]["hy_style"].ToString();
                    else
                        Session["mystyle"] = "/hyhtml/images/";

                    this.Response.Redirect(this.lblurl.Text);
                }
            }
            dt.Clear();
        }
        else
        {
            this.RegisterClientScriptBlock("scripterror", "<script language=javascript>alert('输入的用户名或者密码不正确!')</script>");
            return;
        }
    }
예제 #4
0
    protected void WebPageOpen()
    {
        Session["hyuid"] = "";
        Session["hyuname"] = "";
        Session["hydeptid"] = "";
        Session["hydeptname"] = "";
        Session["hydeptids_jz"] = "";
        Session["hydeptnames_jz"] = "";
        Session["hyisadmin"] = "";
        Session["hypost"] = "";
        Session["mystyle"] = "";
        Session["conntype"] = System.Configuration.ConfigurationManager.AppSettings["HYOA_CONNTYPE"].ToString();

        string ls_uid = "";
        string ls_pwd = "";
        string ls_key = "";
        string ls_url = "";

        if (this.Request.QueryString["uid"] != null)
        {
            ls_uid = this.Request.QueryString["uid"].ToString();
            ls_uid = ls_uid.ToLower();
        }

        if (this.Request.QueryString["pwd"] != null)
        {
            ls_pwd = this.Request.QueryString["pwd"].ToString();
            ls_pwd = ls_pwd.ToLower();
        }

        if (this.Request.QueryString["key"] != null)
            ls_key = this.Request.QueryString["key"].ToString();

        int pos = Request.RawUrl.IndexOf("&redirectto=");
        if (pos > 0)
            ls_url = this.Request.RawUrl.Substring(pos + 12);

        //if (ls_key != "cd04fa144ec48507")
        //    Response.Write("<script language=javascript>alert('非常抱歉,您的访问地址有误,请联系管理员!');self.close();</script>");

        String password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(ls_pwd, "MD5");
        HyoaClass.Hyoa_user Users = new HyoaClass.Hyoa_user();

        if (Users.Login(ls_uid, password))
        {
            DataTable dt = Users.Getuserallinfobyloginid(ls_uid);
            if (dt.Rows.Count > 0)
            {
                Session["hyuid"] = ls_uid;
                Session["hyuname"] = dt.Rows[0]["hy_username"].ToString();
                Session["hydeptid"] = dt.Rows[0]["hy_deptid"].ToString();
                Session["hydeptname"] = dt.Rows[0]["hy_deptname"].ToString();
                Session["hypost"] = dt.Rows[0]["hy_post"].ToString();

                //得到兼职
                DataTable dt_jz = Users.Getjzinfobyuserid(ls_uid);
                if (dt_jz.Rows.Count > 0)
                {
                    Session["hydeptids_jz"] = "";
                    Session["hydeptnames_jz"] = "";
                    for (int ii = 0; ii < dt_jz.Rows.Count; ii++)
                    {
                        if (Session["hydeptids_jz"] == "")
                        {
                            Session["hydeptids_jz"] = dt_jz.Rows[ii]["hy_deptid"].ToString();
                            Session["hydeptnames_jz"] = dt_jz.Rows[ii]["hy_deptname"].ToString();
                        }
                        else
                        {
                            Session["hydeptids_jz"] += "," + dt_jz.Rows[ii]["hy_deptid"].ToString();
                            Session["hydeptnames_jz"] += "," + dt_jz.Rows[ii]["hy_deptname"].ToString();
                        }

                    }
                }
                //得到风格
                HyoaClass.Hyoa_mystyle Hyoa_mystyle = new HyoaClass.Hyoa_mystyle();
                DataTable dt_mystyle = Hyoa_mystyle.Getstylebyuserid(ls_uid);
                if (dt_mystyle.Rows.Count > 0 && dt_mystyle.Rows[0]["hy_style"].ToString() != "")
                    Session["mystyle"] = dt_mystyle.Rows[0]["hy_style"].ToString();
                else
                    Session["mystyle"] = "/hyhtml/images/";

                this.Response.Redirect(ls_url);
            }
            dt.Clear();
        }
        else
        {
            this.Response.Redirect("../");
            return;
        }
    }
예제 #5
0
    private void DataPlay()
    {
        //hy_json = "{\"success\":true,\"total\":\"60\",\"rows\":[{\"hy_mudelid\":\"111\",\"hy_mudelname\":\"1111\",\"hy_roleid\":\"111111\",\"hy_qqroleid\":\"111111\",\"hy_isenabled\":\"111111\"}]}";
        string hy_json = "";
        string ls_success = "true";    //调用方法成功
        string ls_flag = "0";   //登录失败
        string username = "";
        string password = "";
        username = this.Request.Form["txt_username"].ToString().ToLower();
        password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.Request.Form["txt_password"].ToString(), "MD5");
        HyoaClass.Hyoa_user Users = new HyoaClass.Hyoa_user();
        if (Users.Login(username, password))
        {
            DataTable dt = Users.Getuserallinfobyloginid(username);
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["hy_isenabled"].ToString() == "否")
                {
                    //账号被禁用了
                }
                else
                {
                    Session["hyuid"] = username;
                    Session["hyuname"] = dt.Rows[0]["hy_username"].ToString();
                    Session["hydeptid"] = dt.Rows[0]["hy_deptid"].ToString();
                    Session["hydeptname"] = dt.Rows[0]["hy_deptname"].ToString();
                    Session["hypost"] = dt.Rows[0]["hy_post"].ToString();

                    //得到兼职
                    DataTable dt_jz = Users.Getjzinfobyuserid(username);
                    if (dt_jz.Rows.Count > 0)
                    {
                        Session["hydeptids_jz"] = "";
                        Session["hydeptnames_jz"] = "";
                        for (int i = 0; i < dt_jz.Rows.Count; i++)
                        {
                            if (Session["hydeptids_jz"] == "")
                            {
                                Session["hydeptids_jz"] = dt_jz.Rows[i]["hy_deptid"].ToString();
                                Session["hydeptnames_jz"] = dt_jz.Rows[i]["hy_deptname"].ToString();
                            }
                            else
                            {
                                Session["hydeptids_jz"] += "," + dt_jz.Rows[i]["hy_deptid"].ToString();
                                Session["hydeptnames_jz"] += "," + dt_jz.Rows[i]["hy_deptname"].ToString();
                            }

                        }
                    }
                    //得到风格
                    HyoaClass.Hyoa_mystyle Hyoa_mystyle = new HyoaClass.Hyoa_mystyle();
                    DataTable dt_mystyle = Hyoa_mystyle.Getstylebyuserid(username);
                    if (dt_mystyle.Rows.Count > 0 && dt_mystyle.Rows[0]["hy_style"].ToString() != "")
                        Session["mystyle"] = dt_mystyle.Rows[0]["hy_style"].ToString();
                    else
                        Session["mystyle"] = "/hyhtml/images/";

                    //Session["jqmtheme"] = this.Request.Form["ddlfengge"].ToString();
                    ls_flag = "1";
                }
            }
        }
        hy_json = "{\"success\":" + ls_success + ",\"flag\":\"" + ls_flag + "\"}";
        Response.Write(hy_json);
    }
예제 #6
0
    /// <summary>
    /// 认证模式,密码是明码格式还是MD5格式
    /// pi_type  0:密码是明码格式 1:密码是MD5格式
    /// </summary>
    /// <param name="pi_type"></param>
    private void LoginCommand(string pi_type)
    {
        //if (Session["checkcode"].ToString().Equals(this.txt_checkcode.Value))
        String password = "";
        if (pi_type == "0")
        {
            password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txt_password.Value, "MD5");
        }
        if (pi_type == "1")
        {
            password = this.txt_password.Value.ToUpper();
        }
        HyoaClass.Hyoa_user Users = new HyoaClass.Hyoa_user();

        if (Users.Login(this.txt_username.Value.ToLower(), password))
        {
            DataTable dt = Users.Getuserallinfobyloginid(this.txt_username.Value.ToLower());
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["hy_isenabled"].ToString() == "否")
                {
                    //账号被禁用了
                    Response.Write("<script>alert('该账号已被禁用,请联系管理员!');</script>");
                }
                else
                {
                    Session["hyuid"] = this.txt_username.Value.ToLower();
                    Session["hyuname"] = dt.Rows[0]["hy_username"].ToString();
                    Session["hydeptid"] = dt.Rows[0]["hy_deptid"].ToString();
                    Session["hydeptname"] = dt.Rows[0]["hy_deptname"].ToString();
                    Session["hypost"] = dt.Rows[0]["hy_post"].ToString();

                    //得到兼职
                    DataTable dt_jz = Users.Getjzinfobyuserid(this.txt_username.Value.ToLower());
                    if (dt_jz.Rows.Count > 0)
                    {
                        Session["hydeptids_jz"] = "";
                        Session["hydeptnames_jz"] = "";
                        for (int i = 0; i < dt_jz.Rows.Count; i++)
                        {
                            if (Session["hydeptids_jz"] == "")
                            {
                                Session["hydeptids_jz"] = dt_jz.Rows[i]["hy_deptid"].ToString();
                                Session["hydeptnames_jz"] = dt_jz.Rows[i]["hy_deptname"].ToString();
                            }
                            else
                            {
                                Session["hydeptids_jz"] += "," + dt_jz.Rows[i]["hy_deptid"].ToString();
                                Session["hydeptnames_jz"] += "," + dt_jz.Rows[i]["hy_deptname"].ToString();
                            }

                        }
                    }
                    //得到风格
                    HyoaClass.Hyoa_mystyle Hyoa_mystyle = new HyoaClass.Hyoa_mystyle();
                    DataTable dt_mystyle = Hyoa_mystyle.Getstylebyuserid(this.txt_username.Value.ToLower());
                    if (dt_mystyle.Rows.Count > 0 && dt_mystyle.Rows[0]["hy_style"].ToString() != "")
                        Session["mystyle"] = dt_mystyle.Rows[0]["hy_style"].ToString();
                    else
                        Session["mystyle"] = "/hyhtml/images/";

                    HyoaClass.Hyoa_license Hyoa_license = new HyoaClass.Hyoa_license();
                    DataTable dtlicense = Hyoa_license.Getlicensesbybsquseridanddate(this.Session["hyuid"].ToString());

                    if (dtlicense.Rows.Count > 0)
                    {
                        ifshowopengwsq.Text = "1";
                    }
                    else
                    {
                        //////为用户创建一个票证,并将其放入cookie或者url中(具体看你怎么设置票证的保存方式)
                        ////FormsAuthentication.SetAuthCookie(this.txt_username.Value, true);
                        this.Response.Redirect(this.lblurl.Text);
                    }
                }
            }
            dt.Clear();
        }
        else
        {
            this.RegisterClientScriptBlock("scripterror", "<script language=javascript>alert('输入的用户名或者密码不正确!')</script>");
            return;
        }
    }
예제 #7
0
    protected void btnsqlogin_Click(object sender, EventArgs e)
    {
        HyoaClass.Hyoa_user Users = new HyoaClass.Hyoa_user();
        DataTable dt = Users.Getuserallinfo(this.txtloginuid_sqyh.Text);
        if (dt.Rows.Count > 0)
        {
            Session["hyuid"] = this.txtloginuid_sqyh.Text;
            Session["hyuname"] = dt.Rows[0]["hy_username"].ToString();
            Session["hydeptid"] = dt.Rows[0]["hy_deptid"].ToString();
            Session["hydeptname"] = dt.Rows[0]["hy_deptname"].ToString();
            Session["hypost"] = dt.Rows[0]["hy_post"].ToString();

            //得到兼职
            DataTable dt_jz = Users.Getjzinfobyuserid(this.txtloginuid_sqyh.Text);
            if (dt_jz.Rows.Count > 0)
            {
                Session["hydeptids_jz"] = "";
                Session["hydeptnames_jz"] = "";
                for (int i = 0; i < dt_jz.Rows.Count; i++)
                {
                    if (Session["hydeptids_jz"] == "")
                    {
                        Session["hydeptids_jz"] = dt_jz.Rows[i]["hy_deptid"].ToString();
                        Session["hydeptnames_jz"] = dt_jz.Rows[i]["hy_deptname"].ToString();
                    }
                    else
                    {
                        Session["hydeptids_jz"] += "," + dt_jz.Rows[i]["hy_deptid"].ToString();
                        Session["hydeptnames_jz"] += "," + dt_jz.Rows[i]["hy_deptname"].ToString();
                    }

                }
            }
            //得到风格
            HyoaClass.Hyoa_mystyle Hyoa_mystyle = new HyoaClass.Hyoa_mystyle();
            DataTable dt_mystyle = Hyoa_mystyle.Getstylebyuserid(this.txtloginuid_sqyh.Text);
            if (dt_mystyle.Rows.Count > 0 && dt_mystyle.Rows[0]["hy_style"].ToString() != "")
                Session["mystyle"] = dt_mystyle.Rows[0]["hy_style"].ToString();
            else
                Session["mystyle"] = "/hyhtml/images/";

            //////为用户创建一个票证,并将其放入cookie或者url中(具体看你怎么设置票证的保存方式)
            ////FormsAuthentication.SetAuthCookie(this.txt_username.Value, true);

            this.Response.Redirect(this.lblurl.Text);
        }
        dt.Clear();
    }