public int UpdateStatus(ReportCriteria ReportParams, string Action)
        {
            InsuranceClasses.Service.Insurance I = new InsuranceClasses.Service.Insurance();
            //CHGXXXXXXX - CH1 - Server Upgrade 4.6.1 - Removing the methods with respect to Membership - March 2016
            int i = 0;
            int m = 0;

            try {
                StartTransaction();
                SqlCommand Cmd = GetCommand("PAY_Update_Status");
                ReportParams.CopyTo(Cmd);
                Cmd.Parameters["@Application"].Value = "APDS";
                Cmd.Parameters["@Action"].Value      = Action;
                SqlDataReader  Reader   = Cmd.ExecuteReader();
                ArrayOfReceipt Receipts = new ArrayOfReceipt(Reader);
                Reader.Close();
                i = I.UpdateStatus(ReportParams, Receipts, Action);
                //CHGXXXXXXX - CH1 - Server Upgrade 4.6.1 - Removing the methods with respect to Membership - March 2016
                I.CompleteTransaction(i, true);
                //CHGXXXXXXX - CH1 - Server Upgrade 4.6.1 - Removing the methods with respect to Membership - March 2016
                CompleteTransaction(true);
                return(Receipts.Count);
            } catch (Exception e) {
                try { if (i != 0)
                      {
                          I.CompleteTransaction(i, false);
                      }
                } catch {}
                //CHGXXXXXXX - CH1 - Server Upgrade 4.6.1 - Removing the methods with respect to Membership - March 2016
                try { CompleteTransaction(false); } catch {}
                throw new Exception("Exception occured processing UpdateStatus in TurninWebService.", e);
            }
        }
        public string ReceiptReIssue(ReportCriteria ReportParams)
        {
            InsuranceClasses.Service.Insurance I = new InsuranceClasses.Service.Insurance();
            //CHGXXXXXXX - CH1 - Server Upgrade 4.6.1 - Removing the methods with respect to Membership - March 2016
            int i = 0;
            int m = 0;

            try {
                StartTransaction();
                SqlCommand Cmd = GetCommand("PAY_Reissue_Receipt");
                ReportParams.CopyTo(Cmd);
                Cmd.Parameters["@Application"].Value = "APDS";
                Cmd.ExecuteNonQuery();
                string NewReceiptNumber = (string)Cmd.Parameters["@NewReceiptNumber"].Value;
                if (NewReceiptNumber != null && NewReceiptNumber.Length > 0)
                {
                    i = I.ReIssueReceipt(ReportParams, NewReceiptNumber);
                    I.CompleteTransaction(i, true);                      // Modified by Cognizant on 3/3/2005 to commint transaction
                    //CHGXXXXXXX - CH1 - Server Upgrade 4.6.1 - Removing the methods with respect to Membership - March 2016
                }
                CompleteTransaction(true);
                return(NewReceiptNumber);
            } catch (Exception e) {
                try { if (i != 0)
                      {
                          I.CompleteTransaction(i, false);
                      }
                } catch {}
                //CHGXXXXXXX - CH1 - Server Upgrade 4.6.1 - Removing the methods with respect to Membership - March 2016
                try { CompleteTransaction(false); } catch {}
                throw new Exception("Exception occured processing ReceiptReIssue in TurninWebService.", e);
            }
        }
Example #3
0
        public static List <ReportEntity> GetStockLedger(ReportCriteria criteria)
        {
            List <ReportEntity> lstData = new List <ReportEntity>();

            using (SqlDataHelper helper = new SqlDataHelper(ConnectionString))
            {
                helper.CommandText = "[rpt].[sp_rpt_STOCKREGISTER]";
                helper.CommandType = CommandType.StoredProcedure;
                helper.Parameters.Add("@StartDate", criteria.FromDate);
                helper.Parameters.Add("@EndDate", criteria.ToDate);
                //helper.Parameters.Add("@Mode", criteria.FromDate);
                //helper.Parameters.Add("@OBDate", criteria.FromDate);
                //helper.Parameters.Add("@ItemCode", criteria.FromDate);
                helper.Open();
                helper.ExecuteReader(CommandBehavior.CloseConnection);

                while (helper.DataReader.Read())
                {
                    ReportEntity report = new ReportEntity(helper.DataReader);
                    report.LoadStockLedger(helper.DataReader);
                    lstData.Add(report);
                }

                helper.Close();
            }

            return(lstData);
        }
