Ejemplo n.º 1
0
        public IHttpActionResult PutApproval(int id, Approval approval)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != approval.approval_id)
            {
                return(BadRequest());
            }

            db.Entry(approval).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ApprovalExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutAccountHolder(long id, AccountHolder accountHolder)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != accountHolder.account_number)
            {
                return(BadRequest());
            }

            db.Entry(accountHolder).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AccountHolderExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutCustAddress(int id, CustAddress custAddress)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != custAddress.cust_id)
            {
                return(BadRequest());
            }

            db.Entry(custAddress).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustAddressExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 4
0
        public IHttpActionResult PutTransaction(int id, Transaction transaction)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != transaction.reference_id)
            {
                return(BadRequest());
            }

            db.Entry(transaction).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TransactionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutBeneficiary(int id, Beneficiary beneficiary)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != beneficiary.beneficiary_id)
            {
                return(BadRequest());
            }

            db.Entry(beneficiary).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BeneficiaryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 6
0
        public void Modifier(Agence obj)
        {
            try
            {
                #region Processus de teste
                // -- Si l'application est branché à la base de données -- //
                if (!AppSettings.CONNEXION_DB_BANKINGENTITIES)
                {
                    // -- Unicité du code -- //
                    if (Program.db.agences.Exists(l => l.id != obj.id && l.code == obj.code))
                    {
                        throw new GBException(App_Lang.Lang.Existing_data + " [code]");
                    }

                    // -- Modification de la valeur -- //
                    Program.db.agences
                    // -- Spécifier la recherche -- //
                    .Where(l => l.id == obj.id)
                    // -- Lister le résultat -- //
                    .ToList()
                    // -- Parcourir les elements résultats -- //
                    .ForEach(l =>
                    {
                        // -- Mise à jour de l'enregistrement -- //
                        l.code           = obj.code;
                        l.libelle        = obj.libelle;
                        l.id_utilisateur = obj.id_utilisateur;
                        l.utilisateur    = new UtilisateurDAO().ObjectId(obj.id_utilisateur);
                        l.adresse        = obj.adresse;
                        l.ville          = obj.ville;
                        l.bp             = obj.bp;
                        l.telephone      = obj.telephone;
                        l.pays           = obj.pays;
                        l.fax            = obj.fax;
                        l.cobac_id       = obj.cobac_id;
                        l.beac_id        = obj.beac_id;
                        l.ip             = obj.ip;
                        l.mot_de_passe   = obj.mot_de_passe;
                    });
                }
                #endregion

                #region Processus fonctionnel
                else
                {
                    // -- Définition du context -- //
                    using (BankingEntities db = new BankingEntities())
                    {
                        // -- Désactivation du Lasy loading -- //
                        db.Configuration.LazyLoadingEnabled = false;

                        // -- Rechercher l'objet à modifier -- //
                        agence ancien_obj = db.agences.Find(obj.code);

                        // -- Vérifier que l'objet est retournée -- //
                        if (ancien_obj == null)
                        {
                            throw new GBException(App_Lang.Lang.Object_not_found);
                        }

                        // -- Mise à jour de l'ancienne valeur -- //
                        obj.ModifyEntities(ancien_obj);

                        // -- Enregistrement de la données -- //
                        db.Entry <agence>(ancien_obj).State = System.Data.Entity.EntityState.Modified;

                        // -- Sauvegarder les changements -- //
                        db.SaveChanges();
                    }
                }
                #endregion

                // -- Execution des Hubs -- //
                #region Execution des Hubs
                applicationMainHub.RechargerCombo(new AgenceDAO());
                applicationMainHub.RechargerTable(this.id_page, this.connexion.hub_id_context);
                #endregion
            }
            #region Catch
            catch (Exception ex)
            {
                // -- Vérifier la nature de l'exception -- //
                if (!GBException.Est_GBexception(ex))
                {
                    // -- Log -- //
                    GBClass.Log.Error(ex);

                    // -- Renvoyer l'exception -- //
                    throw new GBException(App_Lang.Lang.Error_message_notification);
                }
                else
                {
                    // -- Renvoyer l'exception -- //
                    throw new GBException(ex.Message);
                }
            }
            #endregion
        }
