public void ActionIndex(MInfoMagicModel model) { if (ViewPage.CurrentPage.MenuID > 0) { MenuID = ViewPage.CurrentPage.MenuID; } var dbQuery = ModInfoMagicService.Instance.CreateQuery() .Where(o => o.Activity == true) .Where(State > 0, o => (o.State & State) == State) .WhereIn(MenuID > 0, o => o.MenuID, WebMenuService.Instance.GetChildIDForWeb_Cache("InfoMagic", MenuID, ViewPage.CurrentLang.ID)) .OrderByDesc(o => o.Order) .Take(PageSize) .Skip(PageSize * model.Page); ViewBag.Data = dbQuery.ToList(); model.TotalRecord = dbQuery.TotalRecord; model.PageSize = PageSize; ViewBag.Model = model; }
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 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); } }