public int AddReportConsumable(ReportConsumableInfo info) { sqlStr = "INSERT INTO tblReportConsumable(DispatchReportID,ConsumableID,LotNum,Qty) " + " VALUES(@DispatchReportID,@ConsumableID,@LotNum,@Qty)" + " SELECT @@IDENTITY"; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@DispatchReportID", SqlDbType.Int).Value = info.DispatchReportID; command.Parameters.Add("@ConsumableID", SqlDbType.Int).Value = info.InvConsumable.Consumable.ID; command.Parameters.Add("@LotNum", SqlDbType.NVarChar).Value = info.InvConsumable.LotNum; command.Parameters.Add("@Qty", SqlDbType.Decimal).Value = info.Qty; info.ID = SQLUtil.ConvertInt(command.ExecuteScalar()); } return(info.ID); }
public JsonResult SaveReportConsumable(ReportConsumableInfo info) { ResultModel <ReportConsumableInfo> result = new ResultModel <ReportConsumableInfo>(); if (CheckSession(false) == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } try { info = dispatchManager.SaveReportConsumable(info); result.Data = info; } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(JsonResult(result)); }
public ReportConsumableInfo SaveReportConsumable(ReportConsumableInfo info) { info.ID = this.dispatchReportDao.AddReportConsumable(info); return(info); }