public DataTable Save(BatchDetail det, CompanyDetail companydet, string filePath, DataTable dtcounties) { Save(det); DataTable dtData = GetData(filePath); if (dtData.Rows.Count > 0) { DataTable dtDTSMapping = null; DataTable dtCaseTypeMapping = null; det.TotalCount = dtData.Rows.Count; det.CreatedDate = DateTime.Now; if (companydet.DTSMapping != null) { dtDTSMapping = (DataTable)XMLUtilities.Deserialize(companydet.DTSMapping, typeof(DataTable)); } if (companydet.CaseTypeMapping != null) { dtCaseTypeMapping = (DataTable)XMLUtilities.Deserialize(companydet.CaseTypeMapping, typeof(DataTable)); } Transform(det, ref dtData, dtDTSMapping, dtCaseTypeMapping, dtcounties); } else { throw new ApplicationException(ErrorConstants.EmptyBatchError); } return(dtData); }
public void Save(DataTable dt, BatchDetail batchDet, string sessionid) { BatchRecordDetail det; string strDate, strTime; int iPass = 0, iFail = 0, iBlank = 0, iType = 0; foreach (DataRow dr in dt.Rows) { det = new BatchRecordDetail(); try { if (DataUtils.GetColumnValue(dr, BatchUploadConstants.Name).Length > 0) { det.BatchID = batchDet.ID; det.CompanyID = batchDet.CompanyID; strDate = DataUtils.GetColumnValue(dr, BatchUploadConstants.ReceivedDate); strTime = DataUtils.GetColumnValue(dr, BatchUploadConstants.ReceivedTime); det.ReceivedDate = Convert.ToDateTime(strDate); det.CustomerRefNo = DataUtils.GetColumnValue(dr, BatchUploadConstants.CustomerRefNo); det.LeadNo = GMConvert.GetInt32(DataUtils.GetColumnValue(dr, BatchUploadConstants.LeadNumber)); det.CountyID = GMConvert.GetInt32(DataUtils.GetColumnValue(dr, BatchUploadConstants.CountyID)); det.Name = DataUtils.GetColumnValue(dr, BatchUploadConstants.Name); det.DOB = Convert.ToDateTime(DataUtils.GetColumnValue(dr, BatchUploadConstants.DOB)); iType = GMConvert.GetInt32(DataUtils.GetColumnValue(dr, BatchUploadConstants.CaseTypeID)); if (iType > 0) { det.CaseTypeID = iType; } det.RecordStatusID = Convert.ToInt32(BatchUploadConstants.EnumRecordStatusType.RESEARCH); det.Years = GMConvert.GetInt32(DataUtils.GetColumnValue(dr, BatchUploadConstants.Years)); det.SSN = DataUtils.GetColumnValue(dr, BatchUploadConstants.SSN); det.ClientRemarks = DataUtils.GetColumnValue(dr, BatchUploadConstants.ClientRemarks); det.ClientSplRemarks = DataUtils.GetColumnValue(dr, BatchUploadConstants.ClientSplRemarks); det.ActualCaseType = DataUtils.GetColumnValue(dr, BatchUploadConstants.ActualCaseType); Save(det); SaveRecordHistory(det.ID, det.RecordStatusID, batchDet.UserID); iPass += 1; } else { iBlank += 1; } } catch (Exception ex) { iFail += 1; m_msg.Add(string.Format(ErrorConstants.BatchSaveFailed, det.Name)); Logger.LogException(ex); } } batchDet.FailCount = iFail; batchDet.PassCount = iPass; batchDet.TotalCount = dt.Rows.Count - iBlank; }
public async Task <bool> Clear() { var isCleared = false; try { var bds = new List <BatchDetail>(); foreach (KeyValuePair <int, GeneratorBatch> item in BatchDetails) { var generatedBatch = item.Value; var bd = new BatchDetail { BatchId = generatedBatch.BatchId, NumberOfBatches = generatedBatch.GeneratedNumbers.Count(), NumberPerBatches = generatedBatch.NumbersPerBatch, BatchTotal = generatedBatch.Total, GeneratedNumbers = generatedBatch.GeneratedNumbers.Select(x => new BatchGeneratedNumber { GeneratedNumber = x }).ToList(), MultipliedNumbers = generatedBatch.MultipliedNumbers.Select(x => new BatchMultipliedNumber { MultipliedNumber = x }).ToList() }; bds.Add(bd); } var list = new List <BatchDetail>(); using (var scope = _scopeFactory.CreateScope()) { _batchRepository = scope.ServiceProvider.GetRequiredService <IBatchRepository>(); await _batchRepository.AddRangeAsync(bds); await _batchRepository.SaveChangesAsync(); var aaa = await _batchRepository.BatchDetails; } isCleared = true; BatchDetails = new ConcurrentDictionary <int, GeneratorBatch>(); } catch (Exception ex) { _logger.LogError(ex, "Clear: Processor: An error occured"); } return(isCleared); }
public static AuthenticationProperties CreateProperties(ApplicationUser user) { using (MIUEntities db = new MIUEntities()) { //string userLoginName = db.AspNetUsers.Where(a => a.Id == user.Id).Select(a => a.UserName).FirstOrDefault(); string userLoginName = db.AspNetUsers.Where(a => a.UserName == user.UserName).Select(a => a.UserName).SingleOrDefault(); User userInfo = db.Users.Where(a => a.LoginName == userLoginName).SingleOrDefault(); BatchDetail batchDetail = db.BatchDetails.Where(b => b.StudentID == userInfo.ID).FirstOrDefault(); IDictionary <string, string> data = new Dictionary <string, string> { { "fullName", userInfo.FullName }, { "loginName", user.UserName }, { "email", user.Email }, { "role", userInfo.Role != null ? userInfo.Role : string.Empty }, //{ "role", userInfo.Role }, { "userID", userInfo.ID.ToString() }, { "batchID", batchDetail != null?batchDetail.BatchID.ToString() : string.Empty }, { "batchCode", batchDetail != null?batchDetail.Batch.BatchCode.ToString() : string.Empty } }; return(new AuthenticationProperties(data)); } }
public void Save(DCBatch dcvdr) { CompanyBiz cbiz = new CompanyBiz(); BatchRecordBiz brbiz = new BatchRecordBiz(); try { BatchDetail detvdr = new BatchDetail(); GMUtilities.GMReflectionUtils.Copy(dcvdr, detvdr); detvdr.CreatedDate = DateTime.Now; DataTable dt = m_biz.Save(detvdr, cbiz.Get(dcvdr.CompanyID), dcvdr.BatchFilePath, m_optbiz.GetCounties()); //Save Records dcvdr.Messages = m_biz.Messages; brbiz.Save(dt, detvdr, dcvdr.SessionID); dcvdr.ID = detvdr.ID; dcvdr.Messages.AddRange(brbiz.Messages); //Update the Total, Pass and Fail count. m_biz.Save(detvdr); } catch (Exception exp) { throw exp; } finally { cbiz.Dispose(); brbiz.Dispose(); } }
public void Save(BatchDetail det) { m_db.Save(det); }
private void Transform(BatchDetail det, ref DataTable dtData, DataTable dtDTSMapping, DataTable dtCaseTypeMapping, DataTable dtcounties) { TransformColumn(ref dtData, dtDTSMapping); TransformData(ref dtData, dtCaseTypeMapping, dtcounties); }
public void Save(BatchDetail det) { Save(det, BatchMap.ProcedureSave); }
/// <summary> /// Perform validation on batch detail /// </summary> /// <param name="batchDetail">BatchDetail object, containing information on Batch and Documents</param> /// <param name="indexOptionDetail">IndexOptionDetail object, containing the validation rules for the accompanying BatchDetail</param> /// <returns>List containing validation error messages. Returns empty list if BatchDetail passed validation</returns> public static List <string> ValidateSECURE(BatchDetail batchDetail, IndexOptionDetail indexOptionDetail) { List <string> ValidationMessages = new List <string>(); // Validate BatchDetail if (indexOptionDetail.RequireRequestingParty && batchDetail.RequestingParty == null) { ValidationMessages.Add(string.Format("Batch [{0}]: RequestingParty is required.", batchDetail._ID)); } if (indexOptionDetail.RequireConcurrentIndex && !batchDetail.IsConcurrent) { ValidationMessages.Add(string.Format("Batch [{0}]: IsConcurrnent is required.", batchDetail._ID)); } foreach (DocumentInfo documentInfo in batchDetail.Documents) { // Validate DocumentInfo if (indexOptionDetail.RequireTitleIndex) { if (documentInfo.Titles == null) { ValidationMessages.Add(string.Format("Document [{0}]: Titles are required.", documentInfo._ID)); } else if (documentInfo.Titles.Length == 0) { ValidationMessages.Add(string.Format("Document [{0}]: Titles are required.", documentInfo._ID)); } } if (indexOptionDetail.RequireNamesIndex) { if (documentInfo.Names == null) { ValidationMessages.Add(string.Format("Document [{0}]: Names are required.", documentInfo._ID)); } else if (documentInfo.Names.Length == 0) { ValidationMessages.Add(string.Format("Document [{0}]: Names are required.", documentInfo._ID)); } } if (indexOptionDetail.RequireAPNIndex && (documentInfo.AssessorParcelNumber == null || documentInfo.AssessorParcelNumber == string.Empty)) { ValidationMessages.Add(string.Format("Document [{0}]: Assessor Parcel Number is required.", documentInfo._ID)); } if (indexOptionDetail.RequireTransferTaxIndex && !documentInfo.TransferTaxAmountSpecified) { ValidationMessages.Add(string.Format("Document [{0}]: Transfer Tax is required.", documentInfo._ID)); } if (indexOptionDetail.RequireAmountSaleIndex && !documentInfo.SaleAmountSpecified) { ValidationMessages.Add(string.Format("Document [{0}]: Sale Amount is required.", documentInfo._ID)); } if (indexOptionDetail.RequireCityIndex) { if (documentInfo.Cities == null) { ValidationMessages.Add(string.Format("Document [{0}]: Cities are required.", documentInfo._ID)); } else if (documentInfo.Cities.Length == 0) { ValidationMessages.Add(string.Format("Document [{0}]: Cities are required.", documentInfo._ID)); } } } return(ValidationMessages); }