Esempio n. 1
0
 public static string UpdateCalibrationEadCcfSummary(CalibrationResultCcfSummary input)
 {
     return($"Update [CalibrationResult_EAD_CCF_Summary] " +
            $" set [OD_CCF] = {input.OdCcf}, " +
            $" [Card_CCF] = {input.CardCcf}, " +
            $" [Overall_CCF] = {input.OverallCcf} " +
            $" where CalibrationId = (select top 1 id from CalibrationRunEadCcfSummary where OrganizationUnitId = {input.AffiliateId} and [Status] = 7);");
 }
Esempio n. 2
0
        public List <CalibrationResultCcfSummary> ReadFromExcel()
        {
            var dataList = new List <CalibrationResultCcfSummary>();
            var filePath = $"{Path.Combine(_dataAccess.GetFilePath(), "AssumptionTemplate.xlsx")}";

            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
            using (var package = new ExcelPackage(new FileInfo(filePath)))
            {
                ExcelWorksheet worksheet = package.Workbook.Worksheets[2]; //CCF Sheet
                int            rows      = worksheet.Dimension.Rows;

                for (int i = 2; i <= rows; i++)
                {
                    var AffiliateId = worksheet.Cells[i, 1].Value;
                    var od          = worksheet.Cells[i, 2].Value;
                    var card        = worksheet.Cells[i, 3].Value;
                    var overall     = worksheet.Cells[i, 4].Value;

                    if (AffiliateId == null)
                    {
                        //Console.WriteLine("Row is empty: " + i.ToString());
                    }
                    else if (string.IsNullOrWhiteSpace(AffiliateId.ToString()))
                    {
                        //Console.WriteLine("Row is empty: " + i.ToString());
                    }
                    else
                    {
                        var data = new CalibrationResultCcfSummary();
                        try { data.AffiliateId = Convert.ToInt64(AffiliateId); } catch { data.AffiliateId = -1; }
                        try { data.OdCcf = Convert.ToDouble(od); } catch { data.OdCcf = 0.0; }
                        try { data.CardCcf = Convert.ToDouble(card); } catch { data.CardCcf = 0.0; }
                        try { data.OverallCcf = Convert.ToDouble(overall); } catch { data.OverallCcf = 0.0; }

                        dataList.Add(data);
                    }
                }
            }

            return(dataList);
        }