public void ActionSave(ModDonDangKyUCSCModel model, ModDonDangKyUCSCEntity entityDk) { if (ValidSave(model, entityDk)) { SaveRedirect(); } }
public void ActionApply(ModDonDangKyUCSCModel model, ModDonDangKyUCSCEntity entityDk) { if (ValidSave(model, entityDk)) { ApplyRedirect(model.RecordID, entity.ID); } }
public void ActionAdd(ModDonDangKyUCSCModel model) { if (model.RecordID > 0) { entity = ModDonDangKyUCSCService.Instance.GetByID(model.RecordID); // khoi tao gia tri mac dinh khi update entity.UserID1 = Lib.Global.CPLogin.UserID; ViewBag.HTTT = ModHeThongThongTinService.Instance.CreateQuery() .Where(o => o.Activity == true && o.DonDangKyUCSCID == model.RecordID) .ToList(); } else { entity = new ModDonDangKyUCSCEntity(); // khoi tao gia tri mac dinh khi insert entity.MenuID = model.MenuID; entity.UserID = Lib.Global.CPLogin.UserID; entity.Published = DateTime.Now; entity.Activity = CPViewPage.UserPermissions.Approve; entity.Order = GetMaxOrder(model); } ViewBag.Data = entity; ViewBag.Model = model; }
public void ActionAdd(ModDonDangKyUCSCModel model) { if (model.RecordID > 0) { entity = ModDonDangKyUCSCService.Instance.GetByID(model.RecordID); // khoi tao gia tri mac dinh khi update entity.UserID1 = Lib.Global.CPLogin.UserID; ViewBag.HTTT = ModHeThongThongTinService.Instance.CreateQuery() .Where(o => o.Activity == true && o.DonDangKyUCSCID == model.RecordID) .ToList(); // Danh sach nhan luc ViewBag.NhanLuc = ModNhanLucUCSCService.Instance.CreateQuery() .Where(o => o.Activity == true && o.DonDangKyUCSCID == entity.ID) .ToList(); // Khoi tao tong hop nhan su lstTongHopNhanLucLVDT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "LinhVucDaoDao"); lstTongHopNhanLucTDDT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "TrinhDoDaoTao"); lstTongHopNhanLucCC = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "ChungChi"); lstTongHopNhanLucNhomATTT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "QuanLyATTT"); lstTongHopNhanLucNhomKTPT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "KyThuatPhongThu"); lstTongHopNhanLucNhomKTBV = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "KyThuatBaoVe"); lstTongHopNhanLucNhomKTKT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(entity.ID, "KyThuatKiemTra"); } else { entity = new ModDonDangKyUCSCEntity(); // khoi tao gia tri mac dinh khi insert entity.MenuID = model.MenuID; entity.UserID = Lib.Global.CPLogin.UserID; entity.Published = DateTime.Now; entity.Activity = CPViewPage.UserPermissions.Approve; entity.Order = GetMaxOrder(model); // Khoi tao tong hop nhan su lstTongHopNhanLucLVDT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(0, "LinhVucDaoDao"); lstTongHopNhanLucTDDT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(0, "TrinhDoDaoTao"); lstTongHopNhanLucCC = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(0, "ChungChi"); lstTongHopNhanLucNhomATTT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(0, "QuanLyATTT"); lstTongHopNhanLucNhomKTPT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(0, "KyThuatPhongThu"); lstTongHopNhanLucNhomKTBV = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(0, "KyThuatBaoVe"); lstTongHopNhanLucNhomKTKT = ModTongHopNhanLucUCSCService.Instance.GetTongHopNhanLucByDonDangKyUCSCID(0, "KyThuatKiemTra"); } ViewBag.Data = entity; ViewBag.Model = model; ViewBag.ListTongHopNhanLucLVDT = lstTongHopNhanLucLVDT; ViewBag.ListTongHopNhanLucTDDT = lstTongHopNhanLucTDDT; ViewBag.ListTongHopNhanLucCC = lstTongHopNhanLucCC; ViewBag.ListTongHopNhanLucNhomATTT = lstTongHopNhanLucNhomATTT; ViewBag.ListTongHopNhanLucNhomKTPT = lstTongHopNhanLucNhomKTPT; ViewBag.ListTongHopNhanLucNhomKTBV = lstTongHopNhanLucNhomKTBV; ViewBag.ListTongHopNhanLucNhomKTKT = lstTongHopNhanLucNhomKTKT; }
private bool ValidSave(ModDonDangKyUCSCModel model, ModDonDangKyUCSCEntity entityDk) { TryUpdateModel(entity); //chong hack entity.ID = model.RecordID; ViewBag.Data = entity; ViewBag.Model = model; CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; //kiem tra quyen han if ((model.RecordID < 1 && !CPViewPage.UserPermissions.Add) || (model.RecordID > 0 && !CPViewPage.UserPermissions.Edit)) { CPViewPage.Message.ListMessage.Add("Quyền hạn chế."); } //kiem tra ten if (entity.Name.Trim() == string.Empty) { CPViewPage.Message.ListMessage.Add("Nhập tên."); } //kiem tra chuyen muc //if (entity.MenuID < 1) // CPViewPage.Message.ListMessage.Add("Chọn chuyên mục."); if (CPViewPage.Message.ListMessage.Count == 0) { //neu khong nhap code -> tu sinh if (entity.Code.Trim() == string.Empty) { entity.Code = Data.GetCode(entity.Name); } //cap nhat state entity.State = GetState(model.ArrState); //save int id = ModDonDangKyUCSCService.Instance.Save(entity); if (model.RecordID > 0) { UpdateOther(entity, model); } else { SaveOther(id, model); } return(true); } return(false); }
public void UpdateOther(ModDonDangKyUCSCEntity entityDk, ModDonDangKyUCSCModel model) { int userId = HL.Lib.Global.CPLogin.UserID; var entity = ModDonDangKyUCSCService.Instance.CreateQuery() //.Where(userId > 0, o => o.UserID == userId) .Where(o => o.Code == entityDk.Code) .ToSingle(); if (entity != null) { DateTime date = DateTime.Now; entityDk.ID = entity.ID; entityDk.UserID = entity.UserID; entityDk.UserID1 = entity.UserID1; 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; } var lstName = tmp[1].Split(','); for (int j = 0; j < lstName.Length; j++) { if (string.IsNullOrEmpty(lstName[j])) { continue; } var entityTmp = new ModHeThongThongTinEntity { DonDangKyUCSCID = entity.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); } ViewBag.HoSo = entityDk; ViewBag.HTTT = entityHTTT; } }
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 UpdateOther(ModDonDangKyUCSCEntity entityDk, ModDonDangKyUCSCModel model) { int userId = HL.Lib.Global.CPLogin.UserID; var entity = ModDonDangKyUCSCService.Instance.CreateQuery() //.Where(userId > 0, o => o.UserID == userId) .Where(o => o.Code == entityDk.Code) .ToSingle(); if (entity != null) { DateTime date = DateTime.Now; entityDk.ID = entity.ID; entityDk.UserID = entity.UserID; entityDk.UserID1 = entity.UserID1; 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 = entity.Activity; 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; } var 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 = model.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; #region ITT UPDATE // LinhVucDaoDao string[] tongHopNhanLucs = model.TongHopNhanLucLVDT.Split('|'); 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 = model.TongHopNhanLucTDDT.Split('|'); 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 = model.TongHopNhanLucCC.Split('|'); 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 = model.TongHopNhanLucNhomATTT.Split('|'); 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 = model.TongHopNhanLucNhomKTPT.Split('|'); 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 = model.TongHopNhanLucNhomKTBV.Split('|'); 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 = model.TongHopNhanLucNhomKTKT.Split('|'); 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)); #endregion ViewBag.HoSo = entityDk; ViewBag.HTTT = entityHTTT; ViewBag.ListTongHopNhanLucLVDT = lstTongHopNhanLucLVDT; ViewBag.ListTongHopNhanLucTDDT = lstTongHopNhanLucTDDT; ViewBag.ListTongHopNhanLucCC = lstTongHopNhanLucCC; ViewBag.ListTongHopNhanLucNhomATTT = lstTongHopNhanLucNhomATTT; ViewBag.ListTongHopNhanLucNhomKTPT = lstTongHopNhanLucNhomKTPT; ViewBag.ListTongHopNhanLucNhomKTBV = lstTongHopNhanLucNhomKTBV; ViewBag.ListTongHopNhanLucNhomKTKT = lstTongHopNhanLucNhomKTKT; } }
private bool ValidSave(ModDonDangKyUCSCModel model, ModDonDangKyUCSCEntity entityDk) { TryUpdateModel(entity); //chong hack entity.ID = model.RecordID; ViewBag.Data = entity; ViewBag.Model = model; CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; //kiem tra quyen han if ((model.RecordID < 1 && !CPViewPage.UserPermissions.Add) || (model.RecordID > 0 && !CPViewPage.UserPermissions.Edit)) { CPViewPage.Message.ListMessage.Add("Quyền hạn chế."); } //kiem tra ten if (entity.Name.Trim() == string.Empty) { CPViewPage.Message.ListMessage.Add("Nhập tên."); } //kiem tra chuyen muc //if (entity.MenuID < 1) // CPViewPage.Message.ListMessage.Add("Chọn chuyên mục."); #region ITT UPDATE var nhanLucs = model.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; } // Parse Nam/Thang tot nghiệp int iThang = 0; int iNam = 0; string[] arrNamThangTotNghiep = nhanLuc[9].Split('/'); if (arrNamThangTotNghiep.Length == 2) // Dinh dang MM/yyyy { iThang = Int32.Parse(arrNamThangTotNghiep[0], 0); iNam = Int32.Parse(arrNamThangTotNghiep[1], 0); } var item = new ModNhanLucUCSCEntity() { DonDangKyUCSCID = entity.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() }; entityNhanLuc.Add(item); } // LinhVucDaoDao string[] tongHopNhanLucs = model.TongHopNhanLucLVDT.Split('|'); 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); if (menuId == 0 || thnl[1].Trim() == "") { continue; } int index = lstTongHopNhanLucLVDT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucLVDT[index].MenuID_Value = Int32.Parse(thnl[1], 0); } // TrinhDoDaoTao tongHopNhanLucs = model.TongHopNhanLucTDDT.Split('|'); 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); if (menuId == 0 || thnl[1].Trim() == "") { continue; } int index = lstTongHopNhanLucTDDT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucTDDT[index].MenuID_Value = Int32.Parse(thnl[1], 0); } // ChungChi tongHopNhanLucs = model.TongHopNhanLucCC.Split('|'); 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); if (menuId == 0 || thnl[1].Trim() == "") { continue; } int index = lstTongHopNhanLucCC.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucCC[index].MenuID_Value = Int32.Parse(thnl[1], 0); } // QuanLyATTT tongHopNhanLucs = model.TongHopNhanLucNhomATTT.Split('|'); 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); if (menuId == 0 || thnl[1].Trim() == "") { continue; } int index = lstTongHopNhanLucNhomATTT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucNhomATTT[index].MenuID_Value = Int32.Parse(thnl[1], 0); } //KyThuatPhongThu tongHopNhanLucs = model.TongHopNhanLucNhomKTPT.Split('|'); 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); if (menuId == 0 || thnl[1].Trim() == "") { continue; } int index = lstTongHopNhanLucNhomKTPT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucNhomKTPT[index].MenuID_Value = Int32.Parse(thnl[1], 0); } // KyThuatBaoVe tongHopNhanLucs = model.TongHopNhanLucNhomKTBV.Split('|'); 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); if (menuId == 0 || thnl[1].Trim() == "") { continue; } int index = lstTongHopNhanLucNhomKTBV.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucNhomKTBV[index].MenuID_Value = Int32.Parse(thnl[1], 0); } tongHopNhanLucs = model.TongHopNhanLucNhomKTKT.Split('|'); 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); if (menuId == 0 || thnl[1].Trim() == "") { continue; } int index = lstTongHopNhanLucNhomKTKT.FindIndex(ind => ind.MenuID == menuId); lstTongHopNhanLucNhomKTKT[index].MenuID_Value = Int32.Parse(thnl[1], 0); } ViewBag.ListTongHopNhanLucLVDT = lstTongHopNhanLucLVDT; ViewBag.ListTongHopNhanLucTDDT = lstTongHopNhanLucTDDT; ViewBag.ListTongHopNhanLucCC = lstTongHopNhanLucCC; ViewBag.ListTongHopNhanLucNhomATTT = lstTongHopNhanLucNhomATTT; ViewBag.ListTongHopNhanLucNhomKTPT = lstTongHopNhanLucNhomKTPT; ViewBag.ListTongHopNhanLucNhomKTBV = lstTongHopNhanLucNhomKTBV; ViewBag.ListTongHopNhanLucNhomKTKT = lstTongHopNhanLucNhomKTKT; #endregion if (CPViewPage.Message.ListMessage.Count == 0) { //neu khong nhap code -> tu sinh if (entity.Code.Trim() == string.Empty) { entity.Code = Data.GetCode(entity.Name); } //cap nhat state entity.State = GetState(model.ArrState); //save int id = ModDonDangKyUCSCService.Instance.Save(entity); if (model.RecordID > 0) { UpdateOther(entity, model); } else { SaveOther(id, model); } return(true); } ViewBag.NhanLuc = entityNhanLuc; return(false); }
public void ActionUpdateDangKyUCSC(ModDonDangKyUCSCEntity entityDk, MHSThanhVienUCSCModel model, string endCode) { int userId = HL.Lib.Global.CPLogin.UserID; 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 = entity.UserID1; 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; } var lstName = tmp[1].Split(','); for (int j = 0; j < lstName.Length; j++) { if (string.IsNullOrEmpty(lstName[j])) { continue; } var entityTmp = new ModHeThongThongTinEntity { DonDangKyUCSCID = entity.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 = model.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; } // Xoa nhan luc hien tai var lst = ModNhanLucUCSCService.Instance.CreateQuery() .Where(o => o.DonDangKyUCSCID == entity.ID) .ToList(); if (lst != null && lst.Count > 0) { lst.ForEach(o => o.Activity = false); ModNhanLucUCSCService.Instance.Save(lst); } // Them nhan luc moi var item = new ModNhanLucUCSCEntity() { DonDangKyUCSCID = entity.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); ViewBag.DangKy = entityDk; ViewBag.HTTT1 = entityHTTT; 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ể."); ViewPage.Navigate("/vn/Thanh-vien/DS-dang-ky-ung-cuu-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"); }