Mission 2 finie. Gestion d'abonnement mise en place et fonctionnelle
This commit is contained in:
parent
0852605c42
commit
2e362003d7
16 changed files with 846 additions and 1 deletions
|
|
@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.32413.511
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaTekDocuments", "MediaTekDocuments\MediaTekDocuments.csproj", "{75DE903D-6147-4E14-BBE0-FA20CD1F9840}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaTekDocuments", "MediaTekDocuments\MediaTekDocuments.csproj", "{75DE903D-6147-4E14-BBE0-FA20CD1F9840}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mediatek.Tests", "Mediatek.Tests\Mediatek.Tests.csproj", "{C5F4A786-C844-424C-BB13-F45C6C4CBB93}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|
@ -15,6 +17,10 @@ Global
|
||||||
{75DE903D-6147-4E14-BBE0-FA20CD1F9840}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{75DE903D-6147-4E14-BBE0-FA20CD1F9840}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{75DE903D-6147-4E14-BBE0-FA20CD1F9840}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{75DE903D-6147-4E14-BBE0-FA20CD1F9840}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{75DE903D-6147-4E14-BBE0-FA20CD1F9840}.Release|Any CPU.Build.0 = Release|Any CPU
|
{75DE903D-6147-4E14-BBE0-FA20CD1F9840}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{C5F4A786-C844-424C-BB13-F45C6C4CBB93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C5F4A786-C844-424C-BB13-F45C6C4CBB93}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C5F4A786-C844-424C-BB13-F45C6C4CBB93}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C5F4A786-C844-424C-BB13-F45C6C4CBB93}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@
|
||||||
<Compile Include="manager\ApiRest.cs" />
|
<Compile Include="manager\ApiRest.cs" />
|
||||||
<Compile Include="controller\FrmMediatekController.cs" />
|
<Compile Include="controller\FrmMediatekController.cs" />
|
||||||
<Compile Include="dal\Access.cs" />
|
<Compile Include="dal\Access.cs" />
|
||||||
|
<Compile Include="model\Abonnement.cs" />
|
||||||
<Compile Include="model\CommandeDocument.cs" />
|
<Compile Include="model\CommandeDocument.cs" />
|
||||||
<Compile Include="view\FrmMediatek.cs">
|
<Compile Include="view\FrmMediatek.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
|
|
|
||||||
|
|
@ -127,5 +127,20 @@ namespace MediaTekDocuments.controller
|
||||||
{
|
{
|
||||||
return access.UpdateSuiviCommande(idCommande, idSuivi);
|
return access.UpdateSuiviCommande(idCommande, idSuivi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Abonnement> GetAbonnements(string idRevue)
|
||||||
|
{
|
||||||
|
return access.GetAbonnements(idRevue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CreerAbonnement(Abonnement abonnement)
|
||||||
|
{
|
||||||
|
return access.CreerAbonnement(abonnement);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SupprimerAbonnement(Abonnement abonnement)
|
||||||
|
{
|
||||||
|
return access.SupprimerAbonnement(abonnement.Id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -327,5 +327,38 @@ namespace MediaTekDocuments.dal
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Abonnement> GetAbonnements(string idRevue)
|
||||||
|
{
|
||||||
|
string jsonIdRevue = convertToJson("id", idRevue);
|
||||||
|
return TraitementRecup<Abonnement>(GET, "commanderevue/" + jsonIdRevue, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CreerAbonnement(Abonnement abonnement)
|
||||||
|
{
|
||||||
|
string jsonAbonnement = JsonConvert.SerializeObject(abonnement, new CustomDateTimeConverter());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
JObject retour = api.RecupDistant(POST, "abonnement", "champs=" + jsonAbonnement);
|
||||||
|
|
||||||
|
return retour["code"].ToString().Equals("200");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Erreur lors de l'accès à l'API : " + ex.Message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SupprimerAbonnement(string idAbonnement)
|
||||||
|
{
|
||||||
|
string jsonId = convertToJson("id", idAbonnement);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
JObject retour = api.RecupDistant(DELETE, "abonnement/" + jsonId, null);
|
||||||
|
return retour["code"].ToString().Equals("200");
|
||||||
|
}
|
||||||
|
catch { return false; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
22
MediaTekDocuments/model/Abonnement.cs
Normal file
22
MediaTekDocuments/model/Abonnement.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace MediaTekDocuments.model
|
||||||
|
{
|
||||||
|
public class Abonnement
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public DateTime DateCommande { get; set; }
|
||||||
|
public double Montant { get; set; }
|
||||||
|
public DateTime DateFinAbonnement { get; set; }
|
||||||
|
public string IdRevue { get; set; }
|
||||||
|
|
||||||
|
public Abonnement(string id, DateTime dateCommande, double montant, DateTime dateFinAbonnement, string idRevue)
|
||||||
|
{
|
||||||
|
this.Id = id;
|
||||||
|
this.DateCommande = dateCommande;
|
||||||
|
this.Montant = montant;
|
||||||
|
this.DateFinAbonnement = dateFinAbonnement;
|
||||||
|
this.IdRevue = idRevue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
334
MediaTekDocuments/view/FrmMediatek.Designer.cs
generated
334
MediaTekDocuments/view/FrmMediatek.Designer.cs
generated
|
|
@ -256,6 +256,33 @@ namespace MediaTekDocuments.view
|
||||||
this.dgvDvd = new System.Windows.Forms.DataGridView();
|
this.dgvDvd = new System.Windows.Forms.DataGridView();
|
||||||
this.txtRechercheDvd = new System.Windows.Forms.TextBox();
|
this.txtRechercheDvd = new System.Windows.Forms.TextBox();
|
||||||
this.label78 = new System.Windows.Forms.Label();
|
this.label78 = new System.Windows.Forms.Label();
|
||||||
|
this.tabCommandesRevues = new System.Windows.Forms.TabPage();
|
||||||
|
this.grpAbonnementSaisie = new System.Windows.Forms.GroupBox();
|
||||||
|
this.btnAbonnementSupprimer = new System.Windows.Forms.Button();
|
||||||
|
this.btnAbonnementAjouter = new System.Windows.Forms.Button();
|
||||||
|
this.dtpAbonnementDateFin = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.label101 = new System.Windows.Forms.Label();
|
||||||
|
this.nudAbonnementMontant = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.label100 = new System.Windows.Forms.Label();
|
||||||
|
this.dtpAbonnementDateCommande = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.label99 = new System.Windows.Forms.Label();
|
||||||
|
this.grpAbonnementsInfos = new System.Windows.Forms.GroupBox();
|
||||||
|
this.dgvAbonnements = new System.Windows.Forms.DataGridView();
|
||||||
|
this.label98 = new System.Windows.Forms.Label();
|
||||||
|
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||||
|
this.label97 = new System.Windows.Forms.Label();
|
||||||
|
this.txbRevuesCommandesRayon = new System.Windows.Forms.TextBox();
|
||||||
|
this.label96 = new System.Windows.Forms.Label();
|
||||||
|
this.txbRevuesCommandesPublic = new System.Windows.Forms.TextBox();
|
||||||
|
this.txbRevuesCommandesGenre = new System.Windows.Forms.TextBox();
|
||||||
|
this.label95 = new System.Windows.Forms.Label();
|
||||||
|
this.txbRevuesCommandesPeriodicite = new System.Windows.Forms.TextBox();
|
||||||
|
this.label94 = new System.Windows.Forms.Label();
|
||||||
|
this.txbRevuesCommandesTitre = new System.Windows.Forms.TextBox();
|
||||||
|
this.label93 = new System.Windows.Forms.Label();
|
||||||
|
this.btnRevuesCommandesRechercher = new System.Windows.Forms.Button();
|
||||||
|
this.txbRevuesCommandesNumRecherche = new System.Windows.Forms.TextBox();
|
||||||
|
this.label92 = new System.Windows.Forms.Label();
|
||||||
this.tabOngletsApplication.SuspendLayout();
|
this.tabOngletsApplication.SuspendLayout();
|
||||||
this.tabLivres.SuspendLayout();
|
this.tabLivres.SuspendLayout();
|
||||||
this.grpLivresInfos.SuspendLayout();
|
this.grpLivresInfos.SuspendLayout();
|
||||||
|
|
@ -295,6 +322,12 @@ namespace MediaTekDocuments.view
|
||||||
this.grpDvdCommande.SuspendLayout();
|
this.grpDvdCommande.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dgvCommandesDvd)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.dgvCommandesDvd)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dgvDvd)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.dgvDvd)).BeginInit();
|
||||||
|
this.tabCommandesRevues.SuspendLayout();
|
||||||
|
this.grpAbonnementSaisie.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.nudAbonnementMontant)).BeginInit();
|
||||||
|
this.grpAbonnementsInfos.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dgvAbonnements)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// tabOngletsApplication
|
// tabOngletsApplication
|
||||||
|
|
@ -305,6 +338,7 @@ namespace MediaTekDocuments.view
|
||||||
this.tabOngletsApplication.Controls.Add(this.tabReceptionRevue);
|
this.tabOngletsApplication.Controls.Add(this.tabReceptionRevue);
|
||||||
this.tabOngletsApplication.Controls.Add(this.tabCommandeLivres);
|
this.tabOngletsApplication.Controls.Add(this.tabCommandeLivres);
|
||||||
this.tabOngletsApplication.Controls.Add(this.tabCommandeDvd);
|
this.tabOngletsApplication.Controls.Add(this.tabCommandeDvd);
|
||||||
|
this.tabOngletsApplication.Controls.Add(this.tabCommandesRevues);
|
||||||
this.tabOngletsApplication.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.tabOngletsApplication.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.tabOngletsApplication.ItemSize = new System.Drawing.Size(49, 18);
|
this.tabOngletsApplication.ItemSize = new System.Drawing.Size(49, 18);
|
||||||
this.tabOngletsApplication.Location = new System.Drawing.Point(0, 0);
|
this.tabOngletsApplication.Location = new System.Drawing.Point(0, 0);
|
||||||
|
|
@ -2689,6 +2723,271 @@ namespace MediaTekDocuments.view
|
||||||
this.label78.TabIndex = 0;
|
this.label78.TabIndex = 0;
|
||||||
this.label78.Text = "Numéro de document :";
|
this.label78.Text = "Numéro de document :";
|
||||||
//
|
//
|
||||||
|
// tabCommandesRevues
|
||||||
|
//
|
||||||
|
this.tabCommandesRevues.Controls.Add(this.grpAbonnementSaisie);
|
||||||
|
this.tabCommandesRevues.Controls.Add(this.grpAbonnementsInfos);
|
||||||
|
this.tabCommandesRevues.Location = new System.Drawing.Point(4, 22);
|
||||||
|
this.tabCommandesRevues.Name = "tabCommandesRevues";
|
||||||
|
this.tabCommandesRevues.Padding = new System.Windows.Forms.Padding(3);
|
||||||
|
this.tabCommandesRevues.Size = new System.Drawing.Size(875, 633);
|
||||||
|
this.tabCommandesRevues.TabIndex = 7;
|
||||||
|
this.tabCommandesRevues.Text = "Commandes Revues";
|
||||||
|
this.tabCommandesRevues.UseVisualStyleBackColor = true;
|
||||||
|
this.tabCommandesRevues.Enter += new System.EventHandler(this.tabCommandeRevues_Enter);
|
||||||
|
//
|
||||||
|
// grpAbonnementSaisie
|
||||||
|
//
|
||||||
|
this.grpAbonnementSaisie.Controls.Add(this.btnAbonnementSupprimer);
|
||||||
|
this.grpAbonnementSaisie.Controls.Add(this.btnAbonnementAjouter);
|
||||||
|
this.grpAbonnementSaisie.Controls.Add(this.dtpAbonnementDateFin);
|
||||||
|
this.grpAbonnementSaisie.Controls.Add(this.label101);
|
||||||
|
this.grpAbonnementSaisie.Controls.Add(this.nudAbonnementMontant);
|
||||||
|
this.grpAbonnementSaisie.Controls.Add(this.label100);
|
||||||
|
this.grpAbonnementSaisie.Controls.Add(this.dtpAbonnementDateCommande);
|
||||||
|
this.grpAbonnementSaisie.Controls.Add(this.label99);
|
||||||
|
this.grpAbonnementSaisie.Enabled = false;
|
||||||
|
this.grpAbonnementSaisie.Location = new System.Drawing.Point(9, 410);
|
||||||
|
this.grpAbonnementSaisie.Name = "grpAbonnementSaisie";
|
||||||
|
this.grpAbonnementSaisie.Size = new System.Drawing.Size(858, 215);
|
||||||
|
this.grpAbonnementSaisie.TabIndex = 1;
|
||||||
|
this.grpAbonnementSaisie.TabStop = false;
|
||||||
|
this.grpAbonnementSaisie.Text = "Nouvelle commande / renouvellement";
|
||||||
|
//
|
||||||
|
// btnAbonnementSupprimer
|
||||||
|
//
|
||||||
|
this.btnAbonnementSupprimer.Location = new System.Drawing.Point(103, 103);
|
||||||
|
this.btnAbonnementSupprimer.Name = "btnAbonnementSupprimer";
|
||||||
|
this.btnAbonnementSupprimer.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.btnAbonnementSupprimer.TabIndex = 7;
|
||||||
|
this.btnAbonnementSupprimer.Text = "Supprimer";
|
||||||
|
this.btnAbonnementSupprimer.UseVisualStyleBackColor = true;
|
||||||
|
this.btnAbonnementSupprimer.Click += new System.EventHandler(this.btnAbonnementSupprimer_Click);
|
||||||
|
//
|
||||||
|
// btnAbonnementAjouter
|
||||||
|
//
|
||||||
|
this.btnAbonnementAjouter.Location = new System.Drawing.Point(10, 103);
|
||||||
|
this.btnAbonnementAjouter.Name = "btnAbonnementAjouter";
|
||||||
|
this.btnAbonnementAjouter.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.btnAbonnementAjouter.TabIndex = 6;
|
||||||
|
this.btnAbonnementAjouter.Text = "Ajouter";
|
||||||
|
this.btnAbonnementAjouter.UseVisualStyleBackColor = true;
|
||||||
|
this.btnAbonnementAjouter.Click += new System.EventHandler(this.btnAbonnementAjouter_Click);
|
||||||
|
//
|
||||||
|
// dtpAbonnementDateFin
|
||||||
|
//
|
||||||
|
this.dtpAbonnementDateFin.Location = new System.Drawing.Point(142, 71);
|
||||||
|
this.dtpAbonnementDateFin.Name = "dtpAbonnementDateFin";
|
||||||
|
this.dtpAbonnementDateFin.Size = new System.Drawing.Size(200, 20);
|
||||||
|
this.dtpAbonnementDateFin.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// label101
|
||||||
|
//
|
||||||
|
this.label101.AutoSize = true;
|
||||||
|
this.label101.Location = new System.Drawing.Point(7, 77);
|
||||||
|
this.label101.Name = "label101";
|
||||||
|
this.label101.Size = new System.Drawing.Size(129, 13);
|
||||||
|
this.label101.TabIndex = 4;
|
||||||
|
this.label101.Text = "Date de fin d\'abonnement";
|
||||||
|
//
|
||||||
|
// nudAbonnementMontant
|
||||||
|
//
|
||||||
|
this.nudAbonnementMontant.Location = new System.Drawing.Point(58, 45);
|
||||||
|
this.nudAbonnementMontant.Name = "nudAbonnementMontant";
|
||||||
|
this.nudAbonnementMontant.Size = new System.Drawing.Size(120, 20);
|
||||||
|
this.nudAbonnementMontant.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// label100
|
||||||
|
//
|
||||||
|
this.label100.AutoSize = true;
|
||||||
|
this.label100.Location = new System.Drawing.Point(6, 51);
|
||||||
|
this.label100.Name = "label100";
|
||||||
|
this.label100.Size = new System.Drawing.Size(46, 13);
|
||||||
|
this.label100.TabIndex = 2;
|
||||||
|
this.label100.Text = "Montant";
|
||||||
|
//
|
||||||
|
// dtpAbonnementDateCommande
|
||||||
|
//
|
||||||
|
this.dtpAbonnementDateCommande.Location = new System.Drawing.Point(113, 19);
|
||||||
|
this.dtpAbonnementDateCommande.Name = "dtpAbonnementDateCommande";
|
||||||
|
this.dtpAbonnementDateCommande.Size = new System.Drawing.Size(200, 20);
|
||||||
|
this.dtpAbonnementDateCommande.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// label99
|
||||||
|
//
|
||||||
|
this.label99.AutoSize = true;
|
||||||
|
this.label99.Location = new System.Drawing.Point(7, 25);
|
||||||
|
this.label99.Name = "label99";
|
||||||
|
this.label99.Size = new System.Drawing.Size(100, 13);
|
||||||
|
this.label99.TabIndex = 0;
|
||||||
|
this.label99.Text = "Date de commande";
|
||||||
|
//
|
||||||
|
// grpAbonnementsInfos
|
||||||
|
//
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.dgvAbonnements);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.label98);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.pictureBox1);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.label97);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.txbRevuesCommandesRayon);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.label96);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.txbRevuesCommandesPublic);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.txbRevuesCommandesGenre);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.label95);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.txbRevuesCommandesPeriodicite);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.label94);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.txbRevuesCommandesTitre);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.label93);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.btnRevuesCommandesRechercher);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.txbRevuesCommandesNumRecherche);
|
||||||
|
this.grpAbonnementsInfos.Controls.Add(this.label92);
|
||||||
|
this.grpAbonnementsInfos.Location = new System.Drawing.Point(9, 7);
|
||||||
|
this.grpAbonnementsInfos.Name = "grpAbonnementsInfos";
|
||||||
|
this.grpAbonnementsInfos.Size = new System.Drawing.Size(858, 396);
|
||||||
|
this.grpAbonnementsInfos.TabIndex = 0;
|
||||||
|
this.grpAbonnementsInfos.TabStop = false;
|
||||||
|
this.grpAbonnementsInfos.Text = "Infos";
|
||||||
|
//
|
||||||
|
// dgvAbonnements
|
||||||
|
//
|
||||||
|
this.dgvAbonnements.AllowUserToAddRows = false;
|
||||||
|
this.dgvAbonnements.AllowUserToDeleteRows = false;
|
||||||
|
this.dgvAbonnements.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.dgvAbonnements.Location = new System.Drawing.Point(10, 149);
|
||||||
|
this.dgvAbonnements.Name = "dgvAbonnements";
|
||||||
|
this.dgvAbonnements.ReadOnly = true;
|
||||||
|
this.dgvAbonnements.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
this.dgvAbonnements.Size = new System.Drawing.Size(842, 241);
|
||||||
|
this.dgvAbonnements.TabIndex = 1;
|
||||||
|
this.dgvAbonnements.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvAbonnements_ColumnHeaderMouseClick);
|
||||||
|
//
|
||||||
|
// label98
|
||||||
|
//
|
||||||
|
this.label98.AutoSize = true;
|
||||||
|
this.label98.Location = new System.Drawing.Point(573, 50);
|
||||||
|
this.label98.Name = "label98";
|
||||||
|
this.label98.Size = new System.Drawing.Size(36, 13);
|
||||||
|
this.label98.TabIndex = 14;
|
||||||
|
this.label98.Text = "Image";
|
||||||
|
//
|
||||||
|
// pictureBox1
|
||||||
|
//
|
||||||
|
this.pictureBox1.Location = new System.Drawing.Point(615, 47);
|
||||||
|
this.pictureBox1.Name = "pictureBox1";
|
||||||
|
this.pictureBox1.Size = new System.Drawing.Size(100, 87);
|
||||||
|
this.pictureBox1.TabIndex = 13;
|
||||||
|
this.pictureBox1.TabStop = false;
|
||||||
|
//
|
||||||
|
// label97
|
||||||
|
//
|
||||||
|
this.label97.AutoSize = true;
|
||||||
|
this.label97.Location = new System.Drawing.Point(386, 50);
|
||||||
|
this.label97.Name = "label97";
|
||||||
|
this.label97.Size = new System.Drawing.Size(38, 13);
|
||||||
|
this.label97.TabIndex = 12;
|
||||||
|
this.label97.Text = "Rayon";
|
||||||
|
//
|
||||||
|
// txbRevuesCommandesRayon
|
||||||
|
//
|
||||||
|
this.txbRevuesCommandesRayon.Location = new System.Drawing.Point(430, 47);
|
||||||
|
this.txbRevuesCommandesRayon.Name = "txbRevuesCommandesRayon";
|
||||||
|
this.txbRevuesCommandesRayon.ReadOnly = true;
|
||||||
|
this.txbRevuesCommandesRayon.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.txbRevuesCommandesRayon.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// label96
|
||||||
|
//
|
||||||
|
this.label96.AutoSize = true;
|
||||||
|
this.label96.Location = new System.Drawing.Point(200, 81);
|
||||||
|
this.label96.Name = "label96";
|
||||||
|
this.label96.Size = new System.Drawing.Size(36, 13);
|
||||||
|
this.label96.TabIndex = 10;
|
||||||
|
this.label96.Text = "Public";
|
||||||
|
//
|
||||||
|
// txbRevuesCommandesPublic
|
||||||
|
//
|
||||||
|
this.txbRevuesCommandesPublic.Location = new System.Drawing.Point(242, 78);
|
||||||
|
this.txbRevuesCommandesPublic.Name = "txbRevuesCommandesPublic";
|
||||||
|
this.txbRevuesCommandesPublic.ReadOnly = true;
|
||||||
|
this.txbRevuesCommandesPublic.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.txbRevuesCommandesPublic.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// txbRevuesCommandesGenre
|
||||||
|
//
|
||||||
|
this.txbRevuesCommandesGenre.Location = new System.Drawing.Point(242, 47);
|
||||||
|
this.txbRevuesCommandesGenre.Name = "txbRevuesCommandesGenre";
|
||||||
|
this.txbRevuesCommandesGenre.ReadOnly = true;
|
||||||
|
this.txbRevuesCommandesGenre.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.txbRevuesCommandesGenre.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// label95
|
||||||
|
//
|
||||||
|
this.label95.AutoSize = true;
|
||||||
|
this.label95.Location = new System.Drawing.Point(200, 50);
|
||||||
|
this.label95.Name = "label95";
|
||||||
|
this.label95.Size = new System.Drawing.Size(36, 13);
|
||||||
|
this.label95.TabIndex = 7;
|
||||||
|
this.label95.Text = "Genre";
|
||||||
|
//
|
||||||
|
// txbRevuesCommandesPeriodicite
|
||||||
|
//
|
||||||
|
this.txbRevuesCommandesPeriodicite.Location = new System.Drawing.Point(68, 74);
|
||||||
|
this.txbRevuesCommandesPeriodicite.Name = "txbRevuesCommandesPeriodicite";
|
||||||
|
this.txbRevuesCommandesPeriodicite.ReadOnly = true;
|
||||||
|
this.txbRevuesCommandesPeriodicite.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.txbRevuesCommandesPeriodicite.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// label94
|
||||||
|
//
|
||||||
|
this.label94.AutoSize = true;
|
||||||
|
this.label94.Location = new System.Drawing.Point(6, 77);
|
||||||
|
this.label94.Name = "label94";
|
||||||
|
this.label94.Size = new System.Drawing.Size(56, 13);
|
||||||
|
this.label94.TabIndex = 5;
|
||||||
|
this.label94.Text = "Periodicite";
|
||||||
|
//
|
||||||
|
// txbRevuesCommandesTitre
|
||||||
|
//
|
||||||
|
this.txbRevuesCommandesTitre.Location = new System.Drawing.Point(40, 47);
|
||||||
|
this.txbRevuesCommandesTitre.Name = "txbRevuesCommandesTitre";
|
||||||
|
this.txbRevuesCommandesTitre.ReadOnly = true;
|
||||||
|
this.txbRevuesCommandesTitre.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.txbRevuesCommandesTitre.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// label93
|
||||||
|
//
|
||||||
|
this.label93.AutoSize = true;
|
||||||
|
this.label93.Location = new System.Drawing.Point(6, 50);
|
||||||
|
this.label93.Name = "label93";
|
||||||
|
this.label93.Size = new System.Drawing.Size(28, 13);
|
||||||
|
this.label93.TabIndex = 3;
|
||||||
|
this.label93.Text = "Titre";
|
||||||
|
//
|
||||||
|
// btnRevuesCommandesRechercher
|
||||||
|
//
|
||||||
|
this.btnRevuesCommandesRechercher.Location = new System.Drawing.Point(214, 15);
|
||||||
|
this.btnRevuesCommandesRechercher.Name = "btnRevuesCommandesRechercher";
|
||||||
|
this.btnRevuesCommandesRechercher.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.btnRevuesCommandesRechercher.TabIndex = 2;
|
||||||
|
this.btnRevuesCommandesRechercher.Text = "Rechercher";
|
||||||
|
this.btnRevuesCommandesRechercher.UseVisualStyleBackColor = true;
|
||||||
|
this.btnRevuesCommandesRechercher.Click += new System.EventHandler(this.btnRevuesCommandesRechercher_Click);
|
||||||
|
//
|
||||||
|
// txbRevuesCommandesNumRecherche
|
||||||
|
//
|
||||||
|
this.txbRevuesCommandesNumRecherche.Location = new System.Drawing.Point(108, 17);
|
||||||
|
this.txbRevuesCommandesNumRecherche.Name = "txbRevuesCommandesNumRecherche";
|
||||||
|
this.txbRevuesCommandesNumRecherche.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.txbRevuesCommandesNumRecherche.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// label92
|
||||||
|
//
|
||||||
|
this.label92.AutoSize = true;
|
||||||
|
this.label92.Location = new System.Drawing.Point(7, 20);
|
||||||
|
this.label92.Name = "label92";
|
||||||
|
this.label92.Size = new System.Drawing.Size(95, 13);
|
||||||
|
this.label92.TabIndex = 0;
|
||||||
|
this.label92.Text = "Numéro de revue :";
|
||||||
|
//
|
||||||
// FrmMediatek
|
// FrmMediatek
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
|
@ -2750,6 +3049,14 @@ namespace MediaTekDocuments.view
|
||||||
this.grpDvdCommande.PerformLayout();
|
this.grpDvdCommande.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dgvCommandesDvd)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.dgvCommandesDvd)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dgvDvd)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.dgvDvd)).EndInit();
|
||||||
|
this.tabCommandesRevues.ResumeLayout(false);
|
||||||
|
this.grpAbonnementSaisie.ResumeLayout(false);
|
||||||
|
this.grpAbonnementSaisie.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.nudAbonnementMontant)).EndInit();
|
||||||
|
this.grpAbonnementsInfos.ResumeLayout(false);
|
||||||
|
this.grpAbonnementsInfos.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dgvAbonnements)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -2983,6 +3290,33 @@ namespace MediaTekDocuments.view
|
||||||
private System.Windows.Forms.Label label90;
|
private System.Windows.Forms.Label label90;
|
||||||
private System.Windows.Forms.DateTimePicker dateTimeCommandeDvd;
|
private System.Windows.Forms.DateTimePicker dateTimeCommandeDvd;
|
||||||
private System.Windows.Forms.Label label91;
|
private System.Windows.Forms.Label label91;
|
||||||
|
private System.Windows.Forms.TabPage tabCommandesRevues;
|
||||||
|
private System.Windows.Forms.GroupBox grpAbonnementsInfos;
|
||||||
|
private System.Windows.Forms.Label label93;
|
||||||
|
private System.Windows.Forms.Button btnRevuesCommandesRechercher;
|
||||||
|
private System.Windows.Forms.TextBox txbRevuesCommandesNumRecherche;
|
||||||
|
private System.Windows.Forms.Label label92;
|
||||||
|
private System.Windows.Forms.Label label94;
|
||||||
|
private System.Windows.Forms.TextBox txbRevuesCommandesTitre;
|
||||||
|
private System.Windows.Forms.Label label97;
|
||||||
|
private System.Windows.Forms.TextBox txbRevuesCommandesRayon;
|
||||||
|
private System.Windows.Forms.Label label96;
|
||||||
|
private System.Windows.Forms.TextBox txbRevuesCommandesPublic;
|
||||||
|
private System.Windows.Forms.TextBox txbRevuesCommandesGenre;
|
||||||
|
private System.Windows.Forms.Label label95;
|
||||||
|
private System.Windows.Forms.TextBox txbRevuesCommandesPeriodicite;
|
||||||
|
private System.Windows.Forms.Label label98;
|
||||||
|
private System.Windows.Forms.PictureBox pictureBox1;
|
||||||
|
private System.Windows.Forms.DataGridView dgvAbonnements;
|
||||||
|
private System.Windows.Forms.GroupBox grpAbonnementSaisie;
|
||||||
|
private System.Windows.Forms.Button btnAbonnementSupprimer;
|
||||||
|
private System.Windows.Forms.Button btnAbonnementAjouter;
|
||||||
|
private System.Windows.Forms.DateTimePicker dtpAbonnementDateFin;
|
||||||
|
private System.Windows.Forms.Label label101;
|
||||||
|
private System.Windows.Forms.NumericUpDown nudAbonnementMontant;
|
||||||
|
private System.Windows.Forms.Label label100;
|
||||||
|
private System.Windows.Forms.DateTimePicker dtpAbonnementDateCommande;
|
||||||
|
private System.Windows.Forms.Label label99;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,13 @@ namespace MediaTekDocuments.view
|
||||||
private readonly BindingSource bdgPublics = new BindingSource();
|
private readonly BindingSource bdgPublics = new BindingSource();
|
||||||
private readonly BindingSource bdgRayons = new BindingSource();
|
private readonly BindingSource bdgRayons = new BindingSource();
|
||||||
private readonly BindingSource bdgSuivis = new BindingSource();
|
private readonly BindingSource bdgSuivis = new BindingSource();
|
||||||
|
private readonly BindingSource bdgAbonnements = new BindingSource();
|
||||||
|
private List<Abonnement> lesAbonnements = new List<Abonnement>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructeur : création du contrôleur lié à ce formulaire
|
/// Constructeur : création du contrôleur lié à ce formulaire
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal FrmMediatek()
|
public FrmMediatek()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.controller = new FrmMediatekController();
|
this.controller = new FrmMediatekController();
|
||||||
|
|
@ -36,6 +38,7 @@ namespace MediaTekDocuments.view
|
||||||
|
|
||||||
cboSuivi.SelectedIndex = 0;
|
cboSuivi.SelectedIndex = 0;
|
||||||
cboSuiviDvd.SelectedIndex = 0;
|
cboSuiviDvd.SelectedIndex = 0;
|
||||||
|
AlerteAbonnementsExpirants();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1772,5 +1775,191 @@ namespace MediaTekDocuments.view
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AlerteAbonnementsExpirants()
|
||||||
|
{
|
||||||
|
List<Revue> toutesLesRevues = controller.GetAllRevues();
|
||||||
|
string message = "Abonnements se terminant sous 30 jours :\n";
|
||||||
|
bool alerte = false;
|
||||||
|
|
||||||
|
foreach (Revue revue in toutesLesRevues)
|
||||||
|
{
|
||||||
|
List<Abonnement> abos = controller.GetAbonnements(revue.Id);
|
||||||
|
// On prend le dernier abonnement (le plus récent)
|
||||||
|
Abonnement dernierAbo = abos.OrderByDescending(a => a.DateFinAbonnement).FirstOrDefault();
|
||||||
|
|
||||||
|
if (dernierAbo != null && (dernierAbo.DateFinAbonnement - DateTime.Now).TotalDays <= 30
|
||||||
|
&& (dernierAbo.DateFinAbonnement - DateTime.Now).TotalDays > 0)
|
||||||
|
{
|
||||||
|
message += $"- {revue.Titre} : finit le {dernierAbo.DateFinAbonnement:dd/MM/yyyy}\n";
|
||||||
|
alerte = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alerte)
|
||||||
|
{
|
||||||
|
MessageBox.Show(message, "Alerte Abonnements", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool PeutSupprimerAbonnement(Abonnement abonnement)
|
||||||
|
{
|
||||||
|
List<Exemplaire> exemplaires = controller.GetExemplairesRevue(abonnement.IdRevue);
|
||||||
|
foreach (Exemplaire ex in exemplaires)
|
||||||
|
{
|
||||||
|
if (ParutionDansAbonnement(abonnement.DateCommande, abonnement.DateFinAbonnement, ex.DateAchat))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ParutionDansAbonnement(DateTime dateCommande, DateTime dateFinAbonnement, DateTime dateParution)
|
||||||
|
{
|
||||||
|
return (dateParution >= dateCommande && dateParution <= dateFinAbonnement);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnRevuesCommandesRechercher_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!txbRevuesCommandesNumRecherche.Text.Equals(""))
|
||||||
|
{
|
||||||
|
Revue revue = lesRevues.Find(x => x.Id.Equals(txbRevuesCommandesNumRecherche.Text));
|
||||||
|
if (revue != null)
|
||||||
|
{
|
||||||
|
AfficheRevueInfosCommande(revue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Numéro de revue introuvable");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AfficheRevueInfosCommande(Revue revue)
|
||||||
|
{
|
||||||
|
txbRevuesCommandesTitre.Text = revue.Titre;
|
||||||
|
txbRevuesCommandesGenre.Text = revue.Genre;
|
||||||
|
txbRevuesCommandesPublic.Text = revue.Public;
|
||||||
|
txbRevuesCommandesRayon.Text = revue.Rayon;
|
||||||
|
txbRevuesCommandesPeriodicite.Text = revue.Periodicite;
|
||||||
|
|
||||||
|
lesAbonnements = controller.GetAbonnements(revue.Id)
|
||||||
|
.OrderByDescending(a => a.DateCommande)
|
||||||
|
.ToList();
|
||||||
|
RemplirAbonnementsListe(lesAbonnements);
|
||||||
|
grpAbonnementSaisie.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RemplirAbonnementsListe(List<Abonnement> abonnements)
|
||||||
|
{
|
||||||
|
bdgAbonnements.DataSource = abonnements;
|
||||||
|
dgvAbonnements.DataSource = bdgAbonnements;
|
||||||
|
dgvAbonnements.Columns["id"].Visible = false;
|
||||||
|
dgvAbonnements.Columns["idRevue"].Visible = false;
|
||||||
|
dgvAbonnements.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tabCommandeRevues_Enter(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// On charge la liste des revues pour permettre la recherche par numéro
|
||||||
|
lesRevues = controller.GetAllRevues();
|
||||||
|
// On vide les champs par sécurité au cas où une recherche précédente resterait
|
||||||
|
ViderAbonnementChamps();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ViderAbonnementChamps()
|
||||||
|
{
|
||||||
|
txbRevuesCommandesNumRecherche.Text = "";
|
||||||
|
txbRevuesCommandesTitre.Text = "";
|
||||||
|
txbRevuesCommandesGenre.Text = "";
|
||||||
|
txbRevuesCommandesPublic.Text = "";
|
||||||
|
txbRevuesCommandesRayon.Text = "";
|
||||||
|
txbRevuesCommandesPeriodicite.Text = "";
|
||||||
|
RemplirAbonnementsListe(new List<Abonnement>());
|
||||||
|
grpAbonnementSaisie.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnAbonnementAjouter_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string idRevue = txbRevuesCommandesNumRecherche.Text;
|
||||||
|
if (idRevue.Equals(""))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Veuillez d'abord sélectionner une revue.", "Information");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DateTime dateCommande = dtpAbonnementDateCommande.Value;
|
||||||
|
DateTime dateFin = dtpAbonnementDateFin.Value;
|
||||||
|
double montant = (double)nudAbonnementMontant.Value;
|
||||||
|
if (dateFin <= dateCommande)
|
||||||
|
{
|
||||||
|
MessageBox.Show("La date de fin d'abonnement doit être supérieure à la date de commande.", "Erreur de saisie");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string nextId = controller.GetNextCommandeId();
|
||||||
|
Abonnement nouvelAbo = new Abonnement(nextId, dateCommande, montant, dateFin, idRevue);
|
||||||
|
|
||||||
|
if (controller.CreerAbonnement(nouvelAbo))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Abonnement enregistré avec succès.", "Succès");
|
||||||
|
AfficheRevueInfosCommande(lesRevues.Find(r => r.Id == idRevue));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Erreur lors de l'enregistrement de l'abonnement.", "Erreur");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnAbonnementSupprimer_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dgvAbonnements.CurrentRow == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Veuillez sélectionner un abonnement dans la liste.", "Information");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Abonnement aboSelectionne = (Abonnement)bdgAbonnements.List[bdgAbonnements.Position];
|
||||||
|
if (PeutSupprimerAbonnement(aboSelectionne))
|
||||||
|
{
|
||||||
|
if (MessageBox.Show($"Voulez-vous vraiment supprimer l'abonnement n°{aboSelectionne.Id} ?",
|
||||||
|
"Confirmation de suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
if (controller.SupprimerAbonnement(aboSelectionne))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Abonnement supprimé avec succès.");
|
||||||
|
AfficheRevueInfosCommande(lesRevues.Find(r => r.Id == aboSelectionne.IdRevue));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Une erreur est survenue lors de la suppression sur le serveur.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Suppression impossible : un ou plusieurs exemplaires ont été reçus pendant la période de cet abonnement.", "Règle de gestion");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dgvAbonnements_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
||||||
|
{
|
||||||
|
string titreColonne = dgvAbonnements.Columns[e.ColumnIndex].DataPropertyName;
|
||||||
|
List<Abonnement> sortedList;
|
||||||
|
|
||||||
|
switch (titreColonne)
|
||||||
|
{
|
||||||
|
case "DateCommande":
|
||||||
|
sortedList = lesAbonnements.OrderBy(o => o.DateCommande).ToList();
|
||||||
|
break;
|
||||||
|
case "Montant":
|
||||||
|
sortedList = lesAbonnements.OrderBy(o => o.Montant).ToList();
|
||||||
|
break;
|
||||||
|
case "DateFinAbonnement":
|
||||||
|
sortedList = lesAbonnements.OrderBy(o => o.DateFinAbonnement).ToList();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bdgAbonnements.DataSource = sortedList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,4 +120,7 @@
|
||||||
<metadata name="cboSuiviDvd.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="cboSuiviDvd.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="cboSuiviDvd.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
||||||
75
Mediatek.Tests/Mediatek.Tests.csproj
Normal file
75
Mediatek.Tests/Mediatek.Tests.csproj
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{C5F4A786-C844-424C-BB13-F45C6C4CBB93}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Mediatek.Tests</RootNamespace>
|
||||||
|
<AssemblyName>Mediatek.Tests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||||
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||||
|
<IsCodedUITest>False</IsCodedUITest>
|
||||||
|
<TestProjectType>UnitTest</TestProjectType>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="UnitTest1.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\MediaTekDocuments\MediaTekDocuments.csproj">
|
||||||
|
<Project>{75de903d-6147-4e14-bbe0-fa20cd1f9840}</Project>
|
||||||
|
<Name>MediaTekDocuments</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : {0}.</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets'))" />
|
||||||
|
</Target>
|
||||||
|
<Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
|
||||||
|
</Project>
|
||||||
20
Mediatek.Tests/Properties/AssemblyInfo.cs
Normal file
20
Mediatek.Tests/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("Mediatek.Tests")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Mediatek.Tests")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2026")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
[assembly: Guid("c5f4a786-c844-424c-bb13-f45c6c4cbb93")]
|
||||||
|
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
35
Mediatek.Tests/UnitTest1.cs
Normal file
35
Mediatek.Tests/UnitTest1.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using System;
|
||||||
|
using MediaTekDocuments.model;
|
||||||
|
using MediaTekDocuments.view; // Nécessaire car la méthode à tester est dans FrmMediatek
|
||||||
|
|
||||||
|
namespace Mediatek.Tests
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class CommandeTests
|
||||||
|
{
|
||||||
|
[TestMethod]
|
||||||
|
public void TestParutionDansAbonnement_ValidationDates()
|
||||||
|
{
|
||||||
|
FrmMediatek frm = new FrmMediatek();
|
||||||
|
|
||||||
|
DateTime debut = new DateTime(2024, 01, 01);
|
||||||
|
DateTime fin = new DateTime(2024, 12, 31);
|
||||||
|
|
||||||
|
DateTime parutionDebut = new DateTime(2024, 01, 01);
|
||||||
|
Assert.IsTrue(frm.ParutionDansAbonnement(debut, fin, parutionDebut), "La date de début devrait être incluse.");
|
||||||
|
|
||||||
|
DateTime parutionFin = new DateTime(2024, 12, 31);
|
||||||
|
Assert.IsTrue(frm.ParutionDansAbonnement(debut, fin, parutionFin), "La date de fin devrait être incluse.");
|
||||||
|
|
||||||
|
DateTime parutionMilieu = new DateTime(2024, 06, 15);
|
||||||
|
Assert.IsTrue(frm.ParutionDansAbonnement(debut, fin, parutionMilieu), "Une date en milieu d'abonnement doit être vraie.");
|
||||||
|
|
||||||
|
DateTime parutionAvant = new DateTime(2023, 12, 31);
|
||||||
|
Assert.IsFalse(frm.ParutionDansAbonnement(debut, fin, parutionAvant), "Une date avant le début doit être fausse.");
|
||||||
|
|
||||||
|
DateTime parutionApres = new DateTime(2025, 01, 01);
|
||||||
|
Assert.IsFalse(frm.ParutionDansAbonnement(debut, fin, parutionApres), "Une date après la fin doit être fausse.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
Mediatek.Tests/packages.config
Normal file
5
Mediatek.Tests/packages.config
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net472" />
|
||||||
|
<package id="MSTest.TestFramework" version="2.1.2" targetFramework="net472" />
|
||||||
|
</packages>
|
||||||
68
MediatekTests/MediatekTests.csproj
Normal file
68
MediatekTests/MediatekTests.csproj
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{AFBF991E-F823-46DF-A9B5-07E920AD7061}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>MediatekTests</RootNamespace>
|
||||||
|
<AssemblyName>MediatekTests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||||
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||||
|
<IsCodedUITest>False</IsCodedUITest>
|
||||||
|
<TestProjectType>UnitTest</TestProjectType>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="UnitTest1.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : {0}.</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets'))" />
|
||||||
|
</Target>
|
||||||
|
<Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
|
||||||
|
</Project>
|
||||||
20
MediatekTests/Properties/AssemblyInfo.cs
Normal file
20
MediatekTests/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("MediatekTests")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("MediatekTests")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2026")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
[assembly: Guid("afbf991e-f823-46df-a9b5-07e920ad7061")]
|
||||||
|
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
14
MediatekTests/UnitTest1.cs
Normal file
14
MediatekTests/UnitTest1.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace MediatekTests
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class UnitTest1
|
||||||
|
{
|
||||||
|
[TestMethod]
|
||||||
|
public void TestMethod1()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
MediatekTests/packages.config
Normal file
5
MediatekTests/packages.config
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net472" />
|
||||||
|
<package id="MSTest.TestFramework" version="2.1.2" targetFramework="net472" />
|
||||||
|
</packages>
|
||||||
Loading…
Reference in a new issue