public int VerifyCode(LicenseRefObject verifier) { try { using (var db = new ImportPermitEntities()) { if (verifier.LicenseType == (int) StorageProviderTypeEnum.Own_Depot) { var depotList = db.Depots.Where(p => p.ImporterId == verifier.ImporterId && p.DepotLicense == verifier.RefCode).ToList(); if (!depotList.Any()) { return 0; } return depotList[0].Id; } var licenses = db.ReferenceLicenses.Where(p => p.ImporterId == verifier.ImporterId && p.ReferenceLicenseTypeId == verifier.LicenseType && p.LicenceCode == verifier.RefCode).ToList(); if (!licenses.Any()) { return 0; } return 5; } } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return 0; } }
public int VerifyDepotLicenseCode(LicenseRefObject verifier) { try { using (var db = new ImportPermitEntities()) { var depotList = db.Depots.Where(p => p.ImporterId == verifier.ImporterId && p.DepotLicense == verifier.RefCode).ToList(); if (!depotList.Any()) { depotList = db.Depots.Where(p => p.DepotLicense.Trim() == verifier.RefCode.Trim()).ToList(); if (!depotList.Any()) { return 0; } var depot = depotList[0]; if (depot.ImporterId == null) { depot.ImporterId = verifier.ImporterId; db.Entry(depot).State = EntityState.Modified; db.SaveChanges(); return depot.Id; } return depot.Id; } return depotList[0].Id; } } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return 0; } }
private LicenseRefObject ProcessRecord(DataRowView dv, ref string msg) { if (dv == null) { return(null); } try { var depotLicense = new LicenseRefObject(); var companyName = dv.Row["Company"].ToString().Trim(); if (string.IsNullOrEmpty(companyName)) { msg = "Company Name is empty."; return(null); } depotLicense.ImporterName = companyName; var refCode = dv.Row["License_Code"].ToString().Trim(); if (string.IsNullOrEmpty(refCode)) { msg = "License Number is empty."; return(null); } var jettyName = dv.Row["Jetty"].ToString().Trim(); if (string.IsNullOrEmpty(jettyName)) { msg = "Jetty Name is empty."; return(null); } var jettyId = new JettyServices().GetJettyIdByName(jettyName); if (jettyId < 1) { msg = "Jetty Information could not be verified."; return(null); } depotLicense.ExpiryDate = DateTime.Parse("31/12/2015"); depotLicense.IssueDate = DateTime.Parse("01/01/2015"); depotLicense.Status = true; depotLicense.RefCode = refCode; depotLicense.JettyName = jettyName; depotLicense.JettyId = jettyId; return(depotLicense); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(null); } }
public int VerifyCode(LicenseRefObject verifier) { try { return(_productManager.VerifyCode(verifier)); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(0); } }
public long VerifyVesselLicense(LicenseRefObject verifier) { try { using (var db = new ImportPermitEntities()) { var licenseList = db.Vessels.Where(p => p.VesselLicense == verifier.RefCode).ToList(); if (!licenseList.Any()) { return 0; } return licenseList[0].VesselId; } } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return 0; } }