public static Client getDefaultClient() { NpgsqlConnection con = Connexion.Connection(); try { String search = "select * from yvs_com_client c inner join yvs_tiers t on c.tiers = t.id where defaut = true and t.agence = " + Constantes.Agence.Id + " limit 1"; NpgsqlCommand Lcmd = new NpgsqlCommand(search, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); Client a = new Client(); if (lect.HasRows) { while (lect.Read()) { a.Id = Convert.ToInt64(lect["id"].ToString()); a.Defaut = Convert.ToBoolean((lect["defaut"] != null) ? (!lect["defaut"].ToString().Trim().Equals("") ? lect["defaut"].ToString() : "false") : "false"); a.Tiers = (lect["tiers"] != null ? (!lect["tiers"].ToString().Trim().Equals("") ? BLL.TiersBll.One(Convert.ToInt64(lect["tiers"].ToString())) : new Tiers()) : new Tiers()); a.Nom_prenom = a.Tiers.Nom_prenom; a.Photo = a.Tiers.Logo; a.CategorieClt = (lect["categorie"] != null ? (!lect["categorie"].ToString().Trim().Equals("") ? BLL.CategorieClientBll.One(Convert.ToInt64(lect["categorie"].ToString())) : new CategorieClient()) : new CategorieClient()); a.Categorie = (lect["categorie_comptable"] != null ? (!lect["categorie_comptable"].ToString().Trim().Equals("") ? BLL.CategorieComptableBll.One(Convert.ToInt64(lect["categorie_comptable"].ToString())) : new CategorieComptable()) : new CategorieComptable()); a.Update = true; } lect.Close(); } return a; } catch (NpgsqlException e) { Messages.Exception(e); return null; } finally { Connexion.Deconnection(con); } }
public static Client getAjoutClient(Client a) { NpgsqlConnection con = Connexion.Connection(); try { string insert = ""; NpgsqlCommand cmd = new NpgsqlCommand(insert, con); cmd.ExecuteNonQuery(); a.Id = getCurrent(); return a; } catch { return null; } finally { Connexion.Deconnection(con); } }
private void configClient(Client f) { if (f != null) { codeClient.Text = f.Tiers.CodeTiers; AdresseClient.Text = f.Tiers.Adresse; NomClient.Text = f.Tiers.Nom_prenom; TelClient.Text = f.Tiers.Tel; if (f.Tiers.Logo.Equals("") || f.Tiers.Logo == null) { picClient.Image = ((System.Drawing.Image)global::GESTION_CAISSE.Properties.Resources.user_m1); } else { String chemin = Application.StartupPath; chemin += TOOLS.Constantes.FILE_SEPARATOR + f.Tiers.Logo; picClient.Image = ((System.Drawing.Image)(resources.GetObject(chemin))); } } else { lb_numPiece.Text = Utils.GenererReference(Constantes.DOC_FACTURE); codeClient.Text = f.Tiers.CodeTiers; AdresseClient.Text = f.Tiers.Adresse; NomClient.Text = f.Tiers.Nom_prenom; TelClient.Text = f.Tiers.Tel; if (f.Tiers.Logo.Equals("") || f.Tiers.Logo == null) { picClient.Image = ((System.Drawing.Image)global::GESTION_CAISSE.Properties.Resources.user_m1); } else { String chemin = Application.StartupPath; chemin += TOOLS.Constantes.FILE_SEPARATOR + f.Tiers.Logo; picClient.Image = ((System.Drawing.Image)(resources.GetObject(chemin))); } } }
private void PopulateViewFacture(Facture f) { ResetFicheFacture(); fact = f; clientZero = f.Client; configFacture(f); FullContenu(f); FullReglement(f); btnEnregistrer.Enabled = !f.Statut.Equals(Constantes.ETAT_REGLE); btnReglement.Enabled = !f.Statut.Equals(Constantes.ETAT_REGLE); btn_regl_tick.Enabled = !f.Statut.Equals(Constantes.ETAT_REGLE); foreach (Button btn in buttonAs) { btn.Enabled = !f.Statut.Equals(Constantes.ETAT_REGLE); } SetStateFacture(false); }
private void NvoTicket_Click_1(object sender, EventArgs e) { contenu = new Contenu(); ConfigForm(); initZonePrix(); clientZero = BLL.ClientBll.Default(); dataGridView1.Rows.Clear(); picClient.Enabled = true; btnEnregistrer.Enabled = true; fact = new Facture(); fact.TypeDoc = Constantes.TYPE_FV; fact.Statut = Constantes.ETAT_EN_ATTENTE; fact.Client = BLL.ClientBll.Default(); fact.Categorie = fact.Client.Categorie; fact.HeureDoc = DateTime.Now; fact.MouvStock = true; com_typeDoc.Text = "Facture"; SetStateFacture(true); configFacture(null); initZonePrix(); InitInfoClient(); nbrPgA = 0; btn_cpt_Famille.Text = "0/" + nbrPgF; btn_cpt_Articles.Text = "0/" + nbrPgA; SearchDirectionF(true); }
private void NvoTicket_Click(object sender, EventArgs e) { contenu = new Contenu(); InitButton(buttonAs, labelAs); initZonePrix(); clientZero = BLL.ClientBll.Default(); dataGridView1.Rows.Clear(); picClient.Enabled = true; btnEnregistrer.Enabled = true; archive = false; fact = new Facture(); fact.TypeDoc = Constantes.TYPE_FV; fact.Statut = Constantes.ETAT_EN_ATTENTE; fact.Client = BLL.ClientBll.Default(); fact.Categorie = fact.Client.Categorie; fact.HeureDoc = DateTime.Now; fact.MouvStock = true; com_typeDoc.Text = "Facture"; SetStateFacture(true); configFacture(null); clientZero = BLL.ClientBll.Default(); dpt = TOOLS.Constantes.Creneau.Depot; indTabF = 0; indTabA = 0; // création de la liste des boutons famille buttonFs = new List<Button> { button7, button8, button9, button10, button11, button12, button13, button14 }; // création de la liste des labels famille labelFs = new List<Label> { lbl1, lbl2, lbl3, lbl4, lbl5, lbl6, lbl7, lbl8 }; // création de la liste des boutons article buttonAs = new List<Button> { button15, button16, button17, button18, button19, button20, button21, button22 }; // création de la liste des labels article labelAs = new List<Label> { label18, label20, label21, label22, label23, label24, label25, label26 }; //lise datagridviews datagrids = new List<DataGridView> { dgv_commande, dgv_facture_cours, dgv_facture_regle, dgv_facture_wait, dgv_reglement }; InitButton(buttonFs, labelFs); InitButton(buttonAs, labelAs); initZonePrix(); InitInfoClient(); }
public void ConfigForm() { this.Text = Constantes.APP_NAME + " : Principal"; Timer bg = new Timer(); bg.Tick += (s, e) => { lb_date.Text = DateTime.Now.ToString("U"); }; bg.Interval = 500; bg.Start(); familles.Clear(); familles = prodListFamille(); ResetFicheFacture(); clientZero = BLL.ClientBll.Default(); dpt = TOOLS.Constantes.Creneau.Depot; indTabF = 0; indTabA = 0; // création de la liste des boutons famille buttonFs = new List<Button> { button7, button8, button9, button10, button11, button12, button13, button14 }; // création de la liste des labels famille labelFs = new List<Label> { lbl1, lbl2, lbl3, lbl4, lbl5, lbl6, lbl7, lbl8 }; // création de la liste des boutons article buttonAs = new List<Button> { button15, button16, button17, button18, button19, button20, button21, button22 }; // création de la liste des labels article labelAs = new List<Label> { label18, label20, label21, label22, label23, label24, label25, label26 }; //lise datagridviews datagrids = new List<DataGridView> { dgv_commande, dgv_facture_cours, dgv_facture_regle, dgv_facture_wait, dgv_reglement }; InitButton(buttonFs, labelFs); InitButton(buttonAs, labelAs); initZonePrix(); InitInfoClient(); nbrPgF = ((familles.Count % 8) > 0) ? (familles.Count / 8) + 1 : (familles.Count / 8); btn_cpt_Famille.Text = "0/" + nbrPgF; InitFamille(); }
private void ModifButton(Button ctl, Client cli, Label lbl) { //cli = (Client)clients.ElementAt<Client>(indTab); if (cli.Tiers.Logo.Trim().Equals("") || cli.Tiers.Logo == null) { ctl.BackgroundImage = ((System.Drawing.Image)global::GESTION_CAISSE.Properties.Resources.user_m1); } else { String chemin = Application.StartupPath; chemin += TOOLS.Constantes.FILE_SEPARATOR + cli.Tiers.Logo; ctl.BackgroundImage = ((System.Drawing.Image)(resources.GetObject(chemin))); } ctl.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; ctl.Text = ""; ctl.TextAlign = System.Drawing.ContentAlignment.BottomCenter; ctl.UseVisualStyleBackColor = true; ctl.Visible = true; //ctl.Size = new System.Drawing.Size(159, 170); ctl.Font = new System.Drawing.Font("Trebuchet MS", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ctl.Click += delegate(object sender, EventArgs e) { Form_Caisse_Click f = (Form_Caisse_Click)fParent; f.clientZero = cli; f.InitInfoClient(); this.Close(); }; lbl.Visible = true; lbl.Text = cli.Nom_prenom; }
public ClientBll(Client unClient) { client = unClient; }
private void configClient(Client a) { lb_adr_client.Text = a.Tiers.Adresse; lb_nom_client.Text = a.Tiers.Nom_prenom; lb_tel_client.Text = a.Tiers.Tel; box_client.Image = a.Image; }
public static bool getUpdateClient(Client a) { NpgsqlConnection con = Connexion.Connection(); try { string update = ""; NpgsqlCommand Ucmd = new NpgsqlCommand(update, con); Ucmd.ExecuteNonQuery(); return true; } catch (Exception e) { Messages.Exception(e); return false; } finally { Connexion.Deconnection(con); } }
public static List<Client> getListClient(String query) { NpgsqlConnection con = Connexion.Connection(); try { List<Client> l = new List<Client>(); NpgsqlCommand Lcmd = new NpgsqlCommand(query, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); if (lect.HasRows) { while (lect.Read()) { Client a = new Client(); a.Id = Convert.ToInt64(lect["id"].ToString()); a.Defaut = Convert.ToBoolean((lect["defaut"] != null) ? (!lect["defaut"].ToString().Trim().Equals("") ? lect["defaut"].ToString() : "false") : "false"); a.Tiers = (lect["tiers"] != null ? (!lect["tiers"].ToString().Trim().Equals("") ? BLL.TiersBll.One(Convert.ToInt64(lect["tiers"].ToString())) : new Tiers()) : new Tiers()); a.Nom_prenom = a.Tiers.Nom_prenom; a.Photo = a.Tiers.Logo; a.CategorieClt = (lect["categorie"] != null ? (!lect["categorie"].ToString().Trim().Equals("") ? BLL.CategorieClientBll.One(Convert.ToInt64(lect["categorie"].ToString())) : new CategorieClient()) : new CategorieClient()); a.Categorie = (lect["categorie_comptable"] != null ? (!lect["categorie_comptable"].ToString().Trim().Equals("") ? BLL.CategorieComptableBll.One(Convert.ToInt64(lect["categorie_comptable"].ToString())) : new CategorieComptable()) : new CategorieComptable()); a.Update = true; l.Add(a); } lect.Close(); } return l; } catch (NpgsqlException e) { Messages.Exception(e); return null; } finally { Connexion.Deconnection(con); } }