public static bool SaveGinDetail(whgi2 ginDetail) { int afRecCnt = 0; string storeProcName; using (var connection = new ConnectionProvider(ApiService.Site).CreateDbConnection()) { try { connection.Open(); int ginDetailCnt = connection.ExecuteScalar <int>(qryGoodsIssueNote.selectGinDetailCount, new { TrxNo = ginDetail.TrxNo, LineItemNo = ginDetail.LineItemNo }); if (ginDetailCnt > 0) { storeProcName = qryGoodsIssueNote.updateGinDetail; } else { storeProcName = qryGoodsIssueNote.insertGinDetail; } var param = connection.GetStoreProcParams(storeProcName, ginDetail); afRecCnt = connection.Execute(storeProcName, param, null, null, CommandType.StoredProcedure); } catch (Exception) { throw; } finally { connection.Close(); } } return(afRecCnt > 0 ? true : false); }
public IHttpActionResult SaveGinDetail(whgi2 ginDetail) { if (!ModelState.IsValid) { return(BadRequest()); } bool isValid = GinHelper.SaveGinDetail(ginDetail); if (!isValid) { return(InternalServerError()); } return(Ok()); }
public static whgi2 GetGinDetail(int TrxNo, int LineItemNo) { whgi2 ginDetail = null; using (var connection = new ConnectionProvider(ApiService.Site).CreateDbConnection()) { try { connection.Open(); ginDetail = connection.QuerySingleOrDefault <whgi2>(qryGoodsIssueNote.selectGinDetail, new { TrxNo, LineItemNo }); } catch (Exception) { throw; } finally { connection.Close(); } } return(ginDetail); }