public CropPoint GetCropPointsByCropType(CropPoint cropPoint) { //string singleCropType = cropPoint.CropType; return(_db.Query <CropPoint>("CropPoints_GetByCropType", new { BankId = cropPoint.BankId, ChequeId = cropPoint.ChequeId, SingleCropType = cropPoint.CropType }, commandType: CommandType.StoredProcedure).SingleOrDefault()); }
public string SaveCroppedImage(string liveChequePath, CropType cropType, CropPoint cropPoints) { string savePath = ""; string CropName = cropType.ToString(); Random number = new Random(); Bitmap bitmap = new Bitmap(HttpContext.Current.Server.MapPath(liveChequePath)); Bitmap croppedBitmap = CropCheque(bitmap, cropPoints.CropStartX, cropPoints.CropStartY, cropPoints.CropWidth, cropPoints.CropHeight); HttpResponse response = GetHttpResponse(); response.ContentType = "image/jpeg"; savePath = "~/ChequeImageData/CroppedCheques/" + CropName + "/" + CropName + "_" + number.Next(0, 100000) + ".jpg"; croppedBitmap.Save(HttpContext.Current.Server.MapPath(savePath), ImageFormat.Jpeg); return(savePath); }
public bool InsertCropPoint(CropPoint cropPoint) { int rowsAffected = this._db.Execute("CropPoints_Add", new { CropType = cropPoint.CropType, BankId = cropPoint.BankId, ChequeId = cropPoint.ChequeId, CropStartX = cropPoint.CropStartX, CropStartY = cropPoint.CropStartY, CropWidth = cropPoint.CropWidth, CropHeight = cropPoint.CropHeight }, commandType: CommandType.StoredProcedure); if (rowsAffected > 0) { return(true); } return(false); }
public bool Put([FromBody] CropPoint cropPoint) { return(_cropPointRepository.UpdateCropPoint(cropPoint)); }
public bool Post([FromBody] CropPoint cropPoint) { return(_cropPointRepository.InsertCropPoint(cropPoint)); }
public CropPoint GetByCropType(CropPoint cropPoint) { return(_cropPointRepository.GetCropPointsByCropType(cropPoint)); }
public LiveChequePath Post([FromBody] LiveChequePath liveChequePath) { Dictionary <string, string> pathList = new Dictionary <string, string>(); CropPointsController loadCropPoints = new CropPointsController(); CropPoint cropPointData = new CropPoint(); LiveChequeCrop liveChequeCrop = new LiveChequeCrop(); cropPointData.BankId = liveChequePath.BankId; cropPointData.ChequeId = liveChequePath.ChequeId; foreach (var CropId in CropTypeFactory.CropTypes) { cropPointData.CropType = CropId; CropPoint CropPoints = loadCropPoints.GetByCropType(cropPointData); if (CropPoints == null) { return(liveChequePath); } pathList.Add(cropPointData.CropType.ToString(), liveChequeCrop.SaveCroppedImage(liveChequePath.LiveChequeImageFrontPath, CropId, CropPoints)); switch (CropId) { case CropType.NumericalAmount: liveChequePath.NumericalAmountCroppedImagePath = pathList["NumericalAmount"]; break; case CropType.Amount: liveChequePath.AmountCroppedImagePath = pathList["Amount"]; break; case CropType.Date: liveChequePath.DateCroppedImagePath = pathList["Date"]; break; case CropType.MICR: liveChequePath.MICRCroppedImagePath = pathList["MICR"]; break; case CropType.Payee: liveChequePath.PayeeCroppedImagePath = pathList["Payee"]; break; case CropType.Signature: liveChequePath.SignatureCroppedImagePath = pathList["Signature"]; break; } } //DirectoryInfo firstfile = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ChequeImageData/ArchievedCheques/")); //FileInfo[] garbagefiles = firstfile.GetFiles("1*"); //if (garbagefiles.Count() != 0) //{ // File.Delete(HttpContext.Current.Server.MapPath(@"~/ChequeImageData/ArchievedCheques/") + garbagefiles[0]); //} //var directory = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ChequeImageData/ArchievedCheques/")); //var myFile = (from f in directory.GetFiles() // orderby f.LastWriteTime descending // select f).Last(); //var path = HttpContext.Current.Server.MapPath("~/ChequeImageData/ArchievedCheques/"); //File.Delete(path + myFile.ToString()); return(_liveChequePathRepository.InsertLiveChequePath(liveChequePath)); }