Beispiel #1
0
 protected void btn_okchang_Click(object sender, EventArgs e)
 {
     try {
         ua = (user)Session["Adminu"];
         //Buckup.Buckup_ChangePower(ua.name, txt_name.Text, Hidden1.Value);
         Buckup.Buckup_AccountOperation("修改账号权限", ua.name, clientIP, txt_name.Text, Hidden1.Value.Trim());
         string id  = SqlFunction.Sql_ReturnNumberES("select id from admin where user_name='" + txt_name.Text + "'");
         string sql = "";
         sql = string.Format(@"update admin set User_Name='{0}', User_Email='{1}', 
         phone='{2}', a_state='{3}', isadd='{4}', isupdate='{5}', isselect='{6}', 
         isdelete='{7}', isregedit='{8}', isexport='{9}' where id=" + id,
                             txt_name.Text, txt_email.Value, txt_phone.Value, ddl_s.SelectedIndex,
                             Convert.ToInt32(cb_add.Checked), Convert.ToInt32(cb_update.Checked), Convert.ToInt32(cb_select.Checked),
                             Convert.ToInt32(cb_dele.Checked), Convert.ToInt32(cb_regedit.Checked), Convert.ToInt32(cb_export.Checked));
         int r = SqlFunction.Sql_ReturnNumberENQ(sql);
         if (r == 1)
         {
             LayerA("修改成功!", 6, Page);
         }
         else
         {
             LayerA("修改失败!错误信息:" + r, 5, Page);
         }
     } catch (Exception ee) {
         LayerA("修改失败!错误信息:" + ee.Message, 5, Page);
     }
 }
Beispiel #2
0
        protected void btn_deleteUser_Click(object sender, EventArgs e)
        {
            try {
                ua = (user)Session["Adminu"];

                Buckup.Buckup_AccountOperation("删除用户", ua.name, clientIP, txt_name.Text, "");
                int r = SqlFunction.Sql_ReturnNumberENQ("delete from admin where user_name='" + info[0] + "'");
                if (r == 1)
                {
                    LayerA("删除成功!", 6, Page);
                }
                else
                {
                    LayerA("删除失败!错误信息:" + r, 5, Page);
                }
            } catch (Exception ee) {
                LayerA("删除失败!错误信息:" + ee.Message, 5, Page);
            }
        }
Beispiel #3
0
        protected void btn_changepwd_Click(object sender, EventArgs e)
        {
            ua = (user)Session["Adminu"];
            string clientIP = HttpContext.Current.Request.UserHostAddress;
            string pwd      = MD5pwd.MD5zsgc.MD5Entry(old_pwd.Value);
            string newpwd   = MD5pwd.MD5zsgc.MD5Entry(new_pwd.Value);

            if (SqlFunction.Sql_ReturnNumberES("select user_pwd from admin where user_name='" + ua.name + "'") == pwd)
            {
                int jg = SqlFunction.Sql_ReturnNumberENQ("update admin set user_pwd='" + newpwd + "' where user_name='" + ua.name + "'");
                if (jg == 1)
                {
                    Buckup.Buckup_AccountOperation("更改密码", ua.name, ua.name, clientIP, string.Format("将原密码{0},更改成{1}", pwd, newpwd));
                    LayerA("修改成功", 6, Page);
                }
            }
            else
            {
                LayerA("原密码错误", 5, Page);
            }
        }
Beispiel #4
0
        //注册
        protected void btn_r_ok_Click(object sender, EventArgs e)
        {
            string info = check();

            if (Convert.ToInt32(SqlFunction.Sql_ReturnNumberES("select count(*) from admin where user_name='" + txt_name.Value + "'")) != 0)
            {
                LayerA("注册失败,已存在此用户", 5, Page);
                return;
            }
            if (info == "")  //检查注册信息
            {
                int[] bl;
                bl = new int[6];
                if (cb_add.Checked == true)
                {
                    bl[0] = 1;
                }
                else
                {
                    bl[0] = 0;
                }
                if (cb_update.Checked == true)
                {
                    bl[2] = 1;
                }
                else
                {
                    bl[1] = 0;
                }
                if (cb_select.Checked == true)
                {
                    bl[3] = 1;
                }
                else
                {
                    bl[2] = 0;
                }
                if (cb_dele.Checked == true)
                {
                    bl[1] = 1;
                }
                else
                {
                    bl[3] = 0;
                }
                if (cb_regedit.Checked == true)
                {
                    bl[4] = 1;
                }
                else
                {
                    bl[4] = 0;
                }
                if (cb_export.Checked == true)
                {
                    bl[5] = 1;
                }
                else
                {
                    bl[5] = 0;
                }
                string   sql = "";
                DateTime dt  = DateTime.Now;
                sql = string.Format(@"insert into Admin (User_Name,User_Pwd,
                    User_Email,phone,a_state,isadd,isupdate,isselect,isdelete,isregedit,isexport,creatTime)
                    values(" + "'" + txt_name.Value + "',"
                                    + "'" + MD5pwd.MD5zsgc.MD5Entry(this.txt_pwd.Value) + "',"
                                    + "'" + txt_email.Value + "',"
                                    + "'" + txt_phone.Value + "',"
                                    + "'" + ddl_s.Text + "',"
                                    + "'" + bl[0] + "',"
                                    + "'" + bl[1] + "',"
                                    + "'" + bl[2] + "',"
                                    + "'" + bl[3] + "',"
                                    + "'" + bl[4] + "',"
                                    + "'" + bl[5] + "',"
                                    + "'" + dt.ToString() + "')");
                if (SqlFunction.Sql_ReturnNumberENQ(sql) == 1)
                {
                    string power = "";
                    power = string.Format("[增:{0}],[改:{1}],[查:{2}],[删:{3}],[注册:{4}],[导出:{5}];1表示有权限0表示无权限"
                                          , bl[0], bl[1], bl[2], bl[3], bl[4], bl[5]);
                    ua = (user)Session["Adminu"];
                    string info2 = "";//备份的注册信息
                    info2 = string.Format("[密码:{0}][状态:{1}]{2}",
                                          MD5pwd.MD5zsgc.MD5Entry(txt_pwd.Value), ddl_s.SelectedValue, power);
                    string clientIP = HttpContext.Current.Request.UserHostAddress;
                    Buckup.Buckup_AccountOperation("注册用户", ua.name, clientIP, txt_name.Value, info2);
                    LayerA("注册成功", 6, Page);
                }
                else
                {
                    LayerA("注册失败", 5, Page);
                }
            }
            else     //检查不规范
            {
                LayerA(info, 5, Page);
            }
        }