コード例 #1
0
ファイル: LogTest.cs プロジェクト: jneufeld/cs319
        public void SetupData()
        {
            // make sure the test user doesn't exist
            Membership.DeleteUser("user1");

            request = new Request();
            user = Membership.CreateUser("user1", "Password1!", "*****@*****.**");

            db.SaveChanges();
        }
コード例 #2
0
ファイル: Log.cs プロジェクト: jneufeld/cs319
 public static Log Create(Request request, MembershipUser user)
 {
     Log log = new Log
     {
         Action = (int)LogAction.CREATE,
         UserID = (Guid)user.ProviderUserKey,
         RequestID = request.ID,
         TimePerformed = DateTime.UtcNow,
     };
     return log;
 }
コード例 #3
0
ファイル: RequestViewModel.cs プロジェクト: jneufeld/cs319
 public void MapToRequestPatient(Request r)
 {
     r.Patient.ID = PatientID;
     r.Patient.AgencyID = PatientAgencyID;
     r.Patient.FirstName = PatientFirstName;
     r.Patient.LastName = PatientLastName;
     Gender gender;
     bool parse = Enum.TryParse(PatientGender, true, out gender);
     if (parse)
         r.Patient.Gender = (int)gender;
     r.Patient.Age = PatientAge;
 }
コード例 #4
0
ファイル: RequestViewModel.cs プロジェクト: jneufeld/cs319
        public void MapToRequest(Request r)
        {
            r.ID = RequestID;

            r.Caller.ID = CallerID;
            r.Caller.FirstName = CallerFirstName;
            r.Caller.LastName = CallerLastName;
            r.Caller.PhoneNumber = CallerPhoneNumber;
            r.Caller.Email = CallerEmail;
        }
コード例 #5
0
ファイル: RequestViewModel.cs プロジェクト: jneufeld/cs319
 public static RequestViewModel CreateFromRequest(Request r)
 {
     MembershipUser createdBy = Membership.GetUser(r.CreatedBy);
     MembershipUser closedBy = Membership.GetUser(r.ClosedBy);
     RequestViewModel requestViewModel = new RequestViewModel
     {
         RequestID = r.ID,
         CreationTime = r.CreationTime.ToLocalTime().ToString(),
         CompletionTime = r.CompletionTime != null ? r.CompletionTime.Value.ToLocalTime().ToString() : "",
         RequesterTypeID = r.Caller.Type != null ? r.Caller.Type.ID : 0,
         RequesterTypeString = r.Caller.Type != null ? r.Caller.Type.ToString() : "",
         Status = r.CompletionTime != null ? "Closed" : "Open",
         CallerID = r.Caller.ID,
         CallerFirstName = r.Caller.FirstName,
         CallerLastName = r.Caller.LastName,
         CallerPhoneNumber = r.Caller.PhoneNumber,
         CallerEmail = r.Caller.Email,
         CallerRegionID = r.Caller.Region != null ? r.Caller.Region.ID : 0,
         CallerRegionString = r.Caller.Region != null ? r.Caller.Region.FullName : "",
         PatientID = r.Patient.ID,
         PatientAgencyID = r.Patient.AgencyID,
         PatientFirstName = r.Patient.FirstName,
         PatientLastName = r.Patient.LastName,
         PatientGender = ((Gender)r.Patient.Gender).ToString(),
         PatientAge = r.Patient.Age,
         Questions = new List<QuestionViewModel>(),
         CreatedBy = createdBy != null ? createdBy.UserName : "",
         ClosedBy = closedBy != null ? closedBy.UserName : "",
     };
     int idx = 0;
     foreach (Question q in r.Questions)
     {
         requestViewModel.Questions.Add(QuestionViewModel.CreateFromQuestion(q, idx));
         idx++;
     }
     requestViewModel.QuestionCount = idx;
     return requestViewModel;
 }