Ejemplo n.º 7
0
        public IHttpActionResult UpdateCustDetail(int user_id, Registration registration)
        {
            try
            {
                CustomerDetail customer = new CustomerDetail
                {
                    cust_id             = registration.cust_id,
                    title               = registration.title,
                    first_name          = registration.first_name,
                    middle_name         = registration.middle_name,
                    last_name           = registration.last_name,
                    fathers_name        = registration.fathers_name,
                    mobile_number       = registration.mobile_number,
                    email               = registration.email,
                    aadhar              = registration.aadhar,
                    pan_card            = registration.pan_card,
                    pan_doc             = registration.pan_doc,
                    dob                 = registration.dob,
                    occupation_type     = registration.occupation_type,
                    source_of_income    = registration.source_of_income,
                    gross_annual_income = registration.gross_annual_income,
                    debit_card          = registration.debit_card,
                    net_banking         = registration.net_banking,
                    approval_status     = registration.approval_status
                };

                db.Entry(customer).State = EntityState.Modified;
                db.SaveChanges();


                if (registration.type_of_address == "Yes")
                {
                    CustAddress addr = new CustAddress
                    {
                        cust_id         = registration.cust_id,
                        type_of_address = "same",
                        line1           = registration.line1,
                        line2           = registration.line2,
                        landmark        = registration.landmark,
                        city            = registration.city,
                        cust_state      = registration.cust_state,
                        pin_code        = registration.pin_code
                    };
                    db.Entry(addr).State = EntityState.Modified;
                    db.SaveChanges();
                }
                else
                {
                    CustAddress addr = new CustAddress
                    {
                        cust_id         = registration.cust_id,
                        type_of_address = "Permanent",
                        line1           = registration.line1,
                        line2           = registration.line2,
                        landmark        = registration.landmark,
                        city            = registration.city,
                        cust_state      = registration.cust_state,
                        pin_code        = registration.pin_code
                    };
                    db.Entry(addr).State = EntityState.Modified;
                    db.SaveChanges();

                    CustAddress addr2 = new CustAddress
                    {
                        cust_id         = registration.cust_id,
                        type_of_address = "Resident",
                        line1           = registration.line1_residential,
                        line2           = registration.line2_residential,
                        landmark        = registration.landmark_residential,
                        city            = registration.city_residential,
                        cust_state      = registration.cust_state_residential,
                        pin_code        = registration.pin_code_residential
                    };
                    db.Entry(addr2).State = EntityState.Modified;
                    db.SaveChanges();
                }
                return(Ok(new { message = "Okay", customer.cust_id }));
            }
            catch (Exception e)
            {
                while (e.InnerException != null)
                {
                    e = e.InnerException;
                }
                return(Ok(new { message = "Exception", exception_message = e.Message }));
            }
        }
Ejemplo n.º 8
0
        private static void Mise_a_jour_devise_actuelle(string id, BankingEntities db, List <string> ids_supprimer = null)
        {
            try
            {
                // -- Si l'identifiant est retournée - //
                if (id != null)
                {
                    // -- Rechercher l'objet à modifier -- //
                    db.devises.Where(l => l.devcod != id && l.CurrentCurrency == "Yes")
                    .ToList()
                    .ForEach(ancien_obj =>
                    {
                        // -- Vérifier que l'objet est retournée -- //
                        if (ancien_obj != null)
                        {
                            // -- Mise à jour de l'ancienne valeur -- //
                            ancien_obj.CurrentCurrency = "No";

                            // -- Enregistrement de la données -- //
                            db.Entry <devise>(ancien_obj).State = System.Data.Entity.EntityState.Modified;
                        }
                    });
                }
                else
                {
                    // -- Vérifier si il n'existe plus de devise active -- //
                    if (db.devises.Where(l => ids_supprimer.Count(ll => ll == l.devcod) == 0).Count(l => l.CurrentCurrency == "Yes") == 0)
                    {
                        // -- Réccupérer une devise à définir comme active -- //
                        devise ancien_obj = db.devises.FirstOrDefault(l => ids_supprimer.Count(ll => ll == l.devcod) == 0);

                        // -- Si la devise n'est pas trouvée -- //
                        if (ancien_obj == null)
                        {
                            return;
                        }

                        // -- Mise à jour de l'ancienne valeur -- //
                        ancien_obj.CurrentCurrency = "Yes";

                        // -- Enregistrement de la données -- //
                        db.Entry <devise>(ancien_obj).State = System.Data.Entity.EntityState.Modified;
                    }
                }
            }
            #region Catch
            catch (Exception ex)
            {
                // -- Vérifier la nature de l'exception -- //
                if (!GBException.Est_GBexception(ex))
                {
                    // -- Log -- //
                    GBClass.Log.Error(ex);

                    // -- Renvoyer l'exception -- //
                    throw new GBException(App_Lang.Lang.Error_message_notification);
                }
                else
                {
                    // -- Renvoyer l'exception -- //
                    throw new GBException(ex.Message);
                }
            }
            #endregion
        }
