Beispiel #1
0
        private void ShowInfo(int ID)
        {
            DataSet   ds = bll.GetList("USER_ID=" + ID + "");
            DataTable dt = ds.Tables[0];

            if (dt.Rows.Count > 0)
            {
                this.textname.Text = dt.Rows[0]["USER_NAME"].ToString().Trim();
                this.textpass.Text = dt.Rows[0]["USER_PASSWORD"].ToString().Trim();
                //userName = dt.Rows[0]["USER_NAME"].ToString().Trim();
                //password = dt.Rows[0]["USER_PASSWORD"].ToString().Trim();
            }
        }
Beispiel #2
0
        public void ProcessRequest(HttpContext context)
        {
            //添加
            string funcName = context.Request.QueryString["funName"].ToString();

            if (funcName == "AddUser")
            {
                string    name     = context.Request.QueryString["name"].ToString();
                string    password = context.Request.QueryString["password"].ToString();
                Admin_Bll bll      = new Admin_Bll();
                DataSet   ds       = bll.GetList("");
                DataTable dt       = ds.Tables[0];
                bool      validate = false;
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (dt.Rows[i]["USER_NAME"].ToString() == name)
                        {
                            validate = true;
                            break;
                        }
                    }
                }
                if (validate == true)
                {
                    context.Response.Write("UserExists");
                }
                else
                {
                    Admin_Model model = new Admin_Model();
                    model.USER_NAME     = name;
                    model.USER_PASSWORD = EncryptHelper.Encrypt(password);
                    model.CREATE_TIME   = DateTime.Now;

                    int j = bll.Add(model);
                    if (j > 0)
                    {
                        context.Response.Write("OK");
                    }
                    else
                    {
                        context.Response.Write("error");
                    }
                }
            }
        }
Beispiel #3
0
        public void BindData()
        {
            DataSet   ds = bll.GetList("");
            DataTable dt = ds.Tables[0];

            //显示顺序
            dt.DefaultView.Sort = "USER_ID asc";
            dt = dt.DefaultView.ToTable();
            if (dt.Rows.Count > 0)
            {
                gridView.DataSource = dt;
                gridView.DataBind();
                count = dt.Rows.Count;
                //用lblCurrentIndex来显示当前页的页数。
                //Lab_CurrentPage.Text = "第 " + (gridView.PageIndex + 1).ToString() + " 页";
                ////用LblPageCount来显示当前数据的总页数。
                //Lab_PageCount.Text = "共 " + gridView.PageCount.ToString() + " 页";
            }
            else
            {
                gridView.DataSource = null;
                gridView.DataBind();
            }
        }