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

master
Mamadou Elaphi ARAFA 3 years ago
parent 10d7d165a0
commit 05264cc464

@ -10,10 +10,10 @@ namespace CalculateurApp
{
InitializeComponent();
MainPage = new NavigationPage(new HomePage());
MainPage = new NavigationPage(new HomePage());
//MainPage = new AppShell(BlocViewModel c);
// MainPage = new Maquette ();
// MainPage = new MatNote();
// MainPage = new Maquette ();
// MainPage = new Start();
}
}

@ -53,6 +53,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BSN\Bussness.csproj" />
<ProjectReference Include="..\CalculateurEF\CalculateurEF.csproj" />
<ProjectReference Include="..\ClassCalculateurMoyenne\ClassCalculateurMoyenne.csproj" />
</ItemGroup>

@ -9,8 +9,7 @@
<!--<Grid
<Grid
Padding="10"
RowSpacing="60"
ColumnSpacing="6">
@ -24,9 +23,11 @@
</Grid.ColumnDefinitions >
<Frame Grid.Row="0" BackgroundColor="Black"></Frame>
<Frame Grid.Row="1" BackgroundColor="Yellow"></Frame>
</Grid>-->
<ScrollView >
<Button Text=" afficher UE"></Button>
<BoxView Grid.Row="0" BackgroundColor="Red"></BoxView>
<BoxView Grid.Row="1" BackgroundColor="AliceBlue"></BoxView>
</Grid>
<!--<ScrollView >
<VerticalStackLayout Spacing="10" >
<Label Text="rouf"></Label>
<Frame>
@ -36,6 +37,6 @@
</Frame>
</VerticalStackLayout>
</ScrollView>
</ScrollView>-->
</ContentPage>

@ -9,7 +9,7 @@ public partial class HomePage : TabbedPage
private void Button_Clicked(object sender, EventArgs e)
{
Navigation.PushAsync(new Start());
Navigation.PushAsync(new Maquette());
}
}

@ -12,21 +12,21 @@
Padding="2"
RowSpacing="4"
ColumnSpacing="4">
<Entry Placeholder="Ajout de BLOC DANS LA MAQUETTE"
<Entry Placeholder="Ajout de BLOC DANS LA MAQUETTE"
Grid.Row="1" BackgroundColor="AliceBlue"
Text="{Binding blocModel.Nom }"
TextColor="Black"
/>
<Button
<Button
Command="{Binding AddCommand}"
Text="Add"
Grid.Row="1"
Grid.Column="1">
</Button>
</Button>
<Label Text="Liste des blocs" Grid.Row="2" Grid.ColumnSpan="2" FontSize="Header" HorizontalOptions="Center" TextDecorations="Underline" TextColor="Black" FontAttributes="Bold, Italic" ></Label>
<CollectionView Grid.Row="3" Grid.ColumnSpan="2" ItemsSource="{Binding Items}" SelectionMode="None" >
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="{x:Type model:BlocModel }">
<DataTemplate x:DataType="{x:Type model:BlocModel }">
<SwipeView>
<SwipeView.RightItems>
<SwipeItems>
@ -34,7 +34,7 @@
BackgroundColor="Red"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:MaquetteViewModel}}, Path=DeleteCommand}"
CommandParameter="{Binding .}"
/>
/>
</SwipeItems>
</SwipeView.RightItems>
<Grid Padding="0">
@ -45,28 +45,13 @@
CommandParameter="{Binding .}" />
</Frame.GestureRecognizers>
<Label Text="{Binding Nom}"
FontSize="10" TextColor="Black" />
FontSize="10" TextColor="Black"
/>
</Frame>
</Grid>
</SwipeView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<CollectionView>
</CollectionView>
<!--//<Label Text="Liste des UE dans la Bloc X " Grid.Row="3" VerticalOptions="Center" HorizontalOptions="Start"></Label>-->
<CollectionView Grid.Row="3" VerticalOptions="Center" HorizontalOptions="Start" ItemsSource="{Binding Items}" SelectionMode="None" >
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="{x:Type model:BlocModel }">
<Label Text="{Binding Nom}" Grid.Row="3" VerticalOptions="Center" HorizontalOptions="Start"
FontSize="10" TextColor="Black" />
</DataTemplate>
</CollectionView.ItemTemplate></CollectionView>
</CollectionView >
</Grid>
</ContentPage>

