public int InsertOrderDetails(ConvertToOrder convertToOrder, int tenantId, int userId) { int InsertCount = 0; try { conn.Open(); MySqlCommand cmd = new MySqlCommand("SP_PHYInsertOrderDetails", conn) { Connection = conn }; cmd.Parameters.AddWithValue("@_ShoppingID", convertToOrder.ShoppingID); cmd.Parameters.AddWithValue("@_InvoiceNo", convertToOrder.InvoiceNo); cmd.Parameters.AddWithValue("@_Amount", convertToOrder.Amount); cmd.Parameters.AddWithValue("@_TenantID", tenantId); cmd.Parameters.AddWithValue("@_UserID", userId); cmd.CommandType = CommandType.StoredProcedure; InsertCount = Convert.ToInt32(cmd.ExecuteNonQuery()); } catch (Exception) { throw; } finally { if (conn != null) { conn.Close(); } } return(InsertCount); }
public ResponseModel InsertOrderDetails([FromBody] ConvertToOrder convertToOrder) { int InsertCount = 0; HSOrderCaller hSOrderCaller = new HSOrderCaller(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token)); InsertCount = hSOrderCaller.InsertOrderDetails(new HSOrderService(_connectionString), convertToOrder, authenticate.TenantId, authenticate.UserMasterID); statusCode = InsertCount.Equals(0) ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = InsertCount; } catch (Exception) { throw; } return(objResponseModel); }
public int InsertOrderDetails(IHSOrder order, ConvertToOrder convertToOrder, int tenantId, int userId) { _OrderRepository = order; return(_OrderRepository.InsertOrderDetails(convertToOrder, tenantId, userId)); }