private void button_ajouterClient_Click(object sender, EventArgs e)
        {
            //Pour verifier si les champs textes sont vides
            ns1.BunifuMaterialTextbox[] TBtable = new ns1.BunifuMaterialTextbox[5];
            TBtable[0] = TB_nom;
            TBtable[1] = TB_prenom;
            TBtable[2] = TB_Email;
            TBtable[3] = TB_Adresse;
            TBtable[4] = TB_CIN;
            foreach (var tb in TBtable)
            {
                if (tb.Text == "")
                {
                    tb.Focus();

                    MessageBox.Show(tb, "Le champ ne doit pas etre vide ex : " + tb.HintText);
                    return;
                }
            }
            ////////////////////////////////////////////////
            string nom     = TB_nom.Text;
            string prenom  = TB_prenom.Text;
            string Email   = TB_Email.Text;
            string CIN     = TB_CIN.Text;
            string Adresse = TB_Adresse.Text;

            connection.Open();
            SqlCommand cmd = connection.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "insert into client (nom,prenom,email,CIN,adresse) values ('" + nom + "','" + prenom + "','" + Email + "','" + CIN + "','" + Adresse + "')";
            cmd.ExecuteNonQuery();
            connection.Close();
            MessageBox.Show("votre client est créé, Veuillez ajouter vos produits");
            button_ajouterProduit.Visible = true;
            TB_marque.Enabled             = true;
            TB_quantite.Enabled           = true;
            TB_prix.Enabled      = true;
            CB_reference.Enabled = true;
            TB_nom.Text          = "";
            TB_prenom.Text       = "";
            TB_Email.Text        = "";
            TB_CIN.Text          = "";
            TB_Adresse.Text      = "";
            string status = CB_status.Text;
            float  Total  = float.Parse(TB_total.Text);

            string date      = ((DateTime)DP.Value).ToString("yyyy.MM.dd");
            int    id_client = 0;

            connection.Open();
            SqlCommand cmd4 = connection.CreateCommand();

            cmd4.CommandType = CommandType.Text;
            cmd4.CommandText = "select max(Id) from client";
            id_client        = Convert.ToInt32(cmd4.ExecuteScalar());
            SqlCommand cmd3 = connection.CreateCommand();

            cmd3.CommandType = CommandType.Text;
            cmd3.CommandText = "insert into facture (total,date,statut,id_client) values (" + Total + ",'" + date + "','" + status + "'," + id_client + ")";
            cmd3.ExecuteNonQuery();
            connection.Close();
            TB_nom.Text     = "";
            TB_prenom.Text  = "";
            TB_CIN.Text     = "";
            TB_Adresse.Text = "";
            TB_Email.Text   = "";
            button_ajouterClient.Visible = false;
            TB_nom.Enabled     = false;
            TB_prenom.Enabled  = false;
            TB_Email.Enabled   = false;
            TB_CIN.Enabled     = false;
            TB_Adresse.Enabled = false;
            color();
        }
