public async Task <ActionResult <Chucvu> > PostChucvu(Chucvu chucvu)
        {
            _context.Chucvu.Add(chucvu);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetChucvu", new { id = chucvu.MaCv }, chucvu));
        }
Example #2
0
        private void chứcVụToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Chucvu cv = new Chucvu();

            cv.Show();
            this.Hide();
        }
        public async Task <IActionResult> PutChucvu(int id, Chucvu chucvu)
        {
            if (id != chucvu.MaCv)
            {
                return(BadRequest());
            }

            _context.Entry(chucvu).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ChucvuExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public void NhapThem()
        {
            do
            {
                Console.Write("\tNhập tên nhân viên: ");
                Hoten1 = Console.ReadLine();
            } while (Hoten1.Trim().Length == 0 || Hoten1.Trim().Length > 20);

            do
            {
                Console.Write("\tGiới tính: ");
                Gioitinh1 = Console.ReadLine();
            } while (Gioitinh1.Trim().Length == 0 || Gioitinh1.Trim().Length > 10);
            do
            {
                Console.Write("\tNăm sinh: ");
                NamSinh1 = Console.ReadLine();
            } while (NamSinh1.Trim().Length == 0 || NamSinh1.Trim().Length > 5);
            do
            {
                Console.Write("\tChức vụ: ");
                Chucvu = Console.ReadLine();
            } while (Chucvu.Trim().Length == 0 || Chucvu.Trim().Length > 10);
            do
            {
                Console.Write("\tĐịa chỉ: ");
                Diachi = Console.ReadLine().Trim();
            } while (Diachi.Trim().Length == 0 || Diachi.Trim().Length > 10);
            do
            {
                Console.Write("\tSố điện thoại: ");
                Sodt = Console.ReadLine();
            } while (Sodt.Trim().Length == 0 || Sodt.Trim().Length > 11);
        }
Example #5
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     BonusSkins.Register();
     ndSql                      = new NguoiDungSql();
     detail_userSql             = new ThongTinNguoiDungSql();
     phanquyen                  = new Phanquyen();
     chucvuSql                  = new ChucvuSql();
     cvu                        = new Chucvu();
     quyenSql                   = new QuyenSql();
     quanLyNhanVien             = new QuanLyNhanVien();
     KeHoachSql                 = new KeHoachSql();
     ThongTinChiTietDoiTuongSql = new ThongTinChiTietDoiTuongSql();
     banDoSql                   = new BanDoSql();
     fileDemSql                 = new FileDemSql();
     ThongTinBanDoKeHoachSql    = new ThongTinBanDoKeHoachSql();
     ThongTinFileDemKeHoachSql  = new ThongTinFileDemKeHoachSql();
     thamSoDauVaoSql            = new ThamSoDauVaoSql();
     lg           = new frmLogin();
     frm_Map      = new Frm_test1();
     nodeOnMap    = new NodeOnMap();
     binhChung    = new BinhChung();
     donVi        = new DonVi();
     fileDem      = new FileDem();
     thamSoDauVao = new TSDV();
     Application.Run(lg);
 }
        public async Task <IActionResult> Edit(string id, [Bind("CvMa,CvTen")] Chucvu chucvu)
        {
            if (id != chucvu.CvMa)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(chucvu);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ChucvuExists(chucvu.CvMa))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(chucvu));
        }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            if(validate())
            {
                Chucvu cv = new Chucvu();
                cv.Ten = txtTen.Text;
                cv.Heso = double.Parse(txtHeso.Text);
                if (_them) _cvB.ThemChucvu(cv);
                else
                {
                    cv.Stt = int.Parse(txtMa.Text);
                    _cvB.SuaChucvu(cv);
                }

                foreach(FrameworkElement  child in (this.Parent as StackPanel).Children)
                {
                    if (child.Name=="UC")
                    {
                        ChucvuUC b = child as ChucvuUC;
                        b.loadDanhsach();
                        break;
                    }
                }
                (this.Parent as StackPanel).Children.Remove(this);
            }
        }
