public static IReport CreateInstance(ReportCatalog reportCatalog) { if (reportCatalog == ReportCatalog.Raya) { return(new RayaReport()); } else if (reportCatalog == ReportCatalog.Fonacot) { return(new FonacotReport()); } return(new RayaReport()); }
public UpdateReportCatalogPage(ReportCatalog report) { InitializeComponent(); var viewModel = new UpdateReportCatalogViewModel(); viewModel.ReportCatalogId = report; BindingContext = viewModel; var reportid = report.id; MessagingCenter.Send(new PassIdPatient() { idPatient = reportid }, "UpdateReportId"); }
protected void GetReportCatalog(string strReportGroup) { List <ReportCatalog> rclist = new List <ReportCatalog>(); ReportCatalog rc = null; DataTable dt = WebHelper.bllReport.GetlistByDisplay(me.ID, Convert.ToInt32(me.DatabaseID), me.ReportGroup, me.rp_view, me.ViewLevel); foreach (DataRow dr in dt.Rows) { rc = new ReportCatalog() { ID = Convert.ToInt32(dr["ID"]), DATABASEID = Convert.ToInt32(dr["DATABASEID"]), REPORTNAME = dr["REPORTNAME"] as string, REPORTGROUP = Convert.ToInt32(dr["REPORTGROUPLIST"]), CATEGORY = Convert.ToInt32(dr["CATEGORY"]), TYPE = Convert.ToInt32(dr["TYPE"]), DEFAULTFORMAT = Convert.ToInt32(dr["DEFAULTFORMAT"]), }; rclist.Add(rc); } //v1.2.0 - Cheong - 2016/07/14 - Add support for report category filtering if (!String.IsNullOrEmpty(strReportGroup)) { REPORTGROUP rpgrp = WebHelper.bllrpGroup.GetModelList(me.ID, String.Empty).Where(x => (x.DATABASEID == me.DatabaseID) && (x.NAME == strReportGroup)).FirstOrDefault(); if (rpgrp != null) { rclist = rclist.Where(x => x.REPORTGROUP == rpgrp.ID).ToList(); } } DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(ReportCatalog[])); MemoryStream ms = new MemoryStream(); serializer.WriteObject(ms, rclist.ToArray()); this.p_fSuppressRender = true; Response.Clear(); Response.ContentType = "application/json; charset=utf-8"; Response.ContentEncoding = Encoding.UTF8; ms.WriteTo(Response.OutputStream); HttpContext.Current.ApplicationInstance.CompleteRequest(); }
/// <summary> /// This method executes when the user clicks the delete button for an Report Catalog Item /// and it deletes the Report Catalog Item from the database /// </summary> /// <param name="sender">The lbDeleteReportCatalogItem LinkButton</param> /// <param name="e">The Click event</param> protected void lbDeleteReportCatalogItem_Click(object sender, EventArgs e) { if (currentProgramRole.AllowedToEdit.Value) { //Get the PK from the hidden field int?removeReportCatalogItemPK = String.IsNullOrWhiteSpace(hfDeleteReportCatalogItemPK.Value) ? (int?)null : Convert.ToInt32(hfDeleteReportCatalogItemPK.Value); if (removeReportCatalogItemPK.HasValue) { using (PyramidContext context = new PyramidContext()) { //Get the ReportCatalogItem to remove ReportCatalog ReportCatalogItemToRemove = context.ReportCatalog.Where(rc => rc.ReportCatalogPK == removeReportCatalogItemPK).FirstOrDefault(); //Remove the ReportCatalogItem from the database context.ReportCatalog.Remove(ReportCatalogItemToRemove); context.SaveChanges(); //Show a delete success message msgSys.ShowMessageToUser("success", "Success", "Successfully deleted the Report Catalog Item!", 1000); //Bind the gridview bsGRReports.DataBind(); } } else { msgSys.ShowMessageToUser("danger", "Error", "Could not find the Report Catalog Item to delete!", 120000); } } else { //Not allowed to delete, show a message msgSys.ShowMessageToUser("danger", "Error", "You are not authorized to make changes!", 120000); } }
private async void Update_ReportCatalog(object sender, EventArgs e) { TappedEventArgs tappedEventArgs = (TappedEventArgs)e; ReportCatalog report = ((ReportCatalogViewModel)BindingContext).ReportCatalogs.Where(ser => ser.id == (int)tappedEventArgs.Parameter).FirstOrDefault(); await PopupNavigation.Instance.PushAsync(new UpdateReportCatalogPage(report)); }
/// <summary> /// /// </summary> /// <param name="id"></param> private void BindList(string id, ReportCatalog catalogEnum) { string catalog = EnumHandler<ReportCatalog>.GetStringFromEnum(catalogEnum); IList<InstalmentOfCompensationInfo> cList = new InstalmentOfCompensation().GetList(id, catalog); InstalmentOfCompensationInfo cInfo = new InstalmentOfCompensationInfo(); cList.Add(cInfo); gvList.DataSource = cList; gvList.DataBind(); }
/// <summary> /// /// </summary> /// <param name="id"></param> private void BindList(string id, ReportCatalog catalogEnum) { string catalog = EnumHandler<ReportCatalog>.GetStringFromEnum(catalogEnum); IList<InstalmentOfCompensationInfo> cList = new InstalmentOfCompensation().GetList(id, catalog); InstalmentOfCompensationInfo cInfo = new InstalmentOfCompensationInfo(); cList.Add(cInfo); if (catalogEnum == ReportCatalog.InsuranceOfShip) { gvShipList.DataSource = cList; gvShipList.DataBind(); } else if (catalogEnum == ReportCatalog.InsuranceOfCompensation) { gvCompensationList.DataSource = cList; gvCompensationList.DataBind(); } }
private ReportBaseInfo GetReport(ReportCatalog rType, string id) { ReportBaseInfo rInfo = new ReportBaseInfo(); switch (rType) { case ReportCatalog.Wuliao: rInfo = new ReportBase<WuliaoInputInfo>().GetReport(id); break; case ReportCatalog.Xiuli: rInfo = new ReportBase<XiuliInputInfo>().GetReport(id); break; case ReportCatalog.Jianyan: rInfo = new ReportBase<JianyanInputInfo>().GetReport(id); break; case ReportCatalog.Beijian: rInfo = new ReportBase<BeijianInputInfo>().GetReport(id); break; default: break; } return rInfo; }
protected void Page_Load(object sender, EventArgs e) { //Get the user's current program role currentProgramRole = Utilities.GetProgramRoleFromSession(Session); //Get the file PK from the query string if (!string.IsNullOrWhiteSpace(Request.QueryString["UserFileUploadPK"])) { int.TryParse(Request.QueryString["UserFileUploadPK"], out filePK); } else if (!string.IsNullOrWhiteSpace(Request.QueryString["ReportCatalogPK"])) { int.TryParse(Request.QueryString["ReportCatalogPK"], out reportCatalogPK); } //Get the file information from the database if (filePK > 0) { using (PyramidContext context = new PyramidContext()) { //Get the file record currentFile = context.UserFileUpload.AsNoTracking() .Where(ufu => ufu.UserFileUploadPK == filePK) .FirstOrDefault(); //Check to see if the file record exists if (currentFile == null) { //The file record doesn't exist, set to a default currentFile = new UserFileUpload(); } } } else { currentFile = new UserFileUpload(); } if (reportCatalogPK > 0) { using (PyramidContext context = new PyramidContext()) { //Get the report catalog record currentReportCatalog = context.ReportCatalog.AsNoTracking() .Where(rc => rc.ReportCatalogPK == reportCatalogPK) .FirstOrDefault(); //Check to see if the report catalog record exists if (currentReportCatalog == null) { //The report catalog record doesn't exist, set to a default currentReportCatalog = new ReportCatalog(); } } } else { currentReportCatalog = new ReportCatalog(); } //Don't allow users to view files from other programs if (currentFile.UserFileUploadPK > 0) { if (currentFile.TypeCodeFK == (int)Utilities.FileTypeFKs.STATE_WIDE && currentProgramRole.StateFK.Value != currentFile.StateFK.Value) { //This is a state-wide file and the user is not logged in under that state lblMessage.Text = "No file found..."; } else if (currentFile.TypeCodeFK == (int)Utilities.FileTypeFKs.HUB_WIDE && currentProgramRole.HubFK.Value != currentFile.HubFK.Value) { //This is a hub-wide file and the user is not logged in under that hub lblMessage.Text = "No file found..."; } else if (currentFile.TypeCodeFK == (int)Utilities.FileTypeFKs.PROGRAM_WIDE && !currentProgramRole.ProgramFKs.Contains(currentFile.ProgramFK.Value)) { //This is a program-wide file and the user is not allowed to see that cohort lblMessage.Text = "No file found..."; } else if (currentFile.TypeCodeFK == (int)Utilities.FileTypeFKs.COHORT_WIDE && !currentProgramRole.CohortFKs.Contains(currentFile.CohortFK.Value)) { //This is a cohort-wide file and the user is not allowed to see that cohort lblMessage.Text = "No file found..."; } else { //Get the file URL from Azure storage string fileLink = Utilities.GetFileLinkFromAzureStorage(currentFile.FileName, currentFile.FileName.Contains(".pdf"), Utilities.ConstantAzureStorageContainerName.UPLOADED_FILES.ToString()); //Redirect the user to the file link Response.Redirect(fileLink); } } else if (!string.IsNullOrWhiteSpace(currentReportCatalog.DocumentationLink)) { //Get the file path string baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/'); string filePath = currentReportCatalog.DocumentationLink.Replace("~", baseUrl); //Redirect the user to the file link Response.Redirect(filePath); } else { lblMessage.Text = "No file found..."; } }