コード例 #1
0
ファイル: FrmChucVu.cs プロジェクト: lequan2512/QuanLyNhanSu
        private void FrmChucVu_Load(object sender, EventArgs e)
        {
            model = new ChucVuModel();
            model.setControl(dataGridView1, lblMessage);

            model.getAllData("TEN_CV");


            model.ShowDetail(ShowDetail);

            validate.SetTooltip(toolTip1);

            if (CurrentRowSelected != null)
            {
                dataGridView1.ClearSelection();
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (row.Cells[0].Value.ToString().Equals(CurrentRowSelected))
                    {
                        row.Cells[0].Selected = true;
                    }
                }
                dataGridView1.DoubleClick += new EventHandler(dataGridView1_DoubleClick);
            }

            ShowDetail(dataGridView1.CurrentRow);
        }
コード例 #2
0
        public ActionResult ThemMoiNhanVien(ChucVu std)
        {
            ChucVuModel chucVuModel = new ChucVuModel();

            ViewBag.ChucVu = chucVuModel.GetData();
            return(View());
        }
コード例 #3
0
        public int Xoa(string msChucVu)
        {
            ChucVuModel cv = new ChucVuModel();

            cv.MSCHUCVU = int.Parse(msChucVu);
            return(cv.Xoa());
        }
コード例 #4
0
        public int Them(string tenChucVu)
        {
            ChucVuModel cv = new ChucVuModel();

            cv.TENCHUCVU = tenChucVu;
            return(cv.Them());
        }
コード例 #5
0
        public int CapNhat(string msChucVu, string tenChucVu)
        {
            ChucVuModel cv = new ChucVuModel();

            cv.MSCHUCVU  = int.Parse(msChucVu);
            cv.TENCHUCVU = tenChucVu;
            return(cv.CapNhat());
        }
コード例 #6
0
        public ActionResult EditChucVu(ChucVuModel model)
        {
            var chucvu = db.ChucVus.Find(model.Id);

            chucvu.TenChucVu = model.TenChucVu;
            chucvu.Luong     = model.Luong;
            db.SaveChanges();
            return(RedirectToAction("Index", "ChucVuAdmin"));
        }
コード例 #7
0
        public ActionResult EditChucVu(int machucvu)
        {
            var model  = new ChucVuModel();
            var chucvu = db.ChucVus.FirstOrDefault(x => x.Id == machucvu);

            model.Id        = chucvu.Id;
            model.TenChucVu = chucvu.TenChucVu;
            model.Luong     = chucvu.Luong;
            return(View(model));
        }
コード例 #8
0
        public ActionResult CreateChucVu(ChucVuModel model)
        {
            var chucvu = new ChucVu();

            chucvu.TenChucVu = model.TenChucVu;
            chucvu.Luong     = model.Luong;
            db.ChucVus.Add(chucvu);
            db.SaveChanges();
            return(RedirectToAction("Index", "ChucVuAdmin"));
        }
コード例 #9
0
        /*
         * ________ LOAD COMBOBOX ________
         */
        private void loadComboBoxChucVu()
        {
            //Variable
            ChucVuModel  chucVu       = new ChucVuModel();
            DataTable    td           = new DataTable();
            ComboboxItem comboboxItem = new ComboboxItem();

            td = chucVu.getAllTable();
            foreach (DataRow row in td.Rows)
            {
                comboboxItem       = new ComboboxItem();
                comboboxItem.Text  = row[1].ToString(); //Gan ten chuc vu
                comboboxItem.Value = row[0].ToString(); //Gan ma chuc vu

                cbChucVu.Items.Add(comboboxItem);       //Add item moi vao trong comboBox
            }
        }
コード例 #10
0
        public ActionResult Index()
        {
            var model = new List <ChucVuModel>();
            var list  = db.ChucVus.ToList();
            int i     = 0;

            foreach (var item in list)
            {
                i++;
                var itemmodel = new ChucVuModel();
                itemmodel.Id        = item.Id;
                itemmodel.TenChucVu = item.TenChucVu;
                itemmodel.Luong     = item.Luong;
                itemmodel.STT       = i;
                model.Add(itemmodel);
            }
            return(View(model));
        }
コード例 #11
0
 // GET: Admin/GiangVien
 public ActionResult Index()
 {
     ViewData["DSGiangVien"] = new GiangVienModel().DanhSach();
     ViewData["DSChucVu"]    = new ChucVuModel().DanhSach();
     return(View());
 }