1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705
|
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using clfact;
namespace frmMenu
{
/// Attributs:
/// <summary>
/// Description résumée de frmMenu.
/// </summary>
public class frmMenu : System.Windows.Forms.Form
{
public RecupSaisi rec; //objet de type RecupSaisi
//private object[] _ans; //Tableau des années qui seront presentes sur la cobobox
//public frmRapGen ctrdu;
private int _larg; //Taille de la fenetre->
private int _haut; //pour retrouver la taille initiale
public frmRapGen ctrdu;
//de la fenetre en cas de redimensionnement
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton3;
private System.Windows.Forms.RadioButton radioButton4;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.StatusBarPanel statusBarPanel1;
private System.Windows.Forms.StatusBarPanel statusBarPanel2;
/// <summary>
/// Variable nécessaire au concepteur.
/// </summary>
///
public int larg
{
get
{
return this._larg;
}
set
{
this._larg=value;
}
}
public int haut
{
get
{
return this._haut;
}
set
{
this._haut=value;
}
}
private System.ComponentModel.Container components = null;
//******************************************
//Constructeur:*****************************
//******************************************
public frmMenu()
{
//
// Requis pour la prise en charge du Concepteur Windows Forms
//
InitializeComponent();
rec=new RecupSaisi();
this.larg=this.Size.Width;
this.haut=this.Size.Height;
object[] ans=new object[DateTime.Now.Year-2002+1];
for (int i =2002; i <=DateTime.Now.Year;i++)
{
ans[i-2002]=i;
}
this.comboBox1.Items.AddRange(ans);
this.comboBox1.SelectedItem=DateTime.Now.Year;
//
// TODO : ajoutez le code du constructeur après l'appel à InitializeComponent
//
}
//********************************************
//********************************************
//********************************************
/// <summary>
/// Nettoyage des ressources utilisées.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Code généré par le Concepteur Windows Form
/// <summary>
/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
/// le contenu de cette méthode avec l'éditeur de code.
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.radioButton4 = new System.Windows.Forms.RadioButton();
this.radioButton3 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.comboBox2);
this.groupBox1.Controls.Add(this.comboBox1);
this.groupBox1.Location = new System.Drawing.Point(8, 32);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(480, 112);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Selection Sites & Saison";
//
// label2
//
this.label2.Location = new System.Drawing.Point(224, 40);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 24);
this.label2.TabIndex = 3;
this.label2.Text = " Site:";
this.label2.Click += new System.EventHandler(this.label2_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 24);
this.label1.TabIndex = 2;
this.label1.Text = " Saison:";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// comboBox2
//
this.comboBox2.Items.AddRange(new object[] {"el1", "el2","el3","el4","el5","el6"});
this.comboBox2.Location = new System.Drawing.Point(296, 40);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(136, 21);
this.comboBox2.TabIndex = 1;
//
// comboBox1
//
this.comboBox1.Location = new System.Drawing.Point(72, 40);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(136, 21);
this.comboBox1.TabIndex = 0;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.radioButton4);
this.groupBox2.Controls.Add(this.radioButton3);
this.groupBox2.Controls.Add(this.radioButton2);
this.groupBox2.Controls.Add(this.radioButton1);
this.groupBox2.Location = new System.Drawing.Point(8, 144);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(480, 176);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Salection Fonctionnalité";
//
// radioButton4
//
this.radioButton4.Location = new System.Drawing.Point(312, 120);
this.radioButton4.Name = "radioButton4";
this.radioButton4.Size = new System.Drawing.Size(160, 24);
this.radioButton4.TabIndex = 3;
this.radioButton4.Text = "Suppression des Doublons";
//
// radioButton3
//
this.radioButton3.Location = new System.Drawing.Point(72, 120);
this.radioButton3.Name = "radioButton3";
this.radioButton3.Size = new System.Drawing.Size(176, 24);
this.radioButton3.TabIndex = 2;
this.radioButton3.Text = "Suppression des Dupplicatas";
//
// radioButton2
//
this.radioButton2.Location = new System.Drawing.Point(312, 48);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(136, 24);
this.radioButton2.TabIndex = 1;
this.radioButton2.Text = "Génération partielle";
this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
//
// radioButton1
//
this.radioButton1.Checked = true;
this.radioButton1.Location = new System.Drawing.Point(72, 48);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(128, 24);
this.radioButton1.TabIndex = 0;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Génération totale";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.textBox2);
this.groupBox3.Controls.Add(this.textBox1);
this.groupBox3.Enabled = false;
this.groupBox3.Location = new System.Drawing.Point(8, 328);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(480, 128);
this.groupBox3.TabIndex = 2;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Intervalle de Numéros";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(296, 56);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(104, 20);
this.textBox2.TabIndex = 1;
this.textBox2.Text = "";
this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(72, 56);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(104, 20);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "";
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// button1
//
this.button1.Location = new System.Drawing.Point(80, 472);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(96, 32);
this.button1.TabIndex = 3;
this.button1.Text = "OK";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(304, 472);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(96, 32);
this.button2.TabIndex = 4;
this.button2.Text = "Quitter";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(0, 533);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
this.statusBarPanel1,
this.statusBarPanel2});
this.statusBar1.ShowPanels = true;
this.statusBar1.Size = new System.Drawing.Size(496, 32);
this.statusBar1.TabIndex = 5;
//
// statusBarPanel1
//
this.statusBarPanel1.Width = 280;
//
// statusBarPanel2
//
this.statusBarPanel2.Width = 226;
//
// frmMenu
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.LightGray;
this.ClientSize = new System.Drawing.Size(496, 565);
this.Controls.Add(this.statusBar1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "frmMenu";
this.Text = "Menu principale de la régénération";
this.Resize += new System.EventHandler(this.frmMenu_Resize);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void label1_Click(object sender, System.EventArgs e)
{
}
private void label2_Click(object sender, System.EventArgs e)
{
}
/*********************************************************
* Au clic de la validation *
*********************************************************/
private void button1_Click(object sender, System.EventArgs e)
{
//Insertion du code executé lors de la validation
try
{
this.RecupererInfo(); //On récupére les infos saisies dans l'objet rec
int[] liss=null;
try
{
liss=this.rec.Charge_List_Dif();
}
catch(Exception fex)
{
MessageBox.Show("Erreur de chargement des numéros de fichiers: "+fex.Message,"Erreur de chargement");
}
//Si la liste de difference n'est pas null
//this.statusBar1.Panels[0].Text=lis.Length.ToString();
if(liss!=null)
{
//System.Windows.Forms. ctrdu;
this.ctrdu=new frmRapGen();//new frmRapGen(); //this.
if(this.radioButton1.Checked) this.ctrdu.Text="Rapport complet des pertes"; //this.
if(this.radioButton2.Checked) this.ctrdu.Text="Rapport partiel des pertes";
//On récupére l'année et le site pour en suite le charge dans la ListeChoi
this.ctrdu.ann=(int)this.comboBox1.SelectedItem;
this.ctrdu.sitt=this.comboBox2.SelectedItem.ToString();
foreach(int i in liss)
{
//On remplis la liste des numéros de factures dans le rapport
this.ctrdu.listBox1.Items.Add(i);
}
if(this.ctrdu.listBox1.Items.Count!=0)
{
this.ctrdu.radioButton1.Enabled=true;
this.ctrdu.radioButton1.Checked=false;
}
else
{
this.ctrdu.radioButton1.Enabled=false;
this.ctrdu.radioButton1.Checked=false;
}
this.ctrdu.radioButton2.Enabled=true;
this.ctrdu.radioButton2.Checked=true;
//Remplissage des données statistiques
//Calcul du pourcentage:
float pourc=0;
int temp=this.rec.nbfb-this.rec.nbfa;
this.ctrdu.label2.Text=temp.ToString(); //liss.Length.ToString();
if(this.rec.nbfb!=0)
{
pourc=100*((float)(this.rec.nbfb-this.rec.nbfa)/this.rec.nbfb);
}
this.ctrdu.label4.Text=pourc.ToString()+"%";
//charger l'année et le site choisis
this.ctrdu.label6.Text=this.comboBox2.SelectedItem.ToString();
this.ctrdu.label8.Text=this.comboBox1.SelectedItem.ToString();
//charger le nombre de factures dans l'archive et dans la bdd:
this.ctrdu.label10.Text=this.rec.nbfb.ToString();
this.ctrdu.label12.Text=this.rec.nbfa.ToString();
this.ctrdu.Show();
}
else
{
//Si il n'ya pas de liste de numéros retournée 2 cas :
//1er cas: L'operation demandée est soit une suppression de doublon
// soit une suppression de duplivatas->pas de rapport généré:
if(this.radioButton3.Checked || this.radioButton4.Checked)
{
}
//2em cas: Si la liste retournée est vide alors qu'on a demandé une
// génération de factures
else
{
//2cas: soit il n'ya pas de facture perdue soit il n'ya pas de
// factures stockées dans la base avec les criteres saisis
if(this.rec.nbfb-this.rec.nbfa==0)
{
if(this.rec.nbfb!=0) MessageBox.Show("Il n'y pas de factures manquantes dans l'archive pour cette recherche.","Pas de Factures manquantes");
else MessageBox.Show("Aucune factures correspondant à vos critères n'est trouvée sur la base->Resaisissez de nouveaux critères!!","Factures introuvables");
}
}
}
}
catch(Exception ex)
{
MessageBox.Show("Erreur->"+ex.Message);
}
}
/*********************************************************
* cliquer sur quitter *
*********************************************************/
private void button2_Click(object sender, System.EventArgs e)
{
this.Dispose();
}
/*************************************************************
* Nom de la Procédure: RecupererInfo *
* Fonction: Recupere les données saisies par *
* l'utilisateur dans le menu principal *
* et les met dans l'attribut "rec" de type *
* RecupSasi(classe) *
*************************************************************/
public void RecupererInfo()
{
//Charger les données saisies par l'urtilisateurs:
this.rec.Saison=(int)this.comboBox1.SelectedItem;
this.rec.Site=this.comboBox2.SelectedItem.ToString();
//Charger l'option choisis par l'utilisateur
if(this.radioButton1.Checked)
{
this.rec.option=0;
}
else
{
if (this.radioButton2.Checked)
{
this.rec.option=1;
}
else
{
if (this.radioButton3.Checked)
{
this.rec.option=2;
}
else
{
this.rec.option=3;
}
}
}
if(radioButton2.Checked)
{
this.rec.NumFactDeb= this.Transf_NumInt(textBox1.Text);
this.rec.NumFactFin= this.Transf_NumInt(textBox2.Text);
}
else
{
this.rec.NumFactDeb=-1;
this.rec.NumFactFin=-1;
}
}
//Changement des saisis de l'intervale de numéros de factures:
private void textBox1_TextChanged(object sender, System.EventArgs e)
{
//tester si il y a quelque chose de saisie dans l'autre
if(this.textBox2.Text.Length!=0)
{
if (this.textBox1.Text.Length!=0)
{
//tester si le numéro est un numérique et qu'il est posistif
if(this.Transf_NumInt(this.textBox1.Text)>0)
{
if(this.Transf_NumInt(this.textBox2.Text)>0)
{
//tester si le 2eme numéro est > au 1er:
if(this.Transf_NumInt(this.textBox2.Text)>this.Transf_NumInt(this.textBox1.Text))
{
this.button1.Enabled=true;
this.statusBar1.Panels[0].Text="";
}
else
{
this.button1.Enabled=false;
this.statusBar1.Panels[0].Text="Un des numéros est incorrect!!!";
}
}
else
{
this.button1.Enabled=false;
this.statusBar1.Panels[0].Text="Un des numéros est incorrect!!!";
}
}
else
{
this.button1.Enabled=false;
this.statusBar1.Panels[0].Text="Un des numéros est incorrect!!!";
}
}
else
{
this.statusBar1.Panels[0].Text="Un des numéros est incorrect!!!";
this.button1.Enabled=false;
}
}
else
{
this.button1.Enabled=false;
}
}
private void textBox2_TextChanged(object sender, System.EventArgs e)
{
//tester si il y a quelque chose de saisie dans l'autre
if(this.textBox1.Text.Length!=0)
{
if (this.textBox2.Text.Length!=0)
{
//tester si le numéro est un numérique et qu'il est posistif
if(this.Transf_NumInt(this.textBox2.Text)>0)
{
if(this.Transf_NumInt(this.textBox1.Text)>0)
{
//tester si le 2eme numéro est > au 1er:
if(this.Transf_NumInt(this.textBox2.Text)>this.Transf_NumInt(this.textBox1.Text))
{
//this.statusBar1.Panels[0].Text=this.Transf_NumInt(this.textBox2.Text).ToString();
//this.label8.Text=this.Transf_NumInt(this.textBox1.Text).ToString();
this.button1.Enabled=true;
this.statusBar1.Panels[0].Text="";
}
else
{
this.button1.Enabled=false;
this.statusBar1.Panels[0].Text="Un des numéros est incorrect!!!";
}
}
else
{
this.button1.Enabled=false;
this.statusBar1.Panels[0].Text="Un des numéros est incorrect!!!";
}
}
else
{
this.button1.Enabled=false;
this.statusBar1.Panels[0].Text="Un des numéros est incorrect!!!";
}
}
else
{
this.statusBar1.Panels[0].Text="Renseignez votre intervalle de recherche!!!";
this.button1.Enabled=false;
}
}
else
{
this.button1.Enabled=false;
this.statusBar1.Panels[0].Text="Renseignez votre intervalle de recherche!!!";
}
}
private void radioButton2_CheckedChanged(object sender, System.EventArgs e)
{
//Si on choisis de faire une génération partielle
this.statusBar1.Panels[0].Text="";
if(this.radioButton2.Checked)
{
//int toto;
//char[] coco=toto.ToString().ToCharArray();
this.groupBox3.Enabled=true;
this.button1.Enabled=false;
this.textBox1.Text="";
this.textBox2.Text="";
this.statusBar1.Panels[0].Text="Renseignez votre intervalle de recherche!!!";
}
else
{
this.groupBox3.Enabled=false;
this.statusBar1.Panels[0].Text="";
this.button1.Enabled=true;
}
}
private void frmMenu_Resize(object sender, EventArgs e)
{
this.Height=this.haut;
this.Width =this.larg;
}
[STAThread]
static void Main()
{
Application.Run(new frmMenu());
}
}
} |
Partager