예제 #2
0
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginIFMS));
     this.label2      = new System.Windows.Forms.Label();
     this.label1      = new System.Windows.Forms.Label();
     this.txtPassword = new System.Windows.Forms.TextBox();
     this.btnClose    = new ns1.BunifuImageButton();
     this.txtUsername = new ns1.BunifuMaterialTextbox();
     this.btnLogin    = new ns1.BunifuFlatButton();
     ((System.ComponentModel.ISupportInitialize)(this.btnClose)).BeginInit();
     this.SuspendLayout();
     //
     // label2
     //
     this.label2.AutoSize  = true;
     this.label2.BackColor = System.Drawing.Color.Transparent;
     this.label2.Font      = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.label2.ForeColor = System.Drawing.Color.White;
     this.label2.Location  = new System.Drawing.Point(54, 227);
     this.label2.Name      = "label2";
     this.label2.Size      = new System.Drawing.Size(92, 24);
     this.label2.TabIndex  = 12;
     this.label2.Text      = "Password";
     //
     // label1
     //
     this.label1.AutoSize  = true;
     this.label1.BackColor = System.Drawing.Color.Transparent;
     this.label1.Font      = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.label1.ForeColor = System.Drawing.Color.White;
     this.label1.Location  = new System.Drawing.Point(54, 183);
     this.label1.Name      = "label1";
     this.label1.Size      = new System.Drawing.Size(97, 24);
     this.label1.TabIndex  = 11;
     this.label1.Text      = "Username";
     //
     // txtPassword
     //
     this.txtPassword.BackColor   = System.Drawing.Color.FromArgb(((int)(((byte)(79)))), ((int)(((byte)(195)))), ((int)(((byte)(247)))));
     this.txtPassword.BorderStyle = System.Windows.Forms.BorderStyle.None;
     this.txtPassword.Font        = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.txtPassword.ForeColor   = System.Drawing.Color.White;
     this.txtPassword.Location    = new System.Drawing.Point(177, 227);
     this.txtPassword.Multiline   = true;
     this.txtPassword.Name        = "txtPassword";
     this.txtPassword.Size        = new System.Drawing.Size(206, 32);
     this.txtPassword.TabIndex    = 10;
     //
     // btnClose
     //
     this.btnClose.BackColor   = System.Drawing.Color.Transparent;
     this.btnClose.Image       = ((System.Drawing.Image)(resources.GetObject("btnClose.Image")));
     this.btnClose.ImageActive = null;
     this.btnClose.Location    = new System.Drawing.Point(644, 6);
     this.btnClose.Name        = "btnClose";
     this.btnClose.Size        = new System.Drawing.Size(20, 20);
     this.btnClose.SizeMode    = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
     this.btnClose.TabIndex    = 9;
     this.btnClose.TabStop     = false;
     this.btnClose.Zoom        = 10;
     //
     // txtUsername
     //
     this.txtUsername.BackColor           = System.Drawing.Color.FromArgb(((int)(((byte)(79)))), ((int)(((byte)(195)))), ((int)(((byte)(247)))));
     this.txtUsername.Cursor              = System.Windows.Forms.Cursors.IBeam;
     this.txtUsername.Font                = new System.Drawing.Font("Microsoft Sans Serif", 9.749999F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.txtUsername.ForeColor           = System.Drawing.Color.White;
     this.txtUsername.HintForeColor       = System.Drawing.Color.White;
     this.txtUsername.HintText            = "";
     this.txtUsername.isPassword          = false;
     this.txtUsername.LineFocusedColor    = System.Drawing.Color.FromArgb(((int)(((byte)(79)))), ((int)(((byte)(195)))), ((int)(((byte)(247)))));
     this.txtUsername.LineIdleColor       = System.Drawing.Color.FromArgb(((int)(((byte)(79)))), ((int)(((byte)(195)))), ((int)(((byte)(247)))));
     this.txtUsername.LineMouseHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(39)))), ((int)(((byte)(174)))), ((int)(((byte)(96)))));
     this.txtUsername.LineThickness       = 3;
     this.txtUsername.Location            = new System.Drawing.Point(177, 183);
     this.txtUsername.Margin              = new System.Windows.Forms.Padding(4);
     this.txtUsername.Name                = "txtUsername";
     this.txtUsername.RightToLeft         = System.Windows.Forms.RightToLeft.No;
     this.txtUsername.Size                = new System.Drawing.Size(206, 32);
     this.txtUsername.TabIndex            = 8;
     this.txtUsername.TextAlign           = System.Windows.Forms.HorizontalAlignment.Left;
     //
     // btnLogin
     //
     this.btnLogin.Activecolor           = System.Drawing.Color.Transparent;
     this.btnLogin.BackColor             = System.Drawing.Color.Transparent;
     this.btnLogin.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
     this.btnLogin.BorderRadius          = 5;
     this.btnLogin.ButtonText            = "Login";
     this.btnLogin.Cursor                   = System.Windows.Forms.Cursors.Hand;
     this.btnLogin.DisabledColor            = System.Drawing.Color.Gray;
     this.btnLogin.Iconcolor                = System.Drawing.Color.Transparent;
     this.btnLogin.Iconimage                = ((System.Drawing.Image)(resources.GetObject("btnLogin.Iconimage")));
     this.btnLogin.Iconimage_right          = null;
     this.btnLogin.Iconimage_right_Selected = null;
     this.btnLogin.Iconimage_Selected       = null;
     this.btnLogin.IconMarginLeft           = 0;
     this.btnLogin.IconMarginRight          = 0;
     this.btnLogin.IconRightVisible         = true;
     this.btnLogin.IconRightZoom            = 0D;
     this.btnLogin.IconVisible              = true;
     this.btnLogin.IconZoom                 = 90D;
     this.btnLogin.IsTab            = false;
     this.btnLogin.Location         = new System.Drawing.Point(294, 334);
     this.btnLogin.Name             = "btnLogin";
     this.btnLogin.Normalcolor      = System.Drawing.Color.Transparent;
     this.btnLogin.OnHovercolor     = System.Drawing.Color.FromArgb(((int)(((byte)(52)))), ((int)(((byte)(152)))), ((int)(((byte)(219)))));
     this.btnLogin.OnHoverTextColor = System.Drawing.Color.FromArgb(((int)(((byte)(44)))), ((int)(((byte)(62)))), ((int)(((byte)(80)))));
     this.btnLogin.selected         = false;
     this.btnLogin.Size             = new System.Drawing.Size(89, 40);
     this.btnLogin.TabIndex         = 7;
     this.btnLogin.Text             = "Login";
     this.btnLogin.TextAlign        = System.Drawing.ContentAlignment.TopCenter;
     this.btnLogin.Textcolor        = System.Drawing.Color.White;
     this.btnLogin.TextFont         = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.btnLogin.Click           += new System.EventHandler(this.btnLogin_Click_1);
     //
     // LoginIFMS
     //
     this.BackgroundImage       = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
     this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
     this.ClientSize            = new System.Drawing.Size(672, 448);
     this.ControlBox            = false;
     this.Controls.Add(this.label2);
     this.Controls.Add(this.label1);
     this.Controls.Add(this.txtPassword);
     this.Controls.Add(this.btnClose);
     this.Controls.Add(this.txtUsername);
     this.Controls.Add(this.btnLogin);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
     this.Name            = "LoginIFMS";
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Load           += new System.EventHandler(this.LoginIFMS_Load);
     ((System.ComponentModel.ISupportInitialize)(this.btnClose)).EndInit();
     this.ResumeLayout(false);
     this.PerformLayout();
 }