public void FingerPrint_Insert(FingerPrintModel fm)
 {
     try
     {
         using (var con = GetDbConnection())
         {
             con.Execute("dbo.Usp_FingerPrint_Insert",
                         new {
                 @iIntEmployeeId = fm.EmployeeId,
                 @iTIntFinger    = fm.Finger,
                 @iIntMask       = fm.Mask
             },
                         commandType: CommandType.StoredProcedure);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 public ReturnData RegisterFingerPrints([FromBody] FingerPrintModel printModel)
 {
     try
     {
         var member = db.CUBs.FirstOrDefault(m => m.MemberNo.ToUpper().Equals(printModel.MemberNo.ToUpper()));
         member.FingerPrint = printModel.FingerPrint;
         db.SaveChanges();
         return(new ReturnData
         {
             Success = true,
             Message = "finger print saved successfully"
         });
     }
     catch (Exception ex)
     {
         return(new ReturnData
         {
             Success = false,
             Message = "Sorry, An error occurred"
         });
     }
 }
Example #3
0
        public override bool Transfer(IEnumerable <TransferResourceModel> transferResources)
        {
            var archiveLines = new List <string>();
            var stopwatch    = new Stopwatch();

            if (File.Exists(ArchiveFile))
            {
                archiveLines = File.ReadAllLines(ArchiveFile).ToList();
            }
            else
            {
                TraceSource.TraceInformation("New Fingerprint archive file will be created @{0}", ArchiveFile);
            }

            foreach (var transferResource in transferResources)
            {
                TraceSource.TraceInformation("Processing file '{0}'", transferResource.Source);

                if (transferResource.Source.Scheme != Uri.UriSchemeFile)
                {
                    TraceSource.TraceWarning("Scheme {0} not supported for partial tranfer", transferResource.Source.Scheme);
                    continue;
                }

                var sequence = HttpUtility.ParseQueryString(transferResource.Source.Query).Get("sequence");
                if (sequence.IsNullOrWhiteSpace())
                {
                    TraceSource.TraceWarning("Sequence not provided within query. transfer will be skipped. Resource local {0}. Resource remote {1}", transferResource.Source.LocalPath, transferResource.Destination.LocalPath);
                    continue;
                }

                var productId = HttpUtility.ParseQueryString(transferResource.Source.Query).Get("productId");
                if (productId.IsNullOrWhiteSpace())
                {
                    TraceSource.TraceWarning("productId not provided within query. transfer will be skipped. Resource local {0}. Resource remote {1}", transferResource.Source.LocalPath, transferResource.Destination.LocalPath);
                    continue;
                }

                if (File.Exists(transferResource.Source.LocalPath))
                {
                    stopwatch.Restart();

                    FingerPrintModel fingerprint = FingerPrintHelper.ExtractFingerPrintInfo(transferResource.Source.LocalPath, productId, sequence);

                    TraceSource.TraceInformation("Took '{0}' to create FingerPrint.", stopwatch.ElapsedMilliseconds);

                    if (fingerprint != null)
                    {
                        if (!archiveLines.Contains(fingerprint.ToString()))
                        {
                            if (Transfer(transferResource))
                            {
                                archiveLines.Add(fingerprint.ToString());
                            }
                        }
                    }
                    else
                    {
                        TraceSource.TraceError("Cannot setup fingerprint for file: {0}", transferResource.Source.LocalPath);
                        return(false);
                    }
                }
                else
                {
                    TraceSource.TraceWarning("File cannot be found, the transfer will be skipped. Resource local {0}. Resource remote {1}", transferResource.Source.LocalPath, transferResource.Destination.LocalPath);
                }
            }

            try
            {
                File.WriteAllLines(ArchiveFile, archiveLines, Encoding.ASCII);
            }
            catch (Exception e)
            {
                TraceSource.TraceError("Error writing to fingerprint archive file: {0}. Error:", ArchiveFile, e.Message);
                return(false);
            }

            return(true);
        }
Example #4
0
 public void FingerPrint_Insert(FingerPrintModel fm)
 {
     _repo.FingerPrint_Insert(fm);
 }
Example #5
0
 public void FingerPrint_Delete(FingerPrintModel fm)
 {
     _repo.FingerPrint_Delete(fm);
 }