private void FrmAMDocEmploye_Load(object sender, EventArgs e) { string sql = "select *,concat(nom,' ',prenom) as nomComplete from employe where archive = 1"; bsEmp = Fonctions.remplirList(cb_emps, sql, "Employe", "nomComplete", "id_employe"); if (frm == "Modifier") { cmd = new SqlCommand("select * from document_employe where id_document = " + id, Fonctions.CnConnection()); dr = cmd.ExecuteReader(); dr.Read(); txt_nom.Text = dr["nom"].ToString(); lbl_chemin.Text = dr["fichier"].ToString(); lbl_titre.Text = "Modifier Document"; cb_emps.SelectedValue = id; pnl_ajouter.Visible = false; pnl_modifier.Visible = true; } else { pnl_modifier.Visible = false; pnl_ajouter.Visible = true; lbl_titre.Text = "Ajouter Document"; } }
private void btn_chercher_rubrique_Click(object sender, EventArgs e) { if (cb_type.SelectedIndex == -1) { MessageBox.Show("select un type s'il vous plaît.", "Type Est Vide", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { dt_grid.Rows.Clear(); if (cb_type.Text == "Proprietaire") { remplirGrilutilProp(); } else { string sql = "select u.id_utilisateur,u.login,u.password,u.salt,t.nom_type,(e.prenom+' '+e.nom) as [Nom Complete] from utilisateur u inner join type_utilisateur t on t.id_type = u.id_type inner join employe e on e.id_employe = u.id_table where t.nom_type = '" + cb_type.Text + "' and u.archive = 1"; cmd = new SqlCommand(sql, Fonctions.CnConnection()); dr = cmd.ExecuteReader(); dt_grid.Columns[0].Visible = false; while (dr.Read()) { dt_grid.Rows.Add(dr[0].ToString(), dr[5].ToString(), dr[1].ToString(), dr[2].ToString(), dr[4].ToString()); } dr.Close(); dr = null; } } }
private void btn_Recette_valider_Click(object sender, EventArgs e) { if (textBox1.Text != "") { Fonctions.ouvrireConnection(); com = new SqlCommand("Insert into type_utilisateur values ('" + textBox1.Text + "',1)", CN); int a = -1; a = com.ExecuteNonQuery(); if (a != -1) { DialogResult d = MessageBox.Show("Enregistrer", "enregistrer", MessageBoxButtons.OK); if (DialogResult.OK == d) { this.Close(); } } else { MessageBox.Show("Erreur !!"); } } else { MessageBox.Show("il faut entre le type !!!!!"); } }
private void btn_rubrique_Click(object sender, EventArgs e) { FrmRubrique f = new FrmRubrique(); f.ShowDialog(); bsRub = Fonctions.remplirList(cb_Rubrique, "rubrique", "nomrubrique", "id_rubrique"); }
private void FrmAMRepos_Load(object sender, EventArgs e) { string sql = "select *,concat(prenom,' ',nom) as 'nomComplet' from employe where archive = 1"; bsEmp = Fonctions.remplirList(cb_emps, sql, "Employe", "nomComplet", "id_employe"); if (frm == "Modifier") { activier(false); lbl_titre.Text = "Modifier Repos"; cb_emps.SelectedValue = idemp; cmd = new SqlCommand("select * from repos_employe where id_repos = " + idrep, Fonctions.CnConnection()); dr = cmd.ExecuteReader(); dr.Read(); txt_nb.Text = dr["nb_jour"].ToString(); txt_jours.Text = dr["jours"].ToString(); dr.Close(); dr = null; } else { activier(true); lbl_titre.Text = "Ajouter Repos"; } }
private void frm_cotisation_ajouter_Load(object sender, EventArgs e) { if (cn.State != ConnectionState.Open) { cn.ConnectionString = ConfigurationManager.ConnectionStrings["SyndicCS"].ToString(); cn.Open(); } BindingSource bscombo = Fonctions.remplirList(cmb_type, "Select * from type_cotisation where archive = 1", "type_cotisation", "nomType", "id_type"); cmb_type.DataSource = bscombo; ch.Name = "check"; dataGridView1.Columns.Add(ch); remplirLst(); string sql2 = "Select concat(nom,' ',prenom) as nm , b.id_proprietaire as ids from proprietaire p join Bien b on b.id_proprietaire = p.id_proprietaire "; bsFac = Fonctions.remplirList(cmb_proprietaire, sql2, "proprietaire2", "nm", "ids"); cmb_proprietaire.Focus(); cmb_proprietaire.SelectedIndex = 0; remplirLst(); pos = int.Parse(cmb_proprietaire.ValueMember); remplirLst(); }
private void FrmAMConge_Load(object sender, EventArgs e) { string sql = "select *,concat(prenom,' ',nom) as nomComplet from employe where archive = 1"; bsEmp = Fonctions.remplirList(cb_emps, sql, "Employe", "nomComplet", "id_employe"); if (frm == "Modifier") { cb_emps.SelectedValue = idemp; cmd = new SqlCommand("select * from conge_employe where id_employe = " + idemp + " and id_conge = " + idcon, Fonctions.CnConnection()); dr = cmd.ExecuteReader(); dr.Read(); dt_debut.Value = Convert.ToDateTime(dr["date_sortie"].ToString()); dt_fin.Value = Convert.ToDateTime(dr["date_entree"].ToString()); dr.Close(); dr = null; lbl_titre.Text = "Modifier Conge"; activier(false); } else { lbl_titre.Text = "Ajouter Conge"; activier(true); } }
private void frm_cotisationDocument_info_Load(object sender, EventArgs e) { string sql2 = "Select distinct Concat(nom,' ',prenom) as nm,c.id_cotisation as id from document_cotisation d join cotisation c on c.id_cotisation = d.id_cotisation join proprietaire p on p.id_proprietaire = c.id_proprietaire where c.archive = 1"; bsFct = Fonctions.remplirList(cb_fct, sql2, "Cotisation", "nm", "id"); if (lbl_titre.Text == "Modifier") { cmd = new SqlCommand("select * from document_cotisation where id_document = " + id, Fonctions.CnConnection()); dr = cmd.ExecuteReader(); dr.Read(); txt_nom.Text = dr["nomDocument"].ToString(); lbl_chemin.Text = dr["fichier"].ToString(); lbl_titre.Text = "Modifier Document"; cb_fct.SelectedValue = id; pnl_ajouter.Visible = false; pnl_modifier.Visible = true; } else { pnl_modifier.Visible = false; pnl_ajouter.Visible = true; lbl_titre.Text = "Ajouter"; } }
private void FrmAMContract_Load(object sender, EventArgs e) { string sql = "select id_employe,concat(prenom,' ',nom) as nomComplet from employe where archive = 1"; bsEmp = Fonctions.remplirList(cb_emps, sql, "employe", "nomComplet", "id_employe"); if (frm == "Modifier") { cb_emps.SelectedValue = idemp; cmd = new SqlCommand("select * from contrat where id_contrat = " + idcon, Fonctions.CnConnection()); dr = cmd.ExecuteReader(); dr.Read(); ancien += "id_employe = " + dr["id_employe"].ToString() + " date_debut = " + dr["date_debut"].ToString() + " date_fin = " + dr["date_fin"].ToString() + " salaire = " + dr["salaire"].ToString(); dt_debut.Text = dr["date_debut"].ToString(); dt_fin.Text = dr["date_fin"].ToString(); txt_salaire.Text = dr["salaire"].ToString(); dr.Close(); dr = null; lbl_titre.Text = "Modifier Contract"; activier(false); } else { lbl_titre.Text = "Ajouter Contract"; activier(true); } }
private void FrmAMDocFacture_Load(object sender, EventArgs e) { bsFct = Fonctions.remplirList(cb_fct, "Facture", "designation", "id_facture"); if (frm == "Modifier") { cmd = new SqlCommand("select * from document_facture where id_document = " + id, Fonctions.CnConnection()); dr = cmd.ExecuteReader(); dr.Read(); txt_nom.Text = dr["nom"].ToString(); lbl_chemin.Text = dr["fichier"].ToString(); lbl_titre.Text = "Modifier Document"; cb_fct.SelectedValue = id; pnl_ajouter.Visible = false; pnl_modifier.Visible = true; } else { pnl_modifier.Visible = false; pnl_ajouter.Visible = true; lbl_titre.Text = "Ajouter Document"; } }
private void FrmAchat_Load(object sender, EventArgs e) { bsAchat = Fonctions.remplirGrille(dt_grid, sql, "achat"); dt_grid.Columns[0].Visible = false; dt_grid.Columns[1].Visible = false; }
private void Frm_Bien_Document_aj_Load(object sender, EventArgs e) { bsFct = Fonctions.remplirList(cb_doc, "bien", "NomApparetemnt", "id_bien"); if (frm == "Modifier Document") { cmd = new SqlCommand("select * from document_bien where id_document = " + id, Fonctions.CnConnection()); dr = cmd.ExecuteReader(); dr.Read(); txt_nom.Text = dr["nom"].ToString(); lbl_chemin.Text = dr["fichier"].ToString(); lbl_titre.Text = "Modifier Document"; cb_doc.SelectedValue = id; pnl_ajouter.Visible = false; pnl_modifier.Visible = true; } else { pnl_modifier.Visible = false; pnl_ajouter.Visible = true; lbl_titre.Text = "Ajouter Document"; } }
private void lst_documents_DoubleClick(object sender, EventArgs e) { cmd = new SqlCommand("select fichier from document_employe where id_document = " + GetID(), Fonctions.CnConnection()); string chemin = cmd.ExecuteScalar().ToString(); Fonctions.OuvrirDocument(chemin); }
private void Frm_utilisateur_Load(object sender, EventArgs e) { Affiche(); string sqlEmp = "select u.id_utilisateur,u.login,u.password,u.salt,t.nom_type,(e.prenom+' '+e.nom) as [Nom Complete] from utilisateur u inner join type_utilisateur t on t.id_type = u.id_type inner join employe e on e.id_employe = u.id_table where t.nom_type = 'Employée' and u.archive = 1"; string sqlPrp = "select u.id_utilisateur,u.login,u.password,u.salt,t.nom_type,(e.prenom+' '+e.nom) as [Nom Complete] from utilisateur u inner join type_utilisateur t on t.id_type = u.id_type inner join proprietaire e on e.id_proprietaire=u.id_table where t.nom_type = 'Proprietaire' and u.archive = 1"; cmd = new SqlCommand(sqlEmp, Fonctions.CnConnection()); dr = cmd.ExecuteReader(); dt_grid.Columns[0].Visible = false; while (dr.Read()) { dt_grid.Rows.Add(dr[0].ToString(), dr[5].ToString(), dr[1].ToString(), dr[2].ToString(), dr[4].ToString()); } dr.Close(); dr = null; cmd = new SqlCommand(sqlPrp, Fonctions.CnConnection()); dr = cmd.ExecuteReader(); dt_grid.Columns[0].Visible = false; while (dr.Read()) { dt_grid.Rows.Add(dr[0].ToString(), dr[5].ToString(), dr[1].ToString(), dr[2].ToString(), dr[4].ToString()); } dr.Close(); dr = null; }
private void FrmDocEmploye_Load(object sender, EventArgs e) { string sql = "select *,concat(nom,' ',prenom) as nomComplete from employe where archive = 1"; bsEmp = Fonctions.remplirList(lst_employes, sql, "Employe", "nomComplete", "id_employe"); remplirDoc(); }
private void frm_cotisation_Document_Load(object sender, EventArgs e) { string sql2 = "Select distinct Concat(nom,' ',prenom) as nm,c.id_cotisation as id from document_cotisation d join cotisation c on c.id_cotisation = d.id_cotisation join proprietaire p on p.id_proprietaire = c.id_proprietaire where c.archive = 1"; bsFact = Fonctions.remplirList(lst_cotisation, sql2, "Cotisation", "nm", "id"); remplirDoc(); }
private void lstArticleAchat() { if (lst_fournisseur.Items.Count > 0 && txt_ice.Text != "") { string sql = "select a.id_article,CONCAT(a.designation,' - ',a.qtestock) as Libelle,a.archive from article a inner join achat c on c.id_article = a.id_article inner join facture f on f.id_facture = c.id_facture inner join fournisseur r on r.id_fournisseur = f.id_fournisseur where r.ice = " + txt_ice.Text + " and a.archive = 1"; bsAr = Fonctions.remplirList(lst_article, sql, "articleAchat", "Libelle", "a.id_article"); } }
private void Frm_Bien_Remarque_Load(object sender, EventArgs e) { bsbien = Fonctions.remplirList(cb_bien, "bien", "NomApparetemnt", "id_bien"); remplirLst(); activier(true); }
private void btn_pays_Click(object sender, EventArgs e) { FrmPays f = new FrmPays(); f.ShowDialog(); string sql = "select * from pays"; bsPay = Fonctions.remplirList(cb_pays, sql, "pays", "nom_pays", "id_pays"); }
private void FrmRemFacture_Load(object sender, EventArgs e) { string sql = "select * from facture where archive = 1"; bsFac = Fonctions.remplirList(cb_facture, sql, "facture", "designation", "id_facture"); remplirLst(); activier(true); }
private void frm_Cotisation_Remarque_Load(object sender, EventArgs e) { string sql2 = "Select distinct Concat(nom,' ',prenom) as nm,c.id_cotisation as id from remarque_cotisation d join cotisation c on c.id_cotisation = d.id_cotisation join proprietaire p on p.id_proprietaire = c.id_proprietaire where c.archive = 1"; bsFac = Fonctions.remplirList(cb_facture, sql2, "cotisation", "nm", "id"); remplirLst(); activier(true); }
private void FrmArticleStock_Load(object sender, EventArgs e) { bsArt = Fonctions.remplirGrille(dt_grid, sql, "article"); dt_grid.Columns[0].Width = 100; dt_grid.Columns[1].Width = 180; remplircombo(); afficherpnl(); }
private void FrmRemEmploye_Load(object sender, EventArgs e) { string sql = "select *,concat(nom,' ',prenom) as nomComplet from employe where archive = 1"; bsEmp = Fonctions.remplirList(cb_employes, sql, "Employe", "nomComplet", "id_employe"); remplirLst(); activier(true); }
private void cb_type_SelectedIndexChanged(object sender, EventArgs e) { if (cb_type.Text == "Fournisseur") { string sql = "Select id_fournisseur,concat('[',ice,'] - ',prenom,' ',nom) as nomCP from fournisseur where archive = 1"; bsFr = Fonctions.remplirList(cb_nom, sql, "fournisseur", "nomCP", "id_fournisseur"); } else { string sql = "Select id_employe,concat(id_employe,' - ',prenom,' ',nom) as nomCP from employe where archive = 1"; bsFr = Fonctions.remplirList(cb_nom, sql, "employe", "nomCP", "id_employe"); } }
private void journal() { string sql = "select u.id_utilisateur,u.login,u.password,u.salt,t.nom_type,(e.prenom+' '+e.nom) as [Nom Complete] from utilisateur u inner join type_utilisateur t on t.id_type = u.id_type inner join employe e on e.id_employe = u.id_table where t.nom_type = 'Employée' and u.archive = 1 and u.id_utilisateur =" + id + "union select u.id_utilisateur,u.login,u.password,u.salt,t.nom_type,(e.prenom + ' ' + e.nom) as [Nom Complete] from utilisateur u inner join type_utilisateur t on t.id_type = u.id_type inner join proprietaire e on e.id_proprietaire = u.id_table where t.nom_type = 'Proprietaire' and u.archive = 1 and u.id_utilisateur= " + id; com = new SqlCommand(sql, Fonctions.CnConnection()); dr = com.ExecuteReader(); dr.Read(); nouvelles += "Id =" + dr["id_utilisateur"].ToString() + " Nom Complet =" + dr["Nom Complete"].ToString() + "Login = "******"login"].ToString() + "Password ="******"password"].ToString() + "type=" + dr["nom_type"].ToString(); dr.Close(); com = null; com = new SqlCommand("insert into journal values (1,GETDATE(),'Modifier','utilisateur','" + anciennes + "','" + nouvelles + "',1)", Fonctions.CnConnection()); com.ExecuteNonQuery(); }
private void Affiche() { if (rd_nom.Checked == true) { pnl_nom.Visible = true; //pnl_typ.Visible = false; } else { pnl_nom.Visible = false; // pnl_typ.Visible = true; Fonctions.remplirList(cb_type, "type_utilisateur", "nom_type", "id_type"); } }
private void btn_ajouter_Click(object sender, EventArgs e) { Button btn = (Button)sender; switch (btn.Name) { case "btn_ajouter": pos = lst_emps.Items.Count; bsEmp.AddNew(); txt_archive.Text = "true"; activer(false); break; case "btn_modifier": activer(false); pos = lst_emps.SelectedIndex; break; case "btn_supprimer": if (lst_emps.Items.Count > 0) { if (DialogResult.Yes == MessageBox.Show("Voulez-vous Vraiment Supprimer Ce Employe ?", "Supprimer", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { pos = lst_emps.SelectedIndex - 1; txt_archive.Text = "False"; bsEmp.EndEdit(); Fonctions.syncr("Employe", Fonctions.CnConnection(), Fonctions.ds); remplirEmps(); lst_emps.SelectedIndex = pos; } } break; case "btn_valider": bsEmp.EndEdit(); Fonctions.syncr("Employe", Fonctions.CnConnection(), Fonctions.ds); remplirEmps(); lst_emps.SelectedIndex = pos; activer(true); break; case "btn_annuler": bsEmp.CancelEdit(); activer(true); break; } }
private void frm_Echeance_Load(object sender, EventArgs e) { txt_search = MyHint.LoadText(txt_search, "Nom de bien"); rd_tous.Checked = true; //Fonctions.ouvrireConnection(); cn = Fonctions.CnConnection(); if (cn.State != ConnectionState.Open) { cn.Open(); } ////les annee ////les Mois WhoChecked = ""; sqlQuery = "Select id_echeance,mois,annee,montant,montant_recu,NomApparetemnt from echeance e inner join Bien b on b.id_bien = e.id_bien join immeuble i on i.id_immeuble = b.id_immeuble where e.archive = 1 and paiment like '%" + WhoChecked + "%' "; com = new SqlCommand(sqlQuery, Fonctions.CnConnection()); reader = com.ExecuteReader(); dataGridView1.ColumnCount = 6; dataGridView1.Columns[0].Name = "Id"; dataGridView1.Columns[1].Name = "Mois"; dataGridView1.Columns[2].Name = "Anne"; dataGridView1.Columns[3].Name = "Montant"; dataGridView1.Columns[4].Name = "Montant Recu"; dataGridView1.Columns[5].Name = "Bien"; ///////////////////////////////// // com = new SqlCommand("Select montant from Bien",cn); //readerMontant = com.ExecuteReader(); //while (readerMontant.Read()) //{ //} while (reader.Read()) { dataGridView1.Rows.Add(reader[0].ToString(), reader[1].ToString(), reader[2].ToString(), reader[3].ToString(), reader[4].ToString(), reader[5].ToString()); } ////////// //////// ///////// /////////// ////////////// ////////////// /////////// reader.Close(); }
private void btn_chercher_designation_Click(object sender, EventArgs e) { dt_grid.Rows.Clear(); int a; if (txt_chercher.Text.Contains(' ')) { a = txt_chercher.Text.IndexOf(' '); } else { a = txt_chercher.Text.Length; } string nom = txt_chercher.Text.Substring(0, a); string prenom = txt_chercher.Text.Substring(a, (txt_chercher.Text.Length - a)); if (prenom == "") { prenom = " "; } string sqlPrp = "select u.id_utilisateur,u.login,u.password,u.salt,t.nom_type,(e.prenom+' '+e.nom) as [Nom Complete] from utilisateur u inner join type_utilisateur t on t.id_type = u.id_type inner join proprietaire e on e.id_proprietaire=u.id_table where t.nom_type = 'Proprietaire' and (nom like '%" + nom + "%' or nom like '%" + prenom + "%' or prenom like '%" + nom + "%' or prenom like '%" + prenom + "%')"; cmd = new SqlCommand(sqlPrp, Fonctions.CnConnection()); dr = cmd.ExecuteReader(); dt_grid.Columns[0].Visible = false; while (dr.Read()) { dt_grid.Rows.Add(dr[0].ToString(), dr[5].ToString(), dr[1].ToString(), dr[2].ToString(), dr[4].ToString()); } dr.Close(); dr = null; string sqlEmp = "select u.id_utilisateur,u.login,u.password,u.salt,t.nom_type,(e.prenom+' '+e.nom) as [Nom Complete] from utilisateur u inner join type_utilisateur t on t.id_type = u.id_type inner join employe e on e.id_employe = u.id_table where t.nom_type = 'Employée' and (nom like '%" + nom + "%' or nom like '%" + prenom + "%' or prenom like '%" + nom + "%' or prenom like '%" + prenom + "%')"; cmd = new SqlCommand(sqlEmp, Fonctions.CnConnection()); dr = cmd.ExecuteReader(); dt_grid.Columns[0].Visible = false; while (dr.Read()) { dt_grid.Rows.Add(dr[0].ToString(), dr[5].ToString(), dr[1].ToString(), dr[2].ToString(), dr[4].ToString()); } dr.Close(); dr = null; }
private void Affiche() { if (rd_nom.Checked) { pnl_nom.Visible = true; } else { pnl_nom.Visible = false; Fonctions.remplirList(cm_et, "bien", "etage", "id_bien"); Fonctions.remplirList(cm_ch_im, "immeuble", "nom", "id_immeuble"); } }