Beispiel #1
0
        //
        // GET: /CreateWordHD/Details/TV

        public ActionResult Details_TV(int id = 0)
        {
            hdChiTietHDLD hdchitiethdld = db.hdChiTietHDLD.Find(id);

            if (hdchitiethdld == null)
            {
                return(HttpNotFound());
            }
            return(View(hdchitiethdld));
        }
Beispiel #2
0
        // details hd dai han
        public ActionResult Details_HDDaiHan(int id = 0)
        {
            hdChiTietHDLD hdchitiethdld = db.hdChiTietHDLD.Where(ct => ct.id == id).FirstOrDefault();

            if (hdchitiethdld == null)
            {
                return(HttpNotFound());
            }
            return(View(hdchitiethdld));
        }
Beispiel #3
0
 private void AssignhdChiTietHDLD(hdChiTietHDLD hdld, hdChiTietHDLD old)
 {
     hdld.NgheNghiep = old.NgheNghiep;
     hdld.DonVi      = old.DonVi;
     hdld.ChucDanh   = old.ChucDanh;
     hdld.ChucVu     = old.ChucVu;
     hdld.ThoiHanHD  = old.ThoiHanHD;
     hdld.ThoiGioLV  = old.ThoiGioLV;
     hdld.HSLuong    = old.HSLuong;
     hdld.Bac        = old.Bac;
     hdld.Ngach      = old.Ngach;
     hdld.Nhom       = old.Nhom;
     hdld.MaNhom     = old.MaNhom;
     hdld.mauHopDong = old.mauHopDong;
     hdld.banHopDong = old.banHopDong;
 }
Beispiel #4
0
        public ActionResult Create_HDThuViec(hdChiTietHDLD hdchitiethdld, hdNLD hdnld, int DSNLDCanTaoHD_id)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.DSNLDCanTaoHD_id            = DSNLDCanTaoHD_id;
                TempData["Message_CreateHDThuViec"] = ModelState.Values.First(v => v.Errors.Count > 0).Errors[0].ErrorMessage;
                return(View(hdchitiethdld));
            }
            UpdatehdChiTietHDLD(hdchitiethdld);
            var DSNLDCanTaoHD = (hdCanTaoHDLD)TempData["DSNLDCanTaoHD"];

            ViewBag.DSNLDCanTaoHD_id = DSNLDCanTaoHD_id;
            if (ModelState.IsValid)
            {
                if (DSNLDCanTaoHD.MaNV == null && DSNLDCanTaoHD.MaTD != null)
                {
                    hdnld.TD_id  = DSNLDCanTaoHD.MaTD;
                    hdnld.hidden = false;
                    db.hdNLD.Add(hdnld);
                    db.SaveChanges();
                    hdchitiethdld.NLD_id = hdnld.id;
                    db.hdChiTietHDLD.Add(hdchitiethdld);
                    db.SaveChanges();
                    var dsnldcantaohd = db.hdCanTaoHDLD.Where(ct => ct.id == DSNLDCanTaoHD.id).First();
                    db.hdCanTaoHDLD.Remove(dsnldcantaohd);
                    db.SaveChanges();
                    // chuyen sang quan ly thu viec
                    if (hdchitiethdld.QT_NgayNLDky != null && hdchitiethdld.QT_NgayTrinhHT != null && hdchitiethdld.QT_NgayHTky != null)
                    {
                        var nld = db.hdNLD.Where(ld => ld.id == hdchitiethdld.NLD_id).FirstOrDefault();
                        HRM.Services.QLTTNhanSu.themQuanLyThuViec(nld.TD_id, hdchitiethdld.HotenNLD, hdchitiethdld.NgayHL, hdchitiethdld.Donvi_id, null);
                    }
                }
                String PrintAndSave = "";
                if (Request.Form["PrintAndSave"] != null)
                {
                    PrintAndSave = "PrintAndSave";
                }
                TempData["Message_EditHDThuViec"] = "Thêm mới thành công!";
                return(RedirectToAction("Edit_HDThuViec", "ThemMoiHD", new { id = hdchitiethdld.id, Print_yes_no = PrintAndSave }));
            }
            TempData["Message_CreateHDThuViec"] = "Thêm mới thất bại!";
            return(View(hdchitiethdld));
        }
Beispiel #5
0
        private void UpdatehdChiTietHDLD(hdChiTietHDLD hdld)
        {
            var old = db.hdChiTietHDLD.Find(hdld.id);

            hdld.LoaiHD     = db.dmLoaiHopDong.Find(hdld.LoaiHD_id).tenLoaiHD;
            hdld.NgheNghiep = (db0.dmNgheNghiep.Find(hdld.Nghenghiep_id) ?? new dmNgheNghiep()).tenNgheNghiep;
            hdld.DonVi      = (db0.dmDonVi.Find(hdld.Donvi_id) ?? new dmDonVi()).tenDonVi;
            hdld.ChucDanh   = (db0.dmChucDanhChuyenMon.Find(hdld.Chucdanh_id) ?? new dmChucDanhChuyenMon()).tenChucDanhChuyenMon;
            hdld.ThoiHanHD  = (db.dmThoiHanHD.Find(hdld.ThoihanHD_id) ?? new dmThoiHanHD()).tenThoiHanHD;
            hdld.ThoiGioLV  = (db.dmThoiGioLamViec.Find(hdld.ThoigioLV_id) ?? new dmThoiGioLamViec()).tenThoiGioLamViec;
            var hsl = db0.dmBangLuong.Find(hdld.HSLuong_id) ?? new dmBangLuong();

            hdld.HSLuong = hsl.hesoLuong; hdld.Bac = hsl.bacLuong;
            hdld.Ngach   = (db0.dmNgachVienChuc.Find(hdld.Ngach_id) ?? new dmNgachVienChuc()).tenNgachVienChuc;
            var nhom = db0.dmNhomNgachVienChuc.Find(hdld.Nhom_id) ?? new dmNhomNgachVienChuc();

            hdld.Nhom = nhom.tenNhomNgachVienChuc; hdld.MaNhom = nhom.maNhomNgachVienChuc;
            if (old != null)
            {
                hdld.mauHopDong = old.mauHopDong;
                hdld.banHopDong = old.banHopDong;
            }
        }
