protected void btnLuuUser_Click(object sender, EventArgs e)
        {
            DTOUser dtond = new DTOUser();

            dtond.ID = txtID.Text;
            dtond.MK = txtMK.Text;
            dtond.HTuser = txtHoTen.Text;

            DTONhomQuyen dtonq = new DTONhomQuyen();
            dtonq.MaNQ = int.Parse(ddlNhomQ.SelectedValue);
            dtonq.NhomQ = ddlNhomQ.SelectedItem.ToString();
            dtond.dtoNhomQ = dtonq;

            DAO_Entity daond = new DAO_Entity();
            if (KiemTraNhap() == "")
            {
                daond.ThemUser(dtond);
                Response.Redirect("~/QLBophan_Admin/QLUser/User.aspx");
            }
            else
            {
                ThemUser.Visible = true;
                lbLoi.Text = KiemTraNhap();
            }
        }
예제 #2
0
 public DTOUser(DataRow dongDL)
 {
     ID     = dongDL["IDUser"].ToString();
     MK     = dongDL["MatKhau"].ToString();
     HTuser = dongDL["HoTenuser"].ToString();
     // NhomQuyen = dongDL["NhomQuyen"].ToString();
     MaNQ     = (int)dongDL["MaNhomQ"];
     dtoNhomQ = new DTONhomQuyen(dongDL);
 }
        public DTOUser(DataRow dongDL)
        {

            ID = dongDL["IDUser"].ToString();
            MK = dongDL["MatKhau"].ToString();
            HTuser = dongDL["HoTenuser"].ToString();
           // NhomQuyen = dongDL["NhomQuyen"].ToString();
            MaNQ = (int)dongDL["MaNhomQ"];
            dtoNhomQ = new DTONhomQuyen(dongDL);
        }
        public List<DTONhomQuyen> LayDSNhomQ()
        {
            List<DTONhomQuyen> dsNhomQ = new List<DTONhomQuyen>();
            string lenh = "select * from NhomQuyen";
            ketnoi.TaoKetNoi();
            DataTable bang = new DataTable();
            try
            {
                ketnoi.LenhKetNoi = new SqlCommand(lenh, ketnoi.KetNoi);
                ketnoi.TichHopCSDL = new SqlDataAdapter(ketnoi.LenhKetNoi);
                ketnoi.TichHopCSDL.Fill(bang);
                foreach (DataRow dongDL in bang.Rows)
                {
                    DTONhomQuyen dtoNhomQ = new DTONhomQuyen(dongDL);
                    dsNhomQ.Add(dtoNhomQ);
                }
            }
            catch (Exception)
            {


            }
            finally
            {
                ketnoi.DongKetNoi();
            }
            return dsNhomQ;
        }