Example #4
0
        public static List <ReportEntity> GetBillWiseSaleRefund(ReportCriteria criteria)
        {
            List <ReportEntity> lstData = new List <ReportEntity>();

            using (SqlDataHelper helper = new SqlDataHelper(ConnectionString))
            {
                helper.CommandText = "[dbo].[sp_rpt_SALEREFUNDREGISTER]";
                helper.CommandType = CommandType.StoredProcedure;
                helper.Parameters.Add("@TranType", criteria.TransactionType);
                helper.Parameters.Add("@StartDate", criteria.FromDate);
                helper.Parameters.Add("@EndDate", criteria.ToDate);
                helper.Open();
                helper.ExecuteReader(CommandBehavior.CloseConnection);

                while (helper.DataReader.Read())
                {
                    ReportEntity report = new ReportEntity();
                    report.LoadBillWiseSaleRefund(helper.DataReader);
                    lstData.Add(report);
                }

                helper.Close();
            }

            return(lstData);
        }
        public async Task <ApiResponse <string> > GetReports([FromBody] ReportCriteria criteria)
        {
            var apiResponse = new ApiResponse <string>()
            {
                ReportCriteria = criteria
            };

            try
            {
                var resultCriteria = _reportEngine.BuildQuery(criteria);
                var resultQuery    = await _reportEngine.ExecuteQuery <string>(resultCriteria.SqlStatement, resultCriteria.SqlParameters);

                var doc = new XmlDocument();
                doc.LoadXml(resultQuery);
                var jsonResult = JsonConvert.SerializeXmlNode(doc);

                //remove @ from output json
                var jsonText = Regex.Replace(jsonResult, "(?<=\")(@)(?!.*\":\\s )", string.Empty, RegexOptions.IgnoreCase);

                apiResponse.Data       = jsonText;
                apiResponse.Pagination = await _reportEngine.GetPaginationInfo(criteria);
            }
            catch (Exception e)
            {
                apiResponse.Status.SetError(1, "Error GetReports: ", e);
            }
            return(apiResponse);
        }
        public async Task <string> GetReportsInXml([FromBody] ReportCriteria criteria)
        {
            var resultCriteria = _reportEngine.BuildQuery(criteria);
            var resultQuery    = await _reportEngine.ExecuteQuery <string>(resultCriteria.SqlStatement, resultCriteria.SqlParameters);

            return(resultQuery);
        }
Example #7
0
        public static List <ReportEntity> GetCashierWiseSale(ReportCriteria criteria)
        {
            List <ReportEntity> lstData = new List <ReportEntity>();

            using (SqlDataHelper helper = new SqlDataHelper(ConnectionString))
            {
                helper.CommandText = "[dbo].[sp_rpt_CASHIERWISESALE]";
                helper.CommandType = CommandType.StoredProcedure;
                helper.Parameters.Add("@Mode", criteria.CashierId);
                helper.Parameters.Add("@StartDate", criteria.FromDate);
                helper.Parameters.Add("@EndDate", criteria.ToDate);
                helper.Open();
                helper.ExecuteReader(CommandBehavior.CloseConnection);

                while (helper.DataReader.Read())
                {
                    ReportEntity report = new ReportEntity();
                    report.LoadCashierWiseSale(helper.DataReader);
                    lstData.Add(report);
                }

                helper.Close();
            }

            return(lstData);
        }
