Ejemplo n.º 1
0
 /// <summary>
 /// Lấy nhân viên
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void LayNhanVien()
 {
     try
     {
         cl             = new Server_Client.Client();
         this.tcpClient = cl.Connect(Luu.IP, Luu.Ports);
         Entities.KiemTraChung tt1 = new Entities.KiemTraChung();
         tt1           = new Entities.KiemTraChung("Select", "NhanVien", "MaNhanVien", "TenNhanVien");
         networkStream = cl.SerializeObj(this.tcpClient, "LayCombox", tt1);
         Entities.KiemTraChung[] tt = new Entities.KiemTraChung[1];
         tt = (Entities.KiemTraChung[])cl.DeserializeHepper1(networkStream, tt);
         tcpClient.Close();
         networkStream.Close();
         if (tt.Length > 0)
         {
             Common.Utilities com = new Common.Utilities();
             com.BindingCombobox(tt, cbxMaNhanVien, "giatri", "khoachinh");
         }
         else
         {
             frmXuly_NhanVien frm = new frmXuly_NhanVien();
             frm.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         cbxMaNhanVien.Items.Clear();
         string s = ex.Message.ToString();
     }
 }
Ejemplo n.º 2
0
        private void toolStripStatus_Sua_Click(object sender, EventArgs e)
        {
            if (!frmDangNhap.User.Administrator && !CheckQuyen(this.Name, 2))
            {
                MessageBox.Show("Bạn Không có quyền vào chức năng này.");
                return;
            }
            frmXuly_NhanVien frm = new frmXuly_NhanVien("Sua", dataGridView1.CurrentRow);

            frm.StartPosition = FormStartPosition.CenterScreen;
            frm.ShowDialog();
            hienthi();
        }
Ejemplo n.º 3
0
 private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex > -1)
     {
         if (!frmDangNhap.User.Administrator && !CheckQuyen(this.Name, 2))
         {
             MessageBox.Show("Bạn Không có quyền vào chức năng này.");
             return;
         }
         frmXuly_NhanVien frm = new frmXuly_NhanVien("Sua", dataGridView1.Rows[e.RowIndex]);
         frm.StartPosition = FormStartPosition.CenterScreen;
         frm.ShowDialog();
         hienthi();
     }
 }
Ejemplo n.º 4
0
        private void toolStripStatus_ThemMoi_Click(object sender, EventArgs e)
        {
            KiemTra = "insert";
            if (!frmDangNhap.User.Administrator && !CheckQuyen(this.Name, 4))
            {
                MessageBox.Show("Bạn Không có quyền vào chức năng này.");
                return;
            }

            while (KiemTra == "insert")
            {
                frmXuly_NhanVien frm = new frmXuly_NhanVien("Them", dataGridView1.CurrentRow);
                frm.StartPosition = FormStartPosition.CenterScreen;
                frm.ShowDialog();
                hienthi();
            }
        }
Ejemplo n.º 5
0
 private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex>-1)
     {
         if (!frmDangNhap.User.Administrator && !CheckQuyen(this.Name, 2))
         {
             MessageBox.Show("Bạn Không có quyền vào chức năng này.");
             return;
         }
         frmXuly_NhanVien frm = new frmXuly_NhanVien("Sua", dataGridView1.Rows[e.RowIndex]);
         frm.StartPosition = FormStartPosition.CenterScreen;
         frm.ShowDialog();
         hienthi();
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Lấy nhân viên
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void LayNhanVien()
 {
     try
     {
         cl = new Server_Client.Client();
         this.tcpClient = cl.Connect(Luu.IP, Luu.Ports);
         Entities.KiemTraChung tt1 = new Entities.KiemTraChung();
         tt1 = new Entities.KiemTraChung("Select", "NhanVien", "MaNhanVien", "TenNhanVien");
         networkStream = cl.SerializeObj(this.tcpClient, "LayCombox", tt1);
         Entities.KiemTraChung[] tt = new Entities.KiemTraChung[1];
         tt = (Entities.KiemTraChung[])cl.DeserializeHepper1(networkStream, tt);
         tcpClient.Close();
         networkStream.Close();
         if (tt.Length > 0)
         {
             Common.Utilities com = new Common.Utilities();
             com.BindingCombobox(tt, cbxMaNhanVien, "giatri", "khoachinh");
         }
         else
         {
             frmXuly_NhanVien frm = new frmXuly_NhanVien();
             frm.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         cbxMaNhanVien.Items.Clear();
         string s = ex.Message.ToString();
     }
 }