Exemplo n.º 1
0
    //private void EditUser()
    //{
    //    try
    //    {
    //        throw new Exception("The method or operation is not implemented.");
    //    }
    //    catch (Exception)
    //    {

    //        throw;
    //    }
    //}

    //private void DeleteUser()
    //{
    //    try
    //    {
    //        throw new Exception("The method or operation is not implemented.");
    //    }
    //    catch (Exception)
    //    {

    //        throw;
    //    }
    //}

    //private void AddUser()
    //{
    //    try
    //    {
    //        throw new Exception("The method or operation is not implemented.");
    //    }
    //    catch (Exception)
    //    {

    //        throw;
    //    }
    //}

    private void ViewAllUser()
    {
        try
        {
            DataTable tbl = new facade.list.WebUserFC().Select();
            if (tbl.Rows.Count > 0)
            {
                int num = tbl.Rows.Count;
                if (num > 0)
                {
                    tablecontacts  = "<table border='1' cellpadding='2' cellspacing='0' bordercolor='#DFDFDF' style='border-collapse:collapse;' width='100%'>";
                    tablecontacts += "<tr class='tlist'><td width='30'>STT</td><td width='160'>Mã</td><td width='160'>UserName</td><td width='140'>Password</td><td width='60'>Xóa bỏ</td></tr>";
                    int Stt = 0;
                    foreach (DataRow dr in tbl.Rows)
                    {
                        Stt++;
                        string id = dr[WebUserCM.FLD_ID].ToString();
                        tablecontacts += "<tr><td align='center'>" + Stt.ToString() + "</td><td class='title1'><a href='?menu=editUser&id=" + id + "'>" + id + "</a></td>";
                        tablecontacts += "<td class='title1'><a href='?menu=editUser&id=" + id + "'>" + dr[WebUserCM.FLD_USERNAME].ToString() + "</a></td>";
                        tablecontacts += "<td>???</td>";
                        tablecontacts += "<td align='center'><a href='?menu=deleteUser&id=" + id + "'>Xóa</a></td></tr>";
                    }
                    tablecontacts += "</table>";
                }
                else
                {
                    tablecontacts = "Chưa có địa chỉ liên hệ.";
                }
            }
        }
        catch (Exception)
        {
            throw;
        }
    }
Exemplo n.º 2
0
    protected void btlogin_Click(object sender, EventArgs e)
    {
        try
        {
            string userName = txtUserName.Value.Trim();
            string pass = txtPassword.Value.Trim();
            DataTable tbl = new WebUserFC().Select("Select * from " + WebUserCM.TABLE_NAME + " Where " + WebUserCM.FLD_USERNAME + "='" + userName + "'");
            //Session["UserLoginAdmin"] = userName;
            //Response.Redirect("AdminWebsite.aspx");
            if (tbl.Rows.Count != 1)
            {
                this.diverror.Visible = true;
                this.diverror.InnerHtml = "<div class='diverror'>Người dùng không tồn tại</div>";
                this.txtUserName.Focus();
                return;
            }
            else
            {
                DataRow dr = tbl.Rows[0];
                string dbpass = dr[WebUserCM.FLD_PASSWORD].ToString();
                MD5 md5 = new MD5();
                if (!md5.Verify(pass, dbpass))
                {
                    this.diverror.Visible = true;
                    this.diverror.InnerHtml = "<div class='diverror'>Mật khẩu không chính xác</div>";
                    this.txtUserName.Focus();
                    return;
                }
                else
                {
                    Session["UserLoginAdmin"] = userName;
                    Response.Redirect("AdminWebsite.aspx");
                }
            }
        }
        catch
        {

        }
    }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     diverror.Visible = false;
     try
     {
         id = Convert.ToInt32(Request.QueryString["id"]);
         DataTable tbl = new facade.list.WebUserFC().Select("select * from " + WebUserCM.TABLE_NAME + " where id=" + id);
         if (tbl.Rows.Count > 0)
         {
             DataRow dr = tbl.Rows[0];
             this.txtPassword.Value  = dr[WebUserCM.FLD_PASSWORD].ToString();
             this.txtPassword1.Value = dr[WebUserCM.FLD_PASSWORD].ToString();
             this.txtUserName.Value  = dr[WebUserCM.FLD_USERNAME].ToString();
         }
         else
         {
             Response.Redirect("AdminWebsite.aspx?menu=UserManage");
         }
     }
     catch
     {
         Response.Redirect("AdminWebsite.aspx?menu=UserManage");
     }
 }
Exemplo n.º 4
0
    //private void EditUser()
    //{
    //    try
    //    {
    //        throw new Exception("The method or operation is not implemented.");
    //    }
    //    catch (Exception)
    //    {
    //        throw;
    //    }
    //}
    //private void DeleteUser()
    //{
    //    try
    //    {
    //        throw new Exception("The method or operation is not implemented.");
    //    }
    //    catch (Exception)
    //    {
    //        throw;
    //    }
    //}
    //private void AddUser()
    //{
    //    try
    //    {
    //        throw new Exception("The method or operation is not implemented.");
    //    }
    //    catch (Exception)
    //    {
    //        throw;
    //    }
    //}
    private void ViewAllUser()
    {
        try
        {
            DataTable tbl = new facade.list.WebUserFC().Select();
            if (tbl.Rows.Count > 0)
            {
                int num = tbl.Rows.Count;
                if (num > 0)
                {
                    tablecontacts = "<table border='1' cellpadding='2' cellspacing='0' bordercolor='#DFDFDF' style='border-collapse:collapse;' width='100%'>";
                    tablecontacts += "<tr class='tlist'><td width='30'>STT</td><td width='160'>Mã</td><td width='160'>UserName</td><td width='140'>Password</td><td width='60'>Xóa bỏ</td></tr>";
                    int Stt = 0;
                    foreach (DataRow dr in tbl.Rows)
                    {
                        Stt++;
                        string id = dr[WebUserCM.FLD_ID].ToString();
                        tablecontacts += "<tr><td align='center'>" + Stt.ToString() + "</td><td class='title1'><a href='?menu=editUser&id=" + id + "'>" + id + "</a></td>";
                        tablecontacts += "<td class='title1'><a href='?menu=editUser&id=" + id + "'>" + dr[WebUserCM.FLD_USERNAME].ToString() + "</a></td>";
                        tablecontacts += "<td>???</td>";
                        tablecontacts += "<td align='center'><a href='?menu=deleteUser&id=" + id + "'>Xóa</a></td></tr>";
                    }
                    tablecontacts += "</table>";
                }
                else
                {
                    tablecontacts = "Chưa có địa chỉ liên hệ.";
                }
            }
        }
        catch (Exception)
        {

            throw;
        }
    }
Exemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     diverror.Visible = false;
     try
     {
         id = Convert.ToInt32(Request.QueryString["id"]);
         DataTable tbl = new facade.list.WebUserFC().Select("select * from " + WebUserCM.TABLE_NAME + " where id=" + id);
         if (tbl.Rows.Count > 0)
         {
             DataRow dr = tbl.Rows[0];
             this.txtPassword.Value = dr[WebUserCM.FLD_PASSWORD].ToString();
             this.txtPassword1.Value = dr[WebUserCM.FLD_PASSWORD].ToString();
             this.txtUserName.Value = dr[WebUserCM.FLD_USERNAME].ToString();
         }
         else
         {
             Response.Redirect("AdminWebsite.aspx?menu=UserManage");
         }
     }
     catch
     {
         Response.Redirect("AdminWebsite.aspx?menu=UserManage");
     }
 }