Ejemplo n.º 9
0
        private static void Mise_a_jour_devise_actuelle(string id)
        {
            try
            {
                #region Processus de teste
                // -- Si l'application est branché à la base de données -- //
                if (!AppSettings.CONNEXION_DB_BANKINGENTITIES)
                {
                    // -- Vérification de la nature de l'identifiant -- //
                    if (long.Parse(id) <= 0)
                    {
                        throw new GBException(App_Lang.Lang.The_object_must_have_a_unique_id);
                    }

                    Program.db.devises
                    .Where(l => l.id != id)
                    .ToList()
                    .ForEach(l =>
                    {
                        l.devise_actuelle = false;
                    }
                             );
                }
                #endregion

                #region Processus fonctionnel
                else
                {
                    // -- Définition du context -- //
                    using (BankingEntities db = new BankingEntities())
                    {
                        // -- Désactivation du Lasy loading -- //
                        db.Configuration.LazyLoadingEnabled = false;

                        // -- Rechercher l'objet à modifier -- //
                        devise ancien_obj = db.devises.Find(id);

                        // -- Vérifier que l'objet est retournée -- //
                        if (ancien_obj == null)
                        {
                            throw new GBException(App_Lang.Lang.Object_not_found);
                        }

                        // -- Mise à jour de l'ancienne valeur -- //
                        ancien_obj.CurrentCurrency = "No";

                        // -- Enregistrement de la données -- //
                        db.Entry <devise>(ancien_obj).State = System.Data.Entity.EntityState.Modified;

                        // -- Sauvegarder les changements -- //
                        db.SaveChanges();
                    }
                }
                #endregion
            }
            #region Catch
            catch (Exception ex)
            {
                // -- Vérifier la nature de l'exception -- //
                if (!GBException.Est_GBexception(ex))
                {
                    // -- Log -- //
                    GBClass.Log.Error(ex);

                    // -- Renvoyer l'exception -- //
                    throw new GBException(App_Lang.Lang.Error_message_notification);
                }
                else
                {
                    // -- Renvoyer l'exception -- //
                    throw new GBException(ex.Message);
                }
            }
            #endregion
        }
Ejemplo n.º 10
0
        public void Modifier(Utilisateur obj)
        {
            try
            {
                #region Processus de teste
                // -- Si l'application est branché à la base de données -- //
                if (!AppSettings.CONNEXION_DB_BANKINGENTITIES)
                {
                    // -- Unicité du code -- //
                    if (Program.db.utilisateurs.Exists(l => l.id_utilisateur != obj.id_utilisateur && l.compte == obj.compte))
                    {
                        throw new GBException(App_Lang.Lang.Existing_data + " [compte]");
                    }

                    // -- Modification de la valeur -- //
                    Program.db.utilisateurs
                    // -- Spécifier la recherche -- //
                    .Where(l => l.id_utilisateur == obj.id_utilisateur)
                    // -- Lister le résultat -- //
                    .ToList()
                    // -- Parcourir les elements résultats -- //
                    .ForEach(l =>
                    {
                        // -- Mise à jour de l'enregistrement -- //
                        l.compte                        = obj.compte;
                        l.nom_utilisateur               = obj.nom_utilisateur;
                        l.id_agence                     = obj.id_agence;
                        l.agence                        = new AgenceDAO().ObjectId(obj.id_agence);
                        l.id_profession                 = obj.id_profession;
                        l.profession                    = new ProfessionDAO().ObjectId(obj.id_profession);
                        l.id_autorite_signature         = obj.id_autorite_signature;
                        l.autorite_signature            = new AutoriteSignatureDAO().ObjectId(obj.id_autorite_signature);
                        l.ouverture_back_date           = obj.ouverture_back_date;
                        l.ouverture_back_date_travail   = obj.ouverture_back_date_travail;
                        l.ouverture_branch              = obj.ouverture_branch;
                        l.est_connecte                  = obj.est_connecte;
                        l.est_suspendu                  = obj.est_suspendu;
                        l.duree_mot_de_passe            = obj.duree_mot_de_passe;
                        l.date_mise_a_jour_mot_de_passe = DateTime.Now.AddMonths(obj.duree_mot_de_passe).Ticks;
                        // -- Mise à jour du mot de passe -- //
                        if (obj.modifier_mot_de_passe)
                        {
                            l.mot_de_passe = obj.mot_de_passe;
                        }
                    });
                }
                #endregion

                #region Processus fonctionnel
                else
                {
                    // -- Définition du context -- //
                    using (BankingEntities db = new BankingEntities())
                    {
                        // -- Désactivation du Lasy loading -- //
                        db.Configuration.LazyLoadingEnabled = false;

                        // -- Rechercher l'objet à modifier -- //
                        Employe ancien_obj = db.Employes.Find(obj.code);

                        // -- Vérifier que l'objet est retournée -- //
                        if (ancien_obj == null)
                        {
                            throw new GBException(App_Lang.Lang.Object_not_found);
                        }

                        // -- Mise à jour de l'ancienne valeur -- //
                        obj.ModifyEntities(ancien_obj);

                        // -- Enregistrement de la données -- //
                        db.Entry <Employe>(ancien_obj).State = System.Data.Entity.EntityState.Modified;

                        // -- Sauvegarder les changements -- //
                        db.SaveChanges();
                    }
                }
                #endregion

                // -- Execution des Hubs -- //
                applicationMainHub.RechargerTable(this.id_page, this.connexion.hub_id_context);
                applicationMainHub.RechargerComboEasyAutocomplete(this, this.connexion.hub_id_context);
            }
            #region Catch
            catch (Exception ex)
            {
                // -- Vérifier la nature de l'exception -- //
                if (!GBException.Est_GBexception(ex))
                {
                    // -- Log -- //
                    GBClass.Log.Error(ex);

                    // -- Renvoyer l'exception -- //
                    throw new GBException(App_Lang.Lang.Error_message_notification);
                }
                else
                {
                    // -- Renvoyer l'exception -- //
                    throw new GBException(ex.Message);
                }
            }
            #endregion
        }
