Exemplo n.º 1
0
        //登录事件
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            //检测账户信息是否正确
            BLL.vw_SYS_Account bllAccount_vw = new BLL.vw_SYS_Account();
            string             strWhere      = "AccountName='" + txbUserName.Text + "' and Password='******'";
            DataSet            dsAccount     = bllAccount_vw.GetList(strWhere);

            if (dsAccount.Tables[0].Rows.Count > 0)
            {
                Session["AccountName"] = txbUserName.Text;
                Session["AccountID"]   = dsAccount.Tables[0].Rows[0]["ID"].ToString();
                Session["RoleName"]    = dsAccount.Tables[0].Rows[0]["RoleName"].ToString();
                Alert.ShowInTop("登陆成功!", "提示信息", MessageBoxIcon.Information, "location.href='Default.aspx';");
                return;
            }
            else
            {
                Alert.ShowInTop("用户名不存在 或 密码错误!", "提示信息", MessageBoxIcon.Warning);
            }

            #region 是否为系统初始账户
            if (txbUserName.Text == "YJQ" && txbPassword.Text == "1111")
            {
                Model.tb_SYS_Account modelAccount = new Model.tb_SYS_Account();

                modelAccount.ID          = Guid.NewGuid().ToString();
                modelAccount.AccountName = txbUserName.Text;
                modelAccount.Password    = txbPassword.Text;
                modelAccount.AccountType = "0";
                modelAccount.CreateID    = modelAccount.ID;
                modelAccount.CreateTime  = DateTime.Now;
                modelAccount.State       = "1";

                BLL.tb_SYS_Account bllAccount = new BLL.tb_SYS_Account();
                bool result = bllAccount.Add(modelAccount);
                if (!result)
                {
                    Alert.ShowInTop("初始账户添加失败!", "提示信息", MessageBoxIcon.Error);
                }
                else
                {
                    Alert.ShowInTop("成功添加初始账户!", "提示信息", MessageBoxIcon.Information, "location.href='Default.aspx';");
                }
            }
            #endregion
        }
Exemplo n.º 2
0
        //保存修改
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Model.tb_SYS_Account modelAccount = new Model.tb_SYS_Account();
            modelAccount.ID          = Request.QueryString["ID"].ToString();
            modelAccount.AccountName = txbAccountName.Text;
            modelAccount.Password    = txbPassword.Text;
            modelAccount.RoleID      = hdfRoleID.Text;
            modelAccount.UpdateID    = Session["AccountID"].ToString();
            modelAccount.UpdateTime  = DateTime.Now;

            BLL.tb_SYS_Account bllAccount = new BLL.tb_SYS_Account();
            bool result = bllAccount.Update(modelAccount);

            if (!result)
            {
                Alert.ShowInTop("更新失败", "提示信息", MessageBoxIcon.Error, ActiveWindow.GetHideRefreshReference());
            }
            else
            {
                Alert.ShowInTop("更新成功", "提示信息", MessageBoxIcon.Information, ActiveWindow.GetHideRefreshReference());
            }
        }