Пример #1
0
        public ResultModel <FileUploadModel> getByDateRange(DateTime startTranDate, DateTime endTranDate)
        {
            ResultModel <FileUploadModel> result = new ResultModel <FileUploadModel>();

            try
            {
                service        = new FileUploadDAL();
                result.Status  = true;
                result.Objects = service.getByDateRange(startTranDate, endTranDate);
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = ex.Message;
            }
            return(result);
        }
Пример #2
0
        public ResultModel <FileUploadModel> getByCurrency(string currencyCode)
        {
            ResultModel <FileUploadModel> result = new ResultModel <FileUploadModel>();

            try
            {
                service        = new FileUploadDAL();
                result.Status  = true;
                result.Objects = service.getByCurrency(currencyCode);
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = ex.Message;
            }
            return(result);
        }
Пример #3
0
        public ResultModel <FileUploadModel> getByStatus(string status)
        {
            ResultModel <FileUploadModel> result = new ResultModel <FileUploadModel>();

            try
            {
                service = new FileUploadDAL();
                var mol = service.getByStatus(status);
                result.TotalRecord = mol.Count();
                result.Status      = true;
                result.Objects     = mol;
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = ex.Message;
            }
            return(result);
        }
Пример #4
0
        public ResultModel <FileUploadModel> insert(string filePath)
        {
            log.Info("Start");
            ResultModel <FileUploadModel> result = new ResultModel <FileUploadModel>();
            var validMsg = validateFile(filePath);

            if (validMsg == "HTTP Code 200.")
            {
                try
                {
                    service = new FileUploadDAL();
                    if (Path.GetExtension(filePath.ToUpper()).Contains(FileType.CSV.ToString()))
                    {
                        result.Status = service.insert(CsvHelper.convertCsvToModel(filePath));
                    }
                    else
                    {
                        result.Status = service.insert(XmlHelper.convertXmlToModel(filePath));
                    }
                    result.Message = validMsg;
                    log.Info("End");
                }
                catch (Exception ex)
                {
                    log.Error(ex.StackTrace);
                    result.Status  = false;
                    result.Message = ex.Message;
                }
            }
            else
            {
                result.Status  = false;
                result.Message = validMsg;
            }
            return(result);
        }