public void ActionAddBCKetThucUCSC(ModBaoCaoKetThucSuCoEntity entity, MAppend append) { DateTime date = DateTime.Now; string ngayGioPhatHien = append.Ngay + " " + append.Gio + ":" + append.Phut; string code = "BCKTSC" + ModBaoCaoKetThucSuCoService.Instance.GetMaxID(); entity.Name = code; entity.Code = Data.GetCode(code); entity.UserID = Lib.Global.CPLogin.UserID; if (!string.IsNullOrEmpty(ngayGioPhatHien)) { entity.NgayGioPhatHien = HL.Core.Global.Convert.ToDateTime(ngayGioPhatHien); } else { entity.NgayGioPhatHien = DateTime.MinValue; } entity.Order = GetMaxOrder_BCKetThuc(); entity.Published = date; entity.Activity = false; int id = ModBaoCaoKetThucSuCoService.Instance.Save(entity); ViewBag.BaoCao = entity; ViewPage.Alert("Tạo mới báo cáo thành công! Chúng tôi sẽ xem xét và phê duyệt báo cáo của bạn sớm nhất có thể."); ViewPage.Navigate("/vn/Thanh-vien/DS-bc-ket-thuc-su-co.aspx"); }
public void ActionUpdateBaoCaoUCSC(ModBaoCaoKetThucSuCoEntity entityBc, MAppend append, string endCode) { int userId = HL.Lib.Global.CPLogin.UserID; var entity = ModBaoCaoKetThucSuCoService.Instance.CreateQuery() .Where(userId > 0, o => o.UserID == userId) .Where(o => o.Code == endCode) .ToSingle(); if (entity != null) { DateTime date = DateTime.Now; string ngayGioPhatHien = append.Ngay + " " + append.Gio + ":" + append.Phut; if (!string.IsNullOrEmpty(ngayGioPhatHien)) { entityBc.NgayGioPhatHien = HL.Core.Global.Convert.ToDateTime(ngayGioPhatHien); } else { entityBc.NgayGioPhatHien = DateTime.MinValue; } entityBc.ID = entity.ID; entityBc.UserID = entity.UserID; entityBc.UserID1 = userId; entityBc.MenuID = entity.MenuID; entityBc.State = entity.State; entityBc.Name = entity.Name; entityBc.Code = entity.Code; entityBc.Order = entity.Order; entityBc.Published = entity.Published; entityBc.Published1 = date; entityBc.Activity = false; ModBaoCaoKetThucSuCoService.Instance.Save(entityBc); ViewBag.BaoCao = entityBc; ViewPage.Alert("Cập nhật báo cáo thành công! Chúng tôi sẽ xem xét và phê duyệt báo cáo của bạn sớm nhất có thể."); string url = "/vn/Thanh-vien/DS-bc-ket-thuc-su-co.aspx"; if (ViewPage.CurrentPage.LangID == 2) { url = "/en/Member/DS-bc-ket-thuc-su-co.aspx"; } ViewPage.Navigate(url); } }
public void ActionUpdateDangKyUCSC(ModDonDangKyUCSCEntity entityDk, MAppend append, MHSThanhVienUCSCModel model, string endCode) { int userId = HL.Lib.Global.CPLogin.UserIDOnWeb; var entity = ModDonDangKyUCSCService.Instance.CreateQuery() .Where(userId > 0, o => o.UserID == userId) .Where(o => o.Code == endCode) .ToSingle(); if (entity != null) { DateTime date = DateTime.Now; entityDk.ID = entity.ID; entityDk.UserID = entity.UserID; entityDk.UserID1 = userId; entityDk.MenuID = entity.MenuID; entityDk.State = entity.State; entityDk.Name = entity.Name; entityDk.Code = entity.Code; entityDk.Order = entity.Order; entityDk.Published = entity.Published; entityDk.Published1 = date; entityDk.Activity = false; ModDonDangKyUCSCService.Instance.Save(entityDk); //He thong thong tin var httt = ModHeThongThongTinService.Instance.CreateQuery().Where(o => o.Activity == true && o.DonDangKyUCSCID == entity.ID).ToList(); if (httt != null) { ModHeThongThongTinService.Instance.Delete(httt); } var arr = model.M.Split('|'); List <ModHeThongThongTinEntity> entityHTTT = new List <ModHeThongThongTinEntity>(); for (int i = 0; i < arr.Length; i++) { if (string.IsNullOrEmpty(arr[i])) { continue; } var tmp = arr[i].Split('_'); int m = HL.Core.Global.Convert.ToInt(tmp[0], 0); if (m <= 0 || tmp.Length != 2) { continue; } string sName = tmp[1]; if (string.IsNullOrEmpty(sName)) { continue; } var entityTmp = new ModHeThongThongTinEntity { DonDangKyUCSCID = entity.ID, MenuID = m, Name = sName, Code = Data.GetCode(sName), Published = DateTime.Now, Order = GetMaxOrder_HTTT(), Activity = true }; entityHTTT.Add(entityTmp); ModHeThongThongTinService.Instance.Save(entityHTTT); } // Nhan luc string[] arrNhanLucInString = append.NhanLuc.Split('|'); List <ModNhanLucUCSCEntity> lstNhanLucInViewBag = ViewBag.NhanLuc as List <ModNhanLucUCSCEntity> ?? new List <ModNhanLucUCSCEntity>(); List <ModNhanLucUCSCEntity> lstNhanLucMoi = new List <ModNhanLucUCSCEntity>(); for (int i = 0; i < arrNhanLucInString.Length; i++) { if (string.IsNullOrEmpty(arrNhanLucInString[i])) { continue; } var nhanLuc = arrNhanLucInString[i].Split('_'); int cNhanLuc = nhanLuc.Length; if (cNhanLuc != 10) { continue; } // Parse Nam/Thang tot nghiệp int iThang = 0; int iNam = 0; string[] arrNamThangTotNghiep = nhanLuc[9].Split('/'); if (arrNamThangTotNghiep.Length == 2) { iThang = Int32.Parse(arrNamThangTotNghiep[0], 0); iNam = Int32.Parse(arrNamThangTotNghiep[1], 0); } var item = new ModNhanLucUCSCEntity() { DonDangKyUCSCID = entityDk.ID, Name = nhanLuc[0], School = nhanLuc[1], MenuIDs_LinhVucDT = nhanLuc[2], MenuIDs_TrinhDoDT = nhanLuc[3], MenuIDs_ChungChi = nhanLuc[4], MenuIDs_QuanLyATTT = nhanLuc[5], MenuIDs_KyThuatPhongThu = nhanLuc[6], MenuIDs_KyThuatBaoVe = nhanLuc[7], MenuIDs_KyThuatKiemTra = nhanLuc[8], ThangTotNghiep = iThang, NamTotNghiep = iNam, Activity = true, Published = DateTime.Now, Order = GetMaxOrder_NhanLuc() }; lstNhanLucMoi.Add(item); } ModNhanLucUCSCService.Instance.Delete(lstNhanLucInViewBag); ModNhanLucUCSCService.Instance.Save(lstNhanLucMoi); ViewBag.NhanLuc = lstNhanLucMoi; ViewBag.DangKy = entityDk; ViewBag.HTTT1 = entityHTTT; // LinhVucDaoDao string[] tongHopNhanLucs = append.TongHopNhanLucLVDT.Split('|'); List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucLVDT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "LinhVucDaoDao"); for (int i = 0; i < tongHopNhanLucs.Length; i++) { if (string.IsNullOrEmpty(tongHopNhanLucs[i])) { continue; } string[] thnl = tongHopNhanLucs[i].Split('_'); int menuId = Int32.Parse(thnl[0], 0); int menuId_value = Int32.Parse(thnl[1], 0); if (menuId == 0) { continue; } // REPLACE OR ADD TO LIST int index = lstTongHopNhanLucLVDT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucLVDT[index].MenuID_Value = menuId_value; lstTongHopNhanLucLVDT[index].UpdatedDate = DateTime.Now; } ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucLVDT.FindAll(o => o.MenuID_Value > 0)); ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucLVDT.FindAll(o => o.MenuID_Value <= 0)); // TrinhDoDaoTao tongHopNhanLucs = append.TongHopNhanLucTDDT.Split('|'); List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucTDDT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "TrinhDoDaoTao"); for (int i = 0; i < tongHopNhanLucs.Length; i++) { if (string.IsNullOrEmpty(tongHopNhanLucs[i])) { continue; } string[] thnl = tongHopNhanLucs[i].Split('_'); int menuId = Int32.Parse(thnl[0], 0); int menuId_value = Int32.Parse(thnl[1], 0); if (menuId == 0) { continue; } // REPLACE OR ADD TO LIST int index = lstTongHopNhanLucTDDT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucTDDT[index].MenuID_Value = menuId_value; lstTongHopNhanLucTDDT[index].UpdatedDate = DateTime.Now; } ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucTDDT.FindAll(o => o.MenuID_Value > 0)); ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucTDDT.FindAll(o => o.MenuID_Value <= 0)); // ChungChi tongHopNhanLucs = append.TongHopNhanLucCC.Split('|'); List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucCC = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "ChungChi"); for (int i = 0; i < tongHopNhanLucs.Length; i++) { if (string.IsNullOrEmpty(tongHopNhanLucs[i])) { continue; } string[] thnl = tongHopNhanLucs[i].Split('_'); int menuId = Int32.Parse(thnl[0], 0); int menuId_value = Int32.Parse(thnl[1], 0); if (menuId == 0) { continue; } // REPLACE OR ADD TO LIST int index = lstTongHopNhanLucCC.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucCC[index].MenuID_Value = menuId_value; lstTongHopNhanLucCC[index].UpdatedDate = DateTime.Now; } ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucCC.FindAll(o => o.MenuID_Value > 0)); ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucCC.FindAll(o => o.MenuID_Value <= 0)); // QuanLyATTT tongHopNhanLucs = append.TongHopNhanLucNhomATTT.Split('|'); List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomATTT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "QuanLyATTT"); for (int i = 0; i < tongHopNhanLucs.Length; i++) { if (string.IsNullOrEmpty(tongHopNhanLucs[i])) { continue; } string[] thnl = tongHopNhanLucs[i].Split('_'); int menuId = Int32.Parse(thnl[0], 0); int menuId_value = Int32.Parse(thnl[1], 0); if (menuId == 0) { continue; } // REPLACE OR ADD TO LIST int index = lstTongHopNhanLucNhomATTT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucNhomATTT[index].MenuID_Value = menuId_value; lstTongHopNhanLucNhomATTT[index].UpdatedDate = DateTime.Now; } ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomATTT.FindAll(o => o.MenuID_Value > 0)); ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomATTT.FindAll(o => o.MenuID_Value <= 0)); //KyThuatPhongThu tongHopNhanLucs = append.TongHopNhanLucNhomKTPT.Split('|'); List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomKTPT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "KyThuatPhongThu"); for (int i = 0; i < tongHopNhanLucs.Length; i++) { if (string.IsNullOrEmpty(tongHopNhanLucs[i])) { continue; } string[] thnl = tongHopNhanLucs[i].Split('_'); int menuId = Int32.Parse(thnl[0], 0); int menuId_value = Int32.Parse(thnl[1], 0); if (menuId == 0) { continue; } // REPLACE OR ADD TO LIST int index = lstTongHopNhanLucNhomKTPT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucNhomKTPT[index].MenuID_Value = menuId_value; lstTongHopNhanLucNhomKTPT[index].UpdatedDate = DateTime.Now; } ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomKTPT.FindAll(o => o.MenuID_Value > 0)); ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomKTPT.FindAll(o => o.MenuID_Value <= 0)); // KyThuatBaoVe tongHopNhanLucs = append.TongHopNhanLucNhomKTBV.Split('|'); List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomKTBV = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "KyThuatBaoVe"); for (int i = 0; i < tongHopNhanLucs.Length; i++) { if (string.IsNullOrEmpty(tongHopNhanLucs[i])) { continue; } string[] thnl = tongHopNhanLucs[i].Split('_'); int menuId = Int32.Parse(thnl[0], 0); int menuId_value = Int32.Parse(thnl[1], 0); if (menuId == 0) { continue; } // REPLACE OR ADD TO LIST int index = lstTongHopNhanLucNhomKTBV.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucNhomKTBV[index].MenuID_Value = menuId_value; lstTongHopNhanLucNhomKTBV[index].UpdatedDate = DateTime.Now; } ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomKTBV.FindAll(o => o.MenuID_Value > 0)); ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomKTBV.FindAll(o => o.MenuID_Value <= 0)); tongHopNhanLucs = append.TongHopNhanLucNhomKTKT.Split('|'); List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomKTKT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "KyThuatKiemTra"); for (int i = 0; i < tongHopNhanLucs.Length; i++) { if (string.IsNullOrEmpty(tongHopNhanLucs[i])) { continue; } string[] thnl = tongHopNhanLucs[i].Split('_'); int menuId = Int32.Parse(thnl[0], 0); int menuId_value = Int32.Parse(thnl[1], 0); if (menuId == 0) { continue; } // REPLACE OR ADD TO LIST int index = lstTongHopNhanLucNhomKTKT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucNhomKTKT[index].MenuID_Value = menuId_value; lstTongHopNhanLucNhomKTKT[index].UpdatedDate = DateTime.Now; } ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomKTKT.FindAll(o => o.MenuID_Value > 0)); ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomKTKT.FindAll(o => o.MenuID_Value <= 0)); ViewPage.Alert("Cập nhật đăng ký thành công! Chúng tôi sẽ xem xét và phê duyệt đăng ký của bạn sớm nhất có thể."); string url = "/vn/Thanh-vien/DS-dang-ky-ung-cuu-su-co.aspx"; if (ViewPage.CurrentPage.LangID == 2) { url = "/en/Member/DS-dang-ky-ung-cuu-su-co.aspx"; } ViewPage.Navigate(url); } }
public void ActionUpdateHoSoUCSC(ModHSThanhVienUCSCEntity entityHs, MAppend append, ModDauMoiUCSCEntity entityDm, MHSThanhVienUCSCModel model, string endCode) { int userId = HL.Lib.Global.CPLogin.UserIDOnWeb; var entity = ModHSThanhVienUCSCService.Instance.CreateQuery() .Where(userId > 0, o => o.UserID == userId) .Where(o => o.Code == endCode) .ToSingle(); if (entity != null) { DateTime date = DateTime.Now; //Thong tin chung entityHs.ID = entity.ID; entityHs.UserID = entity.UserID; entityHs.UserID1 = userId; entityHs.MenuID = entity.MenuID; entityHs.State = entity.State; entityHs.Name = entity.Name; entityHs.Code = entity.Code; entityHs.Order = entity.Order; entityHs.Published = entity.Published; entityHs.Published1 = date; entityHs.Activity = false; ModHSThanhVienUCSCService.Instance.Save(entityHs); //Dau moi UCSC WebMenuEntity menu = WebMenuService.Instance.CreateQuery().Where(o => o.Activity == true && o.Type == "DauMoiUCSC" && o.Code == "Chinh").ToSingle(); var dm = ModDauMoiUCSCService.Instance.CreateQuery().Where(o => o.Activity == true && o.HSThanhVienUCSCID == entity.ID && o.MenuID == menu.ID).ToSingle(); //entityDm.ID = dm.ID; //entityDm.HSThanhVienUCSCID = dm.HSThanhVienUCSCID; //entityDm.MenuID = dm.MenuID; //entityDm.State = dm.State; //entityDm.Name = dm.Name; //entityDm.Code = dm.Code; //entityDm.Order = dm.Order; //entityDm.Published = entity.Published; //entityDm.Activity = dm.Activity; dm.Name = entityDm.Name; dm.ChucVu = entityDm.ChucVu; dm.DiaChi = entityDm.DiaChi; dm.DienThoaiDD = entityDm.DienThoaiDD; dm.DienThoai = entityDm.DienThoai; dm.Fax = entityDm.Fax; dm.Email = entityDm.Email; ModDauMoiUCSCService.Instance.Save(dm); ModDauMoiUCSCEntity dmDuPhong = null; WebMenuEntity menu1 = WebMenuService.Instance.CreateQuery().Where(o => o.Activity == true && o.Type == "DauMoiUCSC" && o.Code == "DuPhong").ToSingle(); if (menu1 != null) { dmDuPhong = ModDauMoiUCSCService.Instance.CreateQuery().Where(o => o.Activity == true && o.HSThanhVienUCSCID == entity.ID && o.MenuID == menu1.ID).ToSingle(); dmDuPhong.Name = append.Name1; dmDuPhong.ChucVu = append.ChucVu1; dmDuPhong.DiaChi = append.DiaChi1; dmDuPhong.DienThoaiDD = append.DienThoaiDD1; dmDuPhong.DienThoai = append.DienThoai1; dmDuPhong.Fax = append.Fax1; dmDuPhong.Email = append.Email1; ModDauMoiUCSCService.Instance.Save(dmDuPhong); } //He thong thong tin var httt = ModHeThongThongTinService.Instance.CreateQuery().Where(o => o.Activity == true && o.DauMoiUCSCID == dm.ID).ToList(); if (httt != null) { ModHeThongThongTinService.Instance.Delete(httt); } var arr = model.M.Split('|'); List <ModHeThongThongTinEntity> entityHTTT = new List <ModHeThongThongTinEntity>(); for (int i = 0; i < arr.Length; i++) { if (string.IsNullOrEmpty(arr[i])) { continue; } var tmp = arr[i].Split('_'); int m = HL.Core.Global.Convert.ToInt(tmp[0], 0); if (m <= 0 || tmp.Length != 2) { continue; } string sName = tmp[1]; if (string.IsNullOrEmpty(sName)) { continue; } var entityTmp = new ModHeThongThongTinEntity { DauMoiUCSCID = dm.ID, MenuID = m, Name = sName, Code = Data.GetCode(sName), Published = DateTime.Now, Order = GetMaxOrder_HTTT(), Activity = true, DonDangKyUCSCID = entityHs.ID }; entityHTTT.Add(entityTmp); ModHeThongThongTinService.Instance.Save(entityHTTT); } ViewBag.HoSo = entityHs; ViewBag.DauMoi = entityDm; ViewBag.DauMoiDuPhong = dmDuPhong; ViewBag.HTTT = entityHTTT; /* =======================================================*/ /* =======================================================*/ #region ITT UPDATE string[] arrNhanLucInString = append.NhanLuc.Split('|'); List <ModNhanLucUCSCEntity> lstNhanLucInViewBag = ViewBag.NhanLuc as List <ModNhanLucUCSCEntity> ?? new List <ModNhanLucUCSCEntity>(); List <ModNhanLucUCSCEntity> lstNhanLucMoi = new List <ModNhanLucUCSCEntity>(); for (int i = 0; i < arrNhanLucInString.Length; i++) { if (string.IsNullOrEmpty(arrNhanLucInString[i])) { continue; } var nhanLuc = arrNhanLucInString[i].Split('_'); int cNhanLuc = nhanLuc.Length; if (cNhanLuc != 10) { continue; } // Parse Nam/Thang tot nghiệp int iThang = 0; int iNam = 0; string[] arrNamThangTotNghiep = nhanLuc[9].Split('/'); if (arrNamThangTotNghiep.Length == 2) { iThang = Int32.Parse(arrNamThangTotNghiep[0], 0); iNam = Int32.Parse(arrNamThangTotNghiep[1], 0); } var item = new ModNhanLucUCSCEntity() { HSThanhVienUCSCID = entityHs.ID, Name = nhanLuc[0], School = nhanLuc[1], MenuIDs_LinhVucDT = nhanLuc[2], MenuIDs_TrinhDoDT = nhanLuc[3], MenuIDs_ChungChi = nhanLuc[4], MenuIDs_QuanLyATTT = nhanLuc[5], MenuIDs_KyThuatPhongThu = nhanLuc[6], MenuIDs_KyThuatBaoVe = nhanLuc[7], MenuIDs_KyThuatKiemTra = nhanLuc[8], ThangTotNghiep = iThang, NamTotNghiep = iNam, Activity = true, Published = DateTime.Now, Order = GetMaxOrder_NhanLuc() }; lstNhanLucMoi.Add(item); } ModNhanLucUCSCService.Instance.Delete(lstNhanLucInViewBag); ModNhanLucUCSCService.Instance.Save(lstNhanLucMoi); ViewBag.NhanLuc = lstNhanLucMoi; // LinhVucDaoDao string[] tongHopNhanLucs = append.TongHopNhanLucLVDT.Split('|'); List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucLVDT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "LinhVucDaoDao"); for (int i = 0; i < tongHopNhanLucs.Length; i++) { if (string.IsNullOrEmpty(tongHopNhanLucs[i])) { continue; } string[] thnl = tongHopNhanLucs[i].Split('_'); int menuId = Int32.Parse(thnl[0], 0); int menuId_value = Int32.Parse(thnl[1], 0); if (menuId == 0) { continue; } // REPLACE OR ADD TO LIST int index = lstTongHopNhanLucLVDT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucLVDT[index].MenuID_Value = menuId_value; lstTongHopNhanLucLVDT[index].UpdatedDate = DateTime.Now; } ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucLVDT.FindAll(o => o.MenuID_Value > 0)); ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucLVDT.FindAll(o => o.MenuID_Value <= 0)); // TrinhDoDaoTao tongHopNhanLucs = append.TongHopNhanLucTDDT.Split('|'); List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucTDDT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "TrinhDoDaoTao"); for (int i = 0; i < tongHopNhanLucs.Length; i++) { if (string.IsNullOrEmpty(tongHopNhanLucs[i])) { continue; } string[] thnl = tongHopNhanLucs[i].Split('_'); int menuId = Int32.Parse(thnl[0], 0); int menuId_value = Int32.Parse(thnl[1], 0); if (menuId == 0) { continue; } // REPLACE OR ADD TO LIST int index = lstTongHopNhanLucTDDT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucTDDT[index].MenuID_Value = menuId_value; lstTongHopNhanLucTDDT[index].UpdatedDate = DateTime.Now; } ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucTDDT.FindAll(o => o.MenuID_Value > 0)); ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucTDDT.FindAll(o => o.MenuID_Value <= 0)); // ChungChi tongHopNhanLucs = append.TongHopNhanLucCC.Split('|'); List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucCC = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "ChungChi"); for (int i = 0; i < tongHopNhanLucs.Length; i++) { if (string.IsNullOrEmpty(tongHopNhanLucs[i])) { continue; } string[] thnl = tongHopNhanLucs[i].Split('_'); int menuId = Int32.Parse(thnl[0], 0); int menuId_value = Int32.Parse(thnl[1], 0); if (menuId == 0) { continue; } // REPLACE OR ADD TO LIST int index = lstTongHopNhanLucCC.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucCC[index].MenuID_Value = menuId_value; lstTongHopNhanLucCC[index].UpdatedDate = DateTime.Now; } ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucCC.FindAll(o => o.MenuID_Value > 0)); ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucCC.FindAll(o => o.MenuID_Value <= 0)); // QuanLyATTT tongHopNhanLucs = append.TongHopNhanLucNhomATTT.Split('|'); List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomATTT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "QuanLyATTT"); for (int i = 0; i < tongHopNhanLucs.Length; i++) { if (string.IsNullOrEmpty(tongHopNhanLucs[i])) { continue; } string[] thnl = tongHopNhanLucs[i].Split('_'); int menuId = Int32.Parse(thnl[0], 0); int menuId_value = Int32.Parse(thnl[1], 0); if (menuId == 0) { continue; } // REPLACE OR ADD TO LIST int index = lstTongHopNhanLucNhomATTT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucNhomATTT[index].MenuID_Value = menuId_value; lstTongHopNhanLucNhomATTT[index].UpdatedDate = DateTime.Now; } ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomATTT.FindAll(o => o.MenuID_Value > 0)); ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomATTT.FindAll(o => o.MenuID_Value <= 0)); //KyThuatPhongThu tongHopNhanLucs = append.TongHopNhanLucNhomKTPT.Split('|'); List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomKTPT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "KyThuatPhongThu"); for (int i = 0; i < tongHopNhanLucs.Length; i++) { if (string.IsNullOrEmpty(tongHopNhanLucs[i])) { continue; } string[] thnl = tongHopNhanLucs[i].Split('_'); int menuId = Int32.Parse(thnl[0], 0); int menuId_value = Int32.Parse(thnl[1], 0); if (menuId == 0) { continue; } // REPLACE OR ADD TO LIST int index = lstTongHopNhanLucNhomKTPT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucNhomKTPT[index].MenuID_Value = menuId_value; lstTongHopNhanLucNhomKTPT[index].UpdatedDate = DateTime.Now; } ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomKTPT.FindAll(o => o.MenuID_Value > 0)); ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomKTPT.FindAll(o => o.MenuID_Value <= 0)); // KyThuatBaoVe tongHopNhanLucs = append.TongHopNhanLucNhomKTBV.Split('|'); List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomKTBV = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "KyThuatBaoVe"); for (int i = 0; i < tongHopNhanLucs.Length; i++) { if (string.IsNullOrEmpty(tongHopNhanLucs[i])) { continue; } string[] thnl = tongHopNhanLucs[i].Split('_'); int menuId = Int32.Parse(thnl[0], 0); int menuId_value = Int32.Parse(thnl[1], 0); if (menuId == 0) { continue; } // REPLACE OR ADD TO LIST int index = lstTongHopNhanLucNhomKTBV.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucNhomKTBV[index].MenuID_Value = menuId_value; lstTongHopNhanLucNhomKTBV[index].UpdatedDate = DateTime.Now; } ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomKTBV.FindAll(o => o.MenuID_Value > 0)); ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomKTBV.FindAll(o => o.MenuID_Value <= 0)); tongHopNhanLucs = append.TongHopNhanLucNhomKTKT.Split('|'); List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLucNhomKTKT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByHSThanhVienID(entity.ID, "KyThuatKiemTra"); for (int i = 0; i < tongHopNhanLucs.Length; i++) { if (string.IsNullOrEmpty(tongHopNhanLucs[i])) { continue; } string[] thnl = tongHopNhanLucs[i].Split('_'); int menuId = Int32.Parse(thnl[0], 0); int menuId_value = Int32.Parse(thnl[1], 0); if (menuId == 0) { continue; } // REPLACE OR ADD TO LIST int index = lstTongHopNhanLucNhomKTKT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucNhomKTKT[index].MenuID_Value = menuId_value; lstTongHopNhanLucNhomKTKT[index].UpdatedDate = DateTime.Now; } ModTongHopNhanLucUCSCService.Instance.Save(lstTongHopNhanLucNhomKTKT.FindAll(o => o.MenuID_Value > 0)); ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLucNhomKTKT.FindAll(o => o.MenuID_Value <= 0)); #endregion ViewPage.Alert("Cập nhật hồ sơ thành công! Chúng tôi sẽ xem xét và phê duyệt hồ sơ của bạn sớm nhất có thể."); string url = "/vn/Thanh-vien/Ho-so-ung-cuu-su-co.aspx"; if (ViewPage.CurrentPage.LangID == 2) { url = "/en/Member/Ho-so-ung-cuu-su-co.aspx"; } ViewPage.Navigate(url); } //DateTime date = DateTime.Now; //string code = "HSUCSC" + ModHSThanhVienUCSCService.Instance.GetMaxID(); //entity.Name = code; //entity.Code = Data.GetCode(code); //entity.UserID = Lib.Global.CPLogin.UserIDOnWeb; //entity.Published = date; //entity.Activity = false; //int id = ModHSThanhVienUCSCService.Instance.Save(entity); //WebMenuEntity menu = WebMenuService.Instance.CreateQuery().Where(o => o.Activity == true && o.Type == "DauMoiUCSC" && o.Code == "Chinh").ToSingle(); //entityDm.HSThanhVienUCSCID = id; //entityDm.MenuID = menu.ID; //entityDm.Published = date; //entityDm.Activity = true; //ModDauMoiUCSCService.Instance.Save(entityDm); //ViewPage.Alert("Tạo mới hồ sơ thành công! Chúng tôi sẽ xem xét và phê duyệt hồ sơ của bạn sớm nhất có thể."); //ViewPage.Navigate("/vn/Thanh-vien/Ho-so-ung-cuu-su-co.aspx"); }
public void ActionAddDVCanhBao(ModDichVuCanhBaoEntity entity, MAppend append, string endCode) { string alert = string.Empty; ViewBag.DichVu = entity; ViewBag.Append = append; DateTime date = DateTime.Now; int userId = Lib.Global.CPLogin.UserID; try { // Lay ban ghi dang ky UCSC cua user var donDk = ModDonDangKyUCSCService.Instance.CreateQuery().Where(o => o.UserID == userId).ToSingle(); if (donDk == null) { ViewPage.Message.ListMessage.Add("Bạn chưa thực hiện đăng ký UCSC."); } string code = "DVCB" + ModDichVuCanhBaoService.Instance.GetMaxID(); //entity.DonDangKyUCSCID = 0; entity.Name = code; entity.Code = Data.GetCode(code); entity.UserID = userId; entity.Order = GetMaxOrder_DVCanhBao(); try { if (!string.IsNullOrEmpty(append.ThoiGian)) { entity.Time = TimeSpan.Parse(append.ThoiGian); } } catch (Exception e) { ViewPage.Message.ListMessage.Add("Định dạng thời gian không đúng (HH:mm)"); } // Lay ban ghi neu da ton tai ModDichVuCanhBaoEntity curr = null; List <ModDichVuCanhBaoIPEntity> ipCurr = null; if (!string.IsNullOrEmpty(endCode)) { curr = ModDichVuCanhBaoService.Instance.CreateQuery().Where(o => o.Name == endCode).ToSingle(); if (curr != null) { curr.MenuID = entity.MenuID; curr.Time = entity.Time; ipCurr = ModDichVuCanhBaoIPService.Instance.CreateQuery().Where(o => o.DichVuCanhBaoID == curr.ID).ToList(); } } entity.Published = date; entity.Activity = true; int id = 0; // Danh sach IP var arr = append.M.Split(';'); List <ModDichVuCanhBaoIPEntity> listIP = new List <ModDichVuCanhBaoIPEntity>(); for (int j = 0; j < arr.Length; j++) { if (string.IsNullOrEmpty(arr[j])) { continue; } var entityIP = new ModDichVuCanhBaoIPEntity { DichVuCanhBaoID = id, MenuID = entity.MenuID, Name = arr[j], UserID = userId, Published = DateTime.Now, Published1 = null, Order = GetMaxOrder_DVCanhBaoIP(), Activity = true }; listIP.Add(entityIP); } ViewBag.IPs = listIP; if (ViewPage.Message.ListMessage.Count == 0) { if (curr != null) { ModDichVuCanhBaoService.Instance.Save(curr); id = curr.ID; } else { entity.DonDangKyUCSCID = donDk.ID; ViewBag.EndCode = entity.Name; id = ModDichVuCanhBaoService.Instance.Save(entity); } // Xoa IP cu var ipDel = ModDichVuCanhBaoIPService.Instance.CreateQuery().Where(o => o.DichVuCanhBaoID == id).ToList(); if (ipDel != null) { ModDichVuCanhBaoIPService.Instance.Delete(ipDel); } listIP.ForEach(o => o.DichVuCanhBaoID = id); ModDichVuCanhBaoIPService.Instance.Save(listIP); } } catch (Exception ex) { ViewPage.Message.ListMessage.Add("Lỗi đăng ký nhận cảnh báo! Hãy kiểm tra tính hợp lệ."); } if (ViewPage.Message.ListMessage.Count > 0) { ViewPage.Alert(string.Join("\n", ViewPage.Message.ListMessage)); } else { ViewPage.Alert("Đăng ký nhận cảnh báo thành công."); //ViewPage.RefreshPage(); } }
public void ActionAddBCBanDauUCSC(ModBaoCaoBanDauSuCoEntity entity, MInfoMagicModel modelInfo, MAppend append) { DateTime date = DateTime.Now; string ngayGioPhatHien = append.Ngay + " " + append.Gio + ":" + append.Phut; string[] arr = append.ThoiGian.Split('/'); string thoiGianThucHien = ""; if (arr.Length == 5) { thoiGianThucHien = arr[0] + "/" + arr[1] + "/" + arr[2] + " " + arr[3] + ":" + arr[4]; } string code = "BCBDSC" + ModBaoCaoBanDauSuCoService.Instance.GetMaxID(); entity.Name = code; entity.Code = Data.GetCode(code); entity.UserID = Lib.Global.CPLogin.UserID; if (!string.IsNullOrEmpty(ngayGioPhatHien)) { entity.ChiTiet_NgayGioPhatHien = HL.Core.Global.Convert.ToDateTime(ngayGioPhatHien); } else { entity.ChiTiet_NgayGioPhatHien = DateTime.MinValue; } if (!string.IsNullOrEmpty(thoiGianThucHien)) { entity.ThoiGianThucHien = HL.Core.Global.Convert.ToDateTime(thoiGianThucHien); } else { entity.ThoiGianThucHien = DateTime.MinValue; } entity.Order = GetMaxOrder_BCBanDau(); entity.Published = date; entity.Activity = false; int id = ModBaoCaoBanDauSuCoService.Instance.Save(entity); //Cach thuc phat hien int num = modelInfo.chkCachThuc != null ? modelInfo.chkCachThuc.Length : 0; for (int i = 0; i < num; i++) { string[] tmp = modelInfo.chkCachThuc[i].Split('_'); if (tmp.Length == 3) { ModInfoMagicEntity entityTmp = new ModInfoMagicEntity() { BaoCaoBanDauSuCoID = id, Order = GetMaxOrder_InfoMagic(), Published = date, Activity = true }; entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]); if (tmp[0] == "1") { int idx = HL.Core.Global.Convert.ToInt(tmp[1]); if (modelInfo.txtCachThuc != null && modelInfo.txtCachThuc.Length >= idx) { entityTmp.Name = modelInfo.txtCachThuc[idx]; entityTmp.Code = Data.GetCode(modelInfo.txtCachThuc[idx]); } } ModInfoMagicService.Instance.Save(entityTmp); } } //Da gui thong bao su co num = modelInfo.chkThongBao != null ? modelInfo.chkThongBao.Length : 0; for (int i = 0; i < num; i++) { string[] tmp = modelInfo.chkThongBao[i].Split('_'); if (tmp.Length == 3) { ModInfoMagicEntity entityTmp = new ModInfoMagicEntity() { BaoCaoBanDauSuCoID = id, Order = GetMaxOrder_InfoMagic(), Published = date, Activity = true }; entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]); if (tmp[0] == "1") { int idx = HL.Core.Global.Convert.ToInt(tmp[1]); if (modelInfo.txtThongBao != null && modelInfo.txtThongBao.Length >= idx) { entityTmp.Name = modelInfo.txtThongBao[idx]; entityTmp.Code = Data.GetCode(modelInfo.txtThongBao[idx]); } } ModInfoMagicService.Instance.Save(entityTmp); } } //Dich vu num = modelInfo.chkDichVu != null ? modelInfo.chkDichVu.Length : 0; for (int i = 0; i < num; i++) { string[] tmp = modelInfo.chkDichVu[i].Split('_'); if (tmp.Length == 3) { ModInfoMagicEntity entityTmp = new ModInfoMagicEntity() { BaoCaoBanDauSuCoID = id, Order = GetMaxOrder_InfoMagic(), Published = date, Activity = true }; entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]); if (tmp[0] == "1") { int idx = HL.Core.Global.Convert.ToInt(tmp[1]); if (modelInfo.txtDichVu != null && modelInfo.txtDichVu.Length >= idx) { entityTmp.Name = modelInfo.txtDichVu[idx]; entityTmp.Code = Data.GetCode(modelInfo.txtDichVu[idx]); } } ModInfoMagicService.Instance.Save(entityTmp); } } //Bien phap num = modelInfo.chkBienPhap != null ? modelInfo.chkBienPhap.Length : 0; for (int i = 0; i < num; i++) { string[] tmp = modelInfo.chkBienPhap[i].Split('_'); if (tmp.Length == 3) { ModInfoMagicEntity entityTmp = new ModInfoMagicEntity() { BaoCaoBanDauSuCoID = id, Order = GetMaxOrder_InfoMagic(), Published = date, Activity = true }; entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]); if (tmp[0] == "1") { int idx = HL.Core.Global.Convert.ToInt(tmp[1]); if (modelInfo.txtBienPhap != null && modelInfo.txtBienPhap.Length >= idx) { entityTmp.Name = modelInfo.txtBienPhap[idx]; entityTmp.Code = Data.GetCode(modelInfo.txtBienPhap[idx]); } } ModInfoMagicService.Instance.Save(entityTmp); } } //Thong tin gui kem num = modelInfo.chkThongTinGuiKem != null ? modelInfo.chkThongTinGuiKem.Length : 0; for (int i = 0; i < num; i++) { string[] tmp = modelInfo.chkThongTinGuiKem[i].Split('_'); if (tmp.Length == 3) { ModInfoMagicEntity entityTmp = new ModInfoMagicEntity() { BaoCaoBanDauSuCoID = id, Order = GetMaxOrder_InfoMagic(), Published = date, Activity = true }; entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]); if (tmp[0] == "1") { int idx = HL.Core.Global.Convert.ToInt(tmp[1]); if (modelInfo.txtThongTinGuiKem != null && modelInfo.txtThongTinGuiKem.Length >= idx) { entityTmp.Name = modelInfo.txtThongTinGuiKem[idx]; entityTmp.Code = Data.GetCode(modelInfo.txtThongTinGuiKem[idx]); } ModInfoMagicService.Instance.Save(entityTmp); } } } ViewBag.BaoCao = entity; ViewPage.Alert("Tạo mới báo cáo thành công! Chúng tôi sẽ xem xét và phê duyệt báo cáo của bạn sớm nhất có thể."); ViewPage.Navigate("/vn/Thanh-vien/DS-bc-ban-dau-su-co.aspx"); }
public void ActionAddDangKyUCSC(ModDonDangKyUCSCEntity entity, MAppend append) { string alert = string.Empty; ViewBag.DangKy = entity; DateTime date = DateTime.Now; string code = "DKUCSC" + ModDonDangKyUCSCService.Instance.GetMaxID(); entity.Name = code; entity.Code = Data.GetCode(code); entity.UserID = Lib.Global.CPLogin.UserID; entity.Order = GetMaxOrder_DangKy(); string folder = "/Data/upload/files/DKUCSC/" + CPLogin.CurrentUser.ID.ToString() + "_" + CPLogin.CurrentUser.LoginName + "/"; Lib.Global.Directory.Create(HL.Core.Global.Application.BaseDirectory + folder); entity.File = Utils.Upload("Atack", entity.File, folder, ref alert, true); entity.Published = date; entity.Activity = false; int id = ModDonDangKyUCSCService.Instance.Save(entity); //He thong thong tin var arr = append.M.Split(';'); List <ModHeThongThongTinEntity> entityHTTT = new List <ModHeThongThongTinEntity>(); for (int i = 0; i < arr.Length; i++) { if (string.IsNullOrEmpty(arr[i])) { continue; } var tmp = arr[i].Split('_'); int m = HL.Core.Global.Convert.ToInt(tmp[0], 0); if (m <= 0 || tmp.Length != 2) { continue; } var lstName = tmp[1].Split(','); for (int j = 0; j < lstName.Length; j++) { if (string.IsNullOrEmpty(lstName[j])) { continue; } var entityTmp = new ModHeThongThongTinEntity { DonDangKyUCSCID = id, MenuID = m, Name = lstName[j], Code = Data.GetCode(lstName[j]), Published = DateTime.Now, Order = GetMaxOrder_HTTT(), Activity = true }; entityHTTT.Add(entityTmp); } ModHeThongThongTinService.Instance.Save(entityHTTT); } // Nhan luc var nhanLucs = append.NhanLuc.Split('|'); var cNhanLucs = nhanLucs.Length; List <ModNhanLucUCSCEntity> entityNhanLuc = new List <ModNhanLucUCSCEntity>(); for (int i = 0; i < cNhanLucs; i++) { if (string.IsNullOrEmpty(nhanLucs[i])) { continue; } var nhanLuc = nhanLucs[i].Split('_'); int cNhanLuc = nhanLuc.Length; if (cNhanLuc != 10) { continue; } var item = new ModNhanLucUCSCEntity() { DonDangKyUCSCID = id, Name = nhanLuc[0], School = nhanLuc[1], MenuIDs_LinhVucDT = nhanLuc[2], MenuIDs_TrinhDoDT = nhanLuc[3], MenuIDs_ChungChi = nhanLuc[4], MenuIDs_QuanLyATTT = nhanLuc[5], MenuIDs_KyThuatPhongThu = nhanLuc[6], MenuIDs_KyThuatBaoVe = nhanLuc[7], MenuIDs_KyThuatKiemTra = nhanLuc[8], NamTotNghiep = HL.Core.Global.Convert.ToInt(nhanLuc[9], 0), Activity = true, Published = DateTime.Now, Order = GetMaxOrder_NhanLuc() }; entityNhanLuc.Add(item); } ViewBag.NhanLuc = entityNhanLuc; ModNhanLucUCSCService.Instance.Save(entityNhanLuc); if (alert != string.Empty) { ViewPage.Message.ListMessage.Add(alert); } ViewPage.Alert("Tạo mới đăng ký thành công! Chúng tôi sẽ xem xét và phê duyệt đăng ký của bạn sớm nhất có thể."); ViewPage.Navigate("/vn/Thanh-vien/DS-dang-ky-ung-cuu-su-co.aspx"); }
/// <summary> /// Them ho so ung cuu su co /// </summary> /// <param name="entity">HS thanh vien</param> /// <param name="entityDm">Dau moi UCSC</param> public void ActionAddHoSoUCSC(ModHSThanhVienUCSCEntity entity, ModDauMoiUCSCEntity entityDm, MAppend append) { ViewBag.HoSo = entity; ViewBag.DauMoi = entityDm; DateTime date = DateTime.Now; string code = "HSUCSC" + ModHSThanhVienUCSCService.Instance.GetMaxID(); entity.Name = code; entity.Code = Data.GetCode(code); entity.UserID = Lib.Global.CPLogin.UserID; entity.Order = GetMaxOrder_HoSo(); entity.Published = date; entity.Activity = false; int id = ModHSThanhVienUCSCService.Instance.Save(entity); WebMenuEntity menu = WebMenuService.Instance.CreateQuery().Where(o => o.Activity == true && o.Type == "DauMoiUCSC" && o.Code == "Chinh").ToSingle(); entityDm.HSThanhVienUCSCID = id; entityDm.MenuID = menu.ID; entityDm.Order = GetMaxOrder_DauMoi(); entityDm.Published = date; entityDm.Activity = true; int id1 = ModDauMoiUCSCService.Instance.Save(entityDm); //He thong thong tin var arr = append.M.Split(';'); List <ModHeThongThongTinEntity> entityHTTT = new List <ModHeThongThongTinEntity>(); for (int i = 0; i < arr.Length; i++) { if (string.IsNullOrEmpty(arr[i])) { continue; } var tmp = arr[i].Split('_'); int m = HL.Core.Global.Convert.ToInt(tmp[0], 0); if (m <= 0 || tmp.Length != 2) { continue; } var lstName = tmp[1].Split(','); for (int j = 0; j < lstName.Length; j++) { if (string.IsNullOrEmpty(lstName[j])) { continue; } var entityTmp = new ModHeThongThongTinEntity { DauMoiUCSCID = id1, MenuID = m, Name = lstName[j], Code = Data.GetCode(lstName[j]), Published = DateTime.Now, Order = GetMaxOrder_HTTT(), Activity = true }; entityHTTT.Add(entityTmp); } ModHeThongThongTinService.Instance.Save(entityHTTT); } ViewPage.Alert("Tạo mới hồ sơ thành công! Chúng tôi sẽ xem xét và phê duyệt hồ sơ của bạn sớm nhất có thể."); ViewPage.Navigate("/vn/Thanh-vien/Ho-so-ung-cuu-su-co.aspx"); }
public void ActionUpdateBaoCaoUCSC(ModBaoCaoBanDauSuCoEntity entityBc, MInfoMagicModel modelInfo, MAppend append, string endCode) { int userId = HL.Lib.Global.CPLogin.UserID; var entity = ModBaoCaoBanDauSuCoService.Instance.CreateQuery() .Where(userId > 0, o => o.UserID == userId) .Where(o => o.Code == endCode) .ToSingle(); if (entity != null) { DateTime date = DateTime.Now; string ngayGioPhatHien = append.Ngay + " " + append.Gio + ":" + append.Phut; string[] arr = append.ThoiGian.Split('/'); string thoiGianThucHien = ""; if (arr.Length == 5) { thoiGianThucHien = arr[0] + "/" + arr[1] + "/" + arr[2] + " " + arr[3] + ":" + arr[4]; } if (!string.IsNullOrEmpty(ngayGioPhatHien)) { entityBc.ChiTiet_NgayGioPhatHien = HL.Core.Global.Convert.ToDateTime(ngayGioPhatHien); } else { entityBc.ChiTiet_NgayGioPhatHien = DateTime.MinValue; } if (!string.IsNullOrEmpty(thoiGianThucHien)) { entityBc.ThoiGianThucHien = HL.Core.Global.Convert.ToDateTime(thoiGianThucHien); } else { entityBc.ThoiGianThucHien = DateTime.MinValue; } entityBc.ID = entity.ID; entityBc.UserID = entity.UserID; entityBc.UserID1 = userId; entityBc.MenuID = entity.MenuID; entityBc.State = entity.State; entityBc.Name = entity.Name; entityBc.Code = entity.Code; entityBc.Order = entity.Order; entityBc.Published = entity.Published; entityBc.Published1 = date; entityBc.Activity = false; ModBaoCaoBanDauSuCoService.Instance.Save(entityBc); //Xoa toan bo thong tin InfoMagic cua Bao cao ban dau su co var lstInfoMagic = ModInfoMagicService.Instance.CreateQuery() .Where(o => o.BaoCaoBanDauSuCoID == entity.ID) .ToList(); if (lstInfoMagic != null) { ModInfoMagicService.Instance.Delete(lstInfoMagic); } //Cach thuc phat hien int num = modelInfo.chkCachThuc != null ? modelInfo.chkCachThuc.Length : 0; for (int i = 0; i < num; i++) { string[] tmp = modelInfo.chkCachThuc[i].Split('_'); if (tmp.Length == 3) { ModInfoMagicEntity entityTmp = new ModInfoMagicEntity() { BaoCaoBanDauSuCoID = entity.ID, Order = GetMaxOrder_InfoMagic(), Published = date, Activity = true }; entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]); if (tmp[0] == "1") { int idx = HL.Core.Global.Convert.ToInt(tmp[1]); if (modelInfo.txtCachThuc != null && modelInfo.txtCachThuc.Length >= idx) { entityTmp.Name = modelInfo.txtCachThuc[idx]; entityTmp.Code = Data.GetCode(modelInfo.txtCachThuc[idx]); } } ModInfoMagicService.Instance.Save(entityTmp); } } //Da gui thong bao su co num = modelInfo.chkThongBao != null ? modelInfo.chkThongBao.Length : 0; for (int i = 0; i < num; i++) { string[] tmp = modelInfo.chkThongBao[i].Split('_'); if (tmp.Length == 3) { ModInfoMagicEntity entityTmp = new ModInfoMagicEntity() { BaoCaoBanDauSuCoID = entity.ID, Order = GetMaxOrder_InfoMagic(), Published = date, Activity = true }; entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]); if (tmp[0] == "1") { int idx = HL.Core.Global.Convert.ToInt(tmp[1]); if (modelInfo.txtThongBao != null && modelInfo.txtThongBao.Length >= idx) { entityTmp.Name = modelInfo.txtThongBao[idx]; entityTmp.Code = Data.GetCode(modelInfo.txtThongBao[idx]); } } ModInfoMagicService.Instance.Save(entityTmp); } } //Dich vu num = modelInfo.chkDichVu != null ? modelInfo.chkDichVu.Length : 0; for (int i = 0; i < num; i++) { string[] tmp = modelInfo.chkDichVu[i].Split('_'); if (tmp.Length == 3) { ModInfoMagicEntity entityTmp = new ModInfoMagicEntity() { BaoCaoBanDauSuCoID = entity.ID, Order = GetMaxOrder_InfoMagic(), Published = date, Activity = true }; entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]); if (tmp[0] == "1") { int idx = HL.Core.Global.Convert.ToInt(tmp[1]); if (modelInfo.txtDichVu != null && modelInfo.txtDichVu.Length >= idx) { entityTmp.Name = modelInfo.txtDichVu[idx]; entityTmp.Code = Data.GetCode(modelInfo.txtDichVu[idx]); } } ModInfoMagicService.Instance.Save(entityTmp); } } //Bien phap num = modelInfo.chkBienPhap != null ? modelInfo.chkBienPhap.Length : 0; for (int i = 0; i < num; i++) { string[] tmp = modelInfo.chkBienPhap[i].Split('_'); if (tmp.Length == 3) { ModInfoMagicEntity entityTmp = new ModInfoMagicEntity() { BaoCaoBanDauSuCoID = entity.ID, Order = GetMaxOrder_InfoMagic(), Published = date, Activity = true }; entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]); if (tmp[0] == "1") { int idx = HL.Core.Global.Convert.ToInt(tmp[1]); if (modelInfo.txtBienPhap != null && modelInfo.txtBienPhap.Length >= idx) { entityTmp.Name = modelInfo.txtBienPhap[idx]; entityTmp.Code = Data.GetCode(modelInfo.txtBienPhap[idx]); } } ModInfoMagicService.Instance.Save(entityTmp); } } //Thong tin gui kem num = modelInfo.chkThongTinGuiKem != null ? modelInfo.chkThongTinGuiKem.Length : 0; for (int i = 0; i < num; i++) { string[] tmp = modelInfo.chkThongTinGuiKem[i].Split('_'); if (tmp.Length == 3) { ModInfoMagicEntity entityTmp = new ModInfoMagicEntity() { BaoCaoBanDauSuCoID = entity.ID, Order = GetMaxOrder_InfoMagic(), Published = date, Activity = true }; entityTmp.MenuID = HL.Core.Global.Convert.ToInt(tmp[2]); if (tmp[0] == "1") { int idx = HL.Core.Global.Convert.ToInt(tmp[1]); if (modelInfo.txtThongTinGuiKem != null && modelInfo.txtThongTinGuiKem.Length >= idx) { entityTmp.Name = modelInfo.txtThongTinGuiKem[idx]; entityTmp.Code = Data.GetCode(modelInfo.txtThongTinGuiKem[idx]); } } ModInfoMagicService.Instance.Save(entityTmp); } } ViewBag.BaoCao = entityBc; ViewPage.Alert("Cập nhật báo cáo thành công! Chúng tôi sẽ xem xét và phê duyệt báo cáo của bạn sớm nhất có thể."); string url = "/vn/Thanh-vien/DS-bc-ban-dau-su-co.aspx"; if (ViewPage.CurrentPage.LangID == 2) { url = "/en/Member/DS-bc-ban-dau-su-co.aspx"; } ViewPage.Navigate(url); } }