@ -3,12 +3,13 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:viewmodel="clr-namespace:CalculateurApp.ViewModel"
xmlns:model="clr-namespace:ClassCalculateurMoyenne;assembly=ClassCalculateurMoyenne"
x:Class="CalculateurApp.View.Start"
x:Class="CalculateurApp.View.Start"
x:DataType="viewmodel:BlocViewModel"
Title="StartPage"
BarTextColor="LightSalmon"
SelectedTabColor="DarkRed"
UnselectedTabColor="DarkKhaki">
<ContentPage Title=" Blocs " IconImageSource="mamoyenne.png" x:DataType="viewmodel:BlocViewModel">
<ContentPage Title=" Blocs " IconImageSource="mamoyenne.png" >
<Grid RowDefinitions="100 ,Auto,*"
ColumnDefinitions=".75*,.25*"
Padding="10"
@ -25,23 +26,19 @@
<Entry
Placeholder="coef"
WidthRequest="60"
Grid.Row="1"
Grid.Row="1"
HorizontalOptions="Center"
VerticalOptions="Center"
VerticalOptions="Center"
BackgroundColor="AliceBlue"
Text="{Binding ue.Coefficient}">
</Entry>
<!--<Label Text="{Binding Nom}"></Label>
<Button Text="go" Command="{Binding GoBackCommand}"></Button>-->
<Button
Command="{Binding AddCommand}"
Text="Add"
Grid.Row="1"
Grid.Column="1"
>
Grid.Column="1">
</Button>
<Button Text=" Delete" Grid.Row="1" HorizontalOptions="End" VerticalOptions="End" Command="{Binding DeleteCommand }"></Button>
<CollectionView Grid.Row="2" Grid.ColumnSpan="2" ItemsSource="{Binding Items}" >
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="{x:Type model:UE }">
@ -56,49 +53,43 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Grid.Row="1"
Grid.Column="0"
Text="{Binding Intitulé}"
FontAttributes="None"
VerticalOptions="End"
/>
VerticalOptions="End"/>
<Label Grid.Column="3"
Grid.Row="1"
Text="{Binding Coefficient}"
TextColor="Blue"
FontAttributes="Bold" />
<!--// <Button Text="DELETE"></Button>-->
</Grid>
</SwipeView>
<!--<SwipeView>
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Text="Delete"
BackgroundColor="Red"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:BlocViewModel}}, Path=DeleteCommand}"
CommandParameter="{Binding .}"
/>
</SwipeItems>
</SwipeView.RightItems>
<Grid Padding="0">-->
<!--<Frame>
<Frame.GestureRecognizers>
<TapGestureRecognizer
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:BlocViewModel}}, Path=TapCommand}"
CommandParameter="{Binding .}"/>
</Frame.GestureRecognizers>
<Label Text="{Binding Intitulé}"
FontSize="10" TextColor="Black" />
</Frame>
</Grid>
</SwipeView>-->
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
</ContentPage>
<!--<ContentPage Title="ue" IconImageSource="mamoyenne.png" x:DataType="viewmodel:UeViewModel" >
<Frame Margin="10,0,10,0" VerticalOptions="center">
<Grid RowDefinitions="100 ,auto,*"

@ -10,15 +10,11 @@ using System.Threading.Tasks;
namespace CalculateurApp.ViewModel
{
// [QueryProperty("Nom", "Nom")]
[QueryProperty("Nom", "Nom")]
public partial class BlocViewModel:ObservableObject
{
[RelayCommand]
async Task GoBack()
{
await Shell.Current.GoToAsync("..");
}
public BlocModel blocModel { get; set; }
public UE ue { get; set; }
public BlocViewModel()
@ -54,54 +50,16 @@ namespace CalculateurApp.ViewModel
}
}
//[RelayCommand]
//async Task Tap(String s)
//{
// await Shell.Current.GoToAsync($"{nameof(UE)}?Nom={s}");
//}
[RelayCommand]
async Task GoBack()
{
await Shell.Current.GoToAsync("..");
}
}
// public ObservableCollection<BlocModel> blcs { get; set; }
// public BlocViewModel()
// {
// Items = new ObservableCollection<string>();
// }
// [ObservableProperty]
// ObservableCollection<int> item;
// [RelayCommand]
// public void FillData()
// {
// blcs = new ObservableCollection<BlocModel>
// {
// new BlocModel()
// {
// id=0,
// },
// new BlocModel()
// {
// id=1,
// },
// new BlocModel()
// {
// id=2,
// },
// new BlocModel()
// {
// id=3,
// },
// new BlocModel()
// {
// id=4,
// },
// };
//ckkkkkkkk}
}