Ejemplo n.º 11
0
 public void updatePersonalDetail(Customer customer)
 {
     customer = (Customer)db.Customers.Where(cust => cust.AccountNumber == customer.AccountNumber);
     db.Entry(customer).State = EntityState.Modified;
     db.SaveChanges();
 }
Ejemplo n.º 12
0
        public void Modifier(AutoriteSignature obj)
        {
            try
            {
                #region Processus de teste
                // -- Si l'application est branché à la base de données -- //
                if (!AppSettings.CONNEXION_DB_BANKINGENTITIES)
                {
                    // -- Unicité du code -- //
                    if (Program.db.autorites_signature.Exists(l => l.id != obj.id && l.code == obj.code))
                    {
                        throw new GBException(App_Lang.Lang.Existing_data + " [code]");
                    }

                    // -- Modification de la valeur -- //
                    Program.db.autorites_signature
                    // -- Spécifier la recherche -- //
                    .Where(l => l.id == obj.id)
                    // -- Lister le résultat -- //
                    .ToList()
                    // -- Parcourir les elements résultats -- //
                    .ForEach(l =>
                    {
                        // -- Mise à jour de l'enregistrement -- //
                        l.code                     = obj.code;
                        l.libelle                  = obj.libelle;
                        l.montant_signature        = obj.montant_signature;
                        l.limite_decouvert_client  = obj.limite_decouvert_client;
                        l.debit_max_client         = obj.debit_max_client;
                        l.credit_max_client        = obj.credit_max_client;
                        l.montant_max_ligne_credit = obj.montant_max_ligne_credit;
                        l.montant_limite_pret      = obj.montant_limite_pret;
                    });
                }
                #endregion

                #region Processus fonctionnel
                else
                {
                    // -- Définition du context -- //
                    using (BankingEntities db = new BankingEntities())
                    {
                        // -- Désactivation du Lasy loading -- //
                        db.Configuration.LazyLoadingEnabled = false;

                        // -- Rechercher l'objet à modifier -- //
                        tabSigningAuthority ancien_obj = db.tabSigningAuthorities.Find(obj.code);

                        // -- Vérifier que l'objet est retournée -- //
                        if (ancien_obj == null)
                        {
                            throw new GBException(App_Lang.Lang.Object_not_found);
                        }

                        // -- Mise à jour de l'ancienne valeur -- //
                        obj.ModifyEntities(ancien_obj);

                        // -- Enregistrement de la données -- //
                        db.Entry <tabSigningAuthority>(ancien_obj).State = System.Data.Entity.EntityState.Modified;

                        // -- Sauvegarder les changements -- //
                        db.SaveChanges();
                    }
                }
                #endregion

                #region Execution des Hubs
                // -- Execution des Hubs -- //
                applicationMainHub.RechargerTable(this.id_page, this.connexion.hub_id_context);
                applicationMainHub.RechargerComboEasyAutocomplete(this, this.connexion.hub_id_context);
                #endregion
            }
            #region Catch
            catch (Exception ex)
            {
                // -- Vérifier la nature de l'exception -- //
                if (!GBException.Est_GBexception(ex))
                {
                    // -- Log -- //
                    GBClass.Log.Error(ex);

                    // -- Renvoyer l'exception -- //
                    throw new GBException(App_Lang.Lang.Error_message_notification);
                }
                else
                {
                    // -- Renvoyer l'exception -- //
                    throw new GBException(ex.Message);
                }
            }
            #endregion
        }