public MainWindow() { InitializeComponent(); this._service = new ServiceAgence.AgenceClient("WSHttpBinding_IAgence"); this._filtres = null; this._bienBaseSelectionne = null; this._bienSelectionne = null; this._listeBiens = null; this.DataContext = this; }
protected void TaskGridView_RowDeleting(object sender, GridViewDeleteEventArgs e) { using (ServiceAgence.AgenceClient client = new ServiceAgence.AgenceClient()) { List <ServiceAgence.BienImmobilierBase> mList = (List <ServiceAgence.BienImmobilierBase>)Session["TaskTable"]; GridViewRow row = gvResultats.Rows[e.RowIndex]; ServiceAgence.BienImmobilierBase mBI = mList[row.DataItemIndex]; client.SupprimerBienImmobilier(mBI.Id.ToString()); mList.Remove(mBI); BindData(); } }
/// <summary> /// Supprime dans la base /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button_Delete(object sender, RoutedEventArgs e) { ServiceAgence.BienImmobilierBase SelectedBien = (ServiceAgence.BienImmobilierBase)listBox.SelectedItem; if (SelectedBien != null) { Console.WriteLine("Item select :" + SelectedBien.Id); using (ServiceAgence.AgenceClient client = new ServiceAgence.AgenceClient()) { client.Open(); client.SupprimerBienImmobilier(SelectedBien.Id.ToString()); client.Close(); } ListeBienImmo.Remove(selectedItem); } }
protected void TaskGridView_RowUpdating(object sender, GridViewUpdateEventArgs e) { //Retrieve the table from the session object. // DataTable dt = (DataTable)Session["TaskTable"]; List <ServiceAgence.BienImmobilierBase> mList = (List <ServiceAgence.BienImmobilierBase>)Session["TaskTable"]; GridViewRow row = gvResultats.Rows[e.RowIndex]; ServiceAgence.BienImmobilierBase mBI = mList[row.DataItemIndex]; using (ServiceAgence.AgenceClient client = new ServiceAgence.AgenceClient()) { ServiceAgence.ResultatBienImmobilier mResult = client.LireDetailsBienImmobilier(mBI.Id.ToString()); if (mResult.SuccesExecution) { } else { this.mLabel.Text = mResult.ErreursBloquantes.ToString(); } //Prix Double mDouble; if (Double.TryParse(e.NewValues["Prix"].ToString(), out mDouble)) { mResult.Bien.Prix = mDouble; mList[row.DataItemIndex].Prix = mDouble; } //titre String mString; mString = e.NewValues["Titre"].ToString(); mResult.Bien.Titre = mString; mList[row.DataItemIndex].Titre = mString; //MontantCharges if (Double.TryParse(e.NewValues["MontantCharges"].ToString(), out mDouble)) { mResult.Bien.MontantCharges = mDouble; mList[row.DataItemIndex].MontantCharges = mDouble; } //Ville mString = e.NewValues["Ville"].ToString(); mResult.Bien.Ville = mString; mList[row.DataItemIndex].Ville = mString; //CodePostal mString = e.NewValues["CodePostal"].ToString(); mResult.Bien.CodePostal = mString; mList[row.DataItemIndex].CodePostal = mString; //TransactionEffectuee && //DateTransaction mString = e.NewValues["TransactionEffectuee"].ToString(); if (mString == "True") { mResult.Bien.TransactionEffectuee = true; mList[row.DataItemIndex].TransactionEffectuee = true; /* * L'insertion auto de la date ne marche pas */ DateTime localDate = DateTime.Now; mResult.Bien.DateTransaction = localDate; mList[row.DataItemIndex].DateTransaction = localDate; } else { mResult.Bien.TransactionEffectuee = false; mList[row.DataItemIndex].TransactionEffectuee = false; mResult.Bien.DateTransaction = null; mList[row.DataItemIndex].DateTransaction = null; } client.ModifierBienImmobilier(mResult.Bien); } //Update the values. //Reset the edit index. gvResultats.EditIndex = -1; //Bind data to the GridView control. BindData(); }