Esempio n. 1
0
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            try
            {
                SYS_AdminMod m_admin = SYS_AdminBll.GetInstance().GetModel(GetSession().AdminEntity.SysNo);
                if (txtOldPsd.Text.Trim() == m_admin.Password)
                {
                    if (txtNewPsd.Text.Trim() == txtNewAgain.Text.Trim())
                    {
                        m_admin.Password = txtNewPsd.Text.Trim();
                        SYS_AdminBll.GetInstance().Update(m_admin);

                        ltrNotice.Text = "密码修改成功!";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('masternoticediv').style.display='';document.getElementById('masternoticediv').style.display;", true);
                    }
                    else
                    {
                        ltrError.Text = "两次密码输入不一致,请重新输入!";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('mastererrordiv').style.display='';jQuery.facebox('PassWord');", true);
                    }
                }
                else
                {
                    ltrError.Text = "旧密码错误,请重新输入!";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('mastererrordiv').style.display='';jQuery.facebox('PassWord');", true);
                }
            }
            catch
            {
                ltrError.Text = "系统错误,密码修改失败!";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('mastererrordiv').style.display='';jQuery.facebox('PassWord');", true);
            }
        }
Esempio n. 2
0
        protected void Unnamed3_Click(object sender, EventArgs e)
        {
            SYS_AdminMod m_supplier = new SYS_AdminMod();

            if (type == "EDIT")
            {
                if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    SysNo = int.Parse(Request.QueryString["id"]);
                }
                m_supplier = SYS_AdminBll.GetInstance().GetModel(SysNo);
            }
            if (txtUserName.Text.Trim() == "")
            {
                ltrError.Text = "请填写用户登录名!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
            if (txtPass.Text.Trim() == "" && type == "ADD")
            {
                ltrError.Text = "请输入初始密码!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
            m_supplier.CustomerSysNo = int.Parse(Request.QueryString["user"]);
            m_supplier.Username      = txtUserName.Text;

            try
            {
                if (type == "ADD")
                {
                    m_supplier.DR        = 0;
                    m_supplier.Password  = txtPass.Text;
                    m_supplier.TS        = DateTime.Now;
                    m_supplier.LastLogin = DateTime.Now;
                    m_supplier.SysNo     = SYS_AdminBll.GetInstance().Add(m_supplier);

                    SetPrivilege(m_supplier.SysNo);
                    LogManagement.getInstance().WriteTrace(m_supplier.SysNo, "Article.Add", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);
                }
                else if (type == "EDIT")
                {
                    if (txtPass.Text.Trim() != "加密存储")
                    {
                        m_supplier.Password = txtPass.Text;
                    }
                    SYS_AdminBll.GetInstance().Update(m_supplier);
                    SetPrivilege(m_supplier.SysNo);
                    LogManagement.getInstance().WriteTrace(m_supplier.SysNo, "Article.Edit", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);
                }
                ltrNotice.Text = "该记录已保存成功!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
            }
            catch (Exception ex)
            {
                ltrError.Text = "系统错误,保存失败!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                LogManagement.getInstance().WriteException(ex, "Article.Save", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);
            }
        }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     base.Login(base.Request.RawUrl);
     base.CheckPrivilege(base.Request.RawUrl);
     WebForAdmin.Master.AdminMaster m_master = (WebForAdmin.Master.AdminMaster)base.Master;
     m_master.PageName = "权限设置";
     m_master.SetCate(WebForAdmin.Master.AdminMaster.CateType.Privilege3);
     if (!base.IsPostBack)
     {
         this.BindContent();
         SYS_AdminMod m_admin = SYS_AdminBll.GetInstance().GetModel(SysNo);
         Literal1.Text = m_admin.Username + "的权限";
     }
 }
Esempio n. 4
0
 protected void Delete()
 {
     try
     {
         SYS_AdminMod m_customer = SYS_AdminBll.GetInstance().GetModel(int.Parse(base.Request.QueryString["delete"]));
         m_customer.DR = 1;
         SYS_AdminBll.GetInstance().Update(m_customer);
         this.ltrNotice.Text = "该记录已删除!";
         base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
     }
     catch
     {
         this.ltrError.Text = "系统错误,冻结失败!";
         base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('errordiv').style.display='';", true);
     }
 }
