Esempio n. 1
0
        private void btAdminConfirm_Click(object sender, EventArgs e)
        {
            if (tbAdminID.Text.Trim() == "" || tbAdminPasswd.Text.Trim() == "")
            {
                MessageBox.Show("输入信息不完整!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                flag = 1;
            }

            if (flag == 0)
            {
                Maticsoft.BLL.Admin adm = new BLL.Admin();
                string string1          = string.Format("userID = '{0}' and passwd = '{1}'", tbAdminID.Text.Trim(), tbAdminPasswd.Text.Trim());
                string str2             = string.Format("{0}", tbAdminID.Text.Trim());
                if (adm.GetRecordCount(string1) > 0)
                {
                    if (adm.Delete(str2) == true)
                    {
                        MessageBox.Show("删除成功!");
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("删除失败!");
                    }
                }
                else
                {
                    MessageBox.Show("身份验证错误!", "删除出错", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Esempio n. 2
0
 private void btAdminConfirm_Click(object sender, EventArgs e)
 {
     if (tbAdminID.Text.Trim() == "" || tbAdminProPasswd.Text.Trim() == "" || (tbAdminName.Text.Trim() == "" & tbAdminNewPasswd.Text.Trim() == ""))
     {
         MessageBox.Show("输入信息不完整!", "修改失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         flag = 1;
     }
     if (flag == 0)
     {
         Maticsoft.BLL.Admin adm = new BLL.Admin();
         string string1          = string.Format("userID = '{0}' and passwd = '{1}'", tbAdminID.Text.Trim(), tbAdminProPasswd.Text.Trim());
         if (adm.GetRecordCount(string1) == 1)
         {
             Model.Admin adminmodel = new Model.Admin();
             adminmodel.userID   = tbAdminID.Text.Trim();
             adminmodel.userName = tbAdminName.Text.Trim();
             adminmodel.passwd   = tbAdminNewPasswd.Text.Trim();
             if (adm.Update(adminmodel) == true)
             {
                 MessageBox.Show("修改成功!");
                 ((Main_Admin)this.Owner).dgvAdmin_Load();
                 this.Close();
             }
             else
             {
                 MessageBox.Show("修改失败!");
             }
         }
         else
         {
             MessageBox.Show("身份验证错误!", "修改出错", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
 }
Esempio n. 3
0
 private void btAdminConfirm_Click(object sender, EventArgs e)
 {
     if (tbAdminID.Text.Trim() == "" || tbAdminName.Text.Trim() == "" || tbAdminPassword.Text.Trim() == "" || tbAdminConfirmPasswd.Text == "")
     {
         MessageBox.Show("输入信息不完整!", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         flag = 1;
     }
     if (flag == 0)
     {
         Maticsoft.BLL.Admin adm        = new BLL.Admin();
         Model.Admin         adminmodel = new Model.Admin();
         string str1 = string.Format("userID = '{0}'", tbAdminID.Text.Trim());
         if (adm.GetRecordCount(str1) > 0)
         {
             MessageBox.Show("当前用户名已存在!", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else
         {
             if (tbAdminPassword.Text.Trim().ToString().Length >= 6 && tbAdminPassword.Text.Trim().ToString().Length <= 10)
             {
                 if (tbAdminPassword.Text.Trim() == tbAdminConfirmPasswd.Text.Trim())
                 {
                     adminmodel.userID   = tbAdminID.Text.Trim();
                     adminmodel.userName = tbAdminName.Text.Trim();
                     adminmodel.passwd   = tbAdminPassword.Text.Trim();
                     if (adm.Add(adminmodel) == true)
                     {
                         MessageBox.Show("添加成功!");
                         ((Main_Admin)this.Owner).dgvAdmin_Load();
                         this.Close();
                     }
                     else
                     {
                         MessageBox.Show("添加失败!");
                     }
                 }
                 else
                 {
                     MessageBox.Show("两次密码不对应!", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 }
             }
             else
             {
                 MessageBox.Show("输入密码不合规范!", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
     }
 }
Esempio n. 4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string strErr = "";

            BLL.Admin bll = new BLL.Admin();
            int       aaa = bll.GetRecordCount("adminName='" + txtUsername.Text + "'and adminPass='******'");

            if (aaa >= 1)
            {
                Session["role"] = txtUsername.Text;
                Response.Redirect("index.aspx");
            }
            else
            {
                strErr += "所输入的帐号或密码不正确!\\n";
            }
            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (currentAdmin.Id == null)
            {
                Response.Write("您无权访问该页,错误原因:1.登陆超时;2.非法进入;3.权限不足。请登陆后访问<a href='login.aspx'  target='_parent'>登陆</a>");
                Response.End();
            }

            if (currentAdmin.strPower == "")
            {
                this.litMessage.Text = "<div class=\"row\">对不起,你没有任何管理权限,请联系管理员设置相应权限!</div>";
                this.Panel1.Visible  = false;
                return;
            }

            //统计前台显示的内容

            this.litSysIsRunning.Text   = sys.IsRunning ? "开放" : "关闭";
            this.litIsStatic.Text       = sys.IsStatic ? "静态模式" : "动态模式";
            this.litChinnalNum.Text     = (bllSpeciality.GetRecordCount("1=1") + 1).ToString();
            this.litArticleTypeNum.Text = bllarticletype.GetRecordCount("1=1").ToString();
            this.litArticleNum.Text     = bllarticle.GetRecordCount("1=1").ToString();
            this.litAdminNum.Text       = blladmin.GetRecordCount("1=1").ToString();
        }
Esempio n. 6
0
        private void but_ok_Click(object sender, EventArgs e)
        {
            userName   = text_userName.Text.Trim();
            passwd     = text_passwd.Text.Trim();
            ensureCode = text_ensureCode.Text.Trim();

            if (ensureCode == string.Empty || passwd == string.Empty || userName == string.Empty)
            {
                MessageBox.Show("请完善信息", "糟糕", MessageBoxButtons.OK, MessageBoxIcon.Error);
                form_Shake();
                checkCode_Random();

                if (ensureCode == string.Empty)
                {
                    text_ensureCode.Focus();
                }
                if (passwd == string.Empty)
                {
                    text_ensureCode.Text = string.Empty;
                    text_passwd.Focus();
                }
                if (userName == string.Empty)
                {
                    text_ensureCode.Text = string.Empty;
                    text_passwd.Text     = string.Empty;
                    text_userName.Focus();
                }
            }
            else
            {
                if (text_ensureCode.Text == checkCode.Text)
                {
                    string strWhere = string.Empty,
                           name     = "";
                    int count       = 0;
                    if (combox_power.Text == "管理员")
                    {
                        BLL.Admin bllAdmin = new BLL.Admin();
                        strWhere = string.Format("userID = '{0}' and passwd = '{1}'", userName, passwd);
                        count    = bllAdmin.GetRecordCount(strWhere);

                        name = new BLL.Admin().GetModel(userName).userName;
                    }
                    else
                    {
                        BLL.Manager bllManager = new BLL.Manager();
                        strWhere = string.Format("manID = '{0}' and passwd = '{1}'", userName, passwd);
                        count    = bllManager.GetRecordCount(strWhere);

                        name = new BLL.Manager().GetModel(userName).manName;
                    }

                    if (count == 1)
                    {
                        MessageBox.Show("登录成功", "恭喜", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        Common.StaticClass.userType = combox_power.Text.ToString();
                        Common.StaticClass.userName = name;
                        Common.StaticClass.userID   = userName;

                        this.Hide();

                        new Main_Admin().ShowDialog(this);

                        text_passwd.Text = text_ensureCode.Text = string.Empty;
                        checkCode_Random();
                    }
                    else
                    {
                        errorTime -= 1;
                        if (errorTime > 0)
                        {
                            MessageBox.Show("用户名或密码错误,还有" + errorTime.ToString() + "次机会", "糟糕", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            checkCode_Random();
                            form_Shake();

                            text_userName.Text = text_passwd.Text = text_ensureCode.Text = string.Empty;
                            text_userName.Focus();
                        }
                        else
                        {
                            MessageBox.Show("用户名或密码错误三次,请稍后登录", "糟糕", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            this.Close();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("验证码不正确", "糟糕", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    checkCode_Random();
                    form_Shake();
                }
            }
        }
Esempio n. 7
0
        //判断是否允许删除
        private bool IsAllowDelete(string ids)
        {
            int count = blladmin.GetRecordCount(" dbo_power='super' and id not in(" + ids + ")");

            return(count > 0);
        }