@ -1,4 +1,6 @@
using CalculateurApp.View;
using BSN;
using CalculateurApp.View;
using CalculateurEF.Context;
using ClassCalculateurMoyenne;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
@ -24,8 +26,10 @@ namespace CalculateurApp.ViewModel
}
[ObservableProperty]
ObservableCollection<BlocModel> items;
[ObservableProperty]
string nom;
[RelayCommand]
void Add()
{
@ -44,11 +48,19 @@ namespace CalculateurApp.ViewModel
Items.Remove(bl);
}
}
[RelayCommand]
async Task Tap(String s)
{
await Shell.Current.GoToAsync($"{nameof(BlocModel)}?Nom={s}");
}
[RelayCommand]
public void GetAllUE()
{
// var result=Manager
}
}
}

@ -10,17 +10,13 @@ using System.Threading.Tasks;
namespace CalculateurApp.ViewModel
{
// [QueryProperty("Nom", "Nom")]
[QueryProperty("Nom", "Nom")]
public partial class UeViewModel:ObservableObject
{
//[ObservableProperty]
//string nom;
//[RelayCommand]
//async Task GoBack()
//{
// await Shell.Current.GoToAsync("..");
//}
public UE u { get; set; }
public Matiere ma { get; set; }
@ -67,6 +63,11 @@ namespace CalculateurApp.ViewModel
Items.Remove(bl);
}
}
[RelayCommand]
async Task GoBack()
{
await Shell.Current.GoToAsync("..");
}
}

@ -9,8 +9,9 @@ namespace CalculateurEF.Entities
public class BlocEntity
{
#region Propriétés
public List<UEentity> ue;
public int Id { get; set; }
public string Nom { get; set; }
public string Nom;
//public ICollection<UEentity> ue { get; set; }

@ -12,5 +12,6 @@ namespace CalculateurEF.Entities
public long id { get; set; }
public int Note { get; set; }
public int Coef { get; set; }
}
}

@ -14,6 +14,7 @@ namespace CalculateurEF.Entities
public int Coefficient { get; set; }
public string intitulé { get; set; }
public ICollection<MatiereEntity> mat { get; set; }
public List<MatiereEntity> matiere;
public UEentity()

