// 登录
        protected void ibLogin_Click(object sender, ImageClickEventArgs e)
        {
            // 记录其IP地址,下次登录时验证,IP为空则记录,IP不为空则验证
            string uname = this.tbUname.Value;
            string upwd  = this.tbPwd.Value;
            string uid   = new JumbotOA.BLL.UserBLL().Existslongin(uname, JumbotOA.Utils.MD5.Lower32(upwd));

            if (uid != "")
            {
                JumbotOA.Entity.UserEntity model = new JumbotOA.Entity.UserEntity();
                model = new JumbotOA.BLL.UserBLL().GetEntity(int.Parse(uid));
                if (model.Uipaddress != "")
                {
                    if (model.Uipaddress != Page.Request.UserHostAddress)
                    {
                        Response.Write("<script>alert('非法IP,请在本机登陆!');</script>");
                        Response.End();
                    }
                }
                int iExpires = 0;
                //设置Cookies
                System.Collections.Specialized.NameValueCollection myCol = new System.Collections.Specialized.NameValueCollection();
                myCol.Add("id", uid.ToString());
                myCol.Add("name", uname);
                myCol.Add("ip", Request.UserHostAddress);
                new BLL.UserBLL().UpdateTime(model.Uid);
                int pid = model.Pid;
                myCol.Add("Powerid", pid.ToString());
                JumbotOA.Utils.Cookie.SetObj("oa_user", 60 * 60 * 15 * iExpires, myCol, "", "/");

                switch (pid)
                {
                case 1:
                    Response.Redirect("Home1.aspx");    //管理员
                    break;

                case 2:
                    Response.Redirect("Home2.aspx");    //管理组织层
                    break;

                case 3:
                    Response.Redirect("Home3.aspx");    //网站编辑
                    break;

                case 4:
                    Response.Redirect("Home4.aspx");    //美工和程序员
                    break;
                }
            }
            else
            {
                this.tbUname.Value = "";
                this.tbPwd.Value   = "";
                System.Web.UI.Page page = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;
                page.ClientScript.RegisterStartupScript(page.GetType(), "clientScript", "<script language='javascript'>alert('请正确填写用户名和密码!');</script>");
            }
        }
        // 登录
        protected void ibLogin_Click(object sender, ImageClickEventArgs e)
        {
            // 记录其IP地址,下次登录时验证,IP为空则记录,IP不为空则验证
            string uname = this.tbUname.Value;
            string upwd = this.tbPwd.Value;
            string uid = new JumbotOA.BLL.UserBLL().Existslongin(uname, JumbotOA.Utils.MD5.Lower32(upwd));
            if (uid != "")
            {
                JumbotOA.Entity.UserEntity model = new JumbotOA.Entity.UserEntity();
                model = new JumbotOA.BLL.UserBLL().GetEntity(int.Parse(uid));
                if (model.Uipaddress != "")
                {
                    if (model.Uipaddress != Page.Request.UserHostAddress)
                    {
                        Response.Write("<script>alert('非法IP,请在本机登陆!');</script>");
                        Response.End();
                    }
                }
                int iExpires = 0;
                //设置Cookies
                System.Collections.Specialized.NameValueCollection myCol = new System.Collections.Specialized.NameValueCollection();
                myCol.Add("id", uid.ToString());
                myCol.Add("name", uname);
                myCol.Add("ip", Request.UserHostAddress);
                new BLL.UserBLL().UpdateTime(model.Uid);
                int pid = model.Pid;
                myCol.Add("Powerid",pid.ToString());
                JumbotOA.Utils.Cookie.SetObj("oa_user", 60 * 60 * 15 * iExpires, myCol, "", "/");

                switch (pid)
                {
                    case 1:
                        Response.Redirect("Home1.aspx");//管理员
                        break;
                    case 2:
                        Response.Redirect("Home2.aspx");//管理组织层
                        break;
                    case 3:
                        Response.Redirect("Home3.aspx");//网站编辑
                        break;
                    case 4:
                        Response.Redirect("Home4.aspx");//美工和程序员
                        break;
                }
            }
            else
            {
                this.tbUname.Value = "";
                this.tbPwd.Value = "";
                System.Web.UI.Page page = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;
                page.ClientScript.RegisterStartupScript(page.GetType(), "clientScript", "<script language='javascript'>alert('请正确填写用户名和密码!');</script>");
            }
        }
Beispiel #3
0
        void showdp()
        {
            JumbotOA.BLL.COMDLL com = new JumbotOA.BLL.COMDLL();
            int uid = Convert.ToInt32(com.getsid("fid"));

            if (uid != -1)
            {
                int dpid = new JumbotOA.BLL.UserBLL().GetEntity(uid).Did;
                DropDownList1.SelectedValue       = dpid.ToString();
                DropDownList1.Enabled             = false;
                this.DropDownList2.DataSource     = new JumbotOA.BLL.UserBLL().GetList("Did=" + DropDownList1.SelectedValue.ToString());
                this.DropDownList2.DataTextField  = "Uname";
                this.DropDownList2.DataValueField = "Uid";
                this.DropDownList2.DataBind();
                DropDownList2.SelectedValue = uid.ToString();
                DropDownList2.Enabled       = false;
            }
            else
            {
                DropDownList1.Enabled = true;
                DropDownList2.Enabled = true;
            }
        }
        void showdp()
        {
            JumbotOA.BLL.COMDLL com = new JumbotOA.BLL.COMDLL();
            int uid = Convert.ToInt32(com.getsid("fid"));
            if (uid != -1)
            {
                int dpid = new JumbotOA.BLL.UserBLL().GetEntity(uid).Did;
                DropDownList1.SelectedValue = dpid.ToString();
                DropDownList1.Enabled = false;
                this.DropDownList2.DataSource = new JumbotOA.BLL.UserBLL().GetList("Did=" + DropDownList1.SelectedValue.ToString());
                this.DropDownList2.DataTextField = "Uname";
                this.DropDownList2.DataValueField = "Uid";
                this.DropDownList2.DataBind();
                DropDownList2.SelectedValue = uid.ToString();
                DropDownList2.Enabled = false;

            }
            else
            {
                DropDownList1.Enabled = true;
                DropDownList2.Enabled = true;
            }
        }