Esempio n. 1
0
        public ActionResult GiahanHopDong(int id, HopDongTD hd, FormCollection f)
        {
            HopDongTD hdong = data.HopDongTDs.SingleOrDefault(n => n.MaHD == id);

            if (ModelState.IsValid)
            {
                hdong.Ngay    = DateTime.Now;
                hdong.ThoiHan = Convert.ToInt32(f["Thoihan"]);
                if (Convert.ToInt32(f["Thoihan"]) <= 12)
                {
                    hdong.Loai = "Ngắn hạn";
                }
                else
                {
                    hdong.Loai = "Dài hạn";
                }
                data.SubmitChanges();
                return(RedirectToAction("HopDong"));
            }
            else
            {
                ModelState.AddModelError(" ", "Gia hạn thất bại");
            }
            return(View());
        }
Esempio n. 2
0
        public ActionResult GiahanHopDong(int id)
        {
            HopDongTD hd = data.HopDongTDs.SingleOrDefault(n => n.MaHD == id);

            if (hd == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            return(View(hd));
        }
Esempio n. 3
0
        public ActionResult Xacnhanhuy(int id)
        {
            HopDongTD hd = data.HopDongTDs.SingleOrDefault(n => n.MaHD == id);
            NhanVien  nv = data.NhanViens.SingleOrDefault(n => n.MaHD == id);

            if (hd == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            data.XoaNhanVien(nv.MaNV);
            data.SubmitChanges();
            data.HopDongTDs.DeleteOnSubmit(hd);
            data.SubmitChanges();
            return(RedirectToAction("HopDong"));
        }
Esempio n. 4
0
        public ActionResult XacnhanHD(int id, HopDongTD hd, FormCollection f)
        {
            NhanVien nv = data.NhanViens.SingleOrDefault(n => n.MaNV == id);

            hd.Ngay    = DateTime.Now;
            hd.ThoiHan = Convert.ToInt32(f["Thoihan"]);
            if (Convert.ToInt32(f["Thoihan"]) <= 12)
            {
                hd.Loai = "Ngắn hạn";
            }
            else
            {
                hd.Loai = "Dài hạn";
            }
            data.HopDongTDs.InsertOnSubmit(hd);
            data.SubmitChanges();

            nv.TinhTrang = "Chính thức";
            nv.MaHD      = hd.MaHD;
            data.SubmitChanges();
            return(RedirectToAction("NhanVien", "NhanVien"));
        }