예제 #1
0
        private void editbt_Click(object sender, EventArgs e)
        {
            bool check = false;

            if (KiemTraError(check) == true)
            {
                return;
            }

            ClassCongViec congviec = new ClassCongViec
            {
                MaCV    = this.txtMacv.Text.Trim(),
                TenCV   = this.txtTencv.Text.Trim(),
                ChiTiet = this.txtChitiet.Text.Trim()
            };

            congviec.listDA.Add(DAController.GetDuAn(this.cbbMaDA.Text.Trim()));


            if (CongViecController.UpdateCV(congviec) == false)
            {
                MessageBox.Show("Loi khi sua cong viec", "Loi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            ShowData();

            this.txtChitiet.Clear();
            this.txtMacv.Clear();
            this.txtTencv.Clear();
            this.errorProvider1.Clear();
            this.errorProvider2.Clear();
            this.errorProvider3.Clear();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                List <ClassCongViec> lstcv = new List <ClassCongViec>();
                this.listsearchG.DataSource = null;
                this.listsearchG.Items.Clear();
                foreach (var item in this.checkedListBox1.CheckedItems)
                {
                    ClassDuAn da = DAController.GetDuAn(item.ToString());

                    //lay danh sach cong viec cua du an vao listsearchG
                    foreach (var i in da.listCV)
                    {
                        lstcv.Add(i);
                    }


                    //MessageBox.Show(item.ToString());
                }
                listsearchG.DataSource = lstcv;
            }
            catch
            { }
        }
 public frmPhanCong()
 {
     InitializeComponent();
     this.cbbManv.DataSource = NhanVienController.GetListNV();
     //this.cbbMada.DataSource = DAController.GetListDA();
     foreach (var da in DAController.GetListDA())
     {
         this.checkedListBox1.Items.Add(da);
     }
     ClearControls();
     ShowData();
 }
예제 #4
0
        private void delbt_Click(object sender, EventArgs e)
        {
            if (DAController.DeleteDuAn(this.txtMaDA.Text.Trim()) == false)
            {
                MessageBox.Show("Loi khi xoa du an", "Loi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            ShowData();

            ClearControls();
        }
예제 #5
0
        private void ShowData()
        {
            listViewda.Items.Clear();
            List <ClassDuAn> lstda = DAController.GetListDA();

            foreach (var i in lstda)
            {
                ListViewItem da = new ListViewItem(i.MaDA);
                da.SubItems.Add(new ListViewItem.ListViewSubItem(da, i.TenDA));
                da.SubItems.Add(new ListViewItem.ListViewSubItem(da, i.ChiTiet));
                da.SubItems.Add(new ListViewItem.ListViewSubItem(da, i.fromDate.ToString()));
                da.SubItems.Add(new ListViewItem.ListViewSubItem(da, i.toDate.ToString()));

                this.listViewda.Items.Add(da);
            }
        }
예제 #6
0
        private void addbt_Click(object sender, EventArgs e)
        {
            bool check = false;

            //Kiem tra MaCV da ton tai
            if (CongViecController.GetCV(this.txtMacv.Text.Trim()) != null)
            {
                MessageBox.Show("Cong viec nay da ton tai", "Loi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //Kiem tra hop le
            if (KiemTraError(check) == true)
            {
                return;
            }

            ClassCongViec congviec = new ClassCongViec();

            congviec.MaCV    = this.txtMacv.Text.Trim();
            congviec.TenCV   = this.txtTencv.Text.Trim();
            congviec.ChiTiet = this.txtChitiet.Text.Trim();
            congviec.listDA.Add(DAController.GetDuAn(this.cbbMaDA.Text.Trim()));

            if (CongViecController.AddCV(congviec) == false)
            {
                MessageBox.Show("Loi khi them cong viec", "Loi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            ShowData();

            //Xoa control
            this.txtChitiet.Clear();
            this.txtMacv.Clear();
            this.txtTencv.Clear();
            this.errorProvider1.Clear();
            this.errorProvider2.Clear();
            this.errorProvider3.Clear();
        }
예제 #7
0
        private void addbt_Click(object sender, EventArgs e)
        {
            //Kiem tra MaDA da ton tai hay khong
            if (DAController.GetDuAn(txtMaDA.Text.Trim()) != null)
            {
                return;
            }

            //kiem tra hop le
            bool check = false;

            if (KiemTra(check) == true)
            {
                return;
            }

            ClassDuAn da = new ClassDuAn();

            da.MaDA     = txtMaDA.Text.Trim();
            da.TenDA    = txtTenDA.Text.Trim();
            da.fromDate = fromDatePicker.Value;
            da.toDate   = toDatePicker.Value;
            da.ChiTiet  = txtChitiet.Text;

            //them vao csdl
            if (DAController.AddDuAn(da) == false)
            {
                MessageBox.Show("Loi khi them du an", "Loi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //hien thi du lieu
            ShowData();

            ClearControls();
        }
예제 #8
0
        private void editbt_Click(object sender, EventArgs e)
        {
            bool check = false;

            if (KiemTra(check) == true)
            {
                return;
            }

            ClassDuAn da = new ClassDuAn();

            da.MaDA     = txtMaDA.Text.Trim();
            da.TenDA    = txtTenDA.Text.Trim();
            da.fromDate = fromDatePicker.Value;
            da.toDate   = toDatePicker.Value;
            da.ChiTiet  = txtChitiet.Text;



            //Kiem tra congviec thuoc du an khac hay khong khi ADD
            //if(selectedMaDA!=this.txtMaDA.Text.Trim())
            //{
            //    List<ClassCongViec> congViecs = new List<ClassCongViec>();
            //    foreach (var i in CongViecController.GetListCV())
            //    {
            //        if (i.listDA.Count != 0)
            //            congViecs.Add(i);
            //    }
            //    foreach (var j in congViecs)
            //    {
            //        foreach (var z in da.listCV)
            //        {
            //            if (j.MaCV == z.MaCV)
            //            {
            //                MessageBox.Show("Cong viec da thuoc du an khac", "Loi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //                return;
            //            }
            //        }
            //    }
            //}

            //kiem tra cong viec thuoc du an khac hay khong Update
            //foreach(var i in da.listCV)
            //{
            //    if(i.listDA.Count!=0)
            //        foreach(var j in i.listDA)
            //        {
            //            if (j.MaDA != da.MaDA)
            //            {
            //                MessageBox.Show("Cong viec da thuoc du an khac", "Loi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //                return;
            //            }

            //        }
            //}

            if (DAController.UpdateDA(da) == false)
            {
                MessageBox.Show("Loi khi sua du an", "Loi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            ShowData();

            ClearControls();
        }
예제 #9
0
 public frmCongViec()
 {
     InitializeComponent();
     this.cbbMaDA.DataSource = DAController.GetListDA();
     ShowData();
 }