Beispiel #6
0
        public override void Execute()
        {
            #line 5 "..\..\Views\HDNguoiLaoDong\Index.cshtml"

            ViewBag.Title = "Index";
            var db0     = new HRM.Databases.Models.HRMDB0Entities();
            var db      = new HRMDB2Entities();
            var listXem = new List <string>();
            listXem.Add("HĐLĐ cuối");
            listXem.Add("Tất cả");
            var XemTatCa = "";
            try
            {
                XemTatCa = TempData["XemTatCa"].ToString();
            }
            catch { }
            var selectXem = new SelectList(listXem, XemTatCa);



            #line default
            #line hidden


            #line 21 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
            var dsHDLDDaloc = new hdChiTietHDLD();
            dsHDLDDaloc = null;



            #line default
            #line hidden
            WriteLiteral("<div style=\"margin-left: 45%\">\r\n    <a href=\"");



            #line 25 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
            Write(Url.Action("Index", "NhapDuLieu"));


            #line default
            #line hidden
            WriteLiteral("\">\r\n        <input id=\"bntNhapDuLieu\" type=\"button\" value=\"Nhập dữ liệu\" /></a> <" +
                         "a href=\"");



            #line 26 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
            Write(Url.Action("Index", "BaoCao", new { dsHDLDDaloc = dsHDLDDaloc }));


            #line default
            #line hidden
            WriteLiteral("\">\r\n            <input id=\"btnBaoCao\" type=\"button\" value=\"Báo cáo\" /></a> <a hre" +
                         "f=\"");



            #line 27 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
            Write(Url.Action("Create", "CauHinhHeThong"));


            #line default
            #line hidden
            WriteLiteral("\">\r\n                <input id=\"btnCauHinh\" type=\"button\" value=\"Cấu hình\" /></a>\r" +
                         "\n</div>\r\n<div style=\"padding: 0; width: 1000px; margin-left: -13%; font-size: in" +
                         "herit\">\r\n");



            #line 31 "..\..\Views\HDNguoiLaoDong\Index.cshtml"

            if (TempData["MessageHDHH"] != null)
            {
            #line default
            #line hidden
                WriteLiteral("        <span class=\"message-error\">Có ");



            #line 34 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                Write(TempData["MessageHDHH"]);


            #line default
            #line hidden
                WriteLiteral(" HĐLĐ sắp hết hạn.</span>");



            #line 34 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                if (TempData["MessageHDHH"] != null)
                {
            #line default
            #line hidden
                    WriteLiteral(@"<a title=""Danh sách hợp đồng lao động sắp hết hạn"" href=""~/HDLaoDong/DSHDSapHetHan/Index""><span
                                                                   class=""ui-icon ui-icon-arrowreturnthick-1-e"" style=""display: inline-block; width: 20px;
                                                                   height: 12px""></span></a>");



            #line 37 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                }

            #line default
            #line hidden
                WriteLiteral("<br />\r\n");



                WriteLiteral("        <br />\r\n");



            #line 39 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
            }
            if (TempData["MessageNLDCT"] != null)
            {
            #line default
            #line hidden
                WriteLiteral("        <span class=\"message-error\">Có ");



            #line 42 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                Write(TempData["MessageNLDCT"]);


            #line default
            #line hidden
                WriteLiteral(" Tuyển dụng đạt.</span>");



            #line 42 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                if (TempData["MessageNLDCT"] != null)
                {
            #line default
            #line hidden
                    WriteLiteral(@"<a title=""Danh sách NLĐ cần tạo hợp đồng lao động"" href=""~/HDLaoDong/DSNLDCanTaoHD/Index""><span
                                                                    class=""ui-icon ui-icon-arrowreturnthick-1-e"" style=""display: inline-block; width: 20px;
                                                                    height: 12px""></span></a>");



            #line 45 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                }


            #line default
            #line hidden
                WriteLiteral("        <br />\r\n");



            #line 47 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
            }


            #line default
            #line hidden

            #line 48 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
            Write(Html.StatusMessage(TempData["Message_NhapDuLieu"]));


            #line default
            #line hidden

            #line 48 "..\..\Views\HDNguoiLaoDong\Index.cshtml"



            #line default
            #line hidden
            WriteLiteral("</div>\r\n<div style=\"padding: 0; width: 1000px; margin-left: -13%; font-size: smal" +
                         "l\">\r\n    <table id=\"TableHDNLD\">\r\n        <thead>\r\n            <tr>\r\n           " +
                         "     <th style=\"text-align: center; width: 20px\" nowrap>\r\n                    ST" +
                         "T\r\n                </th>\r\n                <th style=\"text-align: center\" nowrap>" +
                         "\r\n                    Số HĐ\r\n                </th>\r\n                <th style=\"t" +
                         "ext-align: center\" nowrap>\r\n                    Họ và tên\r\n                </th>" +
                         "\r\n                <th style=\"text-align: center\" nowrap>\r\n                    Đơ" +
                         "n<br />\r\n                    vị\r\n                </th>\r\n                <th styl" +
                         "e=\"text-align: center\" nowrap>\r\n                    Chức danh<br />\r\n           " +
                         "         CM\r\n                </th>\r\n                <th style=\"text-align: cente" +
                         "r\" nowrap>\r\n                    Loại HĐ\r\n                </th>\r\n                " +
                         "<th style=\"text-align: center\" nowrap>\r\n                    Thời<br />\r\n        " +
                         "            hạn\r\n                </th>\r\n                <th style=\"text-align: c" +
                         "enter\" nowrap>\r\n                    Ngày có<br />\r\n                    hiệu lực\r" +
                         "\n                </th>\r\n                <th style=\"text-align: center\" nowrap>\r\n" +
                         "                    Ngày hết<br />\r\n                    hiệu lực\r\n              " +
                         "  </th>\r\n                <th style=\"text-align: center\" nowrap>\r\n               " +
                         "     PLHĐ<br />\r\n                    đi kèm\r\n                </th>\r\n            " +
                         "    <th style=\"text-align: center\" nowrap>\r\n                    Hoàn<br />\r\n    " +
                         "                thành\r\n                </th>\r\n            </tr>\r\n        </thead" +
                         ">\r\n");



            #line 97 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
            if (XemTatCa != "Tất cả")
            {
            #line default
            #line hidden
                WriteLiteral("            <tbody>\r\n");



            #line 100 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                int count = 0;


            #line default
            #line hidden


            #line 101 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                foreach (var item in Model)
                {
                    count = count + 1;


            #line default
            #line hidden
                    WriteLiteral("                    <tr>\r\n                        <td style=\"text-align: center\">" +
                                 "\r\n                            ");



            #line 106 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    Write(count);


            #line default
            #line hidden
                    WriteLiteral("\r\n                        </td>\r\n                        <td style=\"text-align: c" +
                                 "enter\" nowrap>\r\n");



            #line 109 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    if (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().LoaiHD.ToLower() == "Thử việc".ToLower())
                    {
            #line default
            #line hidden

            #line 111 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(Html.ActionLink(item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().SoHD, "Details_HDThuViec", "ThemMoiHD", new { id = item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().id }, null));


            #line default
            #line hidden

            #line 111 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    }
                    else if (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().LoaiHD.ToLower() == "Hợp đồng cơ hữu".ToLower())
                    {
            #line default
            #line hidden

            #line 115 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(Html.ActionLink(item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().SoHD, "Details_HDCoHuu", "ThemMoiHD", new { id = item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().id }, null));


            #line default
            #line hidden

            #line 115 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    }
                    else if (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().LoaiHD.ToLower() == "Hợp đồng dài hạn".ToLower() || item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().LoaiHD.ToLower() == "Hợp đồng dài hạn".ToLower())
                    {
            #line default
            #line hidden

            #line 119 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(Html.ActionLink(item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().SoHD, "Details_HDDaiHan", "ThemMoiHD", new { id = item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().id }, null));


            #line default
            #line hidden

            #line 119 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    }


            #line default
            #line hidden
                    WriteLiteral("                        </td>\r\n                        <td style=\"text-align: cen" +
                                 "ter\" nowrap>\r\n                            ");



            #line 123 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    Write(Html.ActionLink(item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().HotenNLD, "Index", "QTKyHDTungNguoi", new { NLD_id = item.id }, null));


            #line default
            #line hidden
                    WriteLiteral("\r\n                        </td>\r\n");



            #line 125 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    string tenDonVi = "";
                    if (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().Donvi_id != null)
                    {
                        int?Donvi_id = item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().Donvi_id;
                        tenDonVi = db0.dmDonVi.Where(dv => dv.id == Donvi_id).First().tenDonVi;
                    }



            #line default
            #line hidden
                    WriteLiteral("                        <td style=\"text-align: center\" data-tip=\"");



            #line 132 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    Write(tenDonVi);


            #line default
            #line hidden
                    WriteLiteral("\">\r\n");



            #line 133 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    string maDonVi = "";
                    if (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().Donvi_id != null)
                    {
                        int?Donvi_id = item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().Donvi_id;
                        maDonVi = db0.dmDonVi.Where(dv => dv.id == Donvi_id).FirstOrDefault().maDonVi;
                    }


            #line default
            #line hidden

            #line 139 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    Write(Html.DisplayFor(model => maDonVi));


            #line default
            #line hidden

            #line 139 "..\..\Views\HDNguoiLaoDong\Index.cshtml"



            #line default
            #line hidden
                    WriteLiteral("                        </td>\r\n                        <td style=\"text-align: cen" +
                                 "ter\">\r\n");



            #line 143 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    string tenChucDanh = "";
                    if (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().Chucdanh_id != null)
                    {
                        int?ChucDanh_id = item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().Chucdanh_id;
                        tenChucDanh = db0.dmChucDanhChuyenMon.Where(dv => dv.id == ChucDanh_id).FirstOrDefault().tenChucDanhChuyenMon;
                    }


            #line default
            #line hidden

            #line 149 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    Write(Html.Raw(tenChucDanh));


            #line default
            #line hidden

            #line 149 "..\..\Views\HDNguoiLaoDong\Index.cshtml"



            #line default
            #line hidden
                    WriteLiteral("                        </td>\r\n                        <td style=\"text-align: cen" +
                                 "ter\">\r\n                            ");



            #line 153 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    Write(Html.DisplayFor(model => item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().dmLoaiHopDong.tenLoaiHD));


            #line default
            #line hidden
                    WriteLiteral("\r\n                        </td>\r\n                        <td style=\"text-align: c" +
                                 "enter\">\r\n                            ");



            #line 156 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    Write(Html.DisplayFor(model => item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().dmThoiHanHD.tenThoiHanHD));


            #line default
            #line hidden
                    WriteLiteral("\r\n                        </td>\r\n                        <td style=\"text-align: c" +
                                 "enter\">\r\n                            ");



            #line 159 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    Write(item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().NgayHL.ToShortDateString());


            #line default
            #line hidden
                    WriteLiteral("\r\n                        </td>\r\n                        <td style=\"text-align: c" +
                                 "enter\">\r\n");



            #line 162 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    try
                    {
            #line default
            #line hidden

            #line 164 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().NgayhetHL.Value.ToShortDateString());


            #line default
            #line hidden

            #line 164 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    }
                    catch
                    {
                    }


            #line default
            #line hidden
                    WriteLiteral("                        </td>\r\n");



            #line 170 "..\..\Views\HDNguoiLaoDong\Index.cshtml"

                    int HD_id = item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().id;
                    var pl1   = db.hdPhuLucHD12LuuFile.Where(pl => pl.HD_id == HD_id && pl.LoaiPL == "PLSo1");
                    var pl2   = db.hdPhuLucHD12LuuFile.Where(pl => pl.HD_id == HD_id && pl.LoaiPL == "PLSo2");



            #line default
            #line hidden
                    WriteLiteral("                        <td style=\"text-align: center\">\r\n");



            #line 177 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    if (pl1.Count() > 0)
                    {
            #line default
            #line hidden

            #line 179 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(Html.Raw("PL Hơp đồng số 1, "));


            #line default
            #line hidden

            #line 179 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    }


            #line default
            #line hidden


            #line 181 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    if (pl2.Count() > 0)
                    {
            #line default
            #line hidden

            #line 183 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(Html.Raw("PL Hơp đồng số 2"));


            #line default
            #line hidden

            #line 183 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    }


            #line default
            #line hidden
                    WriteLiteral("                        </td>\r\n                        <td style=\"text-align: cen" +
                                 "ter\">\r\n");



            #line 187 "..\..\Views\HDNguoiLaoDong\Index.cshtml"

                    string status = "";
                    if (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_NgayNLDky != null || (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_NLDky != null && item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_NLDky != ""))
                    {
                        status = "NLĐ đã ký";
                        if (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_NgayTrinhHT != null || (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_TrinhHT != null && item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_TrinhHT != ""))
                        {
                            status = "Đã trình HT";
                            if (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_NgayHTky != null || (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_HTky != null && item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_HTky != ""))
                            {
                                status = "HT đã ký";
                                if (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_NgayLuuHS != null || (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_LuuHS != null && item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_LuuHS != ""))
                                {
                                    status = "Đã lưu HS";
                                    if (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_NgayTraNLD != null || (item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_TraNLD != null && item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().QT_TraNLD != ""))
                                    {
                                        status = "Hoàn thành";
                                    }
                                }
                            }
                        }
                    }



            #line default
            #line hidden
                    WriteLiteral("                            ");



            #line 210 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    Write(Html.Raw(status));


            #line default
            #line hidden
                    WriteLiteral("\r\n                        </td>\r\n                    </tr>\r\n");



            #line 213 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                }


            #line default
            #line hidden
                WriteLiteral("            </tbody>\r\n");



            #line 215 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
            }
            else
            {
            #line default
            #line hidden
                WriteLiteral("            <tbody>\r\n");



            #line 219 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                int count = 0;


            #line default
            #line hidden


            #line 220 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                foreach (var item in Model)
                {
                    foreach (var it in item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL))
                    {
                        count = count + 1;


            #line default
            #line hidden
                        WriteLiteral("                    <tr>\r\n                        <td style=\"text-align: center\">" +
                                     "\r\n                            ");



            #line 227 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(count);


            #line default
            #line hidden
                        WriteLiteral("\r\n                        </td>\r\n                        <td style=\"text-align: c" +
                                     "enter\" nowrap>\r\n");



            #line 230 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        if (it.id == item.hdChiTietHDLDs.OrderByDescending(ct => ct.NgayhetHL).FirstOrDefault().id)
                        {
                            if (it.LoaiHD == "Thử việc")
                            {
            #line default
            #line hidden
                                WriteLiteral("                                <span data-tip=\"HĐLĐ cuối\"><b>");



            #line 234 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                                Write(Html.ActionLink(it.SoHD, "Details_HDThuViec", "ThemMoiHD", new { id = it.id }, null));


            #line default
            #line hidden
                                WriteLiteral("</b></span>\r\n");



            #line 235 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                            }
                            else if (it.LoaiHD == "Hợp đồng cơ hữu")
                            {
            #line default
            #line hidden
                                WriteLiteral("                                <span data-tip=\"HĐLĐ cuối\"><b>");



            #line 238 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                                Write(Html.ActionLink(it.SoHD, "Details_HDCoHuu", "ThemMoiHD", new { id = it.id }, null));


            #line default
            #line hidden
                                WriteLiteral("</b></span>\r\n");



            #line 239 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                            }
                            else if (it.LoaiHD == "Hợp đồng dài hạn")
                            {
            #line default
            #line hidden
                                WriteLiteral("                                <span data-tip=\"HĐLĐ cuối\"><b>");



            #line 242 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                                Write(Html.ActionLink(it.SoHD, "Details_HDDaiHan", "ThemMoiHD", new { id = it.id }, null));


            #line default
            #line hidden
                                WriteLiteral("</b></span>\r\n");



            #line 243 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                            }
                        }
                        else
                        {
                            if (it.LoaiHD == "Thử việc")
                            {
            #line default
            #line hidden

            #line 249 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                                Write(Html.ActionLink(it.SoHD, "Details_HDThuViec", "ThemMoiHD", new { id = it.id }, null));


            #line default
            #line hidden

            #line 249 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                            }
                            else if (it.LoaiHD == "Hợp đồng cơ hữu")
                            {
            #line default
            #line hidden

            #line 253 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                                Write(Html.ActionLink(it.SoHD, "Details_HDCoHuu", "ThemMoiHD", new { id = it.id }, null));


            #line default
            #line hidden

            #line 253 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                            }
                            else if (it.LoaiHD == "Hợp đồng dài hạn")
                            {
            #line default
            #line hidden

            #line 257 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                                Write(Html.ActionLink(it.SoHD, "Details_HDDaiHan", "ThemMoiHD", new { id = it.id }, null));


            #line default
            #line hidden

            #line 257 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                            }
                        }


            #line default
            #line hidden
                        WriteLiteral("                        </td>\r\n                        <td style=\"text-align: cen" +
                                     "ter\" nowrap>\r\n                            ");



            #line 262 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(Html.ActionLink(it.HotenNLD, "Index", "QTKyHDTungNguoi", new { NLD_id = item.id }, null));


            #line default
            #line hidden
                        WriteLiteral("\r\n                        </td>\r\n");



            #line 264 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        string tenDonVi = "";
                        if (it.Donvi_id != null)
                        {
                            int?Donvi_id = it.Donvi_id;
                            tenDonVi = db0.dmDonVi.Where(dv => dv.id == Donvi_id).FirstOrDefault().tenDonVi;
                        }



            #line default
            #line hidden
                        WriteLiteral("                        <td style=\"text-align: center\" data-tip=\"");



            #line 271 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(tenDonVi);


            #line default
            #line hidden
                        WriteLiteral("\">\r\n");



            #line 272 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        string maDonVi = "";
                        if (it.Donvi_id != null)
                        {
                            int?Donvi_id = it.Donvi_id;
                            maDonVi = db0.dmDonVi.Where(dv => dv.id == Donvi_id).FirstOrDefault().maDonVi;
                        }


            #line default
            #line hidden

            #line 278 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(Html.DisplayFor(model => maDonVi));


            #line default
            #line hidden

            #line 278 "..\..\Views\HDNguoiLaoDong\Index.cshtml"



            #line default
            #line hidden
                        WriteLiteral("                        </td>\r\n                        <td style=\"text-align: cen" +
                                     "ter\">\r\n");



            #line 282 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        string tenChucDanh = "";
                        if (it.Chucdanh_id != null)
                        {
                            int?ChucDanh_id = it.Chucdanh_id;
                            tenChucDanh = db0.dmChucDanhChuyenMon.Where(dv => dv.id == ChucDanh_id).FirstOrDefault().tenChucDanhChuyenMon;
                        }


            #line default
            #line hidden

            #line 288 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(Html.Raw(tenChucDanh));


            #line default
            #line hidden

            #line 288 "..\..\Views\HDNguoiLaoDong\Index.cshtml"



            #line default
            #line hidden
                        WriteLiteral("                        </td>\r\n                        <td style=\"text-align: cen" +
                                     "ter\">\r\n                            ");



            #line 292 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(Html.DisplayFor(model => it.LoaiHD));


            #line default
            #line hidden
                        WriteLiteral("\r\n                        </td>\r\n                        <td style=\"text-align: c" +
                                     "enter\">\r\n                            ");



            #line 295 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(Html.DisplayFor(model => it.dmThoiHanHD.tenThoiHanHD));


            #line default
            #line hidden
                        WriteLiteral("\r\n                        </td>\r\n                        <td style=\"text-align: c" +
                                     "enter\">\r\n                            ");



            #line 298 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(it.NgayHL.ToShortDateString());


            #line default
            #line hidden
                        WriteLiteral("\r\n                        </td>\r\n                        <td style=\"text-align: c" +
                                     "enter\">\r\n");



            #line 301 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        try
                        {
            #line default
            #line hidden

            #line 303 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                            Write(it.NgayhetHL.Value.ToShortDateString());


            #line default
            #line hidden

            #line 303 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        }
                        catch
                        {
                        }


            #line default
            #line hidden
                        WriteLiteral("                        </td>\r\n");



            #line 309 "..\..\Views\HDNguoiLaoDong\Index.cshtml"

                        int HD_id = it.id;
                        var pl1   = db.hdPhuLucHD12LuuFile.Where(pl => pl.HD_id == HD_id && pl.LoaiPL == "PLSo1");
                        var pl2   = db.hdPhuLucHD12LuuFile.Where(pl => pl.HD_id == HD_id && pl.LoaiPL == "PLSo2");



            #line default
            #line hidden
                        WriteLiteral("                        <td style=\"text-align: center\">\r\n");



            #line 316 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        if (pl1.Count() > 0)
                        {
            #line default
            #line hidden

            #line 318 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                            Write(Html.Raw("PL Hơp đồng số 1, "));


            #line default
            #line hidden

            #line 318 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        }


            #line default
            #line hidden


            #line 320 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        if (pl2.Count() > 0)
                        {
            #line default
            #line hidden

            #line 322 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                            Write(Html.Raw("PL Hơp đồng số 2"));


            #line default
            #line hidden

            #line 322 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        }


            #line default
            #line hidden
                        WriteLiteral("                        </td>\r\n                        <td style=\"text-align: cen" +
                                     "ter\">\r\n");



            #line 326 "..\..\Views\HDNguoiLaoDong\Index.cshtml"

                        string status = "";
                        if (it.QT_NgayNLDky != null || (it.QT_NLDky != null && it.QT_NLDky != ""))
                        {
                            status = "NLĐ đã ký";
                            if (it.QT_NgayTrinhHT != null || (it.QT_TrinhHT != null && it.QT_TrinhHT != ""))
                            {
                                status = "Đã trình HT";
                                if (it.QT_NgayHTky != null || (it.QT_HTky != null && it.QT_HTky != ""))
                                {
                                    status = "HT đã ký";
                                    if (it.QT_NgayLuuHS != null || (it.QT_LuuHS != null && it.QT_LuuHS != ""))
                                    {
                                        status = "Đã lưu HS";
                                        if (it.QT_NgayTraNLD != null || (it.QT_TraNLD != null && it.QT_TraNLD != ""))
                                        {
                                            status = "Hoàn thành";
                                        }
                                    }
                                }
                            }
                        }



            #line default
            #line hidden
                        WriteLiteral("                            ");



            #line 349 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                        Write(Html.Raw(status));


            #line default
            #line hidden
                        WriteLiteral("\r\n                        </td>\r\n                    </tr>\r\n");



            #line 352 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
                    }
                }


            #line default
            #line hidden
                WriteLiteral("            </tbody> \r\n");



            #line 355 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
            }


            #line default
            #line hidden
            WriteLiteral("    </table>\r\n    <br />\r\n    <p>\r\n        Xem tất cả\r\n        ");



            #line 360 "..\..\Views\HDNguoiLaoDong\Index.cshtml"
            Write(Html.DropDownList("XemTatCa", selectXem, new { onChange = "myFunction()" }));


            #line default
            #line hidden
            WriteLiteral(@"
    </p>
</div>
<script>
    $(document).ready(function () {
        $(""#TableHDNLD"").dataTable({
            ""bAutoWidth"": false,
            ""bStateSave"": true,
            ""aLengthMenu"": [[10, 25, 50, -1], [10, 25, 50, ""All""]]
        });
    });
</script>
<script>
    function myFunction() {
        var index = document.getElementById('XemTatCa').selectedIndex;
        var m = document.getElementById('XemTatCa').options[index].text;
        $.ajax({
            url: ""XemTatCa?value="" + m,
            success: function () {
                location.reload();
            }
        });
    }

</script>
");
        }
Beispiel #7
0
        public ActionResult Edit_HDDaiHan(hdChiTietHDLD hdchitiethdld)
        {
            UpdatehdChiTietHDLD(hdchitiethdld);
            var old = db.hdChiTietHDLD.Where(ct => ct.id == hdchitiethdld.id).First();

            if (Request.Form["BHXH.Value"] == "true,false")
            {
                hdchitiethdld.BHXH = true;
            }
            else
            {
                hdchitiethdld.BHXH = false;
            }
            if ((old.QT_NgayNLDky != null && old.QT_NgayTrinhHT != null && old.QT_NgayHTky != null) || (old.QT_NLDky != null && old.QT_TrinhHT != null && old.QT_HTky != null))
            {
                AssignhdChiTietHDLD(hdchitiethdld, old);
                hdchitiethdld.HotenNLD       = old.HotenNLD;
                hdchitiethdld.Gioitinh_id    = old.Gioitinh_id;
                hdchitiethdld.Donvi_id       = old.Donvi_id;
                hdchitiethdld.SoHD           = old.SoHD;
                hdchitiethdld.ThoihanHD_id   = old.ThoihanHD_id;
                hdchitiethdld.NgayHL         = old.NgayHL;
                hdchitiethdld.NgayhetHL      = old.NgayhetHL;
                hdchitiethdld.Chucdanh_id    = old.Chucdanh_id;
                hdchitiethdld.Chucvu_id      = old.Chucvu_id;
                hdchitiethdld.ChucvutruongDV = old.ChucvutruongDV;
                hdchitiethdld.Congviec       = old.Congviec;
                hdchitiethdld.ThoigioLV_id   = old.ThoigioLV_id;
                hdchitiethdld.Mucluongchinh  = old.Mucluongchinh;
                hdchitiethdld.BHXH           = old.BHXH;
                hdchitiethdld.HSLuong_id     = old.HSLuong_id;
                hdchitiethdld.Bac_id         = old.Bac_id;
                hdchitiethdld.Ngach_id       = old.Ngach_id;
                hdchitiethdld.Nhom_id        = old.Nhom_id;
                hdchitiethdld.Bangluong_id   = old.Bangluong_id;
                hdchitiethdld.QT_NgayNLDky   = old.QT_NgayNLDky;
                hdchitiethdld.QT_NgayTrinhHT = old.QT_NgayTrinhHT;
                hdchitiethdld.QT_NgayHTky    = old.QT_NgayHTky;
                hdchitiethdld.QT_NLDky       = old.QT_NLDky;
                hdchitiethdld.QT_TrinhHT     = old.QT_TrinhHT;
                hdchitiethdld.QT_HTky        = old.QT_HTky;
                hdchitiethdld.QT_TraNLD      = old.QT_TraNLD;
                hdchitiethdld.QT_LuuHS       = old.QT_LuuHS;
            }
            if (ModelState.IsValid)
            {
                hdchitiethdld.NLD_id = old.NLD_id;
                if (Request.Form["BHXH.Value"] == "true,false")
                {
                    hdchitiethdld.BHXH = true;
                }
                else
                {
                    hdchitiethdld.BHXH = false;
                }

                db.Entry(old).CurrentValues.SetValues(hdchitiethdld);
                db.SaveChanges();
                if (Request.Form["PrintAndSave"] != null)
                {
                    return(RedirectToAction("Details_DHCH", "CreateWordHD", new { id = hdchitiethdld.id, Back = "Edit_HDDaiHan" }));
                }
                TempData["Message_EditHDDaiHan"] = "Cập nhật thành công!";
                return(RedirectToAction("Edit_HDDaiHan", "ThemMoiHD", new { id = hdchitiethdld.id }));
            }
            else if (hdchitiethdld.SoHD != null && hdchitiethdld.Donvi_id != null && hdchitiethdld.HotenNLD != null && hdchitiethdld.ThoihanHD_id != 0 && hdchitiethdld.NgayHL != null && hdchitiethdld.ThoigioLV_id != 0 && hdchitiethdld.Mucluongchinh != null)
            {
                hdchitiethdld.NLD_id = old.NLD_id;
                if (Request.Form["BHXH.Value"] == "true,false")
                {
                    hdchitiethdld.BHXH = true;
                }
                else
                {
                    hdchitiethdld.BHXH = false;
                }

                db.Entry(old).CurrentValues.SetValues(hdchitiethdld);
                db.SaveChanges();
                if (Request.Form["PrintAndSave"] != null)
                {
                    return(RedirectToAction("Details_DHCH", "CreateWordHD", new { id = hdchitiethdld.id, Back = "Edit_HDDaiHan" }));
                }
                TempData["Message_EditHDDaiHan"] = "Cập nhật thành công!";
                return(RedirectToAction("Edit_HDDaiHan", "ThemMoiHD", new { id = hdchitiethdld.id }));
            }
            TempData["Message_EditHDDaiHan"] = "Cập nhật thất bại!";
            return(View(hdchitiethdld));
        }
Beispiel #8
0
        public ActionResult Edit_HDThuViec(hdChiTietHDLD hdchitiethdld)
        {
            UpdatehdChiTietHDLD(hdchitiethdld);
            var old = db.hdChiTietHDLD.Where(ct => ct.id == hdchitiethdld.id).First();

            if (Request.Form["BHXH.Value"] == "true,false")
            {
                hdchitiethdld.BHXH = true;
            }
            else
            {
                hdchitiethdld.BHXH = false;
            }
            if ((old.QT_NgayNLDky != null && old.QT_NgayTrinhHT != null && old.QT_NgayHTky != null) || (old.QT_NLDky != null && old.QT_TrinhHT != null && old.QT_HTky != null))
            {
                AssignhdChiTietHDLD(hdchitiethdld, old);
                hdchitiethdld.HotenNLD       = old.HotenNLD;
                hdchitiethdld.Gioitinh_id    = old.Gioitinh_id;
                hdchitiethdld.Donvi_id       = old.Donvi_id;
                hdchitiethdld.SoHD           = old.SoHD;
                hdchitiethdld.ThoihanHD_id   = old.ThoihanHD_id;
                hdchitiethdld.NgayHL         = old.NgayHL;
                hdchitiethdld.NgayhetHL      = old.NgayhetHL;
                hdchitiethdld.Chucdanh_id    = old.Chucdanh_id;
                hdchitiethdld.Chucvu_id      = old.Chucvu_id;
                hdchitiethdld.ChucvutruongDV = old.ChucvutruongDV;
                hdchitiethdld.Congviec       = old.Congviec;
                hdchitiethdld.ThoigioLV_id   = old.ThoigioLV_id;
                hdchitiethdld.Mucluongchinh  = old.Mucluongchinh;
                hdchitiethdld.Tyleluong      = old.Tyleluong;
                hdchitiethdld.HSLuong_id     = old.HSLuong_id;
                hdchitiethdld.Bac_id         = old.Bac_id;
                hdchitiethdld.Ngach_id       = old.Ngach_id;
                hdchitiethdld.Nhom_id        = old.Nhom_id;
                hdchitiethdld.Bangluong_id   = old.Bangluong_id;
                hdchitiethdld.QT_NgayNLDky   = old.QT_NgayNLDky;
                hdchitiethdld.QT_NgayTrinhHT = old.QT_NgayTrinhHT;
                hdchitiethdld.QT_NgayHTky    = old.QT_NgayHTky;
                hdchitiethdld.QT_NLDky       = old.QT_NLDky;
                hdchitiethdld.QT_TrinhHT     = old.QT_TrinhHT;
                hdchitiethdld.QT_HTky        = old.QT_HTky;
                hdchitiethdld.QT_TraNLD      = old.QT_TraNLD;
                hdchitiethdld.QT_LuuHS       = old.QT_LuuHS;
            }
            if (ModelState.IsValid)
            {
                hdchitiethdld.NLD_id = old.NLD_id;
                if (hdchitiethdld.NgayhetHL == null)
                {
                    hdchitiethdld.NgayhetHL = old.NgayhetHL;
                }

                db.Entry(old).CurrentValues.SetValues(hdchitiethdld);
                db.SaveChanges();
                // chuyen sang quan ly thu viec
                if (hdchitiethdld.QT_NgayNLDky != null && hdchitiethdld.QT_NgayTrinhHT != null && hdchitiethdld.QT_NgayHTky != null)
                {
                    var  nld     = db.hdNLD.Where(ld => ld.id == hdchitiethdld.NLD_id).FirstOrDefault();
                    bool isHadTV = false;
                    foreach (var item in db0.nvQLThuViec.ToList())
                    {
                        if (item.maThuViec == nld.TD_id)
                        {
                            isHadTV = true;
                        }
                    }
                    if (isHadTV == false)
                    {
                        HRM.Services.QLTTNhanSu.themQuanLyThuViec(nld.TD_id, hdchitiethdld.HotenNLD, hdchitiethdld.NgayHL, hdchitiethdld.Donvi_id, null);
                    }
                }
                //print
                if (Request.Form["PrintAndSave"] != null)
                {
                    return(RedirectToAction("Details_TV", "CreateWordHD", new { id = hdchitiethdld.id, Back = "Edit_HDThuViec" }));
                }
                TempData["Message_EditHDThuViec"] = "Cập nhật thành công!";
                return(RedirectToAction("Edit_HDThuViec", "ThemMoiHD", new { id = hdchitiethdld.id }));
            }
            else if (hdchitiethdld.SoHD != null && hdchitiethdld.Donvi_id != null && hdchitiethdld.HotenNLD != null && hdchitiethdld.ThoihanHD_id != 0 && hdchitiethdld.NgayHL != null && hdchitiethdld.ThoigioLV_id != 0 && hdchitiethdld.Mucluongchinh != null)
            {
                hdchitiethdld.NLD_id = old.NLD_id;
                if (hdchitiethdld.NgayhetHL == null)
                {
                    hdchitiethdld.NgayhetHL = old.NgayhetHL;
                }

                db.Entry(old).CurrentValues.SetValues(hdchitiethdld);
                db.SaveChanges();
                // chuyen sang quan ly thu viec
                if (hdchitiethdld.QT_NgayNLDky != null && hdchitiethdld.QT_NgayTrinhHT != null && hdchitiethdld.QT_NgayHTky != null)
                {
                    var  nld     = db.hdNLD.Where(ld => ld.id == hdchitiethdld.NLD_id).FirstOrDefault();
                    bool isHadTV = false;
                    foreach (var item in db0.nvQLThuViec.ToList())
                    {
                        if (item.maThuViec == nld.TD_id)
                        {
                            isHadTV = true;
                        }
                    }
                    if (isHadTV == false)
                    {
                        HRM.Services.QLTTNhanSu.themQuanLyThuViec(nld.TD_id, hdchitiethdld.HotenNLD, hdchitiethdld.NgayHL, hdchitiethdld.Donvi_id, null);
                    }
                }
                // print
                if (Request.Form["PrintAndSave"] != null)
                {
                    return(RedirectToAction("Details_TV", "CreateWordHD", new { id = hdchitiethdld.id, Back = "Edit_HDThuViec" }));
                }
                TempData["Message_EditHDThuViec"] = "Cập nhật thành công!";
                return(RedirectToAction("Edit_HDThuViec", "ThemMoiHD", new { id = hdchitiethdld.id }));
            }
            TempData["Message_EditHDThuViec"] = "Cập nhật thất bại!";
            return(View(hdchitiethdld));
        }
Beispiel #9
0
        public ActionResult Create_HDDaiHan(hdChiTietHDLD hdchitiethdld, hdNLD hdnld, int DSNLDCanTaoHD_id)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.DSNLDCanTaoHD_id           = DSNLDCanTaoHD_id;
                TempData["Message_CreateHDDaiHan"] = ModelState.Values.First(v => v.Errors.Count > 0).Errors[0].ErrorMessage;
                return(View(hdchitiethdld));
            }
            UpdatehdChiTietHDLD(hdchitiethdld);
            var DSNLDCanTaoHD = (hdCanTaoHDLD)TempData["DSNLDCanTaoHD"];

            ViewBag.DSNLDCanTaoHD_id = DSNLDCanTaoHD_id;
            DSNLDCanTaoHD            = DSNLDCanTaoHD ?? db.hdCanTaoHDLD.Find(DSNLDCanTaoHD_id);
            if (hdchitiethdld.HotenNLD != null && hdchitiethdld.Gioitinh_id != null && hdchitiethdld.Donvi_id != null && hdchitiethdld.Chucdanh_id != null && hdchitiethdld.SoHD != null && hdchitiethdld.LoaiHD != null && hdchitiethdld.ThoihanHD_id != null && hdchitiethdld.NgayHL != null && hdchitiethdld.ThoigioLV_id != null && hdchitiethdld.Mucluongchinh != null)
            {
                // is had matd and manv
                if (DSNLDCanTaoHD.MaNV != null && DSNLDCanTaoHD.MaTD != null)
                {
                    int nld_id = 0;
                    foreach (var item in db.hdNLD)
                    {
                        if (item.TD_id == DSNLDCanTaoHD.MaTD)
                        {
                            nld_id = item.id;
                            break;
                        }
                    }
                    if (nld_id == 0)
                    {
                        foreach (var item in db.hdNLD)
                        {
                            if (item.NV_id == DSNLDCanTaoHD.MaNV)
                            {
                                nld_id = item.id;
                                break;
                            }
                        }
                    }
                    var nld = db.hdNLD.Where(ld => ld.id == nld_id).First();
                    hdnld.id     = nld_id;
                    hdnld.TD_id  = nld.TD_id;
                    hdnld.NV_id  = DSNLDCanTaoHD.MaNV;
                    hdnld.hidden = false;
                    db.Entry(nld).CurrentValues.SetValues(hdnld);
                    db.SaveChanges();
                    hdchitiethdld.NLD_id = hdnld.id;
                    db.hdChiTietHDLD.Add(hdchitiethdld);
                    db.SaveChanges();
                    var dsnldcantaohd = db.hdCanTaoHDLD.Where(ct => ct.id == DSNLDCanTaoHD.id).First();
                    db.hdCanTaoHDLD.Remove(dsnldcantaohd);
                    db.SaveChanges();
                }
                // isn't had matd with giang vien
                else if (DSNLDCanTaoHD.MaNV != null && DSNLDCanTaoHD.MaTD == null)
                {
                    bool isHad = false;
                    int  nv_id = 0;
                    foreach (var item in db.hdNLD)
                    {
                        if (item.NV_id == DSNLDCanTaoHD.MaNV)
                        {
                            isHad = true;
                            nv_id = item.id;
                            break;
                        }
                    }
                    if (isHad == true)
                    {
                        if (hdchitiethdld.BHXH == null)
                        {
                            hdchitiethdld.BHXH = false;
                        }
                        var nld = db.hdNLD.Where(ld => ld.id == nv_id).First();
                        hdnld.id     = nv_id;
                        hdnld.TD_id  = nld.TD_id;
                        hdnld.NV_id  = DSNLDCanTaoHD.MaNV;
                        hdnld.hidden = false;
                        db.Entry(nld).CurrentValues.SetValues(hdnld);
                        db.SaveChanges();
                        hdchitiethdld.NLD_id = hdnld.id;
                        db.hdChiTietHDLD.Add(hdchitiethdld);
                        db.SaveChanges();
                        var dsnldcantaohd = db.hdCanTaoHDLD.Where(ct => ct.id == DSNLDCanTaoHD.id).First();
                        db.hdCanTaoHDLD.Remove(dsnldcantaohd);
                        db.SaveChanges();
                    }
                    else
                    {
                        if (hdchitiethdld.BHXH == null)
                        {
                            hdchitiethdld.BHXH = false;
                        }
                        hdnld.NV_id  = DSNLDCanTaoHD.MaNV;
                        hdnld.hidden = false;
                        db.hdNLD.Add(hdnld);
                        db.SaveChanges();
                        hdchitiethdld.NLD_id = hdnld.id;
                        db.hdChiTietHDLD.Add(hdchitiethdld);
                        db.SaveChanges();
                        var dsnldcantaohd = db.hdCanTaoHDLD.Where(ct => ct.id == DSNLDCanTaoHD.id).First();
                        db.hdCanTaoHDLD.Remove(dsnldcantaohd);
                        db.SaveChanges();
                    }
                }
                TempData["Object"] = "DSNLDCanTaoHD";
                String PrintAndSave = "";
                if (Request.Form["PrintAndSave"] != null)
                {
                    PrintAndSave = "PrintAndSave";
                }
                TempData["Message_EditHDDaiHan"] = "Thêm mới thành công!";
                return(RedirectToAction("Edit_HDDaiHan", "ThemMoiHD", new { id = hdchitiethdld.id, Print_yes_no = PrintAndSave }));
            }
            TempData["Message_CreateHDDaiHan"] = "Thêm mới thất bại!";
            return(View(hdchitiethdld));
        }