Exemple #1
0
        public async Task <IList <Activity> > GetActivityByCaseID(long id)
        {
            var mapper = new CaseMapper();

            var param = new DynamicParameters();

            param.Add("@ID", id);

            return((await SqlMapper.QueryAsync(_unitOfWork.Connection,
                                               "GetActivityByCaseID",
                                               new[]
            {
                typeof(Activity),
                typeof(Officer),
                typeof(Attachment),
                typeof(Letter),
                typeof(Email),
            },
                                               obj =>
            {
                return mapper.MapActivity(obj[0] as Activity,
                                          obj[1] as Officer,
                                          obj[2] as Attachment,
                                          obj[3] as Letter,
                                          obj[4] as Email);
            },
                                               param,
                                               splitOn: "userID,activityAttachmentID,letterID,emailID",
                                               commandType: CommandType.StoredProcedure,
                                               transaction: _unitOfWork.Transaction)).Distinct().ToList());
        }
Exemple #2
0
        private static void Main(string[] args)
        {
            var authority             = "https://login.microsoftonline.com/common/";
            var authenticationContext = new AuthenticationContext(authority, new TokenCache());

            var result = authenticationContext.AcquireTokenAsync(
                "https://api.support.microsoft.com",
                "ad9a38dc-2fa5-4863-9557-4f9b4a23e44b",
                new Uri("https://casebuddy.microsoft.com"),
                new PlatformParameters(PromptBehavior.Always),
                new UserIdentifier("*****@*****.**", UserIdentifierType.OptionalDisplayableId)).Result;

            var x   = authenticationContext.TokenCache.Serialize();
            var str = Convert.ToBase64String(x);

            using (var client = new WebClient {
                Headers =
                {
                    ["Content-Type"] = "application/json",
                    ["Authorization"] = $"Bearer {result.AccessToken}",
                    ["cache-control"] = "no-cache"
                }
            }) {
                var data     = JsonConvert.SerializeObject(QueryMakeQuery("*****@*****.**"));
                var response = client.UploadData("https://api.support.microsoft.com/v0/queryidresult", "POST", Encoding.UTF8.GetBytes(data));
                var res      = JsonConvert.DeserializeObject <Welcome>(Encoding.UTF8.GetString(response));
                var tParam   = res.TableParameters.Single();
                foreach (var @case in Enumerable.Range(0, tParam.RowCount).
                         Select(index => CaseMapper.Map(tParam.HeaderNames, res.TableParameters.First().TableParameterResult[index])))
                {
                    CaseStorage.AddCase(@case);
                }
            }
        }
        public async Task <Case> GetCaseByIdAsync(int caseId)
        {
            try
            {
                Cases dbCase = await _context.Cases
                               .Include(c => c.Appointments)
                               .Include(c => c.Casenotes)
                               .Include(c => c.Currentstatus)
                               .Include(c => c.Activeconsultant)
                               .ThenInclude(u => u.UserroleNavigation)
                               .FirstOrDefaultAsync(c => c.Caseid == caseId);

                if (dbCase == null)
                {
                    return(null);
                }

                Case aCase = CaseMapper.Map(dbCase);

                List <Caseclient> caseClients = _context.Caseclient.Where(cc => cc.Caseid == caseId).ToList();
                foreach (Caseclient cc in caseClients)
                {
                    Users dbUser = await _context.Users.FirstOrDefaultAsync(u => u.Rowid == cc.Clientid);

                    _context.Entry(dbUser).Reference(u => u.UserroleNavigation).Load();
                    aCase.Clients.Add(UserMapper.Map(dbUser));
                }

                return(aCase);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Exemple #4
0
        public async Task <Model.Case> GetByID(long id)
        {
            var mapper = new CaseMapper();

            var param = new DynamicParameters();

            param.Add("@ID", id);

            return((await SqlMapper.QueryAsync(_unitOfWork.Connection,
                                               "GetCaseByID",
                                               new[]
            {
                typeof(Model.Case),
                typeof(Offender),
                typeof(ContactInfo),
                typeof(Officer),
                typeof(Officer),
                typeof(Person),
                typeof(ContactInfo),
                typeof(Master),
                typeof(Master),
                typeof(Attachment),
                typeof(Certificate),
                typeof(Premise),
                typeof(SanctionInfo),
            },
                                               obj =>
            {
                return mapper.Map(obj[0] as Model.Case,
                                  obj[1] as Offender,
                                  obj[2] as ContactInfo,
                                  obj[3] as Officer,
                                  obj[4] as Officer,
                                  obj[5] as Person,
                                  obj[6] as ContactInfo,
                                  obj[7] as Master,
                                  obj[8] as Master,
                                  obj[9] as Attachment,
                                  obj[10] as Certificate,
                                  obj[11] as Premise,
                                  obj[12] as SanctionInfo);
            },
                                               param,
                                               splitOn: "offenderID,offenderContactID,managedByID,assignedToID,reporterID,contactID,breachID," +
                                               "offences,attachmentID,certificateID,premiseID,sanctionInfoID",
                                               commandType: CommandType.StoredProcedure,
                                               transaction: _unitOfWork.Transaction)).Distinct().FirstOrDefault());
        }
        // NOTE: AddCaseAsync isnt able to delay saving due to needing to query the db in order to get the id,
        //  which is accomplished by saving
        public async Task <bool> AddCaseAsync(Case targetCase, bool save = true)
        {
            try
            {
                // Add the case
                Cases dbCase = _context.Cases.Add(CaseMapper.Map(targetCase)).Entity;
                await _context.SaveChangesAsync();

                // Next, add the caseclient entry for every client
                foreach (User user in targetCase.Clients)
                {
                    Caseclient dbCaseclient = _context.Caseclient.Add(new Caseclient
                    {
                        Caseid   = dbCase.Caseid,
                        Clientid = user.Id
                    }).Entity;

                    user.Cases.Add(targetCase);
                    await _user.UpdateUserAsync(user, false);

                    dbCase.Caseclient.Add(dbCaseclient);
                }

                // Next, add all of the case's appointments, if any
                foreach (Appointment a in targetCase.Appointments)
                {
                    await _appointment.AddAppointmentToCaseAsync(targetCase, a, false);
                }

                // Finally, add all of the case's notes, if any
                foreach (Note cn in targetCase.Notes)
                {
                    await _note.AddNoteToCaseAsync(targetCase, cn, false);
                }

                if (save)
                {
                    await _context.SaveChangesAsync();
                }

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Exemple #6
0
        public static async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log)
        {
            var by = Convert.FromBase64String(
                "AwAAAAEAAACOAWh0dHBzOi8vbG9naW4ud2luZG93cy5uZXQvNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjQ3Lzo6Omh0dHBzOi8vYXBpLnN1cHBvcnQubWljcm9zb2Z0LmNvbTo6OmFkOWEzOGRjLTJmYTUtNDg2My05NTU3LTRmOWI0YTIzZTQ0Yjo6OjDrInsiUmF3Q2xpZW50SW5mbyI6ImV5SjFhV1FpT2lKa1pEVm1PV1k0TXkwd1pqVm1MVFEyWXpNdFlqYzBNUzAwWlRJNVpUVTVOVGMwTXpjaUxDSjFkR2xrSWpvaU56Sm1PV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UXVZMjl0SWl3aWRYQnVJam9pYUdGemRXNW5kVUJ0YVdOeWIzTnZablF1WTI5dElpd2lkbVZ5SWpvaU1TNHdJbjAuIiwiVGVuYW50SWQiOiI3MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDciLCJVc2VySW5mbyI6eyJEaXNwbGF5YWJsZUlkIjoiaGFzdW5ndUBtaWNyb3NvZnQuY29tIiwiRmFtaWx5TmFtZSI6IlN1bmd1IiwiR2l2ZW5OYW1lIjoiRW1yYWgiLCJJZGVudGl0eVByb3ZpZGVyIjoiaHR0cHM6XC9cL3N0cy53aW5kb3dzLm5ldFwvNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjQ3XC8iLCJQYXNzd29yZENoYW5nZVVybCI6bnVsbCwiUGFzc3dvcmRFeHBpcmVzT24iOm51bGwsIlVuaXF1ZUlkIjoiZGQ1ZjlmODMtMGY1Zi00NmMzLWI3NDEtNGUyOWU1OTU3NDM3In19LCJVc2VyQXNzZXJ0aW9uSGFzaCI6bnVsbH0=");
            var to = new TokenCache(by);


            var authority             = "https://login.microsoftonline.com/common/";
            var authenticationContext = new AuthenticationContext(authority, to);

            var result = authenticationContext.AcquireTokenAsync(
                "https://api.support.microsoft.com",
                "ad9a38dc-2fa5-4863-9557-4f9b4a23e44b",
                new Uri("https://casebuddy.microsoft.com"),
                new PlatformParameters(PromptBehavior.Auto, new Ui()),
                new UserIdentifier("*****@*****.**", UserIdentifierType.OptionalDisplayableId)).Result;



            var hashset = new HashSet <string>();

            using (var client = new WebClient
            {
                Headers =
                {
                    ["Content-Type"] = "application/json",
                    ["Authorization"] = $"Bearer {result.AccessToken}",
                    ["cache-control"] = "no-cache"
                }
            })
            {
                var jsondata = JsonConvert.SerializeObject(QueryMakeQuery("*****@*****.**"));
                var response = client.UploadData("https://api.support.microsoft.com/v0/queryidresult", "POST", Encoding.UTF8.GetBytes(jsondata));
                var res      = JsonConvert.DeserializeObject <Welcome>(Encoding.UTF8.GetString(response));
                var tParam   = res.TableParameters.Single();
                foreach (var @case in Enumerable.Range(0, tParam.RowCount).
                         Select(index => CaseMapper.Map(tParam.HeaderNames, res.TableParameters.First().TableParameterResult[index])))
                {
                    hashset.Add(@case.CaseNumber);
                }
            }
            log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
            return(new OkObjectResult(hashset.OrderBy(x => x).Last()));
        }
Exemple #7
0
        public async Task <IEnumerable <Model.Case> > Select(CaseOptions options)
        {
            var mapper           = new CaseMapper();
            var assignedToTable  = new DataTable();
            var managedByTable   = new DataTable();
            var offenceTypeTable = new DataTable();
            var statusTable      = new DataTable();

            assignedToTable.Columns.Add("Val", typeof(Guid));
            managedByTable.Columns.Add("Val", typeof(Guid));
            offenceTypeTable.Columns.Add("Val", typeof(Guid));
            statusTable.Columns.Add("Val", typeof(long));

            if (options.AssignedTo?.Any() ?? false)
            {
                foreach (var assignedTo in options.AssignedTo)
                {
                    assignedToTable.Rows.Add(assignedTo);
                }
            }

            if (options.ManagedBy?.Any() ?? false)
            {
                foreach (var managedBy in options.ManagedBy)
                {
                    managedByTable.Rows.Add(managedBy);
                }
            }

            if (options.OffenceType?.Any() ?? false)
            {
                foreach (var offenceType in options.OffenceType)
                {
                    offenceTypeTable.Rows.Add(offenceType);
                }
            }

            if (options.Status?.Any() ?? false)
            {
                foreach (var statustype in options.Status)
                {
                    statusTable.Rows.Add(statustype);
                }
            }

            var param = new DynamicParameters();

            param.Add("@ID", options.ID);
            param.Add("@OffenceType", offenceTypeTable.AsTableValuedParameter("dbo.UniqueIdentifierType"));
            param.Add("@Source", options.Source);
            param.Add("@ManagedBy", managedByTable.AsTableValuedParameter("dbo.UniqueIdentifierType"));
            param.Add("@AssignedTO", assignedToTable.AsTableValuedParameter("dbo.UniqueIdentifierType"));
            param.Add("@Status", statusTable.AsTableValuedParameter("dbo.BigIntType"));
            param.Add("@From", options.From);
            param.Add("@To", options.To);

            return((await SqlMapper.QueryAsync(_unitOfWork.Connection,
                                               "SelectCase",
                                               new[]
            {
                typeof(Model.Case),
                typeof(Officer),
                typeof(Officer),
                typeof(Person),
                typeof(Master),
                typeof(Master),
                typeof(Offender),
            },
                                               obj =>
            {
                return mapper.Map(obj[0] as Model.Case,
                                  obj[6] as Offender,
                                  null,
                                  obj[1] as Officer,
                                  obj[2] as Officer,
                                  obj[3] as Person,
                                  null,
                                  obj[4] as Master,
                                  obj[5] as Master);
            },
                                               param,
                                               splitOn: "managedByID,assignedToID,reporterID,breachID,offences,offenderID",
                                               commandType: CommandType.StoredProcedure,
                                               transaction: _unitOfWork.Transaction)).Distinct());
        }
 public CaseMapperTests()
 {
     _sut = new CaseMapper();
 }