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 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155
| using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
using System.Threading;
using System.Text;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using SB2;
namespace SB2CSharpStr
{
/// <summary>
/// Description résumée de frmCollecte.
/// </summary>
public class frmCollecte : System.Windows.Forms.Form
{
delegate void Delegate_TraiteCollecte();
delegate void Delegate_CompteRenduCollecte( UInt32 dwNbRd, UInt32 dwRdTotal );
private System.ComponentModel.IContainer components;
private System.Windows.Forms.Button m_btCollecter;
private RadioButton m_rbMAJ;
private RadioButton m_rbComplete;
private frmSB2CSharpStr m_pCP;
private Label label3;
private Label m_lbStatut;
private SaveFileDialog m_sfDlg;
private RadioButton m_rbI2I;
private Label label1;
private DateTimePicker m_dtpDe;
private Label label2;
private DateTimePicker m_dtpA;
private Button btnTrans;
public DataGridView dataGridView1;
private Button m_btSelFic;
private Label m_lbFicRlt;
private CheckBox m_cbFichierCollecte;
private DataGridViewTextBoxColumn m_dgHheure;
private DataGridViewTextBoxColumn m_dgHdate;
private DataGridViewTextBoxColumn m_dgHtype;
private DataGridViewTextBoxColumn m_dgHidcarte;
private DataGridViewTextBoxColumn m_dgHoperateur;
private Button btnAjoutPoint;
private Button btnFermer;
private Button btnArrondir;
private SB2CSharpStr.AgosPresenceBdDOriginSQLDataSetTableAdapters.POINTAGETableAdapter pointageTableAdapter1;
private GroupBox groupBox1;
private Label lb_nbPoint;
private Label label4;
private Label lbAnomalies;
private Label label6;
private Button btnAno;
private SB2CSharpStr.AgosPresenceBdDOriginSQLDataSetTableAdapters.QueriesTableAdapter queriesTableAdapter1;
private String m_ResultFile_Str;
public frmCollecte( frmSB2CSharpStr frmParent )
{
//
// Requis pour la prise en charge du Concepteur Windows Forms
//
InitializeComponent();
m_pCP = frmParent;
m_pCP.m_FormActive = this;
m_pCP.m_boolFermetureManuelle = true;
}
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmCollecte));
this.m_btCollecter = new System.Windows.Forms.Button();
this.m_rbMAJ = new System.Windows.Forms.RadioButton();
this.m_rbComplete = new System.Windows.Forms.RadioButton();
this.label3 = new System.Windows.Forms.Label();
this.m_lbStatut = new System.Windows.Forms.Label();
this.m_sfDlg = new System.Windows.Forms.SaveFileDialog();
this.m_rbI2I = new System.Windows.Forms.RadioButton();
this.label1 = new System.Windows.Forms.Label();
this.m_dtpDe = new System.Windows.Forms.DateTimePicker();
this.label2 = new System.Windows.Forms.Label();
this.m_dtpA = new System.Windows.Forms.DateTimePicker();
this.btnTrans = new System.Windows.Forms.Button();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.m_dgHheure = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.m_dgHdate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.m_dgHtype = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.m_dgHidcarte = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.m_dgHoperateur = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.m_btSelFic = new System.Windows.Forms.Button();
this.m_lbFicRlt = new System.Windows.Forms.Label();
this.m_cbFichierCollecte = new System.Windows.Forms.CheckBox();
this.btnAjoutPoint = new System.Windows.Forms.Button();
this.btnFermer = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnAno = new System.Windows.Forms.Button();
this.lbAnomalies = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.lb_nbPoint = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.btnArrondir = new System.Windows.Forms.Button();
this.pointageTableAdapter1 = new SB2CSharpStr.AgosPresenceBdDOriginSQLDataSetTableAdapters.POINTAGETableAdapter();
this.queriesTableAdapter1 = new SB2CSharpStr.AgosPresenceBdDOriginSQLDataSetTableAdapters.QueriesTableAdapter();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// m_btCollecter
//
this.m_btCollecter.BackColor = System.Drawing.SystemColors.Control;
this.m_btCollecter.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.m_btCollecter.ForeColor = System.Drawing.SystemColors.ControlText;
this.m_btCollecter.Location = new System.Drawing.Point(604, 170);
this.m_btCollecter.Name = "m_btCollecter";
this.m_btCollecter.Size = new System.Drawing.Size(114, 24);
this.m_btCollecter.TabIndex = 13;
this.m_btCollecter.Text = "Lancer la collecte";
this.m_btCollecter.UseVisualStyleBackColor = false;
this.m_btCollecter.Click += new System.EventHandler(this.m_btCollecter_Click);
//
// m_rbMAJ
//
this.m_rbMAJ.AutoSize = true;
this.m_rbMAJ.Location = new System.Drawing.Point(12, 11);
this.m_rbMAJ.Name = "m_rbMAJ";
this.m_rbMAJ.Size = new System.Drawing.Size(83, 19);
this.m_rbMAJ.TabIndex = 0;
this.m_rbMAJ.TabStop = true;
this.m_rbMAJ.Text = "Mise à jour";
this.m_rbMAJ.UseVisualStyleBackColor = true;
//
// m_rbComplete
//
this.m_rbComplete.AutoSize = true;
this.m_rbComplete.Location = new System.Drawing.Point(12, 35);
this.m_rbComplete.Name = "m_rbComplete";
this.m_rbComplete.Size = new System.Drawing.Size(71, 19);
this.m_rbComplete.TabIndex = 1;
this.m_rbComplete.TabStop = true;
this.m_rbComplete.Text = "Complète";
this.m_rbComplete.UseVisualStyleBackColor = true;
//
// label3
//
this.label3.Font = new System.Drawing.Font("Comic Sans MS", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(71, 61);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(175, 21);
this.label3.TabIndex = 10;
this.label3.Text = "Statut :";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// m_lbStatut
//
this.m_lbStatut.BackColor = System.Drawing.Color.WhiteSmoke;
this.m_lbStatut.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.m_lbStatut.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.m_lbStatut.Location = new System.Drawing.Point(141, 61);
this.m_lbStatut.Name = "m_lbStatut";
this.m_lbStatut.Size = new System.Drawing.Size(128, 21);
this.m_lbStatut.TabIndex = 11;
this.m_lbStatut.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// m_sfDlg
//
this.m_sfDlg.DefaultExt = "Txt";
this.m_sfDlg.Filter = "Fichiers Texte|*.Txt";
this.m_sfDlg.OverwritePrompt = false;
this.m_sfDlg.Title = "Donnez le nom du fichier résultat de collecte";
//
// m_rbI2I
//
this.m_rbI2I.AutoSize = true;
this.m_rbI2I.Location = new System.Drawing.Point(12, 60);
this.m_rbI2I.Name = "m_rbI2I";
this.m_rbI2I.Size = new System.Drawing.Size(130, 19);
this.m_rbI2I.TabIndex = 2;
this.m_rbI2I.TabStop = true;
this.m_rbI2I.Text = "Entre deux instants :";
this.m_rbI2I.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(158, 59);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(44, 21);
this.label1.TabIndex = 3;
this.label1.Text = "De :";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// m_dtpDe
//
this.m_dtpDe.CustomFormat = "dd/MM/yyyy HH:mm:ss ";
this.m_dtpDe.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.m_dtpDe.Location = new System.Drawing.Point(208, 58);
this.m_dtpDe.Name = "m_dtpDe";
this.m_dtpDe.Size = new System.Drawing.Size(154, 23);
this.m_dtpDe.TabIndex = 4;
//
// label2
//
this.label2.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(158, 88);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 21);
this.label2.TabIndex = 5;
this.label2.Text = "A :";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// m_dtpA
//
this.m_dtpA.CustomFormat = "dd/MM/yyyy HH:mm:ss ";
this.m_dtpA.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.m_dtpA.Location = new System.Drawing.Point(208, 87);
this.m_dtpA.Name = "m_dtpA";
this.m_dtpA.Size = new System.Drawing.Size(154, 23);
this.m_dtpA.TabIndex = 6;
//
// btnTrans
//
this.btnTrans.BackColor = System.Drawing.SystemColors.Control;
this.btnTrans.Enabled = false;
this.btnTrans.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnTrans.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnTrans.Location = new System.Drawing.Point(604, 230);
this.btnTrans.Name = "btnTrans";
this.btnTrans.Size = new System.Drawing.Size(114, 24);
this.btnTrans.TabIndex = 14;
this.btnTrans.Text = "Transférer\r\n";
this.btnTrans.UseVisualStyleBackColor = false;
this.btnTrans.Click += new System.EventHandler(this.button1_Click);
//
// dataGridView1
//
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.m_dgHheure,
this.m_dgHdate,
this.m_dgHtype,
this.m_dgHidcarte,
this.m_dgHoperateur});
this.dataGridView1.Location = new System.Drawing.Point(12, 116);
this.dataGridView1.MultiSelect = false;
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.Size = new System.Drawing.Size(583, 387);
this.dataGridView1.TabIndex = 16;
//
// m_dgHheure
//
this.m_dgHheure.HeaderText = "Heure";
this.m_dgHheure.Name = "m_dgHheure";
//
// m_dgHdate
//
this.m_dgHdate.HeaderText = "Date";
this.m_dgHdate.Name = "m_dgHdate";
//
// m_dgHtype
//
this.m_dgHtype.HeaderText = "Entrée/Sortie";
this.m_dgHtype.Name = "m_dgHtype";
//
// m_dgHidcarte
//
this.m_dgHidcarte.FillWeight = 115F;
this.m_dgHidcarte.HeaderText = "Numéro Carte";
this.m_dgHidcarte.Name = "m_dgHidcarte";
this.m_dgHidcarte.ReadOnly = true;
this.m_dgHidcarte.Width = 130;
//
// m_dgHoperateur
//
this.m_dgHoperateur.HeaderText = "Opérateur";
this.m_dgHoperateur.Name = "m_dgHoperateur";
this.m_dgHoperateur.ReadOnly = true;
//
// m_btSelFic
//
this.m_btSelFic.BackColor = System.Drawing.SystemColors.Control;
this.m_btSelFic.Enabled = false;
this.m_btSelFic.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.m_btSelFic.Image = ((System.Drawing.Image)(resources.GetObject("m_btSelFic.Image")));
this.m_btSelFic.Location = new System.Drawing.Point(78, 82);
this.m_btSelFic.Name = "m_btSelFic";
this.m_btSelFic.Size = new System.Drawing.Size(24, 28);
this.m_btSelFic.TabIndex = 9;
this.m_btSelFic.UseVisualStyleBackColor = false;
this.m_btSelFic.Visible = false;
this.m_btSelFic.Click += new System.EventHandler(this.m_btSelFic_Click);
//
// m_lbFicRlt
//
this.m_lbFicRlt.AutoEllipsis = true;
this.m_lbFicRlt.BackColor = System.Drawing.Color.WhiteSmoke;
this.m_lbFicRlt.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.m_lbFicRlt.Enabled = false;
this.m_lbFicRlt.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.m_lbFicRlt.Location = new System.Drawing.Point(12, 89);
this.m_lbFicRlt.Name = "m_lbFicRlt";
this.m_lbFicRlt.Size = new System.Drawing.Size(20, 18);
this.m_lbFicRlt.TabIndex = 8;
this.m_lbFicRlt.Visible = false;
//
// m_cbFichierCollecte
//
this.m_cbFichierCollecte.AutoSize = true;
this.m_cbFichierCollecte.Enabled = false;
this.m_cbFichierCollecte.Location = new System.Drawing.Point(38, 90);
this.m_cbFichierCollecte.Name = "m_cbFichierCollecte";
this.m_cbFichierCollecte.Size = new System.Drawing.Size(34, 19);
this.m_cbFichierCollecte.TabIndex = 7;
this.m_cbFichierCollecte.Text = "S";
this.m_cbFichierCollecte.UseVisualStyleBackColor = true;
this.m_cbFichierCollecte.Visible = false;
//
// btnAjoutPoint
//
this.btnAjoutPoint.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnAjoutPoint.Location = new System.Drawing.Point(601, 116);
this.btnAjoutPoint.Name = "btnAjoutPoint";
this.btnAjoutPoint.Size = new System.Drawing.Size(114, 24);
this.btnAjoutPoint.TabIndex = 17;
this.btnAjoutPoint.Text = "Ajout pointage";
this.btnAjoutPoint.UseVisualStyleBackColor = true;
this.btnAjoutPoint.Click += new System.EventHandler(this.button2_Click);
//
// btnFermer
//
this.btnFermer.BackColor = System.Drawing.SystemColors.Control;
this.btnFermer.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnFermer.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnFermer.Location = new System.Drawing.Point(604, 479);
this.btnFermer.Name = "btnFermer";
this.btnFermer.Size = new System.Drawing.Size(114, 24);
this.btnFermer.TabIndex = 22;
this.btnFermer.Text = "Fermer";
this.btnFermer.UseVisualStyleBackColor = false;
this.btnFermer.Click += new System.EventHandler(this.btnFermer_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.btnAno);
this.groupBox1.Controls.Add(this.lbAnomalies);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.lb_nbPoint);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.m_lbStatut);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Location = new System.Drawing.Point(395, 11);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(320, 98);
this.groupBox1.TabIndex = 23;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Informations :";
//
// btnAno
//
this.btnAno.BackColor = System.Drawing.Color.Silver;
this.btnAno.Enabled = false;
this.btnAno.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnAno.ForeColor = System.Drawing.Color.White;
this.btnAno.Location = new System.Drawing.Point(275, 40);
this.btnAno.Name = "btnAno";
this.btnAno.Size = new System.Drawing.Size(39, 23);
this.btnAno.TabIndex = 24;
this.btnAno.Text = "Voir";
this.btnAno.UseVisualStyleBackColor = false;
this.btnAno.Click += new System.EventHandler(this.btnAno_Click);
//
// lbAnomalies
//
this.lbAnomalies.BackColor = System.Drawing.Color.WhiteSmoke;
this.lbAnomalies.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.lbAnomalies.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbAnomalies.Location = new System.Drawing.Point(141, 40);
this.lbAnomalies.Name = "lbAnomalies";
this.lbAnomalies.Size = new System.Drawing.Size(128, 21);
this.lbAnomalies.TabIndex = 14;
this.lbAnomalies.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label6
//
this.label6.Font = new System.Drawing.Font("Comic Sans MS", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label6.Location = new System.Drawing.Point(51, 40);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(84, 21);
this.label6.TabIndex = 13;
this.label6.Text = "Anomalies :";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lb_nbPoint
//
this.lb_nbPoint.BackColor = System.Drawing.Color.WhiteSmoke;
this.lb_nbPoint.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.lb_nbPoint.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lb_nbPoint.Location = new System.Drawing.Point(141, 19);
this.lb_nbPoint.Name = "lb_nbPoint";
this.lb_nbPoint.Size = new System.Drawing.Size(128, 21);
this.lb_nbPoint.TabIndex = 12;
this.lb_nbPoint.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label4
//
this.label4.Font = new System.Drawing.Font("Comic Sans MS", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(6, 19);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(110, 21);
this.label4.TabIndex = 11;
this.label4.Text = "Pointages collectés :";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// btnArrondir
//
this.btnArrondir.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnArrondir.Location = new System.Drawing.Point(604, 200);
this.btnArrondir.Name = "btnArrondir";
this.btnArrondir.Size = new System.Drawing.Size(114, 24);
this.btnArrondir.TabIndex = 24;
this.btnArrondir.Text = "Arrondir";
this.btnArrondir.UseVisualStyleBackColor = true;
this.btnArrondir.Click += new System.EventHandler(this.btnArrondir_Click_1);
//
// pointageTableAdapter1
//
this.pointageTableAdapter1.ClearBeforeFill = true;
//
// frmCollecte
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 16);
this.ClientSize = new System.Drawing.Size(727, 515);
this.Controls.Add(this.btnArrondir);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnFermer);
this.Controls.Add(this.btnAjoutPoint);
this.Controls.Add(this.dataGridView1);
this.Controls.Add(this.btnTrans);
this.Controls.Add(this.m_dtpA);
this.Controls.Add(this.label2);
this.Controls.Add(this.m_dtpDe);
this.Controls.Add(this.label1);
this.Controls.Add(this.m_rbI2I);
this.Controls.Add(this.m_cbFichierCollecte);
this.Controls.Add(this.m_btSelFic);
this.Controls.Add(this.m_lbFicRlt);
this.Controls.Add(this.m_rbComplete);
this.Controls.Add(this.m_rbMAJ);
this.Controls.Add(this.m_btCollecter);
this.Font = new System.Drawing.Font("Comic Sans MS", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmCollecte";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.TransparencyKey = System.Drawing.Color.Teal;
this.Load += new System.EventHandler(this.frmCollecte_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmSB05_Collecte_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
/// <summary> Chargement initial de la form.
/// </summary>
/// ****************************************
private void frmCollecte_Load(object sender, System.EventArgs e)
{
btnArrondir.Enabled = false;
btnTrans.Enabled = false;
try
{
m_rbMAJ.Checked = true;
}
catch (Exception ex)
{MessageBox.Show(ex.Message);}
}
/// <summary> Appui sur le bouton de lancement des collectes.
/// </summary>
/// *********************************************************
private void m_btCollecter_Click( object sender, System.EventArgs e )
{
btnArrondir.Enabled = true;
btnTrans.Enabled = true;
this.dataGridView1.Rows.Clear();
try
{
if ( m_cbFichierCollecte.Checked == true )
{
// Le nom du fichier de collecte a été spécifié.
//----------------------------------------------
m_ResultFile_Str = m_lbFicRlt.Text;
if ( m_ResultFile_Str == "" )
{ m_ResultFile_Str = Path.GetTempFileName();}
}
else
{ m_ResultFile_Str = Path.GetTempFileName();
}
//m_lvListe.Items.Clear();
m_btCollecter.Enabled = false; // Pour ne pas réautoriser de nouvelle collecte.
m_lbStatut.Text = "En cours";
if ( m_rbComplete.Checked == true )
{
// Collecte complete demandée.
//----------------------------
m_pCP.LiaisonEthernet_Collecte( CConstSB2.c_yTypeCollecte_Complete, m_ResultFile_Str );
lb_nbPoint.Text = ((dataGridView1.Rows.Count)-1).ToString();
lb_nbPoint.ForeColor = Color.Green;
}
else if ( m_rbMAJ.Checked == true )
{
// Collecte de mise à jour demandée.
//----------------------------------
m_pCP.LiaisonEthernet_Collecte( CConstSB2.c_yTypeCollecte_MAJ, m_ResultFile_Str );
lb_nbPoint.Text = ((dataGridView1.Rows.Count) - 1).ToString();
lb_nbPoint.ForeColor = Color.Green;
//Active le bouton transfere
}
else if ( m_rbI2I.Checked == true )
{
// Collecte entre deux indexs demandée.
//-------------------------------------
m_pCP.LiaisonEthernet_I2ICollecte(m_dtpDe.Value, m_dtpA.Value, m_ResultFile_Str);
lb_nbPoint.Text = ((dataGridView1.Rows.Count) - 1).ToString();
lb_nbPoint.ForeColor = Color.Green;
}
}
catch ( Exception ex )
{ MessageBox.Show( ex.Message ); }
}
/// <summary> Réception d'un compte rendu de collecte.
/// </summary>
/// **************************************************
public void CompteRenduCollecte( UInt32 dwNbRd, UInt32 dwRdTotal )
{
try
{
if ( ( m_lbStatut.InvokeRequired ) )
{
Delegate_CompteRenduCollecte d = new Delegate_CompteRenduCollecte( CompteRenduCollecte );
this.Invoke( d, new object [] { dwNbRd, dwRdTotal } );
}
else
{
if ( dwNbRd != dwRdTotal )
{
m_lbStatut.ForeColor = Color.Black;
m_lbStatut.Text = dwNbRd.ToString() + " / " + dwRdTotal.ToString();
}
else
{
m_lbStatut.ForeColor = Color.Green;
m_lbStatut.Text = "Achevée";
btnTrans.Enabled = true;//Pemret le transfere
}
}
}
catch ( Exception ex )
{ MessageBox.Show( ex.Message ); }
}
// Traite les données de collecte.
//--------------------------------
public void TraiteCollecte()
{
try
{
if ( this.dataGridView1.InvokeRequired )
{
Delegate_TraiteCollecte d = new Delegate_TraiteCollecte( TraiteCollecte );
this.Invoke( d, new object [] {} );
}
else
{
this.Cursor = Cursors.WaitCursor;
//m_lvListe.Items.Clear();
//m_lvListe.BeginUpdate();
FileStream fs = new FileStream( m_ResultFile_Str, FileMode.Open, FileAccess.Read, FileShare.Read );
StreamReader sr = new StreamReader( fs, Encoding.Default );
String Ligne_Str, Trav_Str;
int count = 0;
while ( ( Ligne_Str = sr.ReadLine() ) != null )
{
this.dataGridView1.Rows.Add();
String [] TblSplit;
TblSplit = Ligne_Str.Split( ';' );
if ( TblSplit.Length == 4 )
{
Trav_Str = TblSplit[1].Substring(8, 2);
Trav_Str += ":";
Trav_Str += TblSplit[1].Substring(10, 2);
Trav_Str += ":";
Trav_Str += TblSplit[1].Substring(12, 2);
dataGridView1.Rows[count].Cells[0].Value = Trav_Str;
//ListViewItem lvi = new ListViewItem(Trav_Str);
Trav_Str = "";
Trav_Str = TblSplit[1].Substring(0, 2);
Trav_Str += "/";
Trav_Str += TblSplit[1].Substring(2, 2);
Trav_Str += "/";
Trav_Str += TblSplit[1].Substring(4, 4);
dataGridView1.Rows[count].Cells[1].Value = Trav_Str;
//ListViewItem lvi = new ListViewItem(Trav_Str);
//lvi.SubItems.Add(Trav_Str);
switch (TblSplit[2])
{
case "1": Trav_Str = "E"; break;
case "2": Trav_Str = "Touche 2"; break;
case "3": Trav_Str = "S"; break;
case "4": Trav_Str = "Touche 4"; break;
default: Trav_Str = ""; break;
}
dataGridView1.Rows[count].Cells[2].Value = Trav_Str;
//lvi.SubItems.Add(Trav_Str);
dataGridView1.Rows[count].Cells[3].Value = TblSplit[3];
//lvi.SubItems.Add(TblSplit[3]);
try
{
//récuperer le IDNumber
String idnumber = TblSplit[3];
//initialisation de la connection
//declarations
SqlConnection cnx = new SqlConnection();
SqlCommand cmd = new SqlCommand();
cnx.ConnectionString = "Data Source=PORTCLAUDE\\SQLEXPRESS;Initial Catalog=AgosPresenceBdDOriginSQL;Integrated Security=True";
cnx.Open();
cmd.Connection = cnx;
cmd.CommandText = "SELECT nomPers FROM PERSONNEL WHERE numCarte='" + idnumber + "'";
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Trav_Str = (reader.GetString(0));
dataGridView1.Rows[count].Cells[4].Value = Trav_Str;
//lvi.SubItems.Add(Trav_Str);
}
reader.Close();
cnx.Close();
}
catch (Exception ex)
{
MessageBox.Show("Erreur : " + ex);
}
//m_lvListe.Items.Add(lvi);
}
count++;
lb_nbPoint.Text = count.ToString();
lb_nbPoint.ForeColor = Color.Green;
}
sr.Close();
fs.Close();
fs.Dispose();
if ( ( m_rbComplete.Checked == true ) || ( m_rbMAJ.Checked == true ) )
{
// Pour les collectes complètes ou de mise à jour, on va valider la collecte.
//---------------------------------------------------------------------------
//m_pCP.ValidationAdresseCollecte();
}
//m_lvListe.EndUpdate();
this.Cursor = Cursors.Default;
m_btCollecter.Enabled = true;
}
}
catch ( Exception ex )
{ MessageBox.Show( ex.Message ); }
}
// Compte rendu de réception de fin de l'action de collecte.
//----------------------------------------------------------
public void FinAction()
{
// Traite les données de collecte.
//--------------------------------
TraiteCollecte();
}
/// <summary>
/// La fenêtre est en cours de fermeture.
/// -------------------------------------
/// </summary>
private void frmSB05_Collecte_FormClosing( object sender, FormClosingEventArgs e )
{
if ( m_btCollecter.Enabled == false )
{ m_pCP.InterrompActionFermetureFenetre(); }
}
/// <summary> On souhaite sélectionner un fichier résultat spécifique.
/// </summary>
/// ******************************************************************
private void m_btSelFic_Click( object sender, EventArgs e )
{
try
{
if ( m_sfDlg.ShowDialog() == DialogResult.OK )
{
m_lbFicRlt.Text = m_sfDlg.FileName;
m_cbFichierCollecte.Checked = true;
}
}
catch ( Exception ex )
{ MessageBox.Show( ex.Message ); }
}
private void button1_Click(object sender, EventArgs e)
{
DialogResult res = MessageBox.Show("Voulez-vous confirmer le transfère ?","Confirmer?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (res == DialogResult.Yes)
{
try
{
int a = this.dataGridView1.RowCount;
int cpt = 0;
for (int i = 0; i < a - 1; i++)
{
String Heure = dataGridView1.Rows[i].Cells[0].Value.ToString();
String date = dataGridView1.Rows[i].Cells[1].Value.ToString();
String type = dataGridView1.Rows[i].Cells[2].Value.ToString();
String numCarte = dataGridView1.Rows[i].Cells[3].Value.ToString();
//declarations
SqlConnection cnx = new SqlConnection();
SqlCommand cmd = new SqlCommand();
cnx.ConnectionString = "Data Source=PORTCLAUDE\\SQLEXPRESS;Initial Catalog=AgosPresenceBdDOriginSQL;Integrated Security=True";
cnx.Open();
cmd.Connection = cnx;
cmd.CommandText = "SELECT MAX(datePoint) FROM POINTAGE";
SqlDataReader monSqlDR = cmd.ExecuteReader();
monSqlDR.Read();
DateTime LastDate, date1;
if (!monSqlDR.IsDBNull(0))
{
LastDate = monSqlDR.GetDateTime(0);
}
else
{
LastDate = DateTime.Parse("01/01/1900");
}
date1 = DateTime.Parse(date.Substring(6, 4) + "/" + date.Substring(3, 2) + "/" + date.Substring(0, 2) + " " + Heure);
monSqlDR.Close();
cnx.Close();
if (date1 > LastDate)
{
cpt++;
//On rescupere le dernier id
cnx.Open();
cmd.Connection = cnx;
cmd.CommandText = "SELECT MAX(idPoint) FROM POINTAGE";
SqlDataReader monSqlDR3 = cmd.ExecuteReader();
monSqlDR3.Read();
//int idPointage = monSqlDR3.GetInt32(0);
//2010/05/20 08:00:00 <==Format d'insertion
String da = date.Substring(6, 4) + "/" + date.Substring(3, 2) + "/" + date.Substring(0, 2) + " " + Heure;
DateTime daPoint = DateTime.Parse(da);
monSqlDR3.Close();
if (numCarte == "")
{
numCarte = null;
pointageTableAdapter1.Insert(daPoint, daPoint, type, numCarte, null, null);
}
else
{
pointageTableAdapter1.Insert(daPoint, daPoint, type, numCarte, null, null);
}
cnx.Close();
}
}
//declarations
SqlConnection cnx2 = new SqlConnection();
SqlCommand cmd2 = new SqlCommand();
cnx2.ConnectionString = "Data Source=PORTCLAUDE\\SQLEXPRESS;Initial Catalog=AgosPresenceBdDOriginSQL;Integrated Security=True";
cnx2.Open();
cmd2.Connection = cnx2;
cmd2.CommandText = "SELECT count(*)FROM POINTAGE_TMP WHERE valide=0 ";
SqlDataReader monSqlDR2 = cmd2.ExecuteReader();
monSqlDR2.Read();
int nbAnom = monSqlDR2.GetInt32(0);
lbAnomalies.Text = nbAnom.ToString();
if (lbAnomalies.Text != "0")
{
btnAno.Enabled = true;
}
if (cpt == 0)
{
MessageBox.Show("Données déjà traitées, aucune données à transférer", "Informations", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Données transférer avec succès!", "Informations", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception er)
{
MessageBox.Show("Erreur" + er);
}
}
m_pCP.ValidationAdresseCollecte();
}
private void button2_Click(object sender, EventArgs e)
{
Form frmAj = new frmAjoutPointage();
frmAj.Owner = this;
frmAj.Show();
}
//Fonction qui va permettre d'arrondir avant de transmettre
private void btnFermer_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnAno_Click(object sender, EventArgs e)
{
frmAnomalies frmAno = new frmAnomalies();
frmAno.Owner = this;
frmAno.Show();
}
//Calcul heureEquipe - heurePoint = min
private int Calcule_Temps (DateTime heurePoint, DateTime heureEquipe)
{
int min=0;
//declarations
SqlConnection cnx2 = new SqlConnection();
SqlCommand cmd2 = new SqlCommand();
cnx2.ConnectionString = "Data Source=PORTCLAUDE\\SQLEXPRESS;Initial Catalog=AgosPresenceBdDOriginSQL;Integrated Security=True";
cnx2.Open();
cmd2.Connection = cnx2;
cmd2.CommandText = "SELECT datediff(minute,'"+heurePoint+"','"+heureEquipe+"')";
SqlDataReader monSqlDR2 = cmd2.ExecuteReader();
monSqlDR2.Read();
min = monSqlDR2.GetInt32(0);
return min;
}
private void btnArrondir_Click_1(object sender, EventArgs e)
{
DialogResult res = MessageBox.Show("Voulez-vous confirmer les arrondis selon les paramètres ?", "Confirmer?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (res == DialogResult.Yes)
{
try
{
int a = this.dataGridView1.RowCount;
//int cpt = 0;
for (int i = 0; i < a - 1; i++)
{
DateTime heure = DateTime.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString());
DateTime date = DateTime.Parse(dataGridView1.Rows[i].Cells[1].Value.ToString());
String type = dataGridView1.Rows[i].Cells[2].Value.ToString();
String numCarte = dataGridView1.Rows[i].Cells[3].Value.ToString();
//declarations
SqlConnection cnx2 = new SqlConnection();
SqlCommand cmd2 = new SqlCommand();
cnx2.ConnectionString = "Data Source=PORTCLAUDE\\SQLEXPRESS;Initial Catalog=AgosPresenceBdDOriginSQL;Integrated Security=True";
cnx2.Open();
cmd2.Connection = cnx2;
cmd2.CommandText = "SELECT * FROM EQUIPE WHERE idEquipe=(SELECT idEquipe FROM PERSONNEL WHERE numCarte='" + numCarte + "')";
SqlDataReader monSqlDR2 = cmd2.ExecuteReader();
monSqlDR2.Read();
//Affectation des données :
DateTime Deb1 = monSqlDR2.GetDateTime(2);
DateTime Fin1 = monSqlDR2.GetDateTime(3);
DateTime Deb2 = monSqlDR2.GetDateTime(4);
DateTime Fin2 = monSqlDR2.GetDateTime(5);
DateTime Deb3 = monSqlDR2.GetDateTime(6);
DateTime Fin3 = monSqlDR2.GetDateTime(7);
DateTime Deb4 = monSqlDR2.GetDateTime(8);
DateTime Fin4 = monSqlDR2.GetDateTime(9);
int nbES = monSqlDR2.GetInt32(10);
monSqlDR2.Close();
cmd2.CommandText = "SELECT * FROM ARRONDI";
monSqlDR2 = cmd2.ExecuteReader();
monSqlDR2.Read();
int arrondiE = monSqlDR2.GetInt32(0);
int arrondiS = monSqlDR2.GetInt32(1);
String ASortie = "00:" + arrondiS + ":00";
String AEntree = "00:" + arrondiE + ":00";
monSqlDR2.Close();
//Mise en Format de l'heure
DateTime heureP = DateTime.Parse(heure.ToString().Substring(11, 8)+" 01/01/1900");
//Traitement pour une entrée
if (type == "E")
{
if (nbES == 1)
{
if (Calcule_Temps(heureP, Deb1) < arrondiE)
{
//On arrondi la entree 0 soit false
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), AEntree, 0);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
}
else if (nbES == 2)
{
if (Calcule_Temps(heureP, Deb1) < arrondiE)
{
//On arrondi la entree 0 soit false
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), AEntree, 0);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}else
if (Calcule_Temps(heureP, Deb2) < arrondiE)
{
//On arrondi la entree 0 soit false
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), AEntree, 0);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
}
else if (nbES == 3)
{
if (Calcule_Temps(heureP, Deb1) < arrondiE)
{
//On arrondi la entree 0 soit false
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), AEntree, 0);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}else
if (Calcule_Temps(heureP, Deb2) < arrondiE)
{
//On arrondi la entree 0 soit false
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), AEntree, 0);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}else
if (Calcule_Temps(heureP, Deb3) < arrondiE)
{
//On arrondi la entree 0
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), AEntree, 0);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
}
else if (nbES == 4)
{
if (Calcule_Temps(heureP, Deb1) < arrondiE)
{
//On arrondi la entree 0 soit false
DateTime heurpoin = DateTime.Parse(heureP.ToString());
m_rbMAJ.Text = AEntree.ToString();
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(heurpoin, AEntree, 1);
if (heureArondi != null)
{
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
else { MessageBox.Show("nuuuuul"); }
}else
if (Calcule_Temps(heureP, Deb2) < arrondiE)
{
//On arrondi la entree 0 soit false
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), AEntree, 0);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}else
if (Calcule_Temps(heureP, Deb3) < arrondiE)
{
//On arrondi la entree 0 soit false
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), AEntree, 0);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}else
if (Calcule_Temps(heureP, Deb4) < arrondiE)
{
//On arrondi la entree 0 soit false
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), AEntree, 0);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
}
}
//Traitement pour une sortie
else
{
if (nbES == 1)
{
if (Calcule_Temps(heureP, Fin1) < arrondiS)
{
//On arrondi l'sortie 1 soit true
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), ASortie, 1);
if (heureArondi != null)
{
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
else { MessageBox.Show("nuuuuul"); }
}
}
else if (nbES == 2)
{
if (Calcule_Temps(heureP, Fin1) < arrondiS)
{
//On arrondi l'sortie 1 soit true
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), ASortie, 1);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
else if (Calcule_Temps(heureP, Fin2) < arrondiS)
{
//On arrondi l'sortie 1 soit true
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), ASortie, 1);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
}
else if (nbES == 3)
{
if (Calcule_Temps(heureP, Fin1) < arrondiS)
{
//On arrondi l'sortie 1 soit true
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), ASortie, 1);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
else if (Calcule_Temps(heureP, Fin2) < arrondiS)
{
//On arrondi l'sortie 1 soit true
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), ASortie, 1);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
else if (Calcule_Temps(heureP, Fin3) < arrondiS)
{
//On arrondi l'sortie 1 soit true
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), ASortie, 1);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
}
else if (nbES == 4)
{
if (Calcule_Temps(heureP, Fin1) < arrondiS)
{
//On arrondi l'sortie 1 soit true
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), ASortie, 1);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
else if (Calcule_Temps(heureP, Fin2) < arrondiS)
{
//On arrondi l'sortie 1 soit true
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), ASortie, 1);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
else if (Calcule_Temps(heureP, Fin3) < arrondiS)
{
//On arrondi l'sortie 1 soit true
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), ASortie, 1);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
else if (Calcule_Temps(heureP, Fin4) < arrondiS)
{
//On arrondi l'sortie 1 soit true
Object heureArondi = this.queriesTableAdapter1.F_ROUND_TIME(DateTime.Parse(heureP.ToString()), ASortie, 1);
heureArondi.ToString();
dataGridView1.Rows[i].Cells[0].Value = heureArondi;
}
}
}
}
}
catch (Exception er) { MessageBox.Show("" + er); }
}
}
}
} |