private TB_Articles GetChamp() { TB_Articles article = new TB_Articles(); article.N_Pieces = (decimal)c1TextBox3.Value; article.Libelle = (string)c1TextBox2.Text; article.Code_Famille = (string)c1Combo1.SelectedValue; article.Code = (string)c1TextBox1.Text; article.Description = (string)c1TextBox4.Text; article.Prix_Pressing = (decimal)c1NumericEdit1.Value; article.Prix_Repassage = (decimal)c1NumericEdit2.Value; article.Prix_Tenture = (decimal)c1NumericEdit3.Value; article.Prix_Autre = (decimal)c1NumericEdit4.Value; article.Print = checkBox5.Checked; if (newPic) { MyUtils myUtils = new MyUtils(); article.Photo = myUtils.GetPhoto(textBox1.Text); } else { article.Photo = null; } return(article); }
private void btnPhoto_Click(object sender, EventArgs e) { MyUtils myUtils = new MyUtils(); string sPath = myUtils.PhotoPath(); if (sPath != string.Empty) { byte[] img = myUtils.GetPhoto(sPath); MemoryStream ms = new MemoryStream(); ms.Write(img, 0, img.Length); Image imgPhoto = Image.FromStream(ms); pbxLogo.Image = imgPhoto; tbxPhoto.Text = sPath; } }
private void pictureBox1_DoubleClick(object sender, EventArgs e) { MyUtils myUtils = new MyUtils(); string sPath = myUtils.PhotoPath(); if (sPath != string.Empty) { byte[] img = myUtils.GetPhoto(sPath); MemoryStream ms = new MemoryStream(); ms.Write(img, 0, img.Length); Image imgPhoto = Image.FromStream(ms); pictureBox1.Image = imgPhoto; pictureBox1.Text = sPath; btnOK.Enabled = true; newPic = true; } }
private void btnOK_Click(object sender, EventArgs e) { MyUtils myUtils = new MyUtils(); if (VerifierChamp()) { TB_User newUser = GetChamp(); if (newPic) { newUser.Photo = myUtils.GetPhoto(pictureBox1.Text); } if (!Save) { newUser.UpdateData(); } else { newUser.SaveData(); } this.Close(); } }
private void button1_Click(object sender, EventArgs e) { //---------------------------------------------------- DB_PostgreSQL dataBase = new DB_PostgreSQL(); string connString = string.Empty; connString += "Server=" + textBoxServer.Text + ";"; connString += "Port=" + textBoxPort.Text + ";"; connString += "User Id=" + textBoxDBUser.Text + ";"; connString += "Password="******";"; connString += "DataBase=" + textBoxDB.Text + ";"; GlobalVars.connString = connString; if (dataBase.testConnection(connString)) { ConfigSettings.WriteSetting("connString", connString); } else { MessageBox.Show("Vérifiez la configuration de la base de données =>" + connString); } //-------------------------------------------------------- string Printer = comboPrinters.Text; string Page = comboPage.SelectedIndex.ToString(); string NbTicket = textNbTicket.Text; string MaxPressing = textMaxPressing.Text; string MaxRepassage = textMaxRepassage.Text; string MaxTenture = textMaxTenture.Text; string MaxAutre = textMaxAutre.Text; GlobalVars.page = comboPage.SelectedIndex.ToString(); GlobalVars.namePrinter = Printer; GlobalVars.nombreCopieTicket = NbTicket; GlobalVars.maxAutre = MaxAutre; GlobalVars.maxPressing = MaxPressing; GlobalVars.maxRepassage = MaxRepassage; GlobalVars.maxTenture = MaxTenture; ConfigSettings.WriteSetting("Printer", Printer); ConfigSettings.WriteSetting("Page", Page); ConfigSettings.WriteSetting("NbTicket", NbTicket); ConfigSettings.WriteSetting("MaxPressing", MaxPressing); ConfigSettings.WriteSetting("MaxRepassage", MaxRepassage); ConfigSettings.WriteSetting("MaxTenture", MaxTenture); ConfigSettings.WriteSetting("MaxAutre", MaxAutre); //-------------------------------------------------------- string PrefixFacture = textPrefixFacture.Text; string PremierFacture = textPremierFacture.Text; string PrefixClient = textPrefixClient.Text; GlobalVars.PrefixFacture = PrefixFacture; GlobalVars.PremierFacture = PremierFacture; GlobalVars.PrefixClient = PrefixClient; ConfigSettings.WriteSetting("prefixFacutre", PrefixFacture); ConfigSettings.WriteSetting("firstFacutre", PremierFacture); ConfigSettings.WriteSetting("prefixClient", PrefixClient); //---------------------------------------------------------- //---------------------------------------------------------- MyUtils myUtils = new MyUtils(); if (validateFields()) { InfoSociete societe = new InfoSociete(); societe.nom = txtNom.Text; societe.adresse = txtAdresse.Text; societe.tel = txttele.Text; societe.fax = txtfax.Text; if (tbxPhoto.Text != string.Empty) { societe.logo = myUtils.GetPhoto(tbxPhoto.Text); } societe.SaveData(); } //------------------------------------------------------------- this.Close(); }