Exemplo n.º 1
0
        private void GUI()
        {
            TaiKhoan    s = new TaiKhoan();
            ThongTin_TK r = new ThongTin_TK();

            if (BLL_QLNV.Instance.GetNVbyID(id).ID > 0)
            {
                s              = BLL_QLNV.Instance.GetNVbyID(id);
                r              = BLL_ThongTinTK.Instance.GetTTTK(Convert.ToInt32(id));
                txttk.Text     = s.User_Name;
                txtpass.Text   = s.PassWord;
                comboBox1.Text = BLL_QLNV.Instance.GetRole(s.Role);
                txthoten.Text  = r.HoTen;
                txtsdt.Text    = r.SDT;
                txtdiachi.Text = r.DiaChi;
                if (r.Gender == false)
                {
                    radioButton2.Checked = true;
                }
                else
                {
                    radioButton1.Checked = true;
                }
                dateTimePicker1.Value = r.NS;
            }
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (BLL_QLNV.Instance.CheckNV(id) == false)
            {
                TaiKhoan    s = new TaiKhoan();
                ThongTin_TK r = new ThongTin_TK();
                s.ID        = BLL_QLNV.Instance.GetNVLast().ID + 1;
                s.User_Name = txttk.Text;
                s.PassWord  = txtpass.Text;
                s.Role      = comboBox1.SelectedIndex + 1;
                //
                r.ID_ThongTin_TK = BLL_QLNV.Instance.GetNVLast().ID + 1;
                r.HoTen          = txthoten.Text;
                r.SDT            = txtsdt.Text;
                r.DiaChi         = txtdiachi.Text;
                if (radioButton1.Checked == true)
                {
                    r.Gender = true;
                }
                else
                {
                    r.Gender = false;
                }
                r.NS = dateTimePicker1.Value.Date;

                BLL_QLNV.Instance.AddNV(s);
                BLL_ThongTinTK.Instance.AddTT(r);
                MessageBox.Show("Thêm Mới Thành Công");
                d("");
            }
            else
            {
                if (BLL_QLNV.Instance.CheckNV(id))
                {
                    var k = BLL_QLNV.Instance.GetNVbyID(id);
                    k.User_Name = txttk.Text;
                    k.PassWord  = txtpass.Text;
                    k.Role      = comboBox1.SelectedIndex + 1;
                    //
                    k.ThongTin_TK.HoTen  = txthoten.Text;
                    k.ThongTin_TK.SDT    = txtsdt.Text;
                    k.ThongTin_TK.DiaChi = txtdiachi.Text;
                    if (radioButton1.Checked == true)
                    {
                        k.ThongTin_TK.Gender = true;
                    }
                    else
                    {
                        k.ThongTin_TK.Gender = false;
                    }
                    k.ThongTin_TK.NS = dateTimePicker1.Value.Date;
                    BLL_QLNV.Instance.EditNV(k);
                    MessageBox.Show("Sửa Thành Công");
                    this.Close();
                    d("");
                }
            }
        }
Exemplo n.º 3
0
 public void AddTT(ThongTin_TK s)
 {
     try
     {
         db.ThongTin_TK.Add(s);
         db.SaveChanges();
     }
     catch (Exception e) { }
 }
Exemplo n.º 4
0
        public ThongTin_TK GetTTTK(int idtt)
        {
            ThongTin_TK s = new ThongTin_TK();

            foreach (var i in GetTT())
            {
                if (idtt == i.ID_ThongTin_TK)
                {
                    s = i;
                }
            }
            return(s);
        }
Exemplo n.º 5
0
        public void GUI()
        {
            ThongTin_TK s = new ThongTin_TK();

            if (BLL_ThongTinTK.Instance.GetTTTK(idtt) != null)
            {
                s              = BLL_ThongTinTK.Instance.GetTTTK(idtt);
                txtname.Text   = s.HoTen;
                txtsdt.Text    = s.SDT;
                txtdiachi.Text = s.DiaChi;
                if (s.Gender == true)
                {
                    txtgennder.Text = "Nam";
                }
                else
                {
                    txtgennder.Text = "Nữ";
                }
            }
        }