private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { var data = (Person)PersonListBinding.Current; switch (e.ColumnIndex) { case 0: EventConsultationListBinding.DataSource = data.EventConsultations.ToList(); ConsultationListBinding.DataSource = data.Consultations.ToList(); dtgvConsultations.DataSource = ConsultationListBinding; eventConsultationsDtgv.DataSource = EventConsultationListBinding; propertyGrid1.SelectedObject = data; break; case 1: var pg = ControlsFactory.Resolve <ManagePersonPage>(); pg.GetModelData(data); DialogActivator.OpenDialog(pg, $"Edit person detail: {data.FullName}.", () => { HealthCenterService.ModifyProfile(data); }); break; case 2: ExcelReports.GeneratePersonReport(data); break; } }
private async void LoadDetails() { var control = ControlsFactory.ResolveWpfControl <EventsView>(); elementHost1.Child = control; var data = await HealthCenterService.LoadEvents(); EventList = data.ToList(); control.ExportAction = () => { ExcelReports.GenerateEventParticipants(EventList); }; control.ExportSingleAction = (ev) => { ExcelReports.GemerateParticipantEvent(ev); }; control.ViewAction = (obj) => { CurrentEvent = obj; EventLogBinding.DataSource = obj.Logs.ToList(); dtgvPersonevents.DataSource = EventLogBinding; }; control.CreateAction = () => { var pg = ControlsFactory.Resolve <ManageEventsPage>(); var currentevent = new PersonEvents(); pg.GetModelData(currentevent); DialogActivator.OpenDialog(pg, $"New event", () => { HealthCenterService.CreateEvent(currentevent); LoadDetails(); }); }; control.UpdateAction = (obj) => { var pg = ControlsFactory.Resolve <ManageEventsPage>(); var currentevent = obj; pg.GetModelData(currentevent); DialogActivator.OpenDialog(pg, $"Update event {obj.Title}", () => { HealthCenterService.ModifyEvent(currentevent); LoadDetails(); }); }; control.LoadEvents(data); LoadEventParticipantChart(); LoadEventPersonCategoriesChart(); }
public string ExcelReport(DataSourceLoadOptions loadOptions, string test, bool?showSelected, string selectedRecord, bool?only_new, bool?show_classified, string ekk_guid_list) { int?event_id = null; PortalDMTOSModel portalDMTOS = new PortalDMTOSModel(); SYS_AUTHORIZE_USERResult au = JsonConvert.DeserializeObject <SYS_AUTHORIZE_USERResult>(HttpContext.Session.GetString("SYS_AUTHORIZE_USER2_R")); //List<UI_SELECT_GRID_SETTINGS2Result> grid_settings = portalDMTOS.UI_SELECT_GRID_SETTINGS2(au.id, "PRC_SELECT_ORDER_ITEMS_GKI").ToList(); APL_SELECT_PROJECT_STATES_FOR_DDResult delegated_user = JsonConvert.DeserializeObject <APL_SELECT_PROJECT_STATES_FOR_DDResult>(HttpContext.Session.GetString("deleagting_user")); List <PRC_SELECT_ORDER_ITEMS_GKIResult> x = null; if (HttpContext.Session.Keys.Contains("PRC_SELECT_ORDER_ITEMS_GKIResult") && HttpContext.Session.Keys.Contains("PRC_SELECT_ORDER_ITEMS_GKIResult_show_classified") && HttpContext.Session.Keys.Contains("PRC_SELECT_ORDER_ITEMS_GKIResult_only_new") & JsonConvert.DeserializeObject <bool?>(HttpContext.Session.GetString("PRC_SELECT_ORDER_ITEMS_GKIResult_show_classified")) == show_classified & JsonConvert.DeserializeObject <bool?>(HttpContext.Session.GetString("PRC_SELECT_ORDER_ITEMS_GKIResult_only_new")) == only_new) { x = JsonConvert.DeserializeObject <List <PRC_SELECT_ORDER_ITEMS_GKIResult> >(HttpContext.Session.GetString("PRC_SELECT_ORDER_ITEMS_GKIResult")); } else { event_id = portalDMTOS.SYS_START_EVENT(delegated_user.id, "PRC_SELECT_ORDER_ITEMS_GKI", Convert.ToString(show_classified) + "," + Convert.ToString(only_new) + "," + Convert.ToString(delegated_user.id)).FirstOrDefault().event_id; x = portalDMTOS.PRC_SELECT_ORDER_ITEMS_GKI(show_classified, only_new, ekk_guid_list, delegated_user.id, event_id).ToList(); HttpContext.Session.SetString("PRC_SELECT_ORDER_ITEMS_GKIResult", JsonConvert.SerializeObject(x)); HttpContext.Session.SetString("PRC_SELECT_ORDER_ITEMS_GKIResult_only_new", JsonConvert.SerializeObject(only_new)); HttpContext.Session.SetString("PRC_SELECT_ORDER_ITEMS_GKIResult_show_classified", JsonConvert.SerializeObject(show_classified)); } int[] selectedRecordMass = null; if (selectedRecord != null && selectedRecord != "") { selectedRecordMass = selectedRecord.Split(',').Select(Int32.Parse).ToArray(); } if (Convert.ToBoolean(showSelected)) { x = x.Join(selectedRecordMass, y => y.id, m => m, (y, m) => y).ToList(); } DevExtreme.AspNet.Data.ResponseModel.LoadResult loadrResults = DataSourceLoader.Load(x, loadOptions); string j = JsonConvert.SerializeObject(loadrResults.data); List <PRC_SELECT_ORDER_ITEMS_GKIResult> list = JsonConvert.DeserializeObject <List <PRC_SELECT_ORDER_ITEMS_GKIResult> >(j); string templatePath = Path.Combine(_env.ContentRootPath + "\\wwwroot\\AppData\\Templates\\ExcelTemplates", "PRC_SELECT_ORDER_ITEMS_GKI" + ".xlsx"); Guid guid = Guid.NewGuid(); string physicalPath = Path.Combine(_env.ContentRootPath + "\\wwwroot\\AppData\\Templates\\ExcelTemplates", guid + ".xlsx"); System.IO.File.Copy(templatePath, physicalPath); //ExcelReports<PRC_SELECT_ORDER_ITEMS_GKIResult> excel = // new ExcelReports<PRC_SELECT_ORDER_ITEMS_GKIResult>(x,1,1, grid_settings, physicalPath, "PRC_SELECT_ORDER_ITEMS_GKI", 0, null,()=> portalDMTOS.PRC_SELECT_ORDER_ITEMS_GKI(show_classified, only_new, delegated_user.id, event_id).ToList()); ExcelReports <PRC_SELECT_ORDER_ITEMS_GKIResult> excel = new ExcelReports <PRC_SELECT_ORDER_ITEMS_GKIResult>(x, 1, 1, delegated_user.id, physicalPath, "PRC_SELECT_ORDER_ITEMS_GKI", 0, null); excel.ExcelReport(); if (event_id != null) { portalDMTOS.SYS_FINISH_EVENT(event_id, physicalPath); } return(Convert.ToString(guid)); }
public string ExcelReport(DataSourceLoadOptions loadOptions, bool?showSelected, string selectedRecord) { PortalDMTOSModel portalDMTOS = new PortalDMTOSModel(); SYS_AUTHORIZE_USERResult au = JsonConvert.DeserializeObject <SYS_AUTHORIZE_USERResult>(HttpContext.Session.GetString("SYS_AUTHORIZE_USER2_R")); APL_SELECT_PROJECT_STATES_FOR_DDResult delegated_user = JsonConvert.DeserializeObject <APL_SELECT_PROJECT_STATES_FOR_DDResult>(HttpContext.Session.GetString("deleagting_user")); List <OMC_SELECT_SVRResult> x = null; int?event_id = null; if (HttpContext.Session.Keys.Contains("OMC_SELECT_SVR")) { x = JsonConvert.DeserializeObject <List <OMC_SELECT_SVRResult> >(HttpContext.Session.GetString("OMC_SELECT_SVR")); } else { event_id = portalDMTOS.SYS_START_EVENT(delegated_user.id, "OMC_SELECT_SVR", "").FirstOrDefault().event_id; x = portalDMTOS.OMC_SELECT_SVR(event_id, null, delegated_user.id, au.id).ToList(); HttpContext.Session.SetString("OMC_SELECT_SVRResult", JsonConvert.SerializeObject(x)); } int[] selectedRecordMass = null; if (selectedRecord != null && selectedRecord != "") { selectedRecordMass = selectedRecord.Split(',').Select(Int32.Parse).ToArray(); } if (Convert.ToBoolean(showSelected)) { x = x.Join(selectedRecordMass, y => y.id, m => m, (y, m) => y).ToList(); } DevExtreme.AspNet.Data.ResponseModel.LoadResult loadrResults = DataSourceLoader.Load(x, loadOptions); string j = JsonConvert.SerializeObject(loadrResults.data); List <OMC_SELECT_SVRResult> list = JsonConvert.DeserializeObject <List <OMC_SELECT_SVRResult> >(j); string templatePath = Path.Combine(_env.ContentRootPath + "\\wwwroot\\AppData\\ExcelTemplates", "EMPTY" + ".xlsx"); Guid guid = Guid.NewGuid(); string physicalPath = Path.Combine(_env.ContentRootPath + "\\wwwroot\\AppData\\ExportFiles", guid + ".xlsx"); System.IO.File.Copy(templatePath, physicalPath); ExcelReports <OMC_SELECT_SVRResult> excel = new ExcelReports <OMC_SELECT_SVRResult>(list, 1, 1, delegated_user.id, physicalPath, "OMC_SELECT_SVR", 0, null); excel.ExcelReport(); if (event_id != null) { portalDMTOS.SYS_FINISH_EVENT(event_id, physicalPath); } return(Convert.ToString("ExportFiles\\" + guid + ".xlsx")); }
private void exportDataToExcel(DataTable dT, DataTable stats) { string exportPath = @"C:\Cohort\ExcelExtracts"; ExcelReports ER = new ExcelReports(); try { SetControlPropertyThreadSafe(fMain.picProgress, "Image", Properties.Resources.progressWheel5); SetControlPropertyThreadSafe(fMain.lblNotify, "Text", "Exporting Results To Excel...."); ER.ExportToExcel(dT, stats, exportPath); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { SetControlPropertyThreadSafe(fMain.picProgress, "Image", null); SetControlPropertyThreadSafe(fMain.lblNotify, "Text", "Successfully Exported"); } }
private void exportDataToExcel(DataTable dT) { ExcelReports ER = new ExcelReports(); try { SetControlPropertyThreadSafe(picProgress, "Image", Properties.Resources.progressWheel5); SetControlPropertyThreadSafe(lblNotify, "Text", "Exporting To Excel...."); SetControlPropertyThreadSafe(cmdART, "Enabled", false); ER.ExportToExcel(dT, exportPath); } catch (Exception ex) { SetControlPropertyThreadSafe(cmdART, "Text", Assets.Messages.ExportToExcel); MessageBox.Show(ex.Message); } finally { SetControlPropertyThreadSafe(picProgress, "Image", null); SetControlPropertyThreadSafe(lblNotify, "Text", "Successfully Exported"); SetControlPropertyThreadSafe(cmdART, "Enabled", true); SetControlPropertyThreadSafe(cmdART, "Text", Assets.Messages.ViewReport); } }
public string ExportChangeItems(string id_list) { PortalDMTOSModel portalDMTOS = new PortalDMTOSModel(); SYS_AUTHORIZE_USERResult au = JsonConvert.DeserializeObject <SYS_AUTHORIZE_USERResult>(HttpContext.Session.GetString("SYS_AUTHORIZE_USER2_R")); APL_SELECT_PROJECT_STATES_FOR_DDResult delegated_user = JsonConvert.DeserializeObject <APL_SELECT_PROJECT_STATES_FOR_DDResult>(HttpContext.Session.GetString("deleagting_user")); int?event_id = null; List <APL_SELECT_PROJECT_REQUIREMENTS_FOR_CHANGEResult> x = portalDMTOS.APL_SELECT_PROJECT_REQUIREMENTS_FOR_CHANGE(event_id, id_list, delegated_user.id, au.id).ToList(); string j = JsonConvert.SerializeObject(x); List <APL_SELECT_PROJECT_REQUIREMENTS_FOR_CHANGEResult> list = JsonConvert.DeserializeObject <List <APL_SELECT_PROJECT_REQUIREMENTS_FOR_CHANGEResult> >(j); string templatePath = Path.Combine(_env.ContentRootPath + "\\wwwroot\\AppData\\ExcelTemplates", "APL_SELECT_PROJECT_REQUIREMENT_TEMPLATE" + ".xlsx"); Guid guid = Guid.NewGuid(); string physicalPath = Path.Combine(_env.ContentRootPath + "\\wwwroot\\AppData\\ExportFiles", guid + ".xlsx"); System.IO.File.Copy(templatePath, physicalPath); int rowCount = 5; ExcelReports <APL_SELECT_PROJECT_REQUIREMENTS_FOR_CHANGEResult> excel = new ExcelReports <APL_SELECT_PROJECT_REQUIREMENTS_FOR_CHANGEResult>(list, rowCount, 1, delegated_user.id, physicalPath, "APL_SELECT_PROJECT_REQUIREMENT_TEMPLATE", 0, null); foreach (var a in list) { excel.SetValueInCellExport(excel.workSheet, rowCount, 1, a.code, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 2, a.object_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 3, a.subcontractor_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 4, a.project_documentation, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 5, a.project_documentation_date_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 6, a.project_documentation_receive_date_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 7, a.revision_number_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 8, a.revision_number_date_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 9, a.revision_number_receive_date_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 10, a.start_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 11, a.finish_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 12, a.station_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 13, a.description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 14, a.additional_properties, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 15, a.package_contents, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 16, a.unit_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 17, a.quantity_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 18, a.mass_per_unit_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 19, a.mass_size, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 20, a.manufacturer_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 21, a.delivery_type_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 22, a.goods_type_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 23, a.summary, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 24, a.summary2, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 25, a.state_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 26, a.package_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 27, a.in_kd_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 28, a.psd_state_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 29, a.pr_source_description, null); excel.SetValueInCellExport(excel.workSheet, rowCount, 30, a.subcontractor_description, null); rowCount++; } excel.ep.Save(); if (event_id != null) { portalDMTOS.SYS_FINISH_EVENT(event_id, physicalPath); } return(Convert.ToString("ExportFiles\\" + guid + ".xlsx")); }