public bool CreateP(RequestLine requestline, string ProductName) { var productctrl = new ProductController(connection); var product = productctrl.GetByName(ProductName); requestline.ProductId = product.Id; return(Create(requestline)); }
public bool Create(RequestLine requestline, string RequestDescription) { var RequestCtrl = new RequestController(connection); var request = RequestCtrl.GetByDescription(RequestDescription); requestline.RequestId = request.Id; return(Create(requestline)); }
private RequestLine FillRequestLineFromSqlRow(SqlDataReader reader) { var requestline = new RequestLine() { Id = Convert.ToInt32(reader["Id"]), RequestId = Convert.ToInt32(reader["RequestId"]), ProductId = Convert.ToInt32(reader["ProductId"]), Quantity = Convert.ToInt32(reader["Quantity"]) }; return(requestline); }
public bool Change(RequestLine requestLine) { var sql = "Update RequestLines set" + " (RequestId, ProductId, Quantity) " + "Values (@requestid, @productid, @quantity);"; var cmd = new SqlCommand(sql, connection.SqlConn); FillCmdParFromSqlRowsForRequestLines(cmd, requestLine); var rowsaffected = cmd.ExecuteNonQuery(); return(rowsaffected == 1); }
private void GetProductForRequestLine(RequestLine requestLine) { var productctrl = new ProductController(connection); requestLine.product = productctrl.GetByPk(requestLine.ProductId); }
private void GetRequestForRequestLine(RequestLine requestLine) { var requestctrl = new RequestController(connection); requestLine.request = requestctrl.GetByPk(requestLine.RequestId); }
private void FillCmdParFromSqlRowsForRequestLines(SqlCommand cmd, RequestLine requestLine) { cmd.Parameters.AddWithValue("@requestid", requestLine.RequestId); cmd.Parameters.AddWithValue("@productid", requestLine.ProductId); cmd.Parameters.AddWithValue("@quantity", requestLine.Quantity); }