Exemple #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ReportingDbContext dbContext, IOptions <DomainDbConfiguration> settings)
        {
            dbContext.Database.EnsureCreated();
            app.UseKledex().EnsureCosmosDbSqlDbCreated(settings);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapRazorPages();
            });
        }
        //Doctor Report
        public string DoctorReferral(DateTime FromDate, DateTime ToDate, string ProviderName)
        {
            //DanpheHTTPResponse<List<DoctorReferralReport>> responseData = new DanpheHTTPResponse<List<DoctorReferralReport>>();
            DanpheHTTPResponse <DataTable> responseData = new DanpheHTTPResponse <DataTable>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                // DoctorReport doctorReport = reportingDbContext.DoctorReport(FromDate, ToDate, ProviderName);
                DataTable doctorreport = reportingDbContext.DoctorReferral(FromDate, ToDate, ProviderName);
                responseData.Status  = "OK";
                responseData.Results = doctorreport;
            }
            catch (Exception ex)
            {
                //Insert exception details into database table.
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }


            return(DanpheJSONConvert.SerializeObject(responseData));



            //return null;
        }
        // GET: /<controller>/
        //used in doctor's module.
        public string DoctorSummary(DateTime FromDate, DateTime ToDate, int ProviderId)
        {
            DanpheHTTPResponse <DataTable> responseData = new DanpheHTTPResponse <DataTable>();

            try
            {
                if (FromDate < ((DateTime)System.Data.SqlTypes.SqlDateTime.MinValue) && ToDate < ((DateTime)System.Data.SqlTypes.SqlDateTime.MinValue))
                {
                    FromDate = System.DateTime.Today;
                    ToDate   = DateTime.Now;
                }
                else if (FromDate > ((DateTime)System.Data.SqlTypes.SqlDateTime.MinValue) && ToDate > ((DateTime)System.Data.SqlTypes.SqlDateTime.MaxValue))
                {
                    ToDate = DateTime.Now;
                }
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DataTable          doctorrSummary     = reportingDbContext.DoctorSummary(FromDate, ToDate, ProviderId);
                responseData.Status  = "OK";
                responseData.Results = doctorrSummary;
            }
            catch (Exception ex)
            {
                //Insert exception details into database table.
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
Exemple #4
0
        public DynamicReport GovReportSummary(DateTime FromDate, DateTime ToDate)
        {
            List <SqlParameter> paramsList = new List <SqlParameter>();

            paramsList.Add(new SqlParameter("@FromDate", FromDate));
            paramsList.Add(new SqlParameter("@ToDate", ToDate));

            ReportingDbContext reportingDbContext = new ReportingDbContext(this.connStr);
            DataSet            dsCtrUsrs          = DALFunctions.GetDatasetFromStoredProc("SP_Report_Gov_Summary", paramsList, reportingDbContext);

            if (dsCtrUsrs != null && dsCtrUsrs.Tables.Count > 0)
            {
                DynamicReport dReport = new DynamicReport();

                //return an anonymous type with counter and user collection..
                var reports = new { OutNEmergServices = dsCtrUsrs.Tables[0], DiagnosticService = dsCtrUsrs.Tables[1] };
                dReport.JsonData = JsonConvert.SerializeObject(reports,
                                                               new IsoDateTimeConverter()
                {
                    DateTimeFormat = "yyyy-MM-dd"
                });
                return(dReport);
            }
            return(null);
        }
        public string DischargedPatientBillBreakup(int VisitId, int PatientId)
        {
            DanpheHTTPResponse <object> responseData = new DanpheHTTPResponse <object>();

            try
            {
                AdmissionDbContext admissionDbContext = new AdmissionDbContext(connString);
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                var result = (from addm in admissionDbContext.Admissions
                              where addm.PatientVisitId == VisitId
                              join visit in admissionDbContext.Visits
                              on addm.PatientVisitId equals visit.PatientVisitId
                              join pat in admissionDbContext.Patients
                              on addm.PatientId equals pat.PatientId

                              from addmInfo in admissionDbContext.PatientBedInfos
                              join ward in admissionDbContext.Wards
                              on addmInfo.WardId equals ward.WardId
                              join bed in admissionDbContext.Beds
                              on addmInfo.BedId equals bed.BedId
                              where addmInfo.PatientVisitId == VisitId
                              select new
                {
                    Patient = new
                    {
                        IPNumber = visit.VisitCode,
                        PatName = pat.FirstName + " " + (string.IsNullOrEmpty(pat.MiddleName) ? "" : pat.MiddleName + " ") + pat.LastName,
                        Address = pat.Address,
                        Age = pat.Age,
                        Gender = pat.Gender,
                        PatientCode = pat.PatientCode,
                        InvoiceDateTime = System.DateTime.Now,
                        AdmissionDate = addm.AdmissionDate,
                        DischargeDate = addm.DischargeDate,
                        AdmittedDoctor = from emp in admissionDbContext.Employees
                                         where emp.EmployeeId == addm.AdmittingDoctorId
                                         select emp.FirstName + " " + (string.IsNullOrEmpty(emp.MiddleName) ? "" : emp.MiddleName + " ") + emp.LastName,
                        Ward = ward.WardName + " " + ward.WardLocation,
                        BedNo = bed.BedNumber
                    }
                }).FirstOrDefault();
                DataTable dischargeBill = reportingDbContext.BillDischargeBreakup(VisitId, PatientId);

                var resultData = new
                {
                    Patient    = result,
                    ReportData = dischargeBill
                };
                responseData.Status  = "OK";
                responseData.Results = resultData;
            }
            catch (Exception ex)
            {
                //Insert exception details into database table.
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
Exemple #6
0
 public static void WarmUpEF()
 {
     using (var context = new ReportingDbContext())
     {
         context.Database.Initialize(false);
     }
     initialized = 9999;     // I'll explain this
 }
Exemple #7
0
 public void Init()
 {
     // warm up EF.
     using (var context = new ReportingDbContext())
     {
         context.Database.Initialize(false);
     }
     // init other stuff
 }
Exemple #8
0
        public DynamicReport PHRM_Daily_StockValue()
        {
            List <SqlParameter> paramsList         = new List <SqlParameter>();
            ReportingDbContext  reportingDbContext = new ReportingDbContext(this.connStr);
            DataSet             dsDailyRev         = DALFunctions.GetDatasetFromStoredProc("SP_Report_PHRM_Daily_StockValue", paramsList, reportingDbContext);

            DynamicReport dReport = new DynamicReport();

            dReport.Schema = null;//we have only one table returning from the database..
            //wee need datetime in yyyy-MM-dd format.
            dReport.JsonData = JsonConvert.SerializeObject(dsDailyRev.Tables[0],
                                                           new IsoDateTimeConverter()
            {
                DateTimeFormat = "yyyy-MM-dd"
            });
            return(dReport);
        }
        public string TotalRevenueFromLab(DateTime FromDate, DateTime ToDate)
        {
            DanpheHTTPResponse <DataTable> responseData = new DanpheHTTPResponse <DataTable>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DataTable          revenuelab         = reportingDbContext.TotalRevenueFromLab(FromDate, ToDate);
                responseData.Status  = "OK";
                responseData.Results = revenuelab;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string PatientAgeRangeNGenderWise()
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      patCounts          = reportingDbContext.Patient_AgeRangeNGenderWiseCount();
                responseData.Status  = "OK";
                responseData.Results = patCounts;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string BillDepartmentSummary(DateTime FromDate, DateTime ToDate)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext repDbContext = new ReportingDbContext(connString);
                DynamicReport      reportData   = repDbContext.BillDepartmentSummary(FromDate, ToDate);
                responseData.Status  = "OK";
                responseData.Results = reportData;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string DoctorwiseOutPatientReport(DateTime FromDate, DateTime ToDate)
        {
            DanpheHTTPResponse <DataTable> responseData = new DanpheHTTPResponse <DataTable>();

            try
            {
                ReportingDbContext repDbContext = new ReportingDbContext(connString);
                DataTable          reportData   = repDbContext.DoctorWisePatientReport(FromDate, ToDate);
                responseData.Status  = "OK";
                responseData.Results = reportData;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string PatientCensusReport(DateTime FromDate, DateTime ToDate, int?ProviderId, int?DepartmentId)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      patCensusReport    = reportingDbContext.PatientCensusReport(FromDate, ToDate, ProviderId, DepartmentId);
                responseData.Status  = "OK";
                responseData.Results = patCensusReport;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        //DistrictWise Report
        public string DistrictWiseAppointmentReport(DateTime FromDate, DateTime ToDate, string CountrySubDivisionName)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext        = new ReportingDbContext(connString);
                DynamicReport      departmentwiseappointment = reportingDbContext.DistrictWiseAppointmentReport(FromDate, ToDate, CountrySubDivisionName);
                responseData.Status  = "OK";
                responseData.Results = departmentwiseappointment;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string LoadDeptListFromFN()
        {
            DanpheHTTPResponse <DataTable> responseData = new DanpheHTTPResponse <DataTable>();

            try
            {
                ReportingDbContext repDbContext  = new ReportingDbContext(connString);
                DataTable          servDeptsName = repDbContext.LoadServDeptsNameFromFN();
                responseData.Status  = "OK";
                responseData.Results = servDeptsName;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        //public string PatientZoneMap()
        //{
        //    DanpheHTTPResponse<DynamicReport> responseData = new DanpheHTTPResponse<DynamicReport>();
        //    try
        //    {
        //        ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
        //        DynamicReport patZoneMap = reportingDbContext.Home_PatientZoneMap();
        //        responseData.Status = "OK";
        //        responseData.Results = patZoneMap;
        //    }
        //    catch (Exception ex)
        //    {
        //        responseData.Status = "Failed";
        //        responseData.ErrorMessage = ex.Message;
        //    }
        //    return DanpheJSONConvert.SerializeObject(responseData);
        //}

        public string DepartmentAppointmentsTotal()
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      deptAppts          = reportingDbContext.Home_DeptWise_TotalAppointmentCount();
                responseData.Status  = "OK";
                responseData.Results = deptAppts;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string BILLDsbCntrUsrCollection(DateTime fromDate, DateTime toDate, int?counterId)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      cntrDayData        = reportingDbContext.BIL_Daily_CounterNUsersCollection(fromDate, toDate);
                responseData.Status  = "OK";
                responseData.Results = cntrDayData;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string HomeDashboardStats()
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      dsbStats           = reportingDbContext.Home_DashboardStatistics();
                responseData.Status  = "OK";
                responseData.Results = dsbStats;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string MonthlyBillingTrend()
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      dailyRevenue       = reportingDbContext.BIL_Monthly_BillingTrend();
                responseData.Status  = "OK";
                responseData.Results = dailyRevenue;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        //Income segregation report
        public string IncomeSegregation(DateTime FromDate, DateTime ToDate)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      incomeSegregation  = reportingDbContext.BIL_Daily_IncomeSegregation(FromDate, ToDate);
                responseData.Status  = "OK";
                responseData.Results = incomeSegregation;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        //DistrictWise Report
        public string DepartmentWiseAppointmentReport(DateTime FromDate, DateTime ToDate, string DepartmentName)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      departmentwiseappointmentReport = reportingDbContext.DepartmentWiseAppointmentReport(FromDate, ToDate, DepartmentName);
                responseData.Status  = "OK";
                responseData.Results = departmentwiseappointmentReport;
            }
            catch (Exception ex)
            {
                //Insert exception details into database table.
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        //Department wise Sales Daybook report
        public string PatientBillHistory(DateTime?FromDate, DateTime?ToDate, string PatientCode)
        {
            DanpheHTTPResponse <PatientBillHistoryMaster> responseData = new DanpheHTTPResponse <PatientBillHistoryMaster>();

            try
            {
                ReportingDbContext       reportingDbContext = new ReportingDbContext(connString);
                PatientBillHistoryMaster paitbillhistory    = reportingDbContext.PatientBillHistory(FromDate, ToDate, PatientCode);
                responseData.Status  = "OK";
                responseData.Results = paitbillhistory;
            }
            catch (Exception ex)
            {
                //Insert exception details into database table.
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        //Total Admitted Patient
        public string TotalAdmittedPatient()
        {
            DanpheHTTPResponse <DataTable> responseData = new DanpheHTTPResponse <DataTable>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DataTable          deptsalesdaybook   = reportingDbContext.TotalAdmittedPatient();
                responseData.Status  = "OK";
                responseData.Results = deptsalesdaybook;
            }
            catch (Exception ex)
            {
                //Insert exception details into database table.
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        //Radiology Revenue Generated Report
        public string RevenueGenerated(DateTime FromDate, DateTime ToDate)
        {
            DanpheHTTPResponse <DataTable> responseData = new DanpheHTTPResponse <DataTable>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DataTable          revenuegenerated   = reportingDbContext.RevenueGenerated(FromDate, ToDate);
                responseData.Status  = "OK";
                responseData.Results = revenuegenerated;
            }
            catch (Exception ex)
            {
                //Insert exception details into database table.
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string CategoryWiseLabReport(DateTime FromDate, DateTime ToDate)
        {
            DanpheHTTPResponse <DynamicReport> responseData1 = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext    = new ReportingDbContext(connString);
                DynamicReport      categorywiselabreport = reportingDbContext.CategoryWiseLabReport(FromDate, ToDate);
                responseData1.Status  = "OK";
                responseData1.Results = categorywiselabreport;
            }
            catch (Exception ex)
            {
                //Insert exception details into database table.
                responseData1.Status       = "Failed";
                responseData1.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData1));
        }
Exemple #26
0
        private DataSet GetDatasetFromStoredProc(string storedProcName, List <SqlParameter> ipParams, string connString)
        {
            // creates resulting dataset
            var result  = new DataSet();
            var context = new ReportingDbContext(connString);
            // creates a Command
            var cmd = context.Database.Connection.CreateCommand();

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = storedProcName;

            if (ipParams != null && ipParams.Count > 0)
            {
                foreach (var param in ipParams)
                {
                    cmd.Parameters.Add(param);
                }
            }

            try
            {
                // executes
                context.Database.Connection.Open();
                var reader = cmd.ExecuteReader();

                // loop through all resultsets (considering that it's possible to have more than one)
                do
                {
                    // loads the DataTable (schema will be fetch automatically)
                    var tb = new DataTable();
                    tb.Load(reader);
                    result.Tables.Add(tb);
                } while (!reader.IsClosed);

                return(result);
            }
            finally
            {
                // closes the connection
                context.Database.Connection.Close();
            }
        }
        //Daily Sales Report
        public string DailyAppointmentReport(DateTime FromDate, DateTime ToDate, string Doctor_Name, string AppointmentType)
        {
            //DanpheHTTPResponse<List<DailyAppointmentReport>> responseData = new DanpheHTTPResponse<List<DailyAppointmentReport>>();
            DanpheHTTPResponse <DataTable> responseData = new DanpheHTTPResponse <DataTable>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DataTable          dailyappointment   = reportingDbContext.DailyAppointmentReport(FromDate, ToDate, Doctor_Name, AppointmentType);

                responseData.Status  = "OK";
                responseData.Results = dailyappointment;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        //DistrictWise Report
        public string PatientCreditBillSummary(DateTime FromDate, DateTime ToDate)
        {
            //DanpheHTTPResponse<List<PatientWiseCollectionReport>> responseData = new DanpheHTTPResponse<List<PatientWiseCollectionReport>>();
            DanpheHTTPResponse <DataTable> responseData = new DanpheHTTPResponse <DataTable>();

            try
            {
                ReportingDbContext reportingDbContext    = new ReportingDbContext(connString);
                DataTable          patientwiseCollection = reportingDbContext.BIL_PatientCreditSummary(FromDate, ToDate);
                responseData.Status  = "OK";
                responseData.Results = patientwiseCollection;
            }
            catch (Exception ex)
            {
                //Insert exception details into database table.
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        //DistrictWise Report
        public string SalesPurchaseTrainedCompanion(DateTime FromDate, DateTime ToDate, string Status, string ItemIdCommaSeprated)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      phrmGraph          = reportingDbContext.GetSalesPurchaseTrainedCompanion(FromDate, ToDate, Status, ItemIdCommaSeprated);
                responseData.Status  = "OK";
                responseData.Results = phrmGraph;
            }
            catch (Exception ex)
            {
                //Insert exception details into database table.
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }


            return(DanpheJSONConvert.SerializeObject(responseData));
        }
Exemple #30
0
        public string Get(string reqType, DateTime FromDate, DateTime ToDate, string LogType, string Table_Name, string UserName)
        {
            DanpheHTTPResponse <List <object> > responseData    = new DanpheHTTPResponse <List <object> >();
            DanpheHTTPResponse <object>         responseDataObj = new DanpheHTTPResponse <object>();

            try
            {
                RbacDbContext rbacDbContext = new RbacDbContext(connString);

                if (reqType == "getDBBakupLog")
                {
                    SystemAdminDbContext systemAdminDbContext = new SystemAdminDbContext(this.connStringAdmin);
                    var result = (from dbBackupLog in systemAdminDbContext.DatabaseLog
                                  orderby dbBackupLog.CreatedOn descending
                                  select new
                    {
                        CreatedOn = dbBackupLog.CreatedOn,
                        FileName = dbBackupLog.FileName,
                        DatabaseName = dbBackupLog.DatabaseName,
                        DatabaseVersion = dbBackupLog.DatabaseVersion,
                        Action = dbBackupLog.Action,
                        Status = dbBackupLog.Status,
                        MessageDetail = dbBackupLog.MessageDetail,
                        FolderPath = dbBackupLog.FolderPath,
                        IsActive = dbBackupLog.IsActive,
                        IsDBRestorable = dbBackupLog.IsDBRestorable
                    }
                                  ).ToList <object>();
                    responseData.Results = result;
                    responseData.Status  = "OK";
                }
                #region DanpheAuditTrail Details
                else if (reqType == "get-audit-trail-details")
                {
                    ReportingDbContext             dbContext = new ReportingDbContext(this.connStringAdmin);
                    DanpheHTTPResponse <DataTable> resData   = new DanpheHTTPResponse <DataTable>();
                    DataTable res = dbContext.AuditTrails(FromDate, ToDate, Table_Name, UserName);

                    responseDataObj.Results = res;
                    responseDataObj.Status  = "OK";
                    return(DanpheJSONConvert.SerializeObject(responseDataObj, true));
                }
                #endregion
                #region DanpheAuditList Details
                else if (reqType == "get-audit-list")
                {
                    ReportingDbContext dbContext = new ReportingDbContext(this.connStringAdmin);
                    var userList = (from rbac in rbacDbContext.Users
                                    select new
                    {
                        UserName = rbac.UserName
                    }).ToList <object>();

                    var tableNameList = dbContext.AuditTrailList().Select(s => new { Table_Name = s.Table_Name }).ToList();

                    responseDataObj.Results = new
                    {
                        UserList      = userList,
                        TableNameList = tableNameList
                    };

                    responseDataObj.Status = "OK";
                    return(DanpheJSONConvert.SerializeObject(responseDataObj, true));
                }
                #endregion
                else if (reqType == "get-login-info")
                {
                    SystemAdminDbContext systemAdminDbContext = new SystemAdminDbContext(this.connStringAdmin);

                    var loginList = systemAdminDbContext.LoginInformation
                                    .Where(log => DbFunctions.TruncateTime(log.CreatedOn) >= FromDate && DbFunctions.TruncateTime(log.CreatedOn) <= ToDate).ToList();

                    responseDataObj.Status  = "OK";
                    responseDataObj.Results = loginList;
                    return(DanpheJSONConvert.SerializeObject(responseDataObj, true));
                }
                else if (reqType == "getIRDInvoiceDetails")
                {
                    //We are calling from ReportingDbContext because of problem from admin db context
                    ReportingDbContext         dbContext = new ReportingDbContext(this.connString);
                    List <InvoiceDetailsModel> res       = dbContext.InvoiceDetails(FromDate, ToDate);
                    DanpheHTTPResponse <List <InvoiceDetailsModel> > resData = new DanpheHTTPResponse <List <InvoiceDetailsModel> >();
                    resData.Results = res;
                    resData.Status  = "OK";
                    return(DanpheJSONConvert.SerializeObject(resData, true));
                }
                else if (reqType == "getPhrmIRDInvoiceDetails")
                {
                    ReportingDbContext        dbContext = new ReportingDbContext(this.connString);
                    List <PhrmInvoiceDetails> res       = dbContext.PhrmInvoiceDetails(FromDate, ToDate);
                    DanpheHTTPResponse <List <PhrmInvoiceDetails> > resData = new DanpheHTTPResponse <List <PhrmInvoiceDetails> >();
                    resData.Results = res;
                    resData.Status  = "OK";
                    return(DanpheJSONConvert.SerializeObject(resData, true));
                }
                else if (reqType == "getDbActivityLogDetails")
                {
                    //use admin-db's connection string to get db-activity log
                    ReportingDbContext dbContext = new ReportingDbContext(this.connStringAdmin);
                    DanpheHTTPResponse <List <SqlAuditModel> > resData = new DanpheHTTPResponse <List <SqlAuditModel> >();
                    List <SqlAuditModel> res = dbContext.SqlAuditDetails(FromDate, ToDate, LogType);
                    resData.Results = res;
                    resData.Status  = "OK";
                    return(DanpheJSONConvert.SerializeObject(resData, true));
                }
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message + " exception details:" + ex.ToString();
            }
            return(DanpheJSONConvert.SerializeObject(responseData, true));
        }