protected void Rep_list_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        function_all.adminLoginChack(0, "Default.aspx");
        obj = new db_help();
        if (e.CommandName == "dele")
        {
            sql = "delete from stk where(stID=" + e.CommandArgument + ")";
            obj.ExecNonSql(sql);
            function_all.TiaoZhuan("删除成功", "shoudonng.aspx?p=" + p + "&c=" + c, 0);
        }
        if (e.CommandName == "tianjia")
        {
            //可以用if语句来实现分类查询

            sql = "select stnr from stk where(stID=" + e.CommandArgument + ")";
            rds = obj.ExecReaderSql(sql);
            if (rds.Read())
            {
                if (!Convert.IsDBNull(rds["stnr"]))
                {
                    // Text_nr.Text = "First Line\r\nSecond Line\r\nThird Line";
                    Text_nr.Text = rds["stnr"].ToString();
                    //Server.HtmlEncode(br);
                }
            }


            Text_nr.Text = rds["stnr"].ToString();
        }
    }
Exemplo n.º 2
0
    protected void butt_ok_Click(object sender, EventArgs e)
    {
        string sql = "";

        obj = new db_help();
        sql = "insert into stk (stlx,stnr,stda,stnd,zj,stfz,txbz) values('" + Text_tx.Text.ToString() + "','" + Text_nr.Text.ToString() + "','" + Text_da.Text.ToString() + "','" + Text_nd.Text.ToString() + "','" + Text_zj.Text.ToString() + "', '" + System.Convert.ToInt32(Text_fz.Text) + "' ,'" + Text_bz.Text.ToString() + "')";
        obj.ExecNonSql(sql);
        obj.Close();
        function_all.TiaoZhuan("更新成功", "stgl_edit.aspx", 0);
    }
Exemplo n.º 3
0
 protected void Rep_list_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     function_all.adminLoginChack(0, "Default.aspx");
     if (e.CommandName == "dele")
     {
         obj = new db_help();
         sql = "delete from stk where(stID=" + e.CommandArgument + ")";
         obj.ExecNonSql(sql);
         obj.Close();
         function_all.TiaoZhuan("删除成功", "stgl.aspx?p=" + p + "&c=" + c, 0);
     }
 }
Exemplo n.º 4
0
    //用户密码注册
    protected void butt_ok_Click1(object sender, System.EventArgs e)
    {
        string sql = "";
        string adm = System.Convert.ToString(text_adm.Text);
        string npw = System.Convert.ToString(text_npw.Text);

        obj = new db_help();
        //sql = "insert into T_user (U_name,U_password) values ( '"+ adm+ "','" + npw + "')";
        sql = "Insert into T_user(U_name, U_password) values('" + adm + "','" + npw + "')";
        obj.ExecNonSql(sql);
        obj.Close();
        function_all.TiaoZhuan("注册成功,请登录!", "Default.aspx", 0);
    }
    //用户密码匹配与密码修改
    protected void butt_ok_Click1(object sender, System.EventArgs e)
    {
        function_all.adminLoginChack(0, "Default.aspx");

        string ers = null;
        string adm = System.Convert.ToString(text_adm.Text.Trim());
        string opw = System.Convert.ToString(text_opw.Text);
        string npw = System.Convert.ToString(text_npw.Text);
        string spw = System.Convert.ToString(text_spw.Text);

        Regex umReg = new Regex("^[A-Za-z0-9]{1,50}$");

        if (!umReg.IsMatch(adm))
        {
            ers = "管理员账号不能为空,最大支持50个字符,可以是0-9、a-z、A-Z的组合";
        }

        if (string.IsNullOrEmpty(ers))
        {
            if (opw.Length <= 0 || npw.Length <= 0 || spw.Length <= 0)
            {
                ers = "密码不能为空";
            }
            else
            {
                if (npw != spw)
                {
                    ers = "两次输入的新密码不一样";
                }
            }
        }
        if (string.IsNullOrEmpty(ers))
        {
            string dbpwd = "";

            obj = new db_help();
            sql = "SELECT PassWord FROM admin";
            rds = obj.ExecReaderSql(sql);
            if (rds.Read())
            {
                if (!Convert.IsDBNull(rds["PassWord"]))
                {
                    dbpwd = System.Convert.ToString(rds["PassWord"]);
                }
            }
            rds.Close();
            obj.Close();

            if (opw != dbpwd)
            {
                ers = "原密码不正确";
            }
        }

        if (string.IsNullOrEmpty(ers))
        {
            obj = new db_help();
            sql = "UPDATE admin SET UserName = '******', PassWord = '******' ";
            obj.ExecNonSql(sql);
            obj.Close();

            function_all.TiaoZhuan("密码修改成功,下次登录生效!", "welcome.aspx", 0);
            Response.End();
        }
        else
        {
            function_all.TiaoZhuan(ers, "password.aspx", 0);

            Response.End();
        }
    }