Example #8
0
        private string GetCriteriaOrder(ReportCriteria criteria)
        {
            var sbOrderFields    = new StringBuilder();
            var commaPlaceHolder = string.Empty;

            foreach (var orderField in criteria.OrderBy)
            {
                if (!string.IsNullOrEmpty(orderField.Field))
                {
                    if (orderField.Field == "default")
                    {
                        continue;
                    }

                    sbOrderFields.Append(commaPlaceHolder);
                    if (!string.IsNullOrEmpty(orderField.LookupTable) && !string.IsNullOrEmpty(orderField.LookupField))
                    {
                        sbOrderFields.Append($"[{orderField.LookupTable}].[{orderField.LookupField}]");
                    }
                    else
                    {
                        sbOrderFields.Append($"[{criteria.MainTable}].[{orderField.Field}]");
                    }

                    commaPlaceHolder = ", ";
                }
            }
            return(sbOrderFields.ToString());
        }
        public DataSet GetReceiptDetails(ReportCriteria ReportParams)
        {
            //SqlCommand Cmd = GetCommand("PAY_Get_Receipt_Details");
            //CHG0129017 - Removal of Linked server - Start//
            DataSet ds = new DataSet();

            try
            {
                string        rep = Config.Setting("ConnectionString.ReadonlyDBInstance");
                SqlConnection con = new SqlConnection(rep);
                con.Open();
                SqlCommand Cmd = new SqlCommand("PAY_Get_Receipt_Details", con);
                Cmd.CommandType = CommandType.StoredProcedure;
                //CHG0129017 - Removal of Linked server - End//
                ReportParams.CopyTo(Cmd);
                SqlDataAdapter sqlDa = new SqlDataAdapter(Cmd);
                sqlDa.Fill(ds);
                con.Close();
            }
            catch (Exception e)
            {
                Logger.Log(e);
            }
            return(ds);
        }
        private void GenerateSummaryReport()
        {
            ReportBLL cls     = new ReportBLL();
            string    rptName = "";

            if (chkDetails.Checked == true)
            {
                rptName = "CashierWiseSaleDetail";
            }
            else
            {
                rptName = "CashierWiseSaleSummary";
            }
            LocalReportManager reportManager = new LocalReportManager(rptViewer, rptName, ConfigurationManager.AppSettings["ReportNamespace"].ToString(), ConfigurationManager.AppSettings["ReportPath"].ToString());
            ReportCriteria     criteria      = new ReportCriteria();

            BuildCriteria(criteria);
            List <ReportEntity> lstData = ReportBLL.GetCashierWiseSale(criteria);

            ReportDataSource dsGeneral = new ReportDataSource("dsReportData", lstData);

            reportManager.AddParameter("FromDate", txtFromDt.Text.Trim());
            reportManager.AddParameter("ToDate", txtToDt.Text.Trim());
            reportManager.AddDataSource(dsGeneral);
            reportManager.Show();
        }
Example #11
0
        private string GetCriteriaSelect(ReportCriteria criteria)
        {
            var sbSelectFields   = new StringBuilder();
            var commaPlaceHolder = string.Empty;

            foreach (var displayField in criteria.DisplayFields)
            {
                if (displayField.Field == "default")
                {
                    continue;
                }
                sbSelectFields.Append(commaPlaceHolder);
                if (!string.IsNullOrEmpty(displayField.LookupTable) && !string.IsNullOrEmpty(displayField.LookupField))
                {
                    sbSelectFields.Append($"[{displayField.LookupTable}].[{displayField.LookupField}] as [{displayField.Caption}]");
                }
                else
                {
                    sbSelectFields.Append($"[{criteria.MainTable}].[{displayField.Field}] as [{displayField.Caption}]");
                }

                commaPlaceHolder = ", ";
            }
            return(sbSelectFields.ToString());
        }
