Example #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (this.add)
     {
         BLPhanCong      blpc = new BLPhanCong();
         BLNhanVien      blnv = new BLNhanVien();
         BLCa            blca = new BLCa();
         CA              caa  = new CA();
         List <CA>       dsca = new List <CA>();
         List <NHANVIEN> dsnv = new List <NHANVIEN>();
         dsnv = blnv.dsNhanVien();
         dsca = blca.LoadShift();
         NHANVIEN nv = new NHANVIEN();
         nv  = dsnv.Find(x => (x.MaNV == int.Parse(cbb_emp_ID.SelectedItem.ToString())));
         caa = dsca.Find(x => (x.MaCa == int.Parse(cbb_to_shift.SelectedItem.ToString())));
         if (blpc.AddPC(nv, caa))
         {
             MessageBox.Show("SUCCESS!");
         }
         else
         {
             MessageBox.Show("FAIL");
         }
     }
     else
     {
         BLPhanCong      blpc  = new BLPhanCong();
         BLNhanVien      blnv  = new BLNhanVien();
         BLCa            blca  = new BLCa();
         CA              TOcaa = new CA();
         CA              Frcaa = new CA();
         List <CA>       dsca  = new List <CA>();
         List <NHANVIEN> dsnv  = new List <NHANVIEN>();
         dsnv = blnv.dsNhanVien();
         dsca = blca.LoadShift();
         NHANVIEN nv = new NHANVIEN();
         nv    = dsnv.Find(x => (x.MaNV == int.Parse(cbb_emp_ID.SelectedItem.ToString())));
         TOcaa = dsca.Find(x => (x.MaCa == int.Parse(cbb_to_shift.SelectedItem.ToString())));
         Frcaa = dsca.Find(x => (x.MaCa == int.Parse(cbb_shift.SelectedItem.ToString())));
         if (blpc.EditPC(nv, Frcaa, TOcaa))
         {
             MessageBox.Show("SUCCESS!");
         }
         else
         {
             MessageBox.Show("FAIL");
         }
     }
 }
Example #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.add)
            {
                BLPhanCong blpc = new BLPhanCong();
                BLNhanVien blnv = new BLNhanVien();
                BLCa       blca = new BLCa();
                NhanVien   nv   = new NhanVien();
                int        manv = int.Parse(cbb_emp_ID.SelectedItem.ToString());
                int        maca = int.Parse(cbb_to_shift.SelectedItem.ToString());
                if (blpc.AddPC(manv, maca, out string err))
                {
                    MessageBox.Show("SUCCESS!");
                }
                else
                {
                    MessageBox.Show("FAIL ", err);
                }
            }
            else
            {
                BLPhanCong blpc = new BLPhanCong();
                BLNhanVien blnv = new BLNhanVien();

                int TOcaa;
                int Frcaa;
                int nv;



                nv    = int.Parse(cbb_emp_ID.SelectedItem.ToString());
                TOcaa = int.Parse(cbb_to_shift.SelectedItem.ToString());
                Frcaa = int.Parse(cbb_shift.SelectedItem.ToString());
                if (blpc.Update(nv, Frcaa, TOcaa, out string err))
                {
                    MessageBox.Show("SUCCESS!");
                }
                else
                {
                    MessageBox.Show(err);
                }
            }
        }