cntxt
continuous-integration/drone/push Build is failing Details

master
etudiant 3 years ago
parent c0f6bb63b1
commit 44cb3d3bbe

@ -10,7 +10,6 @@ namespace Bussness
public interface IDataManager<Data> public interface IDataManager<Data>
{ {
Task<bool> Add(Data data); Task<bool> Add(Data data);
Task<bool> Delete(Data data); Task<bool> Delete(Data data);
Task<bool> Update(Data data); Task<bool> Update(Data data);
Task<Data> GetDataWithName(string name); Task<Data> GetDataWithName(string name);

@ -14,7 +14,7 @@
ColumnSpacing="4"> ColumnSpacing="4">
<Entry Placeholder="Ajout de BLOC DANS LA MAQUETTE" <Entry Placeholder="Ajout de BLOC DANS LA MAQUETTE"
Grid.Row="1" BackgroundColor="AliceBlue" Grid.Row="1" BackgroundColor="AliceBlue"
Text="{Binding blocModel.Nom }" Text=""
TextColor="Black" TextColor="Black"
/> />
<Button x:Name="Afer" Text="Modifier" Grid.Row="1" Grid.Column="1" HorizontalOptions="End" VerticalOptions="End" WidthRequest="80" Command="{Binding GetAllBlocCommand}"> </Button> <Button x:Name="Afer" Text="Modifier" Grid.Row="1" Grid.Column="1" HorizontalOptions="End" VerticalOptions="End" WidthRequest="80" Command="{Binding GetAllBlocCommand}"> </Button>

@ -15,133 +15,138 @@ using System.Reflection.Metadata;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace CalculateurApp.ViewModel namespace CalculateurApp.ViewModel;
public partial class MaquetteViewModel:ObservableObject
{ {
public partial class MaquetteViewModel:ObservableObject
public BlocModel blocModel { get; set; }
// public ReadOnlyObservableCollection<BlocModel>lst { get; set; }
public Manager manager { get; set; }
public MaquetteViewModel()
{ {
//Items = new ObservableCollection<BlocModel>();
//try
//{
// foreach (var BB in manager.GetAllBloc().Result)
// Items.Add(BB);
//}
//catch (Exception ex)
//{
// Debug.WriteLine(ex);
//}
public BlocModel blocModel { get; set; }
// public ReadOnlyObservableCollection<BlocModel>lst { get; set; }
public Manager manager { get; set; }
//blocModel = new BlocModel();
}
public void init1()
{
Items = new ObservableCollection<BlocModel>();
public MaquetteViewModel() try
{ {
//Items = new ObservableCollection<BlocModel>(); foreach (var BB in manager.GetAllBloc().Result)
Items.Add(BB);
//try
//{
// foreach (var BB in manager.GetAllBloc().Result)
// Items.Add(BB);
//}
//catch (Exception ex)
//{
// Debug.WriteLine(ex);
//}
//blocModel = new BlocModel();
} }
public void init1() catch (Exception ex)
{ {
Items = new ObservableCollection<BlocModel>(); Debug.WriteLine(ex);
}
try
{
foreach (var BB in manager.GetAllBloc().Result)
Items.Add(BB);
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
blocModel = new BlocModel();
}
[ObservableProperty]
ObservableCollection<BlocModel> items;
[ObservableProperty]
ObservableCollection<BlocModel> lstblc=new ObservableCollection<BlocModel>();
[ObservableProperty]
string nom;
[RelayCommand]
async void Add()
{
// Manager blocDbDataManager = new Manager(new BlocDbDataManager<CalculDbMaui>());
if (string.IsNullOrEmpty(blocModel.Nom))
return;
//BlocModel u = blocModel;
//MaquetteModel u = new MaquetteModel();
Items.Add(blocModel);
await manager.AddBlocmaquette(manager.SelectedMaquetteModel, blocModel);
blocModel = new BlocModel(); }
[RelayCommand]
async void Delete(BlocModel bl)
{
if (Items.Contains(bl))
{
Items.Remove(bl);
await manager.DeleteBloc(bl);
var o = await manager.GetAllBloc();
} }
[ObservableProperty]
ObservableCollection<BlocModel> items;
[ObservableProperty]
ObservableCollection<BlocModel> lstblc=new ObservableCollection<BlocModel>();
[ObservableProperty]
string nom;
[RelayCommand]
async void Add() //if (Items.Contains(model))
{ //{
// Manager blocDbDataManager = new Manager(new BlocDbDataManager<CalculDbMaui>()); // Items.Remove(model);
// await manager.Deletemqt(model);
if (string.IsNullOrEmpty(blocModel.Nom))
return;
//BlocModel u = blocModel;
//MaquetteModel u = new MaquetteModel();
Items.Add(blocModel);
await manager.AddBlocmaquette(manager.SelectedMaquetteModel, blocModel);
} // var v = await manager.GetAllMaquette();
[RelayCommand] // Console.WriteLine(v);
async void Delete(BlocModel bl)
{
if (Items.Contains(bl))
{
Items.Remove(bl);
await manager.DeleteBloc(bl);
var o = await manager.GetAllBloc();
}
//if (Items.Contains(model))
//{
// Items.Remove(model);
// await manager.Deletemqt(model);
// var v = await manager.GetAllMaquette();
// Console.WriteLine(v);
//}
}
[RelayCommand]
void AjoutUE(BlocModel bl)
//}
}
[RelayCommand]
void AjoutUE(BlocModel bl)
{
if (Items.Contains(bl))
{ {
if (Items.Contains(bl)) Items.Remove(bl);
{
Items.Remove(bl);
}
} }
}
[RelayCommand] [RelayCommand]
async Task Tap(String s) async Task Tap(String s)
{ {
await Shell.Current.GoToAsync($"{nameof(UE)}?Nom={s}"); await Shell.Current.GoToAsync($"{nameof(UE)}?Nom={s}");
} }
[RelayCommand] [RelayCommand]
async Task GoBack() async Task GoBack()
{ {
await Shell.Current.GoToAsync(".."); await Shell.Current.GoToAsync("..");
} }
public void ApplyQueryAttributes(IDictionary<string, object> query) public void ApplyQueryAttributes(IDictionary<string, object> query)
{ {
var Maquette = query["maquette"] as MaquetteModel; var Maquette = query["maquette"] as MaquetteModel;
blocModel.IDMaquetteFrk = Maquette.Id; blocModel.IDMaquetteFrk = Maquette.Id;
} }
[RelayCommand] [RelayCommand]
public void GetAllBloc() public void GetAllBloc()
{ {
var result = manager.GetAllBloc(); var result = manager.GetAllBloc();
foreach(var item in result.Result) foreach(var item in result.Result)
{ {
lstblc.Add(item); lstblc.Add(item);
}
} }
} }
[RelayCommand]
public void Blocview(IEnumerable<BlocModel> blocModels)
{
//items.Add
}
} }

@ -57,6 +57,16 @@ namespace CalculateurMapping
} }
return true; return true;
} }
public async Task<bool>GetByMaquette(MaquetteModel maquette) {
using (var context = new TContext())
{
//
}
return true;
}
public async Task<List<BlocModel>> GetAll() public async Task<List<BlocModel>> GetAll()
{ //getAll { //getAll

@ -51,6 +51,7 @@ namespace CalculateurMapping
BlocEntity entity = new BlocEntity BlocEntity entity = new BlocEntity
{ {
Id = blocModel.Id, Id = blocModel.Id,
Nom = blocModel.Nom,
MaquetteEntity = new MaquetteEntity MaquetteEntity = new MaquetteEntity
{ {
Id = mqt.Id, Id = mqt.Id,
@ -62,10 +63,11 @@ namespace CalculateurMapping
if (!data.Bloc.Contains(entity)) if (!data.Bloc.Contains(entity))
{ {
data.Bloc.Add(entity); data.Bloc.Add(entity);
await context.Bloc.AddAsync(entity); // await context.Maquettes.AddAsync(data);
// context.Maquettes.Update(data); // Console.WriteLine("jyij");
context.Maquettes.Update(data);
await context.SaveChangesAsync();
result = await context.SaveChangesAsync() > 0;
} }
} }
//context.Database.EnsureCreated(); //context.Database.EnsureCreated();

Loading…
Cancel
Save