Пример #1
0
        public void Button_EnregistrerSinistre_Click(object sender, EventArgs e)
        {
            Javascript.ConsoleLog("clicked Ajout sinistre");
            Exam.Domain.Entities.Sinistre s = new Exam.Domain.Entities.Sinistre();
            s.Conducteur   = _S_Conducteur.Text;
            s.DateSinistre = _S_DateSinistre.Text;
            s.NumeroPermis = _S_NumPermis.Text;
            s.DateDePermis = _S_DatePermis.Text;
            int idExpert, idContrat;

            idExpert  = Int32.Parse(DropDownList_SinistreListeExpert.SelectedItem.Value);
            idContrat = Int32.Parse(DropDownList_Immatriculation.SelectedItem.Value);
            Javascript.ConsoleLog(idExpert.ToString());
            Javascript.ConsoleLog(idContrat.ToString());
            UserAccount Expert = usr.Users.Find(idExpert);

            s.GarageExperts.Add(Expert);
            s.Contrat = usr.Contrats.Find(idContrat);
            s.Phase   = "Affectation Garage";
            s.Etat    = "En cours";
            Javascript.ConsoleLog(s.Contrat.Souscripteur.Nom);
            usr.Sinistres.Add(s);
            usr.SaveChanges();
            this.Page_Load(sender, e);
        }
Пример #2
0
        protected void Button_EnregistrerSinistre_Click(object sender, EventArgs e)
        {
            Javascript.ConsoleLog("ajout sinistre clicked");
            Exam.Domain.Entities.Sinistre s = new Exam.Domain.Entities.Sinistre();
            s.Conducteur = _S_Conducteur.Text;
            s.Nature     = _S_Nature.Text;
            int i = 0;

            Int32.TryParse(RadioButtonList_Indemnite.SelectedValue, out i);
            s.Indemnise        = Convert.ToBoolean(i);
            s.IDA              = Convert.ToBoolean(Int32.Parse(RadioButtonList_IDA.SelectedValue));
            s.GarantieSinistre = DropDownList_SinistreGarantieSinistre.SelectedItem.Text;
            s.NumeroPermis     = _S_NumPermis.Text;
            s.DateDePermis     = _S_DatePermis.Text;
            i = 0;
            Int32.TryParse(_S_PartResp.Text, out i);
            s.PartDeResponsabilite = i;
            i = 0;
            Int32.TryParse(_S_MontantInd.Text, out i);
            s.MontantIndemnisation = i;
            s.CompagnieAdverse     = _S_CompagnieAdv.Text;
            s.DateSinistre         = _S_DateSinistre.Text;
            s.DateIndemnisation    = _S_DateIndm.Text;
            s.VehiculeAdverse      = _S_VehiculeAdverse.Text;

            int idGarage, idExpert, idContrat;

            idGarage  = Int32.Parse(DropDownList_SinistreGaragiste.SelectedItem.Value);
            idExpert  = Int32.Parse(DropDownList_SinistreListeExpert.SelectedItem.Value);
            idContrat = Int32.Parse(DropDownList_Immatriculation.SelectedItem.Value);
            Javascript.ConsoleLog(idGarage.ToString());
            Javascript.ConsoleLog(idExpert.ToString());
            Javascript.ConsoleLog(idContrat.ToString());



            UserAccount Garagiste = u.Users.Find(idGarage);

            Javascript.ConsoleLog("Garagiste : " + Garagiste.FirstName + Garagiste.LastName + Garagiste.Role);
            UserAccount Expert = u.Users.Find(idExpert);

            Javascript.ConsoleLog("Expert : " + Expert.FirstName + Expert.LastName + Expert.Role);
            if (RadioButtonList_Garage.SelectedValue.Equals("1"))
            {
                s.GarageExperts.Add(Garagiste);
            }
            s.GarageExperts.Add(Expert);
            s.Contrat = u.Contrats.Find(idContrat);

            Javascript.ConsoleLog(s.Contrat.Souscripteur.Nom);
            s.Phase = "Expertise";
            u.Sinistres.Add(s);
            u.SaveChanges();
        }