public static int UpdateSalesItems(SalesItemDTO salesItemDto) { string query = "UPDATE sale_has_item SET sale_id = " + salesItemDto.SalesId + ", phi_id = " + salesItemDto.PurchaseHItemId + ", brand_id = " + salesItemDto.BrandId + ", qty = " + salesItemDto.Quntity + ", unit_price = " + salesItemDto.Price + ", updated_by = " + salesItemDto.UpdatedBy + ", updated_at = '" + DateTime.Now + "' WHERE id = " + salesItemDto.Id; try { DataTable salesItemTable = DatabaseConnection.ConnectWithServer(query); if (salesItemTable == null) { return(-1); } return(1); } catch (Exception) { return(-1); } }
public static int AddSalesItems(SalesItemDTO salesItemDto) { string query = "INSERT INTO sale_has_item (sale_id, product_id, brand_id, phi_id, qty, unit_price, created_by) VALUES " + "( " + "" + salesItemDto.SalesId + "," + salesItemDto.ProductId + "," + salesItemDto.BrandId + "," + salesItemDto.PurchaseHItemId + "," + salesItemDto.Quntity + "," + salesItemDto.Price + "," + salesItemDto.CreatedBy + ")"; try { DataTable salesItemTable = DatabaseConnection.ConnectWithServer(query); if (salesItemTable == null) { return(-1); } return(1); } catch (Exception) { return(-1); } }