public List <Lien> getInfosLiensByIdeeCadeau(int id_ideecadeau) { String sql = "SELECT lien, id_lien FROM \"liens\" WHERE id_cadeau = (SELECT id_cadeau FROM \"ideesCadeaux\" WHERE id_ideecadeau =" + id_ideecadeau + ");"; try { List <Lien> listeLiensRetour = new List <Lien>(); DataTable dt = conn.getConnection(sql); foreach (DataRow row in dt.Rows) { Lien lienRetour = new Lien(); lienRetour.lien = row.ItemArray.GetValue(0).ToString(); lienRetour.id_lien = int.Parse(row.ItemArray.GetValue(1).ToString()); listeLiensRetour.Add(lienRetour); } return(listeLiensRetour); } catch (Exception) { return(null); } }
protected void gvCertInfo_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow gvRow = (GridViewRow)((Button)e.CommandSource).NamingContainer; Lien oLien = (Lien)Session[Constants.SES_LIEN_MARK]; if (oLien != null && gvRow != null) { oLien.DtLienDetails.Rows.RemoveAt(gvRow.RowIndex); DataTable dtTmp = oLien.DtLienDetails.Copy(); if (dtTmp.Columns.Contains("SPScripID")) { dtTmp.Columns.Remove("SPScripID"); } gvCertInfo.DataSource = dtTmp; gvCertInfo.DataBind(); Session[Constants.SES_LIEN_MARK] = oLien; } decimal dTotalAmount = 0m; foreach (GridViewRow gvr in gvCertInfo.Rows) { dTotalAmount += Util.GetDecimalNumber(gvr.Cells[1].Text); } txtCDTotalAmount.Text = dTotalAmount.ToString("N2"); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,URl")] Lien lien) { if (id != lien.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lien); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LienExists(lien.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(lien)); }
protected void btnApprove_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(hdLienTransNo.Value)) { Lien oLien = new Lien(hdLienTransNo.Value); LienDAL oLienDAL = new LienDAL(); oLien.UserDetails = ucUserDet.UserDetail; Result oResult = (Result)oLienDAL.ApproveLienMark(oLien); if (oResult.Status) { ReportDAL rdal = new ReportDAL(); oResult = rdal.LienLetter(Constants.LETTER_TYPE_LIEN, txtLienTransNo.Text); if (oResult.Status) { Session[Constants.SES_RPT_DATA] = oResult.Return; Page.RegisterStartupScript(Constants.REPORT_WINDOW, Util.OpenReport()); } ClearAfterApprove(); //ucMessage.OpenMessage(Constants.MSG_SUCCESS_APPROVE, Constants.MSG_TYPE_SUCCESS); //Response.Redirect(Constants.PAGE_TRAN_APPROVAL + "?pType=" + Convert.ToString((int)Constants.PAGEINDEX_TRANS.LIEN_MARK).PadLeft(5, '0'), false); } else { ucMessage.OpenMessage(Constants.MSG_ERROR_APPROVE, Constants.MSG_TYPE_ERROR); } } else { ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND + " to Approve", Constants.MSG_TYPE_INFO); } }
protected void btnSave_Click(object sender, EventArgs e) { Config oConfig = (Config)Session[Constants.SES_USER_CONFIG]; if (oConfig != null) { if (!hdDataType.Value.Equals("2")) { Lien oLien = GetObject(); oLien.UserDetails = ucUserDet.UserDetail; oLien.UserDetails.MakeDate = DateTime.Now; ucUserDet.ResetData(); LienDAL oLienDAL = new LienDAL(); Result oResult = oLienDAL.SaveLienMark(oLien); if (oResult.Status) { TotalClear(); LoadPreviousList(); ucMessage.OpenMessage(Constants.MSG_SUCCESS_SAVE, Constants.MSG_TYPE_SUCCESS); } else { ucMessage.OpenMessage(Constants.MSG_ERROR_SAVE, Constants.MSG_TYPE_ERROR); } } else { ucMessage.OpenMessage(Constants.MSG_APPROVED_SAVE_DATA, Constants.MSG_TYPE_INFO); ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true); } } }
static void SetNbLiens(Point point1, Point point2, int nbLiens) { if (nbLiens == 2 && (point1.poidsInit == 1 || point2.poidsInit == 1)) { nbLiens = 1; } int nbLiensAdd = 0; Lien lien = GetLien(point1, point2); if (lien == null) { if (point1.poids == 1 || point2.poids == 1) { nbLiens = 1; } liens.Add(new Lien(point1.coord, point2.coord, nbLiens)); nbLiensAdd = nbLiens; } else { lien.nbLiens = nbLiens; nbLiensAdd = nbLiens - 1; } hasChanged = nbLiensAdd > 0; point1.nbLiens += nbLiensAdd; point2.nbLiens += nbLiensAdd; }
private void lstObjectif_DragDrop(object sender, DragEventArgs e) { // Get the tree. TreeView tree = (TreeView)sender; // Get the screen point. System.Drawing.Point pt = new System.Drawing.Point(e.X, e.Y); // Convert to a point in the TreeView's coordinate system. pt = tree.PointToClient(pt); // Get the node underneath the mouse. TreeNode NodDest = tree.GetNodeAt(pt); TreeNode nodSrc = (TreeNode)e.Data.GetData(typeof(TreeNode)); if (NodDest == nodSrc) { return; } //Système anti-bouclage //Prise en compte du changement en base //Recherche d'un lien du NodSrc if (!(nodSrc.Tag is null)) { Lien k = Acces.Donner_LienParent(((Lien)nodSrc.Tag).ID); Acces.Supprimer_Lien(k); } //Création du lien Lien p = new Lien() { Acces = Acces }; p.element1_type = Acces.type_OBJECTIF.id; p.element1_id = int.Parse(NodDest.Name); p.element1_code = ((Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF.id, p.element1_id)).Code; p.element2_type = Acces.type_OBJECTIF.id; p.element2_id = int.Parse(nodSrc.Name); p.element2_code = ((Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF.id, p.element2_id)).Code; p.element0_type = Acces.type_PLAN.id; //SYSTEME p.element0_id = 1; //SYSTEME p.element0_code = "SYSTEME"; //SYSTEME p.ordre = p.Donner_Ordre() + 1; p.Ajouter(); Acces.Ajouter_Lien(p); TreeNode nd = new TreeNode(); nd = (TreeNode)nodSrc.Clone(); NodDest.Nodes.Add(nd); lstObjectif.SelectedNode = nd; TreeNode[] Nods = lstObjectif.Nodes.Find(nodSrc.Name.ToString(), true); try { Nods[0].Remove(); } catch { } }
public void TestAjouterGet() { Collection collection = new Collection(); Lien lien = new Lien("Wikipedia", "wikipedia.org"); collection.Ajouter(lien); Assert.AreEqual(collection.Get(0), lien); }
void AjouterSousIndicateur() { if (lstIndicateur.SelectedNode is null) { MessageBox.Show("Choix d'un indicateur"); return; } Indicateur indParent = (Indicateur)Acces.Trouver_Element(Acces.type_INDICATEUR.id, int.Parse(lstIndicateur.SelectedNode.Name.ToString())); if (!(indParent.TypeIndicateur == TypeIndicateur.DOSSIER)) { MessageBox.Show("Impossible de créer un indicateur sous un indicateur autre qu'un type DOSSIER", "Erreur", MessageBoxButtons.OK); return; } var f = new frmIndicateur(); f.Acces = Acces; f.Creation = true; f.indicateur = new PATIO.Classes.Indicateur(); f.indicateur.Actif = true; f.indicateur.Code = indParent.Code; f.Initialise(); if (f.ShowDialog(this) == DialogResult.OK) { if (!(lstIndicateur.SelectedNode is null)) { //Création du lien avec le parent Lien l = new Lien() { element0_type = Acces.type_PLAN.id, element0_id = 1, element0_code = "SYSTEME", element1_type = Acces.type_INDICATEUR.id, element2_type = Acces.type_INDICATEUR.id, element1_id = int.Parse(lstIndicateur.SelectedNode.Name), element1_code = ((Indicateur)Acces.Trouver_Element(Acces.type_INDICATEUR.id, int.Parse(lstIndicateur.SelectedNode.Name))).Code, element2_id = f.indicateur.ID, element2_code = ((Indicateur)Acces.Trouver_Element(Acces.type_INDICATEUR.id, f.indicateur.ID)).Code, ordre = 1, Acces = Acces, }; l.Ajouter(); Acces.Ajouter_Lien(l); } Afficher_ListeIndicateur(); TreeNode[] Nod = lstIndicateur.Nodes.Find(f.indicateur.ID.ToString(), true); if (Nod.Length > 0) { lstIndicateur.SelectedNode = Nod[0].Parent; Nod[0].EnsureVisible(); } } }
public Contact(string prenom, string nom, string email, string societe, Lien lien) { Prenom = prenom; Nom = nom; Email = email; Societe = societe; Lien = lien; DateDeCreation = DateTime.Now; DateDeModification = DateTime.Now; }
/// <summary> /// Constructeur de la classe Contact /// </summary> /// <param name="nom">Le nom du contact</param> /// <param name="prenom">Le prenom du contact</param> /// <param name="courriel">L'e-mail du contact</param> /// <param name="societe">La societe du contact</param> /// <param name="lien">Le lien entre le contact et l'utilisateur</param> public Contact(string nom, string prenom, string courriel, string societe, Lien lien) : base() { Nom = nom; Prenom = prenom; Courriel = courriel; Societe = societe; Lien = lien; DateDeCreation = DateTime.Now; DateDeModification = DateDeCreation; }
public void TestGet() { Lien lien = new Lien("Wikipedia", "wikipedia.org"); Lien lien2 = new Lien("Musicscape", "https://musicscape.fr"); Collection co = new Collection(); co.Ajouter(lien); co.Ajouter(lien2); Assert.AreEqual(lien2, co.Get(1)); }
public void TestSupprimerLienCollection() { Collection collection = new Collection(); Lien exempleLien = new Lien("Example", "example.com"); collection.Ajouter(exempleLien); collection.Supprimer(0); Assert.AreEqual(0, collection.Compte); }
//----------------------------------------------------- public CResultAErreur Delete() { CResultAErreur result = CResultAErreur.True; if (Lien != null && Lien.IsValide()) { result = Lien.Delete(true); } return(result); }
public void TestAjouterLienCollection() { Collection collection = new Collection(); Lien exempleLien = new Lien("Example", "example.com"); collection.Ajouter(exempleLien); Assert.AreEqual(1, collection.Compte); Assert.AreEqual(exempleLien.ToString(), collection.Get(0).ToString()); }
void Valider() { string LibBudget = lblLibelle.Text.Trim(); string CodeBudget = lblCodePeriode.Text; bool OptActive = this.OptActive.Checked; var TypePeriode = (TypePeriode)lstTypePeriode.SelectedIndex; if (LibBudget.Length == 0) { MessageBox.Show("Libellé de la période obligatoire", "Erreur", MessageBoxButtons.OK); return; } if (CodeBudget.Length == 0) { MessageBox.Show("Code de la période obligatoire", "Erreur", MessageBoxButtons.OK); return; } budget_periode.Acces = Acces; budget_periode.Libelle = LibBudget; budget_periode.Code = CodeBudget; budget_periode.TypePeriode = TypePeriode; budget_periode.DateDeb = string.Format("{0:yyyyMMdd}", lblDateDebut.Value); budget_periode.DateFin = string.Format("{0:yyyyMMdd}", lblDateFin.Value); budget_periode.Actif = OptActive; if (Creation) { if (!(Acces.Existe_Element(Acces.type_BUDGET_PERIODE, "CODE", CodeBudget))) { budget_periode.ID = Acces.Ajouter_Element(Acces.type_BUDGET_PERIODE, budget_periode); } else { MessageBox.Show("Code existant"); return; } } else { Acces.Enregistrer(Acces.type_BUDGET_PERIODE, budget_periode); //Test du changement de code --> Impact sur les liens if (lblCodePeriode.Text != lblCodePeriode.Tag.ToString()) { Lien l = new Lien() { Acces = Acces, }; l.MettreAJourCode(Acces.type_BUDGET_PERIODE, budget_periode.ID, budget_periode.Code); } } this.DialogResult = DialogResult.OK; }
void Valider() { string LibEnveloppe = lblLibelle.Text.Trim(); string CodeEnveloppe = lblCodeGenere.Text; bool OptActive = this.OptActive.Checked; var TypeEnveloppe = (TypeEnveloppe)lstTypeEnveloppe.SelectedIndex; if (LibEnveloppe.Length == 0) { MessageBox.Show("Libellé de l'enveloppe obligatoire", "Erreur", MessageBoxButtons.OK); return; } if (CodeEnveloppe.Length == 0) { MessageBox.Show("Code de l'enveloppe obligatoire", "Erreur", MessageBoxButtons.OK); return; } budget_enveloppe.Acces = Acces; budget_enveloppe.Libelle = LibEnveloppe; budget_enveloppe.Code = CodeEnveloppe; budget_enveloppe.TypeEnveloppe = TypeEnveloppe; budget_enveloppe.Actif = OptActive; TypeElement Type_Element = Acces.type_BUDGET_ENVELOPPE; if (Creation) { if (!(Acces.Existe_Element(Type_Element, "CODE", CodeEnveloppe))) { budget_enveloppe.ID = Acces.Ajouter_Element(Type_Element, budget_enveloppe); } else { MessageBox.Show("Code existant"); return; } } else { Acces.Enregistrer(Type_Element, budget_enveloppe); //Test du changement de code --> Impact sur les liens if (lblCodeGenere.Text != lblCodeGenere.Tag.ToString()) { Lien l = new Lien() { Acces = Acces, }; l.MettreAJourCode(Type_Element, budget_enveloppe.ID, budget_enveloppe.Code); } } this.DialogResult = DialogResult.OK; }
//Ajoute une réservation pour un groupe et affiche la confirmation public ActionResult ReservationGroupe(string nom, string prenom, string entre, string sort, int[] numero, decimal prix) { //S'il n'y a pas de chambre proposée mais que l'utilisateur essaie de réserver, il est redirigé sur la page d'accueil if (numero is null) { return(RedirectToAction("Index", "Home")); } else { DateTime entree = DateTime.Parse(entre); DateTime sortie = DateTime.Parse(sort); //Créer la réservation Reservation r = new Reservation() { Debut = entree, Fin = sortie, NomClient = nom, PrenomClient = prenom, Price = prix }; PostReservation(r); List <Reservation> ListProdReservation = null; using (HttpClient httpClient = new HttpClient()) { string uri = baseUri + "Reservations/" + entre + "/" + sort + "/" + nom + "/" + prenom; Task <String> response = httpClient.GetStringAsync(uri); ListProdReservation = JsonConvert.DeserializeObject <List <Reservation> >(response.Result); } //récupérer l'id de la réservation Reservation IdReservation = ListProdReservation.Last(); foreach (int i in numero) { //Récupérer la chambre concernée Room ListProdRoom = null; using (HttpClient httpClient = new HttpClient()) { string uri = baseUri + "Rooms/" + i; Task <String> response = httpClient.GetStringAsync(uri); ListProdRoom = JsonConvert.DeserializeObject <Room>(response.Result); } //Créer le lien Lien l = new Lien() { ReservationId = IdReservation.Id, RoomId = ListProdRoom.Id }; PostLien(l); } ViewBag.code = IdReservation.Id; ViewBag.nom = nom; ViewBag.prenom = prenom; return(View()); } }
public void TestCreerLien() { string Titre = "Wikipedia"; string URL = "http://wikipedia.org"; Lien lien = new Lien(Titre, URL); Assert.AreEqual(Titre, lien.titre); Assert.AreEqual(URL, lien.Url); Assert.AreEqual(Titre + " " + URL, lien.ToString()); }
public void TestCreerLienSansProtocole() { string titre = "Wikipedia"; string url = "wikipedia.org"; Lien lien = new Lien(titre, url); Assert.AreEqual(titre, lien.Titre); Assert.AreEqual("http://" + url, lien.Url); Assert.AreEqual(titre + " http://" + url, lien.ToString()); }
void Valider() { var LibIndicateur = lblLibelleIndicateur.Text.Trim(); var CodeIndicateur = lblCodeIndicateur.Text.Trim().ToUpper(); var OptActive = OptActiveIndicateur.Checked; var TypeIndicateur = (TypeIndicateur)lstTypeIndicateur.SelectedIndex; if (LibIndicateur.Length == 0) { MessageBox.Show("Libellé de l'indicateur obligatoire", "Erreur", MessageBoxButtons.OK); return; } if (CodeIndicateur.Length == 0) { MessageBox.Show("Code de l'indicateur obligatoire", "Erreur", MessageBoxButtons.OK); return; } indicateur.Acces = Acces; indicateur.Libelle = LibIndicateur; indicateur.Code = CodeIndicateur; indicateur.TypeIndicateur = TypeIndicateur; indicateur.Actif = OptActive; indicateur.Type = ListeType[lstType_6PO.SelectedIndex].ID; try { indicateur.Genre = ListeGenre[lstGenre_6PO.SelectedIndex].ID; } catch { } try { indicateur.Categorie = ListeCategorie[lstCateg_6PO.SelectedIndex].ID; } catch { } indicateur.Repartition = ListeRepartition[lstRepartition_6PO.SelectedIndex].ID; if (Creation) { if (!(Acces.Existe_Element(Acces.type_INDICATEUR, "CODE", CodeIndicateur))) { indicateur.ID = Acces.Ajouter_Element(Acces.type_INDICATEUR, indicateur); } } else { Acces.Enregistrer(Acces.type_INDICATEUR, indicateur); //Test du changement de code --> Impact sur les liens if (lblCodeIndicateur.Text != lblCodeIndicateur.Tag.ToString()) { Lien l = new Lien() { Acces = Acces, }; l.MettreAJourCode(Acces.type_INDICATEUR, indicateur.ID, indicateur.Code); } } this.DialogResult = DialogResult.OK; }
public void TestCreerLien() { string Titre = "Wikipedia"; string URL = "wikipedia.org"; Lien lien = new Lien("Wikipedia", "wikipedia.org"); Assert.AreEqual(Titre, lien._titre); Assert.AreEqual(URL, lien._url); Assert.AreEqual(Titre + " " + URL, lien.ToString()); }
public async Task <IHttpActionResult> GetLien(int id) { Lien lien = await db.Liens.FindAsync(id); if (lien == null) { return(NotFound()); } return(Ok(lien)); }
public async Task <IActionResult> Create([Bind("ID,Name,URl")] Lien lien) { if (ModelState.IsValid) { _context.Add(lien); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(lien)); }
//Insert Lien public bool PostLien(Lien lien) { string uri = baseUri + "/Liens"; using (HttpClient httpClient = new HttpClient()) { string pro = JsonConvert.SerializeObject(lien); StringContent frame = new StringContent(pro, Encoding.UTF8, "Application/json"); Task <HttpResponseMessage> response = httpClient.PostAsync(uri, frame); return(response.Result.IsSuccessStatusCode); } }
public void TestSuppression() { Lien lien = new Lien("Wikipedia", "wikipedia.org"); Lien lien2 = new Lien("Musicscape", "https://musicscape.fr"); Collection co = new Collection(); co.Ajouter(lien); co.Ajouter(lien2); co.Supprimer(0); Assert.AreEqual(lien2, co.Get(0)); Assert.AreEqual(1, co.Compte); }
public async Task <IHttpActionResult> PostLien(Lien lien) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Liens.Add(lien); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = lien.Id }, lien)); }
static void Main(string[] args) { Texte texte = new Texte("fefzefezfefzf"); Lien lien = new Lien("fzefezfezfze"); Couleur couleur = new Couleur("jkjnkjnkjn"); Horodatage horodatage = new Horodatage(DateTime.Now); MessageComposite root = new MessageComposite(horodatage, texte, lien, couleur); IMessageFilter filter = new MessageGrasFilter(); filter.appliquer(root); }
public async Task <IHttpActionResult> DeleteLien(int id) { Lien lien = await db.Liens.FindAsync(id); if (lien == null) { return(NotFound()); } db.Liens.Remove(lien); await db.SaveChangesAsync(); return(Ok(lien)); }
public void TestEnlever() { Collection collection = new Collection(); Lien lien = new Lien("Wikipedia", "wikipedia.org"); collection.Ajouter(lien); lien = new Lien("Youtube", "youtube.fr"); collection.Ajouter(lien); Assert.AreEqual(collection.Compte, 2); Assert.AreEqual(collection.Get(1), lien); collection.Enlever(0); Assert.AreEqual(collection.Compte, 1); Assert.AreEqual(collection.Get(0), lien); }