Example #8
0
        public IActionResult Delete(string id)
        {
            try
            {
                Chucvu cv = db.Chucvu.Find(id);

                if (cv != null)
                {
                    if (db.Quyen.Where(x => x.Machucvu == cv.Machucvu).Count() > 0 || db.Vienchuc.Where(x => x.Machucvu == cv.Machucvu).Count() > 0)
                    {
                        return(BadRequest());
                    }
                    else
                    {
                        db.Chucvu.Remove(cv);
                        db.SaveChanges();
                        return(Ok());
                    }
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch
            {
                throw;
            }
        }
Example #9
0
        public ActionResult DeleteConfirmed(string id)
        {
            Chucvu chucvu = db.Chucvus.Find(id);

            db.Chucvus.Remove(chucvu);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ThemSuaChucVu(Chucvu cv)
 {
     InitializeComponent();
     lbTitle.Content = "THAY ĐỔI CHỨC VỤ";
     stackMa.Visibility = Visibility.Visible;
     txtMa.Text = cv.Stt.ToString();
     txtTen.Text = cv.Ten;
     txtHeso.Text = cv.Heso.ToString();
     _them = false;
 }
Example #11
0
 public ActionResult Edit([Bind(Include = "Machucvu,Tenchucvu")] Chucvu chucvu)
 {
     if (ModelState.IsValid)
     {
         db.Entry(chucvu).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(chucvu));
 }
Example #12
0
        public ActionResult Create([Bind(Include = "Machucvu,Tenchucvu")] Chucvu chucvu)
        {
            if (ModelState.IsValid)
            {
                db.Chucvus.Add(chucvu);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(chucvu));
        }
        public async Task <IActionResult> Create([Bind("CvMa,CvTen")] Chucvu chucvu)
        {
            if (ModelState.IsValid)
            {
                _context.Add(chucvu);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(chucvu));
        }
        public async Task <IActionResult> Create([FromBody] Chucvu model)
        {
            if (model == null)
            {
                return(BadRequest());
            }

            await chucVuRepository.Create(model);

            return(Ok(model));
        }
Example #15
0
 public int Edit(Chucvu cvu)
 {
     try
     {
         db.Entry(cvu).State = EntityState.Modified;
         db.SaveChanges();
         return(1);
     }
     catch
     {
         throw;
     }
 }
        public async Task <IActionResult> Update(int id, [FromBody] Chucvu model)
        {
            if (id != model.Id)
            {
                return(BadRequest());
            }

            model.Id = id;

            await chucVuRepository.Update(model);

            return(Ok(model));
        }
Example #17
0
        // GET: Employee/Chucvu_Em/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Chucvu chucvu = db.Chucvus.Find(id);

            if (chucvu == null)
            {
                return(HttpNotFound());
            }
            return(View(chucvu));
        }
Example #18
0
 public int Create([FromBody] Chucvu cvu)
 {
     db.Chucvu.Add(cvu);
     try
     {
         if (ModelState.IsValid)
         {
             db.SaveChanges();
         }
         return(1);
     }
     catch (DbUpdateException)
     {
         throw;
     }
 }
        public void Nhap()
        {
            do
            {
                Console.Write("Nhap ma nhan vien: ");
                Manv1 = Console.ReadLine().Trim();
            } while (Manv1.Trim().Length == 0 || Manv1.Trim().Length > 10);
            do
            {
                Console.Write("Nhap ten nhan vien: ");
                Hoten1 = Console.ReadLine();
            } while (Hoten1.Trim().Length == 0 || Hoten1.Trim().Length > 20);

            do
            {
                Console.Write("Nhap gioi tinh: ");
                Gioitinh1 = Console.ReadLine();
            } while (Gioitinh1.Trim().Length == 0 || Gioitinh1.Trim().Length > 5);
            do
            {
                Console.Write("Nhap nam sinh: ");
                NamSinh1 = Console.ReadLine();
            } while (NamSinh1.Trim().Length == 0 || NamSinh1.Trim().Length > 5);
            do
            {
                Console.Write("Nhap chuc vu nhan vien: ");
                Chucvu = Console.ReadLine();
            } while (Chucvu.Trim().Length == 0 || Chucvu.Trim().Length > 10);
            do
            {
                Console.Write("Nhap dia chi: ");
                Diachi = Console.ReadLine().Trim();
            } while (Diachi1.Trim().Length == 0 || Diachi1.Trim().Length > 10);
            do
            {
                Console.Write("Nhap so dien thoai: ");
                Sodt = Console.ReadLine();
            } while (Sodt.Trim().Length == 0 || Sodt.Trim().Length > 11);
        }