void SelectCombo() { idInscription = dn.retourIdM(membreCombo.Text); situationLbl.Text = dn.retourLastCotisationMembre(lastLbl, fraisLbl, idInscription); if (situationLbl.Text == "Prémière Cotisation") { lastLbl.Text = InstantSemaine.GetInstance().DateDebut.ToString("dd/MM/yyyy"); dateCotise = Convert.ToDateTime(lastLbl.Text); dateCotTxt.Text = lastLbl.Text; membreCombo.Enabled = false; addBtn.Visible = true; checkBox1.Checked = true; situationLbl.Text = "Prémière Cotisation"; //situationLbl.Text = "Deuxième Cotisation"; inc = 1; } else { if (dateCotise.ToString("dd/MM/yyyy") == lastLbl.Text && situationLbl.Text == "Prémière Cotisation") { if (inc == 0) { dateCotise = Convert.ToDateTime(lastLbl.Text); dateCotTxt.Text = lastLbl.Text; membreCombo.Enabled = false; addBtn.Visible = true; checkBox1.Checked = true; situationLbl.Text = "Prémière Cotisation"; inc = 1; } else { //idInscription = dn.retourIdM(membreCombo.Text); //situationLbl.Text = dn.retourLastCotisationMembre(lastLbl, fraisLbl, idInscription); dateCotise = Convert.ToDateTime(lastLbl.Text); dateCotTxt.Text = dateCotise.AddDays(1).ToString(); membreCombo.Enabled = false; addBtn.Visible = true; situationLbl.Text = "Deuxième Cotisation"; checkBox1.Checked = true; } } else { //idInscription = dn.retourIdM(membreCombo.Text); //situationLbl.Text = dn.retourLastCotisationMembre(lastLbl, fraisLbl, idInscription); dateCotise = Convert.ToDateTime(lastLbl.Text); dateCotTxt.Text = dateCotise.AddDays(1).ToString(); membreCombo.Enabled = false; addBtn.Visible = true; checkBox1.Checked = true; } } }
public UC_Cotisation() { InitializeComponent(); dateCotise = DateTime.Now; //timerTime.Start(); panelWidth = panelGrid.Height; isColapsed = false; lastLbl.Text = InstantSemaine.GetInstance().DateDebut.ToString("dd/MM/yyyy"); saveBtn.Enabled = false; }
void SavePlusieur() { try { Cotisation cot = new Cotisation(); for (int i = 0; i < (dgManyCotisation.Rows.Count); i++) { if (idSemaine != 0) { cot.Id = Convert.ToInt32(dgManyCotisation[0, i].Value.ToString()); cot.RefInscription = idInscription; cot.RefSemaine = Convert.ToInt32(dgManyCotisation[1, i].Value.ToString()); cot.DateConcernee = Convert.ToDateTime(dgManyCotisation[2, i].Value.ToString()); cot.RefFrais = idFrais; cot.Montant = dgManyCotisation[3, i].Value.ToString(); cot.Cas = Convert.ToInt32(dgManyCotisation[4, i].Value.ToString()); cot.UserSession = UserSession.GetInstance().UserName; cot.Enregistrer(cot); } else { cot.Id = Convert.ToInt32(dgManyCotisation[0, i].Value.ToString()); cot.RefInscription = idInscription; cot.RefSemaine = InstantSemaine.GetInstance().IdSemaine; cot.DateConcernee = Convert.ToDateTime(dgManyCotisation[2, i].Value.ToString()); cot.RefFrais = idFrais; cot.Montant = dgManyCotisation[3, i].Value.ToString(); cot.Cas = Convert.ToInt32(dgManyCotisation[4, i].Value.ToString()); cot.UserSession = UserSession.GetInstance().UserName; cot.Enregistrer(cot); //MessageBox.Show("Enregistrement reussie", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); //Initialise(); } } MessageBox.Show("Enregistrement reussie", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); dgManyCotisation.Rows.Clear(); nouveauBtn.Enabled = true; saveBtn.Enabled = false; Initialise(); //idEnteteSortie = 0; } catch (Exception ex) { MessageBox.Show("L'erreur suivant est survenue : " + ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
private void OneSemaine(int id) { if (ImplementeConnexion.Instance.Conn.State == ConnectionState.Closed) { ImplementeConnexion.Instance.Conn.Open(); } using (IDbCommand cmd = ImplementeConnexion.Instance.Conn.CreateCommand()) { cmd.CommandText = "SELECT_DETAILS_SEMAINE"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(Parametre.Instance.AjouterParametre(cmd, "@id", 4, DbType.Int32, id)); IDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { DateTime dateco, datefin = new DateTime(); dateco = Convert.ToDateTime(dr["Date_Debut"].ToString()); datefin = Convert.ToDateTime(dr["Date_Fin"].ToString()); InstantSemaine.GetInstance().IdSemaine = Convert.ToInt32(dr["Id"].ToString()); InstantSemaine.GetInstance().DateDebut = Convert.ToDateTime(dr["Date_Debut"].ToString()); InstantSemaine.GetInstance().DateFin = Convert.ToDateTime(dr["Date_Fin"].ToString()); InstantSemaine.GetInstance().NomComplet = dr["Nom_Complet"].ToString(); lblDebut.Text = string.Format("{0}", dateco.ToString("dd/MM/yyyy")); lblFin.Text = string.Format("{0}", datefin.ToString("dd/MM/yyyy")); lblNom.Text = dr["Nom_Complet"].ToString(); } dr.Dispose(); } OneInfoSemaine(); dn.retreivePhoto2("Photo", "Affichage_Details_Semaine", "Id", InstantSemaine.GetInstance().IdSemaine.ToString(), pictureBox3); //return semaine; }
public void chargeSemainesCombo(ComboBox cmb, string nomChamp, string procedure) { if (ImplementeConnexion.Instance.Conn.State == ConnectionState.Closed) { ImplementeConnexion.Instance.Conn.Open(); } using (IDbCommand cmd = ImplementeConnexion.Instance.Conn.CreateCommand()) { cmd.CommandText = procedure; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(Parametre.Instance.AjouterParametre(cmd, "@idRound", 5, DbType.Int32, InstantRound.GetInstance().Id)); cmd.Parameters.Add(Parametre.Instance.AjouterParametre(cmd, "@id", 5, DbType.Int32, InstantSemaine.GetInstance().IdSemaine)); IDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { string de = rd[nomChamp].ToString(); cmb.Items.Add(de); } rd.Close(); rd.Dispose(); cmd.Dispose(); } }
void ChartCotisation() { try { if (ImplementeConnexion.Instance.Conn.State == ConnectionState.Closed) { ImplementeConnexion.Instance.Conn.Open(); } SqlDataAdapter ad = new SqlDataAdapter("SELECT Date_Concernee, SUM(Mont) as Montant FROM Affichage_Details_Cotisation WHERE IdSemaine='" + InstantSemaine.GetInstance().IdSemaine + "' GROUP BY Date_Concernee", (SqlConnection)ImplementeConnexion.Instance.Conn); DataTable dt = new DataTable(); ad.Fill(dt); chartWeek.DataSource = dt; chartWeek.ChartAreas["ChartAreas1"].AxisX.Title = "Date"; chartWeek.ChartAreas["ChartAreas1"].AxisX.Title = "Montant"; chartWeek.Series["Cotisation"].XValueMember = "Date_Concernee"; chartWeek.Series["Cotisation"].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Date; chartWeek.Series["Cotisation"].YValueMembers = "Montant"; chartWeek.Series["Cotisation"].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; } catch (Exception ex) { MessageBox.Show("Une erreur est survenue : " + ex.Message); } }
private void OneInfoSemaine() { if (ImplementeConnexion.Instance.Conn.State == ConnectionState.Closed) { ImplementeConnexion.Instance.Conn.Open(); } using (IDbCommand cmd = ImplementeConnexion.Instance.Conn.CreateCommand()) { cmd.CommandText = "SELECT_CAISSE_RESTE"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(Parametre.Instance.AjouterParametre(cmd, "@id", 4, DbType.Int32, InstantSemaine.GetInstance().IdSemaine)); cmd.Parameters.Add(Parametre.Instance.AjouterParametre(cmd, "@idRound", 4, DbType.Int32, InstantRound.GetInstance().Id)); IDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { lblCaisse.Text = dr["En_Caisse"].ToString(); lblReste.Text = dr["Dette"].ToString(); } dr.Dispose(); } //return semaine; }
public List <Cotisation> ResearchDette(string recherche) { List <Cotisation> lst = new List <Cotisation>(); if (ImplementeConnexion.Instance.Conn.State == ConnectionState.Closed) { ImplementeConnexion.Instance.Conn.Open(); } using (IDbCommand cmd = ImplementeConnexion.Instance.Conn.CreateCommand()) { cmd.CommandText = "SEARCH_DETTE_ROUND"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(Parametre.Instance.AjouterParametre(cmd, "@id", 5, DbType.Int32, InstantRound.GetInstance().Id)); cmd.Parameters.Add(Parametre.Instance.AjouterParametre(cmd, "@idSemaine", 5, DbType.Int32, InstantSemaine.GetInstance().IdSemaine)); cmd.Parameters.Add(Parametre.Instance.AjouterParametre(cmd, "@text", 200, DbType.String, recherche)); IDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { Matricule.ToUpper(); lst.Add(GetDetailDettes(rd)); } rd.Dispose(); rd.Close(); } return(lst); }
public List <Cotisation> Research(string recherche) { List <Cotisation> lst = new List <Cotisation>(); if (ImplementeConnexion.Instance.Conn.State == ConnectionState.Closed) { ImplementeConnexion.Instance.Conn.Open(); } using (IDbCommand cmd = ImplementeConnexion.Instance.Conn.CreateCommand()) { cmd.CommandText = "SELECT * FROM Affichage_Details_Cotisation WHERE IdRound=" + InstantRound.GetInstance().Id + " AND IdSemaine=" + InstantSemaine.GetInstance().IdSemaine + " AND (Nom LIKE '%" + recherche + "%' OR Postnom LIKE '%" + recherche + "' OR Prenom LIKE '%" + recherche + "')"; //cmd.CommandType = CommandType.StoredProcedure; IDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { lst.Add(GetDetailCotisation(rd)); } rd.Dispose(); rd.Close(); } return(lst); }
void Ajouter() { try { Cotisation cot = new Cotisation(); int rowCount; DateTime datenow; if (idCotisation == 0) { MessageBox.Show("Avant chaque opération d'enregistrement veuillez cliqué d'abord sur le bouton Nouveau", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (membreCombo.Text == "" || dateCotTxt.Text == "" || montantTxt.Text == "" || fraisCombo.Text == "") { MessageBox.Show("Completez tous les champs svp !!!", "Champs Obligatiore", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); } else { rowCount = dgManyCotisation.Rows.Count; datenow = Convert.ToDateTime(dateCotTxt.Text); dateCotise = Convert.ToDateTime(dateCotTxt.Text); if (lastLbl.Text == "Dernière contribution") { if (datenow.Date > InstantSemaine.GetInstance().DateFin.Date || datenow.Date < InstantSemaine.GetInstance().DateDebut.Date) { MessageBox.Show("Cette cotisation n'est concerne pas cette semaine, veillez cochez la case cotisation spéciale pour plus d'options "); } else { if (rowCount == 0) { idCotisation = cot.Nouveau(); dgManyCotisation.Rows.Add(idCotisation.ToString(), idSemaine, dateCotTxt.Text, montantTxt.Text, chkSocial.Checked == true ? 1 : 0); dateCotTxt.Text = dateCotise.AddDays(1).ToString(); } else { idCotisation = idCotisation + 1; dgManyCotisation.Rows.Add(idCotisation.ToString(), idSemaine, dateCotTxt.Text, montantTxt.Text, chkSocial.Checked == true ? 1 : 0); dateCotTxt.Text = dateCotise.AddDays(1).ToString(); } } } else { if (datenow.Date <= Convert.ToDateTime(lastLbl.Text) && situationLbl.Text != "Prémière Cotisation") { MessageBox.Show("Vérifier votre date svp, elle ne doit pas etre inférieure ou égale à la dernière contribution"); } else if ((datenow.Date > InstantSemaine.GetInstance().DateFin.Date || datenow.Date < InstantSemaine.GetInstance().DateDebut.Date) && checkBox2.Checked == false) { MessageBox.Show("Cette cotisation n'est concerne pas cette semaine, veillez cochez la case cotisation spéciale pour plus d'options "); } else { if (rowCount == 0) { idCotisation = cot.Nouveau(); dgManyCotisation.Rows.Add(idCotisation.ToString(), idSemaine, dateCotTxt.Text, montantTxt.Text, chkSocial.Checked == true ? 1 : 0); dateCotTxt.Text = dateCotise.AddDays(1).ToString(); } else { idCotisation = idCotisation + 1; dgManyCotisation.Rows.Add(idCotisation.ToString(), idSemaine, dateCotTxt.Text, montantTxt.Text, chkSocial.Checked == true ? 1 : 0); dateCotTxt.Text = dateCotise.AddDays(1).ToString(); } } } } } catch (Exception ex) { MessageBox.Show("L'erreur suivant est survenue : " + ex.Message, "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void SaveOne() { try { DateTime datenow = Convert.ToDateTime(dateCotTxt.Text); Cotisation cot = new Cotisation(); if (lastLbl.Text == "Dernière contribution") { if (datenow.Date > InstantSemaine.GetInstance().DateFin.Date || datenow.Date < InstantSemaine.GetInstance().DateDebut.Date) { MessageBox.Show("Cette cotisation n'est concerne pas cette semaine, veillez cochez la case cotisation spéciale pour plus d'options "); } else { cot.Id = idCotisation; cot.RefInscription = idInscription; cot.RefSemaine = InstantSemaine.GetInstance().IdSemaine; cot.DateConcernee = Convert.ToDateTime(dateCotTxt.Text); cot.RefFrais = idFrais; cot.Montant = montantTxt.Text; cot.UserSession = UserSession.GetInstance().UserName; cot.Enregistrer(cot); Initialise(); } } else { if (datenow.Date > Convert.ToDateTime(lastLbl.Text)) { if (datenow.Date > InstantSemaine.GetInstance().DateFin.Date || datenow.Date < InstantSemaine.GetInstance().DateDebut.Date) { MessageBox.Show("Cette cotisation n'est concerne pas cette semaine, veillez cochez la case cotisation spéciale pour plus d'options "); } else { cot.Id = idCotisation; cot.RefInscription = idInscription; cot.RefSemaine = InstantSemaine.GetInstance().IdSemaine; cot.DateConcernee = Convert.ToDateTime(dateCotTxt.Text); cot.RefFrais = idFrais; cot.Montant = montantTxt.Text; cot.UserSession = UserSession.GetInstance().UserName; cot.Enregistrer(cot); Initialise(); } } else { MessageBox.Show("Vérifier votre date svp, elle ne doit pas etre inférieure ou égale à la dernière contribution"); } } } catch (Exception ex) { MessageBox.Show("L'erreur suivant est survenue : " + ex.Message); } }
void RefreshData(Cotisation cot) { dgCotisation.DataSource = cot.AllCotisationSemaine(InstantSemaine.GetInstance().IdSemaine, InstantRound.GetInstance().Id); }