public async Task <IActionResult> Update(string jsonObject)
        {
            try
            {
                _response = await _service.UpdateTypeProduit(jsonObject);

                if (_response.IsSuccessStatusCode)
                {
                    Result = await _response.Content.ReadAsAsync <ObjetRetour>();

                    if (Result.Etat)
                    {
                        return(Json(new { ok = true, message = "Mise à réalisée avec succès!" }));
                    }
                    else
                    {
                        return(Json(new { ok = false, message = Result.Message }));
                    }
                }
                else
                {
                    return
                        (Json(
                             new
                    {
                        ok = false,
                        message = string.Format("{0} : {1}", _response.StatusCode, _response.RequestMessage)
                    }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { ok = false, message = ex.Message }));
            }
        }
Esempio n. 2
0
        public async Task <ObjetRetour> GetUsers(decimal id, string token)
        {
            var retour = new ObjetRetour();

            try
            {
                if (_commun.ConnexionValide(token) == (int)enumEtat.Valide)
                {
                    retour.Contenu = await _service.Tbuser.FindByConditionAync(a => a.IdUser == id);

                    retour.Etat = true;
                    _logger.LogInfo($"SUCCESS");
                }
                else
                {
                    retour.Message = $"Token non valide!";
                    retour.Etat    = false;
                    _logger.LogInfo($"Token non valide!");
                }
            }
            catch (Exception ex)
            {
                retour.Etat    = false;
                retour.Message = ex.Message;
                _logger.LogError(ex.Message);
            }

            return(retour);
        }
Esempio n. 3
0
        public ObjetRetour AddReceptionProduit(ReceptionProduitDto value)
        {
            var retour = new ObjetRetour();

            try
            {
                if (_commun.GetConnexionValide(value.Token, _strIP) == (int)enumEtat.Valide)
                {
                    _service.ReceptionProduit.Create(value.ToModel());
                    retour.Etat = true;
                    _logger.LogInformation($"SUCCESS");
                }
                else
                {
                    retour.Message = $"Token non valide!";
                    retour.Etat    = false;
                    _logger.LogInformation($"Token non valide!");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                retour.Etat    = false;
                retour.Message = ex.Message;
            }

            return(retour);
        }
Esempio n. 4
0
        [HttpPost]//GetStatutPaiement
        public async Task <JsonResult> GetStatutPaiement(string jsonObject)
        {
            try
            {
                var ic        = JObject.Parse(jsonObject);
                var operateur = (int)ic["operateur"];
                var OrderId   = (string)ic["OrderId"];

                if (operateur == 2)
                {
                    _response = await Api.Url.GetAsync("/api/Operation/GetStatutPaiementMoov?orderId=" + OrderId);
                }
                else
                {
                    _response = await Api.Url.GetAsync("/api/Operation/GetStatutPaiementOrange?orderId=" + OrderId);
                }

                if (_response.IsSuccessStatusCode)
                {
                    //Update paiement
                    var querySql       = new Sql("SELECT * FROM TB_PAIEMENT WHERE ORDERID = '" + OrderId + "'");
                    var UpdatePaiement = _db.Fetch <PaiementDto>(querySql).FirstOrDefault();

                    Result = JsonConvert.DeserializeObject <ObjetRetour>(_response.Content.ReadAsStringAsync().Result);
                    if (Result.Etat)
                    {
                        //UpdatePaiement.STATUT_PAIEMENT = 2;//Payer
                        if (UpdatePaiement.STATUT_PAIEMENT != 2)
                        {
                            var sql = new Sql("UPDATE TB_PAIEMENT SET STATUT_PAIEMENT = '" + 2 + "', DATE_MODIFICATION = '" + DateTime.Now + "' WHERE ROWIDAUTO = '" + UpdatePaiement.ROWIDAUTO + "'");
                            _db.Execute(sql);
                        }
                        return(Json(new { ok = true, message = Result.Message }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        //UpdatePaiement.STATUT_PAIEMENT = 3;//Echec

                        var sql = new Sql("UPDATE TB_PAIEMENT SET STATUT_PAIEMENT = '" + 3 + "', DATE_MODIFICATION = '" + DateTime.Now + "' WHERE ROWIDAUTO = '" + UpdatePaiement.ROWIDAUTO + "'");
                        _db.Execute(sql);

                        return(Json(new { ok = false, message = Result.Message }, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    return(Json(new { ok = false, message = string.Format("{0}: {1}", _response.StatusCode, _response.RequestMessage), JsonRequestBehavior.AllowGet }));
                }
            }
            catch (Exception ex)
            {
                //_logger.LogError(ex.Message);
                return(Json(new { ok = false, message = ex.Message }));
            }
        }
Esempio n. 5
0
        public async Task <ObjetRetour> InsertUsers(TbuserDto value)
        {
            var retour = new ObjetRetour();

            try
            {
                if (value != null)
                {
                    if (_commun.ConnexionValide(value.Token) == (int)enumEtat.Valide)
                    {
                        var pass = clsSecurityHash.getSHA256(value.Password);
                        value.Password = pass;
                        var agent = _service.Tbagent.FindByCondition(a => a.Matricule == value.Matricule).FirstOrDefault();
                        if (agent != null)
                        {
                            value.AgentId    = agent.AgentId;
                            value.StatusCode = (int)EtatAgent.EnFonction;
                            await _service.Tbuser.CreateAsync(value.ToModel());

                            _service.Save();
                            retour.Etat = true;
                            _logger.LogInfo($"SUCCESS");
                        }
                        else
                        {
                            retour.Message = $"Agent Inexistant!";
                            retour.Etat    = false;
                            _logger.LogInfo($"Agent Inexistant!");
                        }
                    }
                    else
                    {
                        retour.Message = $"Token non valide!";
                        retour.Etat    = false;
                        _logger.LogInfo($"Token non valide!");
                    }
                }
                else
                {
                    retour.Message = $"Parametre non valide!";
                    retour.Etat    = false;
                    _logger.LogInfo($"Parametre non valide!");
                }
            }
            catch (Exception ex)
            {
                retour.Etat    = false;
                retour.Message = ex.Message;
                _logger.LogError(ex.Message);
            }
            return(retour);
        }
Esempio n. 6
0
        public ObjetRetour InitialiserMotDePasse(LoginModel login)
        {
            var retour = new ObjetRetour();

            try
            {
                if (login != null)
                {
                    if (_commun.ConnexionValide(login.Token) == (int)enumEtat.Valide)
                    {
                        var user = _service.Tbuser.FindByCondition(u => u.IdUser == login.UserId).FirstOrDefault();

                        user.Password = clsSecurityHash.getSHA256("123456");
                        //user..DateDerniereModificationPassword = DateTime.Now;
                        user.DateDerniereModificationPassword = DateTime.Now;
                        _service.Tbuser.Update(user);
                        _service.Save();
                        retour.Etat = true;
                        _logger.LogInfo($"SUCCESS");
                    }
                    else
                    {
                        retour.Message = $"Token non valide!";
                        retour.Etat    = false;
                        _logger.LogInfo($"Token non valide!");
                    }
                }
                else
                {
                    retour.Message = $"Parametre non valide!";
                    retour.Etat    = false;
                    _logger.LogInfo($"Parametre non valide!");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                retour.Etat    = true;
                retour.Message = ex.Message;
            }

            return(retour);
        }
Esempio n. 7
0
        //private InfoUserModel getinfoUser(TbuserDto connexion)
        //{
        //    var retour = new InfoUserModel();

        //    return retour;
        //}

        //public ObjetRetour ModifierMotDePasse(LoginModel login)
        //{
        //    throw new NotImplementedException();
        //}

        //public Task<ObjetRetour> GetAllUsers(string token)
        //{
        //    throw new NotImplementedException();
        //}

        //public Task<ObjetRetour> GetUsers(int id, string token)
        //{
        //    throw new NotImplementedException();
        //}

        //public Task<ObjetRetour> InsertUsers(TbuserDto value)
        //{
        //    throw new NotImplementedException();
        //}

        //public Task<ObjetRetour> InsertListUsers(List<TbuserDto> value)
        //{
        //    throw new NotImplementedException();
        //}

        //public ObjetRetour MajUsers(TbuserDto value)
        //{
        //    throw new NotImplementedException();
        //}

        //public ObjetRetour MajListUsers(List<TbuserDto> value)
        //{
        //    throw new NotImplementedException();
        //}

        //public ObjetRetour DeleteUsers(TbuserDto value)
        //{
        //    throw new NotImplementedException();
        //}

        //public ObjetRetour DeleteListUsers(List<TbuserDto> values)
        //{
        //    throw new NotImplementedException();
        //}

        public ObjetRetour ModifierMotDePasse(LoginModel login)
        {
            var retour = new ObjetRetour();

            try
            {
                if (_commun.ConnexionValide(login.Token) == (int)enumEtat.Valide)
                {
                    var pass = clsSecurityHash.getSHA256(login.OldPassword);

                    var user = _service.Tbuser.FindByCondition(u => u.LoginUser == login.Login && u.Password == pass).FirstOrDefault();

                    if (user.Password == pass)
                    {
                        user.Password = clsSecurityHash.getSHA256(login.Password);
                        _service.Tbuser.Update(user);
                        _service.Save();
                        retour.Etat = true;
                        _logger.LogInfo($"SUCCESS");
                    }
                    else
                    {
                        retour.Message = $"Ancien mot de passe incorrect!";
                        retour.Etat    = false;
                        _logger.LogInfo($"Ancien mot de passe incorrect!");
                    }
                }
                else
                {
                    retour.Message = $"Token non valide!";
                    retour.Etat    = false;
                    _logger.LogInfo($"Token non valide!");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                retour.Etat    = false;
                retour.Message = ex.Message;
            }

            return(retour);
        }
Esempio n. 8
0
        public ObjetRetour DeleteUsers(TbuserDto value)
        {
            var retour = new ObjetRetour();

            try
            {
                if (_commun.ConnexionValide(value.Token) == (int)enumEtat.Valide)
                {
                    try
                    {
                        _service.Tbuser.Delete(value.ToModel());
                        _service.Save();
                        retour.Etat = true;
                        _logger.LogInfo($"SUCCESS");
                    }
                    catch (Microsoft.EntityFrameworkCore.DbUpdateException ex)
                    {
                        value.StatusCode = (int)EtatAgent.Supprimer;
                        _service.Tbuser.Update(value.ToModel());
                        _service.Save();
                        retour.Etat = true;
                        _logger.LogInfo($"SUCCESS");
                        retour.Message = ex.Message;
                    }
                }
                else
                {
                    retour.Message = $"Token non valide!";
                    retour.Etat    = false;
                    _logger.LogInfo($"Token non valide!");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                retour.Etat    = false;
                retour.Message = ex.Message;
            }

            return(retour);
        }
Esempio n. 9
0
        [HttpPost]//NotifPaiementOrange
        public ObjetRetour NotifPaiementOrange(NotifClientModel value)
        {
            var retour = new ObjetRetour();

            try
            {
                if (value != null)
                {
                    var querySql       = new Sql("SELECT * FROM TB_PAIEMENT WHERE ORDERID = '" + value.orderId + "'");
                    var UpdatePaiement = _db.Fetch <PaiementDto>(querySql).FirstOrDefault();

                    if (value.status == "SUCCESS" || value.status == "Successful")
                    {
                        //UpdatePaiement.STATUT_PAIEMENT = 2;//Payer
                        if (UpdatePaiement.STATUT_PAIEMENT != 2)
                        {
                            var sql = new Sql("UPDATE TB_PAIEMENT SET STATUT_PAIEMENT = '" + 2 + "', DATE_MODIFICATION = '" + DateTime.Now + "' WHERE ORDERID = '" + value.orderId + "'");
                            _db.Execute(sql);
                        }
                        retour.Etat    = true;
                        retour.Message = $"SUCCESS: PAIEMENT EFFECTUE AVEC SUCCES";
                        //_logger.LogInfo($"SUCCESS: PAIEMENT EFFECTUE AVEC SUCCES");
                    }
                    else
                    {
                        retour.Message = $"Notification non valide! Statut : " + value.status;
                        retour.Etat    = false;
                        //_logger.LogInfo($"Notification non valide! Statut : " + value.status);
                    }
                }
            }
            catch (Exception ex)
            {
                retour.Etat    = false;
                retour.Message = ex.Message;
                //_logger.LogError(ex.Message);
            }
            return(retour);
        }
        public async Task <IActionResult> Get(string jsonObject)
        {
            try
            {
                _response = await _service.GetTypeProduit(jsonObject);

                if (_response.IsSuccessStatusCode)
                {
                    Result = await _response.Content.ReadAsAsync <ObjetRetour>();

                    if (Result.Etat)
                    {
                        var DecompressResult = JsonConvert.DeserializeObject <TypeProduitDto>(Result.Contenu.ToString());
                        return(Json(new { ok = true, Data = DecompressResult, message = Result.Message }));
                    }
                    else
                    {
                        return(Json(new { ok = false, message = Result.Message }));
                    }
                }
                else
                {
                    return
                        (Json(
                             new
                    {
                        ok = false,
                        message = string.Format("{0}: {1}", _response.StatusCode, _response.RequestMessage)
                    }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { ok = false, message = ex.Message }));
            }
        }
Esempio n. 11
0
        public ObjetRetour Login(LoginModel login)
        {
            if (login == null)
            {
                return(new ObjetRetour());
            }

            var retour = new ObjetRetour();

            try
            {
                string pass = "";
                pass = clsSecurityHash.getSHA256(login.Password);

                var user = _service.Tbuser.FindByCondition(u => u.LoginUser == login.Login && u.Password == pass).FirstOrDefault();

                if (user == null)
                {
                    retour.Etat    = false;
                    retour.Message = "Login ou mot de passe non valide!";
                    retour.Contenu = new LoginModel();
                    return(retour);
                }

                if (user.Password == pass)
                {
                    var secretKey         = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Startup.SecretKey));
                    var signinCredentials = new SigningCredentials(secretKey, SecurityAlgorithms.HmacSha256);

                    var tokeOptions = new JwtSecurityToken(
                        issuer: Startup.Issuer,// TODO adresse de deploiement du service
                        audience: _strIP,
                        claims: new List <Claim>(),
                        expires: DateTime.Now.AddMinutes(10),//TODO Duree du Token
                        signingCredentials: signinCredentials
                        );

                    var tokenString = new JwtSecurityTokenHandler().WriteToken(tokeOptions);

                    var connexion = new Connexion()
                    {
                        AdresseIpSource   = _strIP,
                        Bsucces           = true,
                        DateConnexion     = DateTime.Now,
                        DateLastConnexion = DateTime.Now,
                        Token             = tokenString,
                        UserId            = (int)user.IdUser
                    };


                    _service.Connexion.Create(connexion);

                    var profil = _service.Tbprofil.FindByCondition(p => p.ProfilId == user.ProfilId).FirstOrDefault();


                    var habilitations = _service.Tbhabilitation.FindByCondition(h => h.ProfilId == profil.ProfilId);
                    var lstIdMenus    = habilitations.Select(m => m.MenuId).ToList();

                    var menuUsers  = _service.Tbmenu.FindByCondition(mp => lstIdMenus.Contains(mp.MenuId));
                    var info       = new InfoUserModel();
                    var loginModel = new LoginModel();

                    loginModel.UserId   = (int)user.IdUser;
                    loginModel.UserName = user.NomPrenUser;
                    loginModel.Login    = user.LoginUser;
                    loginModel.Token    = tokenString;
                    info.Login          = loginModel;

                    info.Menus = new List <MenuModel>();

                    var vueMenuParent = menuUsers.Where(m => m.IdParent == null).OrderBy(o => o.OrdreMenu).ToList();

                    foreach (var menuUser in vueMenuParent)
                    {
                        var menup = new MenuModel();
                        menup.MenuParent = ModelFromDto(menuUser);

                        menup.Menu = LstModelFromDto(menuUsers.Where(me => me.IdParent == menuUser.MenuId).OrderBy(o => o.OrdreMenu).ToList());

                        info.Menus.Add(menup);
                    }

                    // info = getinfoUser(user);
                    _service.Save();

                    retour.Contenu = info;
                    retour.Message = $"SUCCESS";
                    retour.Etat    = true;
                    _logger.LogInfo($"SUCCESS");
                }
            }
            catch (Exception ex)
            {
                retour.Etat    = false;
                retour.Message = ex.Message;
                _logger.LogError(ex.Message);
            }

            return(retour);
        }
Esempio n. 12
0
        public ObjetRetour MajUsers(TbuserDto value)
        {
            var retour = new ObjetRetour();

            try
            {
                if (value != null)
                {
                    if (_commun.ConnexionValide(value.Token) == (int)enumEtat.Valide)
                    {
                        var agent = _service.Tbagent.FindByCondition(a => a.Matricule == value.Matricule).FirstOrDefault();
                        if (agent != null)
                        {
                            var user = _service.Tbuser.FindByCondition(u => u.IdUser == value.IdUser).FirstOrDefault();

                            if (user != null)
                            {
                                user.IdUser            = value.IdUser;
                                user.CodUser           = value.CodUser;
                                user.LoginUser         = value.LoginUser;
                                user.NomPrenUser       = value.NomPrenUser;
                                user.NumTel            = value.NumTel;
                                user.SexUser           = value.SexUser;
                                user.AdrUser           = value.AdrUser;
                                user.Password          = value.Password;
                                user.DatFonc           = value.DatFonc;
                                user.IdTypeUser        = value.IdTypeUser;
                                user.ProfilId          = value.ProfilId;
                                user.AgentId           = value.AgentId;
                                user.DateDebutValidite = value.DateDebutValidite;
                                user.DateFinValidite   = value.DateFinValidite;
                                user.DateDerniereModificationPassword = value.DateDerniereModificationPassword;
                                user.InitUserPassword           = value.InitUserPassword;
                                user.NbreEchecsOuvertureSession = value.NbreEchecsOuvertureSession;
                                user.DateDerniereConnexion      = value.DateDerniereConnexion;
                                user.DerniereConnexionReussie   = value.DerniereConnexionReussie;
                                user.DateDernierVerrouillage    = value.DateDernierVerrouillage;
                                user.Email         = value.Email;
                                user.StatutSession = value.StatutSession;
                                user.Hostname      = value.Hostname;
                                user.ModifieLe     = value.ModifieLe;
                                user.ModifiePar    = value.ModifiePar;
                                user.StateCode     = value.StateCode;
                                user.StatusCode    = value.StatusCode;
                                user.DateCreation  = value.DateCreation;



                                _service.Tbuser.Update(user);
                                _service.Save();
                                retour.Etat = true;
                                _logger.LogInfo($"SUCCESS");
                            }
                            else
                            {
                                retour.Message = $"Tbuser  Inexistant!";
                                retour.Etat    = false;
                                _logger.LogInfo($"Tbuser Inexistant!");
                            }
                        }
                        else
                        {
                            retour.Message = $"Agent Inexistant!";
                            retour.Etat    = false;
                            _logger.LogInfo($"Agent Inexistant!");
                        }
                    }
                    else
                    {
                        retour.Message = $"Token non valide!";
                        retour.Etat    = false;
                        _logger.LogInfo($"Token non valide!");
                    }
                }
                else
                {
                    retour.Message = $"Parametre non valide!";
                    retour.Etat    = false;
                    _logger.LogInfo($"Parametre non valide!");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                retour.Etat    = false;
                retour.Message = ex.Message;
            }

            return(retour);
        }
Esempio n. 13
0
        public ObjetRetour LoginMobile(string codeEquipement)
        {
            if (string.IsNullOrEmpty(codeEquipement))
            {
                return(new ObjetRetour());
            }

            var retour = new ObjetRetour();

            try
            {
                var equipement = _service.Equipement.FindByCondition(e => e.CodeEq == codeEquipement).FirstOrDefault();

                if (equipement == null)
                {
                    retour.Etat    = false;
                    retour.Message = "Equipement non habilité!";

                    return(retour);
                }

                if (equipement != null)
                {
                    var secretKey         = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Startup.SecretKey));
                    var signinCredentials = new SigningCredentials(secretKey, SecurityAlgorithms.HmacSha256);

                    var tokeOptions = new JwtSecurityToken(
                        issuer: Startup.Issuer,// TODO adresse de deploiement du service
                        audience: _strIP,
                        claims: new List <Claim>(),
                        expires: DateTime.Now.AddMinutes(10),//TODO Duree du Token
                        signingCredentials: signinCredentials
                        );

                    var tokenString = new JwtSecurityTokenHandler().WriteToken(tokeOptions);

                    var connexion = new Connexion()
                    {
                        AdresseIpSource   = _strIP,
                        Bsucces           = true,
                        DateConnexion     = DateTime.Now,
                        DateLastConnexion = DateTime.Now,
                        Token             = tokenString,
                        Equipementid      = equipement.Equipementid
                    };
                    _service.Connexion.Create(connexion);

                    // info = getinfoUser(user);
                    _service.Save();

                    retour.Contenu = tokenString;
                    retour.Message = $"SUCCESS";
                    retour.Etat    = true;
                    _logger.LogInfo($"SUCCESS");
                }
            }
            catch (Exception ex)
            {
                retour.Etat    = false;
                retour.Message = ex.Message;
                _logger.LogError(ex.Message);
            }

            return(retour);
        }
Esempio n. 14
0
        public async Task <JsonResult> AddParticipant(string jsonObject, int Operateur)
        {
            try
            {
                var ObjectParticipant = JsonConvert.DeserializeObject <ParticipantDto>(jsonObject);
                ObjectParticipant.DateCreation = DateTime.Now;

                var currentEvent = Session["CurrentEvent"] as CurrentEventModel;

                var retour = _db.Insert <ParticipantDto>("TB_PARTICPANT", "rowid", ObjectParticipant);

                //var NewParticipant = _db.Fetch<ParticipantDto>(new Sql().Select("*").From("TB_PARTICPANT").Where("Telephone = @telephone","DateCreation = @dateCreation", new { telephone = ObjectParticipant.Telephone, dateCreation = ObjectParticipant.DateCreation })).FirstOrDefault();
                //string stringSql = string.Format("SELECT * FROM TB_PARTICPANT WHERE Telephone = '{0}' AND DateCreation = '{1}'", ObjectParticipant.Telephone, Convert.ToDateTime(ObjectParticipant.DateCreation));
                var stringSql      = "SELECT * FROM TB_PARTICPANT WHERE Telephone = '" + ObjectParticipant.Telephone + "' AND DateCreation >= '" + Convert.ToDateTime(ObjectParticipant.DateCreation) + "'";
                var query          = new Sql(stringSql);
                var NewParticipant = _db.Fetch <ParticipantDto>(query).FirstOrDefault();

                if (NewParticipant != null)
                {
                    var NewParticiper = new ParticiperDto()
                    {
                        rowidparticipant  = NewParticipant.rowid,
                        rowidevenement    = currentEvent.ROWID,
                        dateparticipation = DateTime.Now
                    };

                    var result = _db.Insert <ParticiperDto>("TB_PARTICIPER", "rowid", NewParticiper);

                    if (currentEvent.ESTPAYANT == true)
                    {
                        //Création du orderid
                        string orderid = null;
                        Random random  = new Random();
                        var    orders  = random.Next(1000, 10000);
                        var    dt      = DateTime.Now.ToShortTimeString().Replace("/", "");
                        var    id      = orders.ToString() + dt.Replace(":", "");
                        orderid = "ASC_" + id;

                        var codePlateforme = "Asc00123";
                        if (Operateur == 2)
                        {
                            _response = await Api.Url.GetAsync("/api/Operation/InitierPaiementMoov?montant=" + currentEvent.TARIF + "&CodePlateForme=" + codePlateforme + "&orderid=" + orderid);
                        }
                        else
                        {
                            _response = await Api.Url.GetAsync("/api/Operation/InitierPaiementOrange?montant=" + currentEvent.TARIF + "&CodePlateForme=" + codePlateforme + "&orderid=" + orderid);
                        }


                        if (_response.IsSuccessStatusCode)
                        {
                            Result = JsonConvert.DeserializeObject <ObjetRetour>(_response.Content.ReadAsStringAsync().Result);
                            if (Result.Etat)
                            {
                                var DecompressResult = JsonConvert.DeserializeObject <RetourPaiement>(Result.Contenu.ToString());

                                //initiation du paiement
                                var querySql = new Sql("SELECT * FROM TB_PARTICIPER WHERE rowidevenement = '" + NewParticiper.rowidevenement + "' AND rowidparticipant = '" + NewParticiper.rowidparticipant + "'");
                                var NewQuery = _db.Fetch <ParticiperDto>(querySql).FirstOrDefault();

                                var NewPaiement = new PaiementDto()
                                {
                                    ID_PARTICIPER     = NewQuery.rowid,
                                    MONTANT           = currentEvent.TARIF,
                                    STATUT_PAIEMENT   = 1,//initier
                                    DATE_PAIEMENT     = DateTime.Now,
                                    DATE_MODIFICATION = DateTime.Now,
                                    ORDERID           = DecompressResult.orderId
                                };
                                _db.Insert <PaiementDto>("TB_PAIEMENT", "ROWIDAUTO", NewPaiement);

                                return(Json(new { ok = true, data = DecompressResult, aPayer = 1, url = "/Accueil", message = "Votre réservation est enregistrée, Veuillez terminer le processus SVP!" }, JsonRequestBehavior.AllowGet));
                            }
                            else
                            {
                                return(Json(new { ok = false, message = Result.Message }, JsonRequestBehavior.AllowGet));
                            }
                        }
                        else
                        {
                            return(Json(new { ok = false, message = string.Format("{0}: {1}", _response.StatusCode, _response.RequestMessage), JsonRequestBehavior.AllowGet }));
                        }
                    }
                    else
                    {
                        return(Json(new { ok = true, aPayer = 0, url = "/Accueil", message = "Votre réservation a bien été enregistrée" }, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    return(Json(new { ok = false, message = "Echec de la réservation pour cet évènement !" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { ok = false, message = ex.Message }));
            }
        }