public HttpResponseMessage VerifyProofDetils() { bool res = false; HttpResponseMessage message; ManpowerProofInsertDTO objVerifyDetil = new ManpowerProofInsertDTO(); var VerifyProof = HttpContext.Current.Request.Files[0]; var ProofFileName = DateTime.Now.Ticks + "_" + VerifyProof.FileName; var ManpowerId = HttpContext.Current.Request.Form[0]; var ProofId = HttpContext.Current.Request.Form[1]; objVerifyDetil.ProofCardNo = HttpContext.Current.Request.Form[2]; objVerifyDetil.CreatedBy = HttpContext.Current.Request.Form[3]; objVerifyDetil.ProofUrl = ProofFileName; objVerifyDetil.ManpowerId = Convert.ToInt32(ManpowerId); objVerifyDetil.ProofId = Convert.ToInt32(ProofId); CreateProofDetail(objVerifyDetil); if (VerifyProof != null && ProofFileName != null) { var pathf = HttpContext.Current.Server.MapPath("~/ProofImages"); var fileSavePath = Path.Combine(pathf, ProofFileName); Directory.CreateDirectory(pathf); VerifyProof.SaveAs(fileSavePath); res = true; } return(message = Request.CreateResponse(HttpStatusCode.OK, new { msgText = "Success!", result = res })); }
public HttpResponseMessage CreateProofDetail(ManpowerProofInsertDTO objVerifyProof) { HttpResponseMessage message; try { // ManPowerDataAccessLayer dal = new ManPowerDataAccessLayer(); var dynObj = new { result = _obj.InsertVerifyProof(objVerifyProof) }; message = Request.CreateResponse(HttpStatusCode.OK, dynObj); } catch (Exception ex) { message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Somthing wrong, Try Again!" }); ErrorLog.CreateErrorMessage(ex, "ManPower", "CreateProofDetail"); } return(message); }
public bool InsertVerifyProof(ManpowerProofInsertDTO objVerifyProof) { bool res = false; SqlCommand SqlCmd = new SqlCommand("spInsertManPowerProof"); SqlCmd.CommandType = CommandType.StoredProcedure; SqlCmd.Parameters.AddWithValue("@ManpowerId", objVerifyProof.ManpowerId); SqlCmd.Parameters.AddWithValue("@ProofId", objVerifyProof.ProofId); SqlCmd.Parameters.AddWithValue("@ProofCardNo", objVerifyProof.ProofCardNo); SqlCmd.Parameters.AddWithValue("@ProofUrl", objVerifyProof.ProofUrl); SqlCmd.Parameters.AddWithValue("@CreatedBy", objVerifyProof.CreatedBy); int result = _unitOfWork.DbLayer.ExecuteNonQuery(SqlCmd); if (result != Int32.MaxValue) { res = true; } return(res); }