@ -13,21 +13,40 @@ namespace CalculateurMapping
{
public class BlocDbDataManager : IDataManager<BlocModel>
{
public Task<bool> Add(BlocModel data)
public async Task<bool> Add(BlocModel data)
{
throw new NotImplementedException();
bool resultat = false;
using (var context = new CalculContext())
{
BlocEntity entity = new BlocEntity
{
Nom = data.Getnom(),
};
for (int i = 0; i < data.ue.Count; i++)
{
UEentity uEentity = new UEentity
{
intitulé = data.ue[i].Intitulé
};
context.Bloc.Add(entity);
await context.SaveChangesAsync();
resultat = true;
}
return resultat;
}
}
public async Task<bool> Delete(BlocModel bloc)
{
//bool result = false;
//using (var context = new CalculContext())
//{
// BlocEntity entity = context.Bloc.Find(bloc.Nom);
// context.Bloc.Remove(entity);
// result = await context.SaveChangesAsync() > 0;
bool result = false;
using (var context = new CalculContext())
{
BlocEntity entity = context.Bloc.Find(bloc.Nom);
context.Bloc.Remove(entity);
result = await context.SaveChangesAsync() > 0;
//}
}
return true;
}
@ -49,8 +68,7 @@ namespace CalculateurMapping
using (var context = new CalculContext())
{
return await context.Bloc.Where(e => e.Nom == name).Select(e => new BlocModel
(
(
e.Nom,
e.ue.Select(j => new UE(j.intitulé)).ToArray()
)).FirstOrDefaultAsync();

@ -54,39 +54,59 @@ namespace CalculateurMapping
return result;
}
//public async Task<IEnumerable<MaquetteModel>> GetAll()
//{
// using (var context = new CalculContext())
// {
// return await context.Maquettes.Select(I => new MaquetteModel
// (
// I.Id,
// I.NomMaquette,
// I.Bloc.Select(u =>
// u.ue.Select(uee => new UE(uee.Id, uee.Coefficient, uee.intitulé,
// uee.mat.Select(ma => new Matiere(ma.id, ma.Note,ma.Nommatiere,ma.Coef)).ToArray()
// )).ToList()
// ),
// I.Bloc.Select(j => new BlocModel(j.Nom)).ToArray()
// )).ToListAsync();
// }
// return null;
// }
public async Task<IEnumerable<MaquetteModel>> GetAll()
{
//using (var context = new CalculContext())
//{
// return await context.Maquettes.Select(e => new MaquetteModel
// (e.Id,
// e.NomMaquette,
// e.Bloc.Select(u =>
// u.ue.Select(uee => new UE(uee.Id, uee.Coefficient, uee.intitulé,
// uee.mat.Select(ma => new Matiere(ma.id, ma.Note,ma.Nommatiere,ma.Coef)).ToArray()
// )).ToList()
// ),
// e.Bloc.Select(j => new BlocModel(j.Nom)).ToArray()
// )).ToListAsync();
//}
return null;
using (var context = new CalculContext())
{
List<MaquetteModel> maquettes = new List<MaquetteModel>();
foreach (var item in await context.Maquettes.ToListAsync())
maquettes.Add(new MaquetteModel(item.Id, item.NomMaquette));
return maquettes;
}
}
public async Task<MaquetteModel> GetDataWithName(string name)
{
using (var context = new CalculContext())
{
MaquetteModel _mqt = null;
var query = await context.Maquettes.FirstOrDefaultAsync(n => n.NomMaquette == name);
_mqt = new MaquetteModel(query.Id, query.NomMaquette);
return _mqt;
}
}
//using (var context = new CalculContext())
//{
// return await context.Maquettes.Where(e => e.NomMaquette == name).Select(e => new MaquetteModel
// (
// // e.Id,
// //e.NomMaquette,
// //e.Bloc.Select(u => u.ue).ToList(),
// //e.Bloc.Select(j => new BlocModel(j.Nom)).ToArray()
//e.Id,
//e.NomMaquette,
//e.Bloc.Select(u => u.ue).ToList(),
//e.Bloc.Select(j => new BlocModel(j.Nom)).ToArray()
// )).FirstOrDefaultAsync();
//}
return null;
}
public async Task<bool> Update(MaquetteModel data)
{

@ -1,5 +1,6 @@
using BSN;
using CalculateurEF.Context;
using CalculateurEF.Entities;
using ClassCalculateurMoyenne;
using Microsoft.EntityFrameworkCore;
using System;
@ -12,23 +13,43 @@ namespace CalculateurMapping
{
public class MatiereDbDataManager : IDataManager<Matiere>
{ //Maping entre la classe Matier et MatiereEntity
public Task<bool> Add(Matiere data)
public async Task<bool> Add(Matiere data)
{
throw new NotImplementedException();
bool result = false;
using (var context = new CalculContext())
{
MatiereEntity entity = new MatiereEntity
{
Nommatiere = data.GetNommatiere(),
};
context.matier.Add(entity);
await context.SaveChangesAsync();
result = true;
return result;
}
}
public Task<bool> Delete(Matiere data)
public async Task<bool> Delete(Matiere mat)
{
throw new NotImplementedException();
bool result = false;
using (var Context = new CalculContext())
{
MatiereEntity entity = Context.matier.Find(mat.GetNommatiere());
Context.matier.Remove(entity);
result = await Context.SaveChangesAsync() > 0;
}
return result;
}
public async Task<IEnumerable<Matiere>> GetAll()
{
using (var context = new CalculContext())
{
return await context.matier.Select(e => new Matiere
( e.id,
e.Note,
return await context.matier.Select(e => new Matiere
(e.id,
e.Note,
e.Nommatiere,
e.Coef
)).ToListAsync();
@ -40,9 +61,21 @@ namespace CalculateurMapping
throw new NotImplementedException();
}
public Task<bool> Update(Matiere data)
public async Task<bool> Update(Matiere mat)
{
throw new NotImplementedException();
bool result = false;
using (var context = new CalculContext())
{
MatiereEntity entity = context.matier?.Find(mat.Id);
if (entity != null)
{
entity.Nommatiere = mat.Nommatiere;
result = await context.SaveChangesAsync() > 0;
}
return result;
}
}
}
}

@ -1,8 +1,12 @@
using BSN;
using CalculateurEF.Context;
using CalculateurEF.Entities;
using ClassCalculateurMoyenne;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
@ -10,19 +14,55 @@ namespace CalculateurMapping
{
public class UeDbDataManager : IDataManager<UE>
{
public Task<bool> Add(UE data)
public async Task<bool> Add(UE data)
{
throw new NotImplementedException();
bool resultat = false;
using (var context = new CalculContext())
{
UEentity entity = new UEentity
{
intitulé = data.GetIntitulé(),
};
for (int i = 0; i < data.Matieres.Count; i++)
{
MatiereEntity matiereEntity = new MatiereEntity
{
Nommatiere = data.Matieres[i].Nommatiere
};
context.Ue.Add(entity);
await context.SaveChangesAsync();
resultat = true;
}
return resultat;
}
}
public Task<bool> Delete(UE data)
public async Task<bool> Delete(UE data)
{
throw new NotImplementedException();
bool result = false;
using (var context = new CalculContext())
{
UEentity entity = context.Ue.Find(data.Intitulé);
context.Ue.Remove(entity);
result = await context.SaveChangesAsync() > 0;
}
return true;
}
public Task<IEnumerable<UE>> GetAll()
public async Task<IEnumerable<UE>> GetAll()
{
throw new NotImplementedException();
using (var context = new CalculContext())
{
return await context.Ue.Select(e => new UE
(
e.Id,
e.Coefficient,
e.intitulé,
e.matiere.Select(j => new Matiere(j.Nommatiere)).ToArray()
)).ToListAsync();
}
}
public Task<UE> GetDataWithName(string name)
@ -30,9 +70,20 @@ namespace CalculateurMapping
throw new NotImplementedException();
}
public Task<bool> Update(UE data)
public async Task<bool> Update(UE data)
{
throw new NotImplementedException();
bool result = false;
using (var context = new CalculContext())
{
UEentity entity = context.Ue.Find(data.Id);
entity.intitulé = data.Intitulé;
entity.matiere = data.Matieres.Select(j => new MatiereEntity
{
Nommatiere = j.Nommatiere,
}).ToList();
result = await context.SaveChangesAsync() > 0;
}
return result;
}
}
}

@ -49,6 +49,11 @@ namespace ClassCalculateurMoyenne
{
}
public string Getnom()
{
return Getnom();
}
private IEnumerable<UE> Ajouterue(params UE[] ues)
{
List<UE> result = new();
@ -88,10 +93,9 @@ namespace ClassCalculateurMoyenne
{
if (ues.Contains(nouveauUE))
return true;
return false;
return false;
}
public bool Equals(BlocModel other)
public bool Equals(BlocModel other)
{
return Equals(other.Nom);
@ -103,5 +107,9 @@ namespace ClassCalculateurMoyenne
if (GetType() != obj.GetType()) return false;
return Equals(obj as BlocModel);
}
public override int GetHashCode()
{
return Nom.GetHashCode();
}
}
}

@ -81,8 +81,9 @@ namespace ClassCalculateurMoyenne
{
return false;
}
}
}
public bool ajouteBloc(BlocModel b)
{
if (IsExiste(b))
@ -96,6 +97,10 @@ namespace ClassCalculateurMoyenne
}
}
public override int GetHashCode()
{
return NomMaquette.GetHashCode();
}
private bool IsExiste(BlocModel b)
{

@ -10,15 +10,23 @@ namespace ClassCalculateurMoyenne
public class Matiere
{
public long Id { get; set; }
public string Nommatiere { get; set; }
public int Note { get; set; }
public int Coef { get; set; }
public Matiere()
public string GetNommatiere()
{
return GetNommatiere();
}
private void SetNomMaquette(string value)
{
this.Nommatiere = value;
}
public Matiere(long id ,int note, string nommatiere, int coef)
public Matiere(long id ,int note, string nommatiere, int coef)
{
Id = id;
Coef = coef;
@ -30,6 +38,11 @@ namespace ClassCalculateurMoyenne
{
Nommatiere = nommatiere;
}
public Matiere()
{
}
public override string ToString()
{
return $"{Nommatiere},{Note},{Coef}";

@ -11,7 +11,10 @@ namespace ClassCalculateurMoyenne
private int coefficient;
[ObservableProperty]
private string intitulé;
public string GetIntitulé()
{
return GetIntitulé();
}
public UE ( long id, int coefficient, string intitulé,params Matiere[] matieres)
{

@ -4,10 +4,10 @@ using CalculateurEF.Entities;
Console.WriteLine("Hello, World!");
namespace testpourEF
{ class Program
{
{ class Program
{
}
}
}

Loading…
Cancel
Save