/// <summary> /// Handles the Click event of the cmdUpload control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> /// <exception cref="System.Exception"> /// No file has been delivered to the server. /// or /// Filesize is zero. /// or /// No filename has been specified. /// or /// Wrong file format has been specified. /// </exception> protected void cmdUpload_Click(object sender, EventArgs e) { HttpPostedFile hFile = null; try { if (ctrlFileUpload.PostedFile == null) { throw new Exception("No file has been delivered to the server."); } hFile = ctrlFileUpload.PostedFile; string pFileName; string pFileNameNoExtension; string pFileExt; byte[] fileData; int pFileLength = hFile.ContentLength; string pContentType = hFile.ContentType; if (pFileLength == 0) { throw new Exception("Filesize is zero."); } if (hFile.FileName == String.Empty) { throw new Exception("No filename has been specified."); } pFileName = System.IO.Path.GetFileName(hFile.FileName); pFileNameNoExtension = System.IO.Path.GetFileNameWithoutExtension(hFile.FileName); pFileExt = System.IO.Path.GetExtension(pFileName).Replace(".", "").ToUpper(); if (pFileExt != "XSL") { throw new Exception("Wrong file format has been specified."); } fileData = new byte[pFileLength]; hFile.InputStream.Read(fileData, 0, pFileLength); int reportID = Convert.ToInt16(HReport_ID.Value); theReports = (IReportIQTools)ObjectFactory.CreateInstance("BusinessProcess.Reports.IQToolsReport, BusinessProcess.Reports"); theReports.UpdateReportXsl(reportID, fileData, pFileNameNoExtension, pFileExt, pContentType, pFileLength); this.PopulateData(); divData.Visible = false; HReport_ID.Value = ""; } catch (Exception Err) { lblError.Text = Err.Message; isError = true; } }
/// <summary> /// Handles the Click event of the DocumentTemplateLink control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void DocumentTemplateLink_Click(object sender, EventArgs e) { theReports = (IReportIQTools)ObjectFactory.CreateInstance("BusinessProcess.Reports.IQToolsReport, BusinessProcess.Reports"); theReports.GetReportbyID(int.Parse(HReport_ID.Value)); string strTemplate = theReports.ReportXslTemplate; byte[] toBytes = System.Text.Encoding.UTF8.GetBytes(strTemplate); IQWebUtils Util = new IQWebUtils(); Util.ExportDocument(toBytes, theReports.ReportTemplateContentType, theReports.ReportTemplateFileName, Response); }
/// <summary> /// Handles the Click event of the btrRefresh control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btrRefresh_Click(object sender, EventArgs e) { try { theReports = (IReportIQTools)ObjectFactory.CreateInstance("BusinessProcess.Reports.IQToolsReport, BusinessProcess.Reports"); theReports.ImportReportsFromIQTools(false); this.PopulateData(); } catch (Exception ex) { IQCareMsgBox.Show("IQToolsNotConfugured", this); } }
/// <summary> /// Populates the data. /// </summary> private void PopulateData() { try { theReports = (IReportIQTools)ObjectFactory.CreateInstance("BusinessProcess.Reports.IQToolsReport, BusinessProcess.Reports"); DataTable reports = theReports.GetReports(); gridResult.DataSource = reports; gridResult.DataBind(); } catch (Exception exp) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = exp.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); Response.Redirect("~/frmFacilityHome.aspx", true); } }
/// <summary> /// Handles the Click event of the buttonReportXML control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void buttonReportXML_Click(object sender, EventArgs e) { theReports = (IReportIQTools)ObjectFactory.CreateInstance("BusinessProcess.Reports.IQToolsReport, BusinessProcess.Reports"); // theReports.GetReportbyID(int.Parse(HReport_ID.Value)); DateTime dateFrom = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); DateTime dateTo = new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 1).AddDays(-1); int cd4Baseline = int.Parse(hCutOffCD4.Value); // int cd4CutOff = (textCD4.Text == "") ? cd4Baseline : int.Parse(textCD4.Text); //DataTable theDT = theQueries.ExecQuery(queryID, dateFrom, dateTo, cd4CutOff); theReports.RunReport(int.Parse(HReport_ID.Value), dateFrom, dateTo, cd4Baseline); string strTemplate = theReports.GetReportData(); byte[] toBytes = System.Text.Encoding.UTF8.GetBytes(strTemplate); IQWebUtils Util = new IQWebUtils(); Util.ExportDocument(toBytes, "text/xml", theReports.ReportName + ".xml", Response); }
/// <summary> /// Handles the Click event of the cmdTFConfirmDelete control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void cmdTFConfirmDelete_Click(object sender, EventArgs e) { try { if (HReport_ID.Value == String.Empty) { throw new Exception("Template was not found."); } theReports = (IReportIQTools)ObjectFactory.CreateInstance("BusinessProcess.Reports.IQToolsReport, BusinessProcess.Reports"); theReports.UpdateReportXsl(int.Parse(HReport_ID.Value), null, "", "", "", 0); //parForceRender = true; //HDataMode.Value = "LIST"; this.PopulateData(); } catch (Exception Err) { lblError.Text = Err.Message; isError = true; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["AppLocation"] == null || Session.Count == 0 || Session["AppUserID"].ToString() == "") { IQCareMsgBox.Show("SessionExpired", this); Response.Redirect("~/frmlogin.aspx", true); } #region Commented Old Code for GenerateCache //System.IO.FileInfo theFileInfo1 = new System.IO.FileInfo(Server.MapPath(".\\XMLFiles\\AllMasters.con").ToString()); //System.IO.FileInfo theFileInfo2 = new System.IO.FileInfo(Server.MapPath(".\\XMLFiles\\DrugMasters.con").ToString()); //System.IO.FileInfo theFileInfo3 = new System.IO.FileInfo(Server.MapPath(".\\XMLFiles\\LabMasters.con").ToString()); //System.IO.FileInfo theFileInfo4 = new System.IO.FileInfo(Server.MapPath(".\\XMLFiles\\Frequency.xml").ToString()); //theFileInfo1.Delete(); //theFileInfo2.Delete(); //theFileInfo3.Delete(); //theFileInfo4.Delete(); //IIQCareSystem theCacheManager = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem,BusinessProcess.Security"); //DataSet theMainDS = theCacheManager.GetSystemCache(); //DataSet WriteXMLDS = new DataSet(); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_CouncellingType"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_CouncellingTopic"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Provider"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Division"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Ward"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_District"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Reason"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Education"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Designation"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Employee"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Occupation"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Province"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Village"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Code"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_HIVAIDSCareTypes"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_ARTSponsor"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_HivDisease"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Assessment"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Symptom"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Decode"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Feature"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Function"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_HivDisclosure"].Copy()); ////WriteXMLDS.Tables.Add(theMainDS.Tables["mst_Satellite"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_LPTF"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_StoppedReason"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_facility"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_HIVCareStatus"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_RelationshipType"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_TBStatus"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_ARVStatus"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_LostFollowreason"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Regimen"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_pmtctDeCode"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Module"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_ModDecode"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_ARVSideEffects"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_ModCode"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Country"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Town"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["VWDiseaseSymptom"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["VW_ICDList"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_RegimenLine"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_Store"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_BlueCode"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_BlueDecode"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_FormBuilderTab"].Copy()); //WriteXMLDS.WriteXml(Server.MapPath(".\\XMLFiles\\").ToString() + "AllMasters.con",XmlWriteMode.WriteSchema); //WriteXMLDS.Tables.Clear(); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Strength"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_FrequencyUnits"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Drug"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Generic"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_DrugType"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Frequency"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_DrugSchedule"].Copy()); //WriteXMLDS.WriteXml(Server.MapPath(".\\XMLFiles\\").ToString() + "DrugMasters.con",XmlWriteMode.WriteSchema); //WriteXMLDS.Tables.Clear(); //WriteXMLDS.Tables.Clear(); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_LabTest"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Lnk_TestParameter"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Lnk_LabValue"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Lnk_ParameterResult"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["LabTestOrder"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_PatientLabPeriod"].Copy()); //WriteXMLDS.WriteXml(Server.MapPath(".\\XMLFiles\\").ToString() + "LabMasters.con",XmlWriteMode.WriteSchema); //WriteXMLDS.Tables.Clear(); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Frequency"].Copy()); //WriteXMLDS.WriteXml(Server.MapPath(".\\XMLFiles\\").ToString() + "Frequency.xml", XmlWriteMode.WriteSchema); #endregion /* * Calling generate cache from common location * Update By: Gaurav * Update Date: 8 July 2014 */ string code = Request.QueryString["Code"].ToString(); try { if ((string.IsNullOrEmpty(code)) || (code == "1")) { IQCareUtils.GenerateCache(true); } else if (code == "2") { try { IReportIQTools IQToolsReport = (IReportIQTools)ObjectFactory.CreateInstance("BusinessProcess.Reports.IQToolsReport,BusinessProcess.Reports"); IQToolsReport.IQToolsRefresh(); } catch (Exception exp) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = exp.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); } } DataSet theDS = new DataSet(); theDS.ReadXml(MapPath("XMLFiles\\ALLMasters.con")); BindFunctions BindManager = new BindFunctions(); IQCareUtils theUtils = new IQCareUtils(); if (theDS.Tables["Mst_Facility"] != null) { DataView theDV = new DataView(theDS.Tables["Mst_Facility"]); theDV.RowFilter = "DeleteFlag=0 and FacilityId=" + Convert.ToInt32(Session["AppLocationId"]); if (theDV.Table != null) { DataTable theDT = (DataTable)theUtils.CreateTableFromDataView(theDV); HttpContext.Current.Session["Billing"] = theDT.Rows[0]["Billing"].ToString(); HttpContext.Current.Session["Wards"] = theDT.Rows[0]["Wards"].ToString(); if (theDT.Rows[0]["PMSCM"].ToString() == "1") { Session["SCMModule"] = "PMSCM"; } else { Session["SCMModule"] = null; } } } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); } finally { Response.Redirect("frmFacilityHome.aspx"); } }
/// <summary> /// Prevents a default instance of the <see cref="IQToolsReport"/> class from being created. /// </summary> public IQToolsReport() { reportIQTools = (IReportIQTools)this; // reportQuery = (IReportQuery)this; }