public ClientChangesResponse GetClientChanges(ClientChangesRequest request)
        {
            var response = new ClientChangesResponse {
                ResponseStatus = ResponseStatus.Success
            };

            var clientsProvider = new ClientsProvider();

            try
            {
                if (request.ActionType == ActionType.Select)
                {
                    response.Changes = clientsProvider.GetAllChanges(request);
                }
                else
                {
                    response.ResponseStatus      = ResponseStatus.Failure;
                    response.ResponseDescription = "Not update action";
                }
            }
            catch (Exception ex)
            {
                response.ResponseStatus      = ResponseStatus.Failure;
                response.ResponseDescription = ex.Message;
            }
            return(response);
        }
Example #2
0
        public List <DataBaseChange> GetAllChanges(ClientChangesRequest request)
        {
            var conn           = GetConnection(ConnectionNames.CSPSqlDatabase);
            var commandWrapper = GetStoredProcCommand("dbo.Get_All_Changes", conn);

            AddInParameter(commandWrapper, "@CustomerNumber", DbType.Int32, request.ClientId);

            IDataReader           reader = null;
            List <DataBaseChange> tmp    = new List <DataBaseChange>();

            try
            {
                conn.Open();
                reader = commandWrapper.ExecuteReader();
                FillChanges(reader, tmp, 0, int.MaxValue);
                MakeDboLog(request.ToString(), reader.ToString(), "dbo.Get_All_Changes");
                return(tmp);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                commandWrapper.Dispose();
                conn.Close();
            }
        }
        public ClientChangesRequest GetClientChangesRequest(int clientId)
        {
            var request = new ClientChangesRequest
            {
                ClientId   = clientId,
                ActionType = DataBaseCommunication.Mappers.Requests.ActionType.Select
            };

            return(request);
        }