Example #12
0
        public RootObject GetChangeIndexChart(ReportCriteria reportCriteria)
        {
            try
            {
                Dictionary <string, object> parameters = new Dictionary <string, object>();

                parameters.Add(Constants.StoredProcedures.GetIndexChange.CountryCodes, reportCriteria.countryCodeIds);
                // parameters.Add(Constants.StoredProcedures.GetIndexChange.CategoryIds, reportCriteria.categoryCodeIds);
                parameters.Add(Constants.StoredProcedures.GetIndexChange.Years, reportCriteria.years);
                //parameters.Add(Constants.StoredProcedures.GetIndexChange.Months, reportCriteria.months);

                var fullReport = _imfUnitOfWork.Repository <IndexChangeReport>().SqlCommand(Constants.StoredProcedures.GetIndexChangeChart.Sql, parameters);

                List <IndexChangeReport> lstChangeIndexReport = new List <IndexChangeReport>();
                List <string>            lstCountryName       = new List <string>();
                lstChangeIndexReport = fullReport.ToList();
                lstCountryName       = fullReport.AsEnumerable().Select(o => o.CountryName).Distinct().ToList();


                RootObject      objRootObject = new RootObject();
                List <datasets> lstChartList  = new List <datasets>();
                List <Datum>    lstDatum      = new List <Datum>();

                List <string> lstColors = new List <string> {
                    "#3cba9f", "#3A76BC"
                };
                //var tempList = new List<string> { "Name", "DOB", "Address" };
                var random = new Random();
                foreach (string objCountryName in lstCountryName)
                {
                    datasets     objChartList = new datasets();
                    List <Datum> objDatum     = new List <Datum>();

                    var color = "#{0:X6}" + Convert.ToString(random.Next(0x1000000)); //String.Format("#{0:X6}", random.Next(0x1000000));//String.Format("#{0:X6}", random.Next(0x1000000)); // = "#A197B9"
                    objChartList.strokeColor = color;                                 // "#3cba9f";
                    objChartList.fill        = "false";
                    objChartList.label       = objCountryName.ToString();
                    objDatum = (from stad in lstChangeIndexReport.Where(x => x.CountryName == objCountryName)
                                select new Datum()
                    {
                        x = stad.Report.ToString(),
                        y = stad.ChangeIndex
                    }).ToList();

                    objChartList.data = objDatum;
                    lstChartList.Add(objChartList);
                }

                objRootObject.datasets     = lstChartList.ToList();
                objRootObject.lstYEARMONTH = fullReport.AsEnumerable().Select(o => o.Report).Distinct().ToList();


                return(objRootObject);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Example #13
0
 private void BuildCriteria(ReportCriteria criteria)
 {
     if (txtFromDt.Text.Trim() != string.Empty)
     {
         criteria.FromDate = Convert.ToDateTime(txtFromDt.Text, _culture);
     }
     if (txtToDt.Text.Trim() != string.Empty)
     {
         criteria.ToDate = Convert.ToDateTime(txtToDt.Text, _culture);
     }
 }
Example #14
0
        public async Task <PaginationInfo> GetPaginationInfo(ReportCriteria criteria)
        {
            var resultCriteria = BuildQuery(criteria, true);
            var resultQuery    = await ExecuteQuery <int>(resultCriteria.SqlStatement, resultCriteria.SqlParameters);

            var paginationInfo = new PaginationInfo();

            paginationInfo.TotalRecCount  = resultQuery;
            paginationInfo.TotalPageCount = (int)Math.Ceiling((double)paginationInfo.TotalRecCount / criteria.RecordsPerPage);
            paginationInfo.CurrentPage    = criteria.CurrentPage;
            return(paginationInfo);
        }
        public DataSet GetPayTransReports(ReportCriteria ReportParams)
        {
            // .Modified by Cognizant based on new SP changes
            SqlCommand Cmd = GetCommand("PAY_Reports");

            ReportParams.CopyTo(Cmd);
            SqlDataAdapter sqlDa = new SqlDataAdapter(Cmd);
            DataSet        ds    = new DataSet();

            sqlDa.Fill(ds);
            return(ds);
        }
 private void BuildCriteria(ReportCriteria criteria)
 {
     if (txtFromDt.Text.Trim() != string.Empty)
     {
         criteria.FromDate = Convert.ToDateTime(txtFromDt.Text, _culture);
     }
     if (txtToDt.Text.Trim() != string.Empty)
     {
         criteria.ToDate = Convert.ToDateTime(txtToDt.Text, _culture);
     }
     criteria.TransactionType = ddlTxnType.SelectedValue;
 }
        public async Task GetAdvertiserReport_ShouldReturnSummaryReport()
        {
            // Arrange
            var reportCriteria = new ReportCriteria
            {
                Type  = ReportTypeEnum.Advertiser,
                Level = ReportLevelEnum.Summary
            };
            var adAnalyticsReportIds = new[]
            {
                new AdAnalyticsReportId
                {
                    AdvertiserId   = 1,
                    AdvertiserName = "Advertiser 1",
                    Bids           = 1
                },
                new AdAnalyticsReportId
                {
                    AdvertiserId   = 1,
                    AdvertiserName = "Advertiser 1",
                    Bids           = 1
                },
                new AdAnalyticsReportId
                {
                    AdvertiserId   = 2,
                    AdvertiserName = "Advertiser 2",
                    Bids           = 1
                },
            };

            MockUnitOfWorkRepository <AdAnalyticsReportId>().Setup(x => x.Queryable())
            .Returns(adAnalyticsReportIds.ToAsyncEnumerable());

            // Act
            var result = await Mock.Create <ReportService>().GetAdvertiserReport(reportCriteria);

            // Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result.ReportType, Is.EqualTo(reportCriteria.Type.ToString()));
            Assert.That(result.ReportLevel, Is.EqualTo(reportCriteria.Level.ToString()));
            Assert.That(result.Data, Is.Not.Null);
            var data = result.Data.CastToAnonymousPerformanceData(new { AdvertiserId = default(int), AdvertiserName = default(string) }).ToList();

            Assert.That(data.Count(), Is.EqualTo(2));

            Assert.That(data[0].KeyData.AdvertiserId, Is.EqualTo(1));
            Assert.That(data[0].KeyData.AdvertiserName, Is.EqualTo("Advertiser 1"));
            Assert.That(data[0].Bids, Is.EqualTo(2));

            Assert.That(data[1].KeyData.AdvertiserId, Is.EqualTo(2));
            Assert.That(data[1].KeyData.AdvertiserName, Is.EqualTo("Advertiser 2"));
            Assert.That(data[1].Bids, Is.EqualTo(1));
        }
        public DataSet PayWorkflowReport(ReportCriteria ReportParams)
        {
            //Changed the SP Call from SalesRep_Cashier_WorkFlow to PAY_Workflow_Report
            SqlCommand Cmd = GetCommand("PAY_Workflow_Report");

            ReportParams.CopyTo(Cmd);
            SqlDataAdapter sqlDa = new SqlDataAdapter(Cmd);
            DataSet        ds    = new DataSet();

            sqlDa.Fill(ds);
            return(ds);
        }
Example #19
0
 public IHttpActionResult GetChangeIndexChart(ReportCriteria reportCriteria)
 {
     try
     {
         var changeIndexReport = _reportManager.GetChangeIndexChart(reportCriteria);
         return(Ok(changeIndexReport));
     }
     catch (Exception ex)
     {
         //log.SaveErrorLog(ex, MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name);
         return(Ok());
     }
 }
        public DataSet GetInsuranceReports(ReportCriteria ReportParams)
        {
            Logger.Log(CSAAWeb.Constants.INS_REPORTS_SP_START);
            SqlCommand Cmd = GetCommand("INS_Reports");

            ReportParams.CopyTo(Cmd);
            SqlDataAdapter sqlDa = new SqlDataAdapter(Cmd);
            DataSet        ds    = new DataSet();

            sqlDa.Fill(ds);
            Logger.Log(CSAAWeb.Constants.INS_REPORTS_SP_END);
            return(ds);
        }
Example #21
0
 //public IHttpActionResult GetFullReport(int[] countryCodes, int[] categoryIds, int[] years, int[] months)
 public IHttpActionResult GetFullReport(ReportCriteria reportCriteria)
 {
     try
     {
         //var fullReport = _reportManager.GetFullReport(countryCodes.ToList(), categoryIds.ToList(), years.ToList(), months.ToList());
         var fullReport = _reportManager.GetFullReport(reportCriteria);
         return(Ok(fullReport));
     }
     catch (Exception ex)
     {
         //log.SaveErrorLog(ex, MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name);
         return(Ok());
     }
 }
        private void GenerateReport()
        {
            ReportBLL          cls           = new ReportBLL();
            LocalReportManager reportManager = new LocalReportManager(rptViewer, "CashierLog", ConfigurationManager.AppSettings["ReportNamespace"].ToString(), ConfigurationManager.AppSettings["ReportPath"].ToString());
            ReportCriteria     criteria      = new ReportCriteria();
            //BuildCriteria(criteria);
            List <ReportEntity> lstData = ReportBLL.GetCashierLog(criteria);

            ReportDataSource dsGeneral = new ReportDataSource("dsReportData", lstData);

            reportManager.AddParameter("FromDate", txtFromDt.Text.Trim());
            reportManager.AddParameter("ToDate", txtToDt.Text.Trim());
            reportManager.AddDataSource(dsGeneral);
            reportManager.Show();
        }
Example #23
0
        public async Task <IActionResult> CreateInvoiceReport(ReportCriteria criteria)
        {
            companyId = await services.GetCurrentCompanyId();

            var        assembly = typeof(MyApp.ReportStorageWebExtension1).Assembly;
            Stream     resource = assembly.GetManifestResourceStream("MyApp.Reports.Invoices.repx");
            XtraReport report   = XtraReport.FromStream(resource);

            report.RequestParameters = true;
            report.Parameters["prmCompanyId"].Value   = companyId;
            report.Parameters["prmCompanyId"].Visible = false;
            report.Parameters["prmFromDate"].Value    = criteria.FromDate;
            report.Parameters["prmToDate"].Value      = criteria.ToDate.AddDays(1);
            report.CreateDocument();
            return(View("MainViewer", report));
        }
        /// <summary>
        /// Updates the Report Data Source.
        /// </summary>
        /// <param name="startDate">Start date of the Report.</param>
        /// <param name="endDate">End date of the Report.</param>
        /// <param name="reportType"> Type of Report <see cref="ReportType"/>.</param>
        /// /// <param name="reportCriteria"> Criteria to create Report <see cref="ReportCriteria"/>.</param>
        /// <param name="numberOfRecords">Number of records included 0 for all records.</param>
        /// <param name="dataContext">DataContext from which the available reportingParameters are pulled <see cref="DataContext"/>.</param>
        public void UpdateReportSource(DateTime startDate, DateTime endDate, ReportCriteria reportCriteria, ReportType reportType, int numberOfRecords, DataContext dataContext)
        {
            m_percentComplete = 0;

            if (m_writing)
            {
                m_cancellation.Cancel();
            }

            m_writing = true;
            CancellationToken token = m_cancellation.Token;

            new Thread(() =>
            {
                try
                {
                    if (token.IsCancellationRequested)
                    {
                        m_writing = false;
                        return;
                    }

                    List <ReportMeasurements> reportingMeasurements = GetFromStats(dataContext, startDate, endDate, reportType, reportCriteria, numberOfRecords, token);

                    if (token.IsCancellationRequested)
                    {
                        m_writing = false;
                        return;
                    }

                    m_listing = reportingMeasurements;

                    m_writing         = false;
                    m_percentComplete = 100.0;
                }
                catch (Exception e)
                {
                    LogException(e);
                }

                m_writing         = false;
                m_percentComplete = 100.0;
            })
            {
                IsBackground = true,
            }.Start();
        }
 public int ReIssueReceipt(ReportCriteria ReceiptParams, string NewReceiptNumber)
 {
     try
     {
         StartTransaction();
         SqlCommand cmd = GetCommand("INS_Reissue_Receipt");
         ReceiptParams.CopyTo(cmd);
         cmd.Parameters["@NewReceiptNumber"].Value = NewReceiptNumber;
         cmd.ExecuteNonQuery();
         return(SetExtendedTransaction());
     }
     catch (Exception e)
     {
         CompleteTransaction(false);
         throw new Exception("Exception occured processing ReIssueReceipt in InsuranceWebService.", e);
     }
 }
Example #26
0
        private string GetCriteriaFromClause(ReportCriteria criteria)
        {
            var sbFromClause = new StringBuilder();

            sbFromClause.AppendLine(" From ");
            sbFromClause.AppendLine(criteria.MainTable);

            //to avoid adding the joined table more than once, in the case more than lookupfield required fronm the same lookup table
            var joinClauseList = new List <string>();

            foreach (var field in criteria.DisplayFields)
            {
                if (!string.IsNullOrEmpty(field.LookupTable) && !string.IsNullOrEmpty(field.LookupFieldValue))
                {
                    var joinClause = $" Left Join [{field.LookupTable}] on [{field.LookupTable}].[{field.LookupFieldValue}] = [{criteria.MainTable}].[{field.Field}] ";
                    if (!joinClauseList.Contains(joinClause))
                    {
                        joinClauseList.Add(joinClause);
                    }
                }
            }
            //----------------------------------------------------------
            foreach (var filter in criteria.ValueFilters)
            {
                if (!string.IsNullOrEmpty(filter.LookupTable) && !string.IsNullOrEmpty(filter.LookupFieldValue))
                {
                    // naming confusion ...need to be revised... filTer.LookupField & field.LookupField
                    var joinClause = $" Left Join [{filter.LookupTable}] on [{filter.LookupTable}].[{filter.LookupFieldValue}] = [{criteria.MainTable}].[{filter.Field}] ";
                    if (!joinClauseList.Contains(joinClause))
                    {
                        joinClauseList.Add(joinClause);
                    }
                }
            }
            //----------------------------------------------------------
            foreach (var joinClause in joinClauseList)
            {
                sbFromClause.AppendLine(joinClause);
            }
            return(sbFromClause.ToString());
        }
Example #27
0
        public IEnumerable <IndexChangeReport> GetChangeIndex(ReportCriteria reportCriteria)
        {
            try
            {
                Dictionary <string, object> parameters = new Dictionary <string, object>();

                parameters.Add(Constants.StoredProcedures.GetIndexChange.CountryCodes, reportCriteria.countryCodeIds);
                // parameters.Add(Constants.StoredProcedures.GetIndexChange.CategoryIds, reportCriteria.categoryCodeIds);
                parameters.Add(Constants.StoredProcedures.GetIndexChange.Years, reportCriteria.years);
                //parameters.Add(Constants.StoredProcedures.GetIndexChange.Months, reportCriteria.months);

                var fullReport = _imfUnitOfWork.Repository <IndexChangeReport>().SqlCommand(Constants.StoredProcedures.GetIndexChange.Sql, parameters);


                return(fullReport);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
 public int UpdateStatus(ReportCriteria ReportParams, TurninClasses.ArrayOfReceipt Receipts, string Action)
 {
     try
     {
         StartTransaction();
         SqlCommand Cmd = GetCommand("INS_Update_Status");
         ReportParams.CopyTo(Cmd);
         Cmd.Parameters["@Action"].Value = Action;
         foreach (TurninClasses.Receipt R in Receipts)
         {
             R.CopyTo(Cmd);
             Cmd.ExecuteNonQuery();
         }
         return(SetExtendedTransaction());
     }
     catch (Exception e)
     {
         CompleteTransaction(false);
         throw new Exception("Exception occured processing UpdateStatus in InsuranceWebService.", e);
     }
 }
Example #29
0
        private string GetCriteriaWhere(ReportCriteria criteria, ref List <object> queryParametersList)
        {
            var sbWhereFields    = new StringBuilder();
            var commaPlaceHolder = string.Empty;

            foreach (var valueFilter in criteria.ValueFilters)
            {
                sbWhereFields.Append(commaPlaceHolder);
                sbWhereFields.Append($" {criteria.MainTable}.{valueFilter.Field} = @p_{valueFilter.Field}");
                commaPlaceHolder = " and ";
                queryParametersList.Add(new SqlParameter($"p_{valueFilter.Field}", valueFilter.Value));
            }

            foreach (var rangeFilter in criteria.RangeFilters)
            {
                sbWhereFields.Append(commaPlaceHolder);
                sbWhereFields.Append($"  {criteria.MainTable}.{rangeFilter.Field} >= {rangeFilter.FromValue} and {criteria.MainTable}.{rangeFilter.Field} <= {rangeFilter.ToValue} ");
                commaPlaceHolder = " and ";
            }

            return(sbWhereFields.ToString());
        }
Example #30
0
        public IEnumerable <YesIndexReport> GetYesIndex(ReportCriteria reportCriteria)
        {
            try
            {
                Dictionary <string, object> parameters = new Dictionary <string, object>();

                parameters.Add(Constants.StoredProcedures.GetYesIndex.CountryCodes, reportCriteria.countryCodeIds);
                parameters.Add(Constants.StoredProcedures.GetYesIndex.CategoryIds, reportCriteria.categoryCodeIds);
                parameters.Add(Constants.StoredProcedures.GetYesIndex.Years, reportCriteria.years);
                parameters.Add(Constants.StoredProcedures.GetYesIndex.Months, reportCriteria.months);

                var fullReport2 = _imfUnitOfWork.Repository <YesIndexReport>().SqlCommand(Constants.StoredProcedures.GetYesIndex.Sql, parameters);
                //var fullReport1 = _imfUnitOfWork.Repository<Country>().SqlCommand(Constants.StoredProcedures.GetAllCountries.Sql);

                var fullReport = _imfUnitOfWork.Repository <FullReport>().SqlCommand(Constants.StoredProcedures.GetFullReport.Sql, parameters);

                return(fullReport2);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }