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>
{
Task<bool> Add(Data data);
Task<bool> Delete(Data data);
Task<bool> Update(Data data);
Task<Data> GetDataWithName(string name);

@ -14,7 +14,7 @@
ColumnSpacing="4">
<Entry Placeholder="Ajout de BLOC DANS LA MAQUETTE"
Grid.Row="1" BackgroundColor="AliceBlue"
Text="{Binding blocModel.Nom }"
Text=""
TextColor="Black"
/>
<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.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>();
//try
//{
// foreach (var BB in manager.GetAllBloc().Result)
// Items.Add(BB);
//}
//catch (Exception ex)
//{
// Debug.WriteLine(ex);
//}
//blocModel = new BlocModel();
foreach (var BB in manager.GetAllBloc().Result)
Items.Add(BB);
}
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()
{
// 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);
//if (Items.Contains(model))
//{
// Items.Remove(model);
// await manager.Deletemqt(model);
}
[RelayCommand]
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)
// var v = await manager.GetAllMaquette();
// Console.WriteLine(v);
//}
}
[RelayCommand]
void AjoutUE(BlocModel bl)
{
if (Items.Contains(bl))
{
if (Items.Contains(bl))
{
Items.Remove(bl);
}
Items.Remove(bl);
}
}
[RelayCommand]
async Task Tap(String s)
{
await Shell.Current.GoToAsync($"{nameof(UE)}?Nom={s}");
[RelayCommand]
async Task Tap(String s)
{
await Shell.Current.GoToAsync($"{nameof(UE)}?Nom={s}");
}
[RelayCommand]
async Task GoBack()
{
await Shell.Current.GoToAsync("..");
}
}
[RelayCommand]
async Task GoBack()
{
await Shell.Current.GoToAsync("..");
}
public void ApplyQueryAttributes(IDictionary<string, object> query)
{
var Maquette = query["maquette"] as MaquetteModel;
public void ApplyQueryAttributes(IDictionary<string, object> query)
{
var Maquette = query["maquette"] as MaquetteModel;
blocModel.IDMaquetteFrk = Maquette.Id;
}
[RelayCommand]
public void GetAllBloc()
{
blocModel.IDMaquetteFrk = Maquette.Id;
}
[RelayCommand]
public void GetAllBloc()
{
var result = manager.GetAllBloc();
foreach(var item in result.Result)
{
lstblc.Add(item);
var result = manager.GetAllBloc();
foreach(var item in result.Result)
{
lstblc.Add(item);
}
}
}
[RelayCommand]
public void Blocview(IEnumerable<BlocModel> blocModels)
{
//items.Add
}
}

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

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

Loading…
Cancel
Save