Esempio n. 5
0
        public void LoginCheck(string username, string password)
        {
            SYS_AdminMod m_admin = SYS_AdminBll.GetInstance().CheckAdmin(username, password);

            if (m_admin.CustomerSysNo != AppConst.IntNull)//COOKIES验证成功
            {
                WebForAnalyse.SessionInfo m_session = new SessionInfo();
                m_session.AdminEntity           = m_admin;
                m_session.PrivilegeDt           = SYS_AdminBll.GetInstance().GetAdminPrivilege(m_admin.CustomerSysNo);
                Session[AppConfig.AdminSession] = m_session;
                //记住我
                if (CheckBox1.Checked)
                {
                    HttpCookie Cookie = CookiesHelper.GetCookie("upup1000Admin");
                    if (Cookie == null || Cookie.Value == null || Cookie.Value == "")
                    {
                        Cookie = new HttpCookie("upup1000Admin");
                        Cookie.Values.Add("uname", CommonTools.Encode(username));
                        Cookie.Values.Add("psd", CommonTools.Encode(password));
                        //设置Cookie过期时间
                        Cookie.Expires = DateTime.Now.AddYears(50);
                        CookiesHelper.AddCookie(Cookie);
                    }
                    else
                    {
                        CookiesHelper.SetCookie("upup1000Admin", "uname", CommonTools.Encode(username), DateTime.Now.AddYears(50));
                        CookiesHelper.SetCookie("upup1000Admin", "psd", CommonTools.Encode(password), DateTime.Now.AddYears(50));
                    }
                }
                LogManagement.getInstance().WriteTrace(m_session.AdminEntity, "Login", "IP:" + Request.UserHostAddress + "|AdminID:" + m_session.AdminEntity.Username);
                //跳转
                if (Request.QueryString["url"] != null && Request.QueryString["url"] != "")
                {
                    Response.Redirect(Request.QueryString["url"]);
                }
                else
                {
                    Response.Redirect("BaZi/PatternList.aspx");
                }
            }
            else
            {
                this.ltrNotice.Text = "用户名或密码错误!";
                base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('" + divNotice.ClientID + "').style.display='';", true);
            }
        }
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            try
            {
                SYS_AdminMod m_admin = SYS_AdminBll.GetInstance().GetModel(GetSession().AdminEntity.SysNo);
                if (txtOldPsd.Text.Trim() == m_admin.Password)
                {
                    if (txtNewPsd.Text.Trim() == txtNewAgain.Text.Trim())
                    {
                        m_admin.Password = txtNewPsd.Text.Trim();
                        SYS_AdminBll.GetInstance().Update(m_admin);

                        ltrNotice.Text = "密码修改成功!";
                        masternoticediv.Style["display"] = "";
                    }
                    else
                    {
                        ltrError.Text = "两次密码输入不一致,请重新输入!";
                        mastererrordiv.Style["display"] = "";
                    }
                }
                else
                {
                    ltrError.Text = "旧密码错误,请重新输入!";
                    mastererrordiv.Style["display"] = "";
                }
            }
            catch
            {
                ltrError.Text = "系统错误,密码修改失败!";
                mastererrordiv.Style["display"] = "";
            }
            finally
            {
                txtOldPsd.Text   = "";
                txtNewAgain.Text = "";
                txtNewPsd.Text   = "";
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "closeforseconds();", true);
            }
        }
Esempio n. 7
0
        // Methods
        protected void BindContent()
        {
            DataTable m_dt = SYS_AdminBll.GetInstance().GetList(20, this.pageindex, this.txtName.Text.Trim(), this.drpStatus.SelectedValue, int.Parse(drpPrivilege.SelectedValue), ref this.total);

            m_dt.Columns.Add("deleteurl");
            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                m_dt.Rows[i]["deleteurl"] = this.urlnow + "&delete=";
            }
            this.rptFamous.DataSource = m_dt;
            this.rptFamous.DataBind();
            this.Pager1.url = "Admin.aspx?name=" + this.txtName.Text.Trim() + "&privilege=" + drpPrivilege.SelectedValue + "&status=" + this.drpStatus.SelectedValue + "&pn=";
            if ((this.total % 20) == 0)
            {
                this.Pager1.total = this.total / 20;
            }
            else
            {
                this.Pager1.total = (this.total / 20) + 1;
            }
            this.Pager1.index    = this.pageindex;
            this.Pager1.numlenth = 3;
        }
Esempio n. 8
0
        protected void PrepareForm()
        {
            #region  项绑定
            //drpGender.DataSource = AppEnum.GetGender();
            //drpGender.DataTextField = "Value";
            //drpGender.DataValueField = "Key";
            //drpGender.DataBind();
            //drpGender.SelectedIndex = 2;

            //drpLevel.DataSource = AppEnum.GetCustomerType();
            //drpLevel.DataTextField = "Value";
            //drpLevel.DataValueField = "Key";
            //drpLevel.DataBind();
            //drpLevel.SelectedIndex = 2;
            //drpLevel.Items.Insert(0, new ListItem("请选择会员等级", "0"));

            int tmptotal = 0;
            drpPrivilege.DataSource     = SYS_AdminBll.GetInstance().GetList(1000, 1, "", "", 0, ref tmptotal);
            drpPrivilege.DataTextField  = "NickName";
            drpPrivilege.DataValueField = "SysNo";
            drpPrivilege.DataBind();
            drpPrivilege.Items.Insert(0, new ListItem("选择后台用户", "0"));

            #endregion

            if (type == "ADD")
            {
                if (Request.QueryString["user"] != null && Request.QueryString["user"] != "")
                {
                    try
                    {
                        if (SYS_AdminBll.GetInstance().IsAdmin(int.Parse(Request.QueryString["user"])))
                        {
                            Response.Redirect("../Error.aspx?msg=");
                            return;
                        }
                        txtName.Text = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["user"])).NickName;
                    }
                    catch
                    {
                        Response.Redirect("../Error.aspx?msg=");
                        return;
                    }
                }
                else
                {
                    Response.Redirect("../Error.aspx?msg=");
                    return;
                }
            }
            else if (type == "EDIT")
            {
                if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    try
                    {
                        SysNo = int.Parse(Request.QueryString["id"]);
                        SYS_AdminMod m_cms = SYS_AdminBll.GetInstance().GetModel(SysNo);

                        txtSysNo.Text    = m_cms.SysNo.ToString();
                        txtName.Text     = USR_CustomerBll.GetInstance().GetModel(m_cms.CustomerSysNo).NickName;
                        txtUserName.Text = m_cms.Username;
                        //txtPass.Enabled = false;
                        txtPass.Text = "加密存储";
                        //txtPass.ReadOnly = true;
                    }
                    catch
                    {
                        Response.Redirect("../Error.aspx?msg=");
                        return;
                    }
                }
            }
        }