private void BindingData(Immo_Rale.Management.Agent ag) // dua cac gia tri cua Acheteur va Souhait vao textbox ( sau khi double click ) { tb_statut.Visible = false; cbb_Statut.Visible = true; this.obj_ag = ag; bt_Enregistrer.Text = "MISE A JOUR"; tb_Nom.Text = obj_ag.NomAgent; tb_Prenom.Text = obj_ag.PrenomAgent; tb_TelFixePro.Text = obj_ag.Telephone_Fixe_Pro; tb_TelPortablePrive.Text = obj_ag.Telephone_Portable_Prive; tb_TelPortablePro.Text = obj_ag.Telephone_Portable_Pro; tb_Email.Text = obj_ag.Email; cbb_Agence.SelectedItem = obj_ag.Agence_Locale; cbb_Statut.SelectedItem = obj_ag.Statut; }
private void reset_value() { if (obj_ag != null) { obj_ag = null; } groupBox1.Text = "Nouveau Agent"; cbb_Statut.Visible = false; tb_statut.Visible = true; tb_statut.Text = "ACTIF"; bt_Enregistrer.Text = "ENREGISTRE"; tb_Nom.Text = String.Empty; tb_Prenom.Text = String.Empty; tb_TelFixePro.Text = String.Empty; tb_TelPortablePro.Text = String.Empty; tb_TelPortablePrive.Text = String.Empty; tb_Email.Text = String.Empty; cbb_Agence.SelectedIndex = 0; cbb_Statut.SelectedIndex = 0; }
private void init() { string str = ""; if (obj_Souhait.Prix_max != 0) { str += " AND prixSouhait < " + obj_Souhait.Prix_max; } if (obj_Souhait.Garage == "True") { str += " AND avecGarage = 'True'"; } if (obj_Souhait.Cave == "True") { str += " AND avecCave = 'True'"; } lsBien = Management.Biens.getList(String.Format("statutBien = 'DISPONIBLE' AND typeHabitation = '{0}' AND ville = '{1}' AND surfaceHabitable > {2} AND surfaceParcelle > {3} AND nombreChambres > {4}" + str, obj_Souhait.Type, obj_Souhait.Ville, obj_Souhait.Surface_habitable_min, obj_Souhait.Surface_parcelle_min, obj_Souhait.Chambre_min)); obj_Acheteur = Management.Acheteur.getFirst(String.Format("ID = '{0}'", obj_Souhait.Id_acheteur)); obj_Agent = Management.Agent.getFirst(String.Format("ID = '{0}'", obj_Acheteur.Idagent)); }
public Boolean saveSouhait_Acheteur(string s_nom, string s_prenom, string s_adresse, string s_email, string s_tel_mobile, string s_tel_fixe, string s_habitablemin, string s_parcellemin, string s_villesouhait, string s_type, string s_statut, string s_garage, string s_cave, int chambre, string prix, Management.Agent agent) { Acheteur obj_Acheteur = new Acheteur() { Id = Guid.NewGuid(), Nom = s_nom, Prenom = s_prenom, Adresse = s_adresse, Telfixe = s_tel_fixe, Telportable = s_tel_mobile, Email = s_email, Idagent = agent.ID.ToString() }; Souhait obj_Souhait = new Souhait() { Id = Guid.NewGuid(), Statut = s_statut, Type = s_type, Surface_habitable_min = Aide.parseInt(s_habitablemin), Surface_parcelle_min = Aide.parseInt(s_parcellemin), Chambre_min = Aide.parseInt(s_parcellemin), Cave = s_cave, Garage = s_garage, Ville = s_villesouhait, Prix_max = Aide.parseFloat(prix), Id_acheteur = obj_Acheteur.Id.ToString(), Nom_acheteur = obj_Acheteur.Prenom + " " + obj_Acheteur.Nom, }; return(Souhait.insert(obj_Souhait) && Acheteur.insert(obj_Acheteur)); }
private void bt_chercher_Click(object sender, EventArgs e) { if (checkBox_Tout.Checked) { lsAcheteur = Management.Acheteur.getList(""); } else { Management.Agent ag = new Management.Agent(); ag = (Management.Agent)cbb_agent_cherche.SelectedItem; lsAcheteur = Management.Acheteur.getList(String.Format("idAgent = '{0}'", ag.ID)); if (checkBox_encours.Checked) { lsSouhait = Management.Souhait.getList("statutS =\"EN COURS\""); lsAcheteur.Clear(); List <Management.Acheteur> lsAcheteur_temp; lsAcheteur_temp = Management.Acheteur.getList(String.Format("idAgent = '{0}'", ag.ID)); foreach (Management.Acheteur ach in lsAcheteur_temp) { foreach (Management.Souhait souh in lsSouhait) { if (ach.Id.ToString() == souh.Id_acheteur) { lsAcheteur.Add(ach); } } } } } dataGridView1.DataSource = lsAcheteur; dataGridView1.Columns["ID"].Visible = false; dataGridView1.Columns["Idagent"].Visible = false; dataGridView1.Columns["Telfixe"].HeaderText = "Tel Fixe"; dataGridView1.Columns["Telportable"].HeaderText = "Portable"; }
private Management.Agent getSelectedAgent(Guid id) { obj_agent = lsAgents.First(agent => agent.ID == id); return(obj_agent); }
private void saveProcess(string s_nom, string s_prenom, string s_adresse, string s_email, string s_tel_mobile, string s_tel_fixe, string s_habitablemin, string s_parcellemin, string s_type, string s_villesouhait, string s_statut, string s_garage, string s_cave, int chambre, string prix, Management.Agent agent) { if (s_nom.Trim() == String.Empty || s_prenom.Trim() == String.Empty || s_adresse.Trim() == String.Empty || s_email.Trim() == String.Empty || s_tel_mobile.Trim() == String.Empty || s_tel_fixe.Trim() == String.Empty || prix.Trim() == String.Empty || s_habitablemin.Trim() == String.Empty || s_parcellemin.Trim() == String.Empty) { MessageBox.Show("Value obligatoire"); } else { SouhaitControlleur ec = new SouhaitControlleur(); //new if (obj_Souhait == null && obj_Acheteur == null) { if (!ec.saveSouhait_Acheteur(s_nom, s_prenom, s_adresse, s_email, s_tel_mobile, s_tel_fixe, s_habitablemin, s_parcellemin, s_villesouhait, s_type, s_statut, s_garage, s_cave, chambre, prix, agent)) { MessageBox.Show("Lỗi khi lưu hồ sơ, tạo contrat"); } else { if (MessageBox.Show("Lưu thành công. Bạn muốn tìm Biens phù hợp không?", "Thông Báo", MessageBoxButtons.YesNo) == DialogResult.Yes) { trouver_souhait(getSouhait(s_habitablemin, s_parcellemin, s_type, s_villesouhait, s_statut, s_garage, s_cave, chambre, prix, s_nom, s_prenom), null); } } } else //edit { if (obj_Souhait == null) { if (!ec.newSouhait_oldAcheteur(obj_Acheteur, s_habitablemin, s_parcellemin, s_villesouhait, s_type, s_statut, s_garage, s_cave, chambre, prix)) { MessageBox.Show("Lỗi khi lưu hồ sơ, tạo contrat"); } else { //MessageBox.Show("Lưu thành công"); if (MessageBox.Show("Cập nhật thành công. Bạn muốn tìm Biens phù hợp không?", "Thông Báo", MessageBoxButtons.YesNo) == DialogResult.Yes) { trouver_souhait(getSouhait(s_habitablemin, s_parcellemin, s_type, s_villesouhait, s_statut, s_garage, s_cave, chambre, prix, s_nom, s_prenom), null); } } } else { obj_Acheteur.Nom = s_nom; obj_Acheteur.Prenom = s_prenom; obj_Acheteur.Telfixe = s_tel_fixe; obj_Acheteur.Telportable = s_tel_mobile; obj_Acheteur.Idagent = agent.ID.ToString(); obj_Acheteur.Email = s_email; obj_Acheteur.Adresse = s_adresse; obj_Souhait.Statut = s_statut; obj_Souhait.Ville = s_villesouhait; obj_Souhait.Type = s_type; obj_Souhait.Surface_habitable_min = Aide.parseInt(s_habitablemin);; obj_Souhait.Surface_parcelle_min = Aide.parseInt(s_parcellemin); obj_Souhait.Chambre_min = chambre; obj_Souhait.Cave = s_cave; obj_Souhait.Garage = s_garage; obj_Souhait.Prix_max = Aide.parseFloat(prix); if (!ec.updateSouhait_Acheteur(obj_Souhait, obj_Acheteur)) { MessageBox.Show("Lỗi khi cập nhật hồ sơ"); } else { if (MessageBox.Show("Cập nhật thành công. Bạn muốn tìm Biens phù hợp không?", "Thông Báo", MessageBoxButtons.YesNo) == DialogResult.Yes) { //MessageBox.Show("Cập nhật thành công"); trouver_souhait(obj_Souhait, null); } } } } } }