//public List<Driver> GetDriverByName<T>(IContract lookupItem) where T : IContract //{ // var item = ((Driver)lookupItem); // List<Driver> list = db.ExecuteSprocAccessor(DBRoutine.GETDRIVERBYNAME, // MapBuilder<Driver>.BuildAllProperties(), item.Status).ToList(); // return list; //} public bool SaveAttachment(DriverAttachmentsDTO attachment) { var result = false; var connection = db.CreateConnection(); connection.Open(); var transaction = connection.BeginTransaction(); try { var saveCommand = db.GetStoredProcCommand(DBRoutine.SAVEATTACHMENTS); db.AddInParameter(saveCommand, "AttachmentId", System.Data.DbType.String, attachment.attachmentId); db.AddInParameter(saveCommand, "DrvierID", System.Data.DbType.String, attachment.driverId); db.AddInParameter(saveCommand, "LookupCode", System.Data.DbType.String, attachment.lookupCode); db.AddInParameter(saveCommand, "ImagePath", System.Data.DbType.String, attachment.imagePath); result = Convert.ToBoolean(db.ExecuteNonQuery(saveCommand, transaction)); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw ex; } return(result); }
public async Task <string> SaveDriverAttachmentAsync(DriverAttachmentsDTO attachment) { IRestClient client = new RestClient(ApiBaseUrl); var request = p_request; request.Method = Method.POST; request.Resource = "master/driver/saveattachment"; request.AddJsonBody(attachment); return(await Task.Run(() => { return ServiceResponse(client.Execute(request)); })); }
public IHttpActionResult SaveAttachment(DriverAttachmentsDTO attachments) { try { var result = new DriverBO().SaveAttachment(attachments); if (result) { return(Ok(UTILITY.SUCCESSMSG)); } else { return(BadRequest()); } } catch (Exception ex) { return(InternalServerError(ex)); } }
public async Task <JsonResult> AddAttachment() { var result = ""; try { foreach (string file in Request.Files) { var fileContent = Request.Files[file]; var driverId = Request.Form[0]; var lookupId = Request.Form[1]; string mapPath = Server.MapPath("~/Attachments/"); if (!Directory.Exists(mapPath)) { Directory.CreateDirectory(mapPath); } fileContent.SaveAs(mapPath + fileContent.FileName); DriverAttachmentsDTO atttachment = new DriverAttachmentsDTO() { attachmentId = driverId + lookupId, driverId = driverId, imagePath = fileContent.FileName, lookupCode = lookupId }; result = await new DriverService(AUTHTOKEN, p_mobileNo).SaveDriverAttachmentAsync(atttachment); } } catch (Exception ex) { throw; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public bool SaveAttachment(DriverAttachmentsDTO attachment) { return(driverDAL.SaveAttachment(attachment)); }