Exemplo n.º 1
0
        public ResponseToAllClients AllClients(bool include_inactive)
        {
            RequestAllClients    q  = new RequestAllClients(include_inactive);
            ResponseToAllClients ac = ResponseToAllClients.ResponseToAllTheClients(q);

            return(ac);
        }
Exemplo n.º 2
0
        public ResponseToAllClients ToAllClients(RequestAllClients requestAllClients)
        {
            ResponseToAllClients objToAllClients = new ResponseToAllClients();

            try
            {
                var clienteTbl = entities.clientTables.ToList();
                foreach (clientTable item in clienteTbl)
                {
                    Client tempClient = new Client();
                    tempClient.Client_State = item.STATE;
                    tempClient.Direction    = item.DIRECTION;
                    tempClient.Email        = item.EMAIL;
                    tempClient.ID_Number    = item.IDENTIFIER;
                    tempClient.Last_Name    = item.LAST;
                    tempClient.Name         = item.NAME;
                    tempClient.Password     = item.PASSWORD;
                    tempClient.Pin          = item.PIN;

                    var accountTbl = entities.accountTables.ToList();
                    foreach (accountTable element in accountTbl)
                    {
                        if (item.IDENTIFIER == tempClient.ID_Number)
                        {
                            Account tempAccount = new Account();
                            tempAccount.Account_Name  = element.ACCOUNT_NAME;
                            tempAccount.Account_State = element.ACCOUNT_STATE;
                            tempAccount.Account_Type  = element.ACCOUNT_TYPE;
                            tempAccount.Balance       = element.BALANCE;

                            tempClient.Accounts.Add(tempAccount);
                        }
                    }

                    tempClient.Number_Of_Accounts = tempClient.Accounts.Count;
                    objToAllClients.Success       = true;
                    objToAllClients.Message       = "Se ha encontrado todos los clientes!";
                }
            }
            catch
            {
                objToAllClients.Success = false;
                objToAllClients.Message = "Hubo un error en la busqueda de clientes, intentelo mas tarde";
            }

            return(objToAllClients);
        }