예제 #1
0
		public static void AddServicesToRegistration(Registration registration, params Service[] services)
		{
			foreach (var service in services)
			{
				//registration.AddService(service);
			}
		}
예제 #2
0
		public static void AddRenewalToRegistration(Registration registration, params Renewal[] renewals)
		{
			foreach (var renewal in renewals)
			{
				registration.AddRenewal(renewal);
			}
		}
        public HttpResponseMessage Get(int id)
        {
            using (var session = NHibernateHelper.CreateSessionFactory())
            {
                using (var transaction = session.BeginTransaction())
                {
                    var registrations = new List<Registration>(session.CreateCriteria(typeof(Registration)).List<Registration>());

                    var registration = registrations.FirstOrDefault(x => x.Id == id);

                    var staffings = session.CreateCriteria(typeof (Staffing)).List<Staffing>();
                    var services = session.CreateCriteria(typeof (Service)).List<Service>();

                    if (registration == null)
                    {
                        registration = new Registration();
					
                        foreach (var service in services)
                        {
                            registration.RegistrationServices.Add(new RegistrationService
                            {
                                Registration = registration,
                                Selected = false,
                                Service = service
                            });
                        }

                    }
                    else
                    {

                        // Services
                        foreach (var service in services)
                        {
                            if (registration.RegistrationServices.FirstOrDefault(x => x.Service.Id == service.Id) == null)
                            {
                                var rs = new RegistrationService
                                {
                                    Registration = registration,
                                    Service = service,
                                    Selected = false
                                };
                                registration.RegistrationServices.Add(rs);
                            }
                        }
                    }

                    // trim excess
                    if (registration.Category != null)
                    {
                        if (registration.Category.Costings != null) registration.Category.Costings = null;
                    }

                    return WebApiHelper.ObjectToHttpResponseMessage(registration);
                }

            }
        }
        public HttpResponseMessage Post([FromBody]JToken body)
		{

		    using (var session = NHibernateHelper.CreateSessionFactory())
		    {
		        using (var transaction = session.BeginTransaction())
		        {
                    if (AuthHelper.JwtAuth() != 1)
                    {
                        return WebApiHelper.ObjectToHttpResponseMessage("No token was supplied", System.Net.HttpStatusCode.Unauthorized);
                    }


                    var stateId = Convert.ToInt32(AuthHelper.GetKey("stateId"));

                    var id = body.Value<decimal>("Id");

		            var r = PopulateRegistration(body);

                    var registration = new Registration();
                    Renewal renewal = null;

                    if (id != 0) 
                    {
                        // Existing Registration
                        var registrations = new List<Registration>(session.CreateCriteria(typeof(Registration)).List<Registration>());
                        registration = registrations.FirstOrDefault(x => x.Id == id);
                    }
                    else
                    {
                        // New Registration
                        var renewalType = new List<RenewalType>(session.CreateCriteria(typeof(RenewalType)).List<RenewalType>());
                        var renewalTypeToInsert = renewalType.FirstOrDefault(x => x.Id >= 1);

                        var costing = new List<Costing>(session.CreateCriteria(typeof(Costing)).List<Costing>());
                        var costingTypeToInsert = costing.FirstOrDefault(x => x.Category.Id == r.Category.Id && x.State.Id == stateId);

                        renewal = new Renewal
                        {
                            Date = DateTime.Now,
                            RenewalType = renewalTypeToInsert,
                            Registration = registration,
                            Amount = costingTypeToInsert.RenewalCost
                        };

                        registration.Renewals.Add(renewal);
                    }

                    if (registration != null)
                    {
                        //
                        registration.CacNumber = r.CacNumber ?? "";
                        var isRenewal = r.Renewals.FirstOrDefault(x => x.Id == 0) != null ? true : false;
                        if (isRenewal)
                        {
                            registration.LastRenewalDate = DateTime.Now;

                            var renewalType = new List<RenewalType>(session.CreateCriteria(typeof(RenewalType)).List<RenewalType>());
                            var renewalTypeToInsert = renewalType.FirstOrDefault(x => x.Id >= 2);

                            var costing = new List<Costing>(session.CreateCriteria(typeof(Costing)).List<Costing>());
                            var costingTypeToInsert = costing.FirstOrDefault(x => x.Category.Id == r.Category.Id && x.State.Id == stateId);

                            renewal = new Renewal
                            {
                                Date = DateTime.Now,
                                RenewalType = renewalTypeToInsert,
                                Registration = registration,
                                Amount = costingTypeToInsert.RenewalCost
                            };
                            registration.Renewals.Add(renewal);
                        }
                        else
                        {
                            registration.LastRenewalDate = r.LastRenewalDate;
                        }

                        registration.RegistrationDate = r.RegistrationDate;
                        registration.ProprietorFirstName = r.ProprietorFirstName ?? "";
                        registration.ProprietorLastName = r.ProprietorLastName ?? "";
                        registration.ProprietorGender = r.ProprietorGender ?? "";
                        registration.ProprietorNinNumber = r.ProprietorNinNumber ?? "";
                        registration.ProprietorIsMedicalDirector = r.ProprietorIsMedicalDirector;
                        registration.ProprietorMobile1 = r.ProprietorMobile1 ?? "";
                        registration.ProprietorMobile2 = r.ProprietorMobile2 ?? "";
                        registration.ProprietorEmailAddress = r.ProprietorEmailAddress ?? "";

                        registration.MedicalDirectorFirstName = r.MedicalDirectorFirstName ?? "";
                        registration.MedicalDirectorLastName = r.MedicalDirectorLastName ?? "";
                        registration.MedicalDirectorGender = r.MedicalDirectorGender;
                        registration.MedicalDirectorNinNumber = r.MedicalDirectorNinNumber ?? "";
                        registration.MedicalDirectorMobile1 = r.MedicalDirectorMobile1 ?? "";
                        registration.MedicalDirectorMobile2 = r.MedicalDirectorMobile2 ?? "";
                        registration.MedicalDirectorEmailAddress = r.MedicalDirectorEmailAddress ?? "";

                        registration.AdministratorFirstName = r.AdministratorFirstName ?? "";
                        registration.AdministratorLastName = r.AdministratorLastName ?? "";
                        registration.AdministratorMobile1 = r.AdministratorMobile1 ?? "";
                        registration.AdministratorMobile2 = r.AdministratorMobile2 ?? "";

                        registration.EstablishmentName = r.EstablishmentName ?? "";

                        registration.TypeOfEstablishment = r.TypeOfEstablishment;

                        registration.ProfessionalBody = r.ProfessionalBody;

                        registration.NoOfBeds = r.NoOfBeds;

                        registration.AddressLine1 = r.AddressLine1 ?? "";
                        registration.AddressLine2 = r.AddressLine2 ?? "";
                        registration.LandMark = r.LandMark ?? "";

                        registration.Latitude = r.Latitude;
                        registration.Longitude = r.Longitude;

                        // Add 
                        foreach (var rs in r.RegistrationTypeOfEstablishmentStaffing)
                        {
                            rs.Registration = registration;
                        }
                        registration.RegistrationTypeOfEstablishmentStaffing = r.RegistrationTypeOfEstablishmentStaffing;
						

                        foreach (var rs in r.RegistrationServices)
                        {
                            var registrationService = registration.RegistrationServices.FirstOrDefault(x => x.Service.Name == rs.Service.Name);

                            if (registrationService != null)
                            {
                                registrationService.Selected = rs.Selected;
                            }
                            else
                            {
                                var serviceToAdd = session.CreateCriteria(typeof(Service)).List<Service>().FirstOrDefault(x => x.Name == rs.Service.Name);

                                var regService = new RegistrationService
                                {
                                    Registration = registration,
                                    Service = serviceToAdd,
                                    Selected = rs.Selected
                                };
                                // if not in db, add it
                                registration.AddRegistrationService(regService);
                            }

                        }

                        registration.ProfessionalBodyAttendance = r.ProfessionalBodyAttendance ?? "";
                        registration.ProfessionalBodyInvolvement = r.ProfessionalBodyInvolvement ?? "";
                        registration.ProfessionalBodyRemarks = r.ProfessionalBodyRemarks ?? "";
                        registration.ProfessionalBodyFirstName = r.ProfessionalBodyFirstName ?? "";
                        registration.ProfessionalBodyLastName = r.ProfessionalBodyLastName ?? "";
                        registration.ProfessionalBodyPosition = r.ProfessionalBodyPosition ?? "";
                        registration.ProfessionalBodySignatureDate = r.ProfessionalBodySignatureDate;

                        registration.AcceptanceDetailsAccepted = r.AcceptanceDetailsAccepted;
                        registration.AcceptanceDetailsReason = r.AcceptanceDetailsReason ?? "";

                        registration.Category =
                            (from x in session.CreateCriteria(typeof(Category)).List<Category>()
                             where x.Id == r.Category.Id
                             select x).FirstOrDefault();

                        registration.Location =
                            (from x in session.CreateCriteria(typeof(Location)).List<Location>()
                             where x.Id == r.Location.Id
                             select x).FirstOrDefault();

                        registration.Created = DateTime.Now;
                        registration.Modified = DateTime.Now;
                        registration.Deleted = false;
                    }

                    session.SaveOrUpdate(registration);
                    if (renewal != null)
                    {
                        session.SaveOrUpdate(renewal);
                    }
                    transaction.Commit();

                    return Get(registration.Id);
		        }
		    }
		}
		/*

		public HttpResponseMessage Post([FromBody]FormDataCollection  body)
		{
			var field1Values = body.GetValues("ProfessionalBody");

			return null;
		}
         * 
         * 
*/

        Registration PopulateRegistration(JToken j)
        {
            var registration = new Registration();

            // Main details
            registration.PhermcRegistrationNumber = j["PhermcRegistrationNumber"].ToObject<string>();
            registration.LastRenewalDate = j["LastRenewalDate"].ToObject<DateTime?>();
            registration.CacNumber = (string)j["CacNumber"];
            registration.RegistrationDate = j["RegistrationDate"].ToObject<DateTime>();

            // Proprietor details
            registration.ProprietorGender = (string)j["ProprietorGender"];
            registration.ProprietorFirstName = (string)j["ProprietorFirstName"];
            registration.ProprietorNinNumber = (string)j["ProprietorNinNumber"];
            registration.ProprietorEmailAddress = (string)j["ProprietorEmailAddress"];
            registration.PaymentMethod = (string)j["ProprietorLastName"];
            registration.ProprietorLastName = (string)j["ProprietorLastName"];
            registration.ProprietorMobile2 = (string)j["ProprietorMobile2"];
            registration.ProprietorIsMedicalDirector = (bool)j["ProprietorIsMedicalDirector"];
            registration.ProprietorMobile1 = (string)j["ProprietorMobile1"];

            // Professional body details
            registration.ProfessionalBodyAttendance = (string) j["ProfessionalBodyAttendance"];
            registration.ProfessionalBodyFirstName = (string) j["ProfessionalBodyFirstName"];
            registration.ProfessionalBodyLastName = (string) j["ProfessionalBodyLastName"];
            registration.ProfessionalBodyRemarks = (string) j["ProfessionalBodyRemarks"];
            registration.ProfessionalBodyPosition = (string) j["ProfessionalBodyPosition"];
            registration.MedicalDirectorFirstName = (string) j["MedicalDirectorFirstName"];
            registration.AddressLine1 = (string) j["AddressLine1"];
            registration.AddressLine2 = (string) j["AddressLine2"];
            registration.MedicalDirectorEmailAddress = (string) j["MedicalDirectorEmailAddress"];
            registration.AcceptanceDetailsReason = (string) j["AcceptanceDetailsReason"];


            registration.MedicalDirectorNinNumber = (string) j["MedicalDirectorNinNumber"];
            registration.MedicalDirectorLastName = (string) j["MedicalDirectorLastName"];
            registration.MedicalDirectorGender = (string) j["MedicalDirectorGender"];
            registration.MedicalDirectorMobile1 = (string) j["MedicalDirectorMobile1"];
            registration.MedicalDirectorMobile2 = (string)j["MedicalDirectorMobile2"];


            registration.EstablishmentName = (string)j["EstablishmentName"];
			registration.TypeOfEstablishment = j["TypeOfEstablishment"].ToObject<TypeOfEstablishment>();

			registration.RegistrationTypeOfEstablishmentStaffing = j["RegistrationTypeOfEstablishmentStaffing"].ToObject<List<RegistrationTypeOfEstablishmentStaffing>>();

            registration.NoOfBeds = (int)j["NoOfBeds"];


            registration.AddressLine1 = j["AddressLine1"].ToObject<string>();
            registration.AddressLine2 = j["AddressLine2"].ToObject<string>();
            /*
            registration.Category = JsonConvert.DeserializeObject(j.ToString(), typeof (Category)) as Category;
            registration.Location = JsonConvert.DeserializeObject(j.ToString(), typeof(Location)) as Location;
            */
            registration.Location = j["Location"].ToObject<Location>();
            registration.Category = j["Location"].ToObject<Category>();
            registration.LandMark = j["LandMark"].ToObject<string>();

            // Number of Staff

            // Services
            registration.RegistrationServices = j["RegistrationServices"].ToObject<List<RegistrationService>>();

            // Administrator details
            registration.AdministratorFirstName = (string)j["AdministratorFirstName"];
            registration.AdministratorLastName = (string)j["AdministratorLastName"];
            registration.AdministratorMobile1 = (string)j["AdministratorMobile1"];
            registration.AdministratorMobile2 = (string)j["AdministratorMobile2"];

            // Professional details
            registration.ProfessionalBody = j["ProfessionalBody"].ToObject<ProfessionalBody>();
            registration.ProfessionalBodyAttendance = j["ProfessionalBodyAttendance"].ToObject<string>();
            registration.ProfessionalBodyInvolvement = j["ProfessionalBodyInvolvement"].ToObject<string>();
            registration.ProfessionalBodyRemarks = j["ProfessionalBodyRemarks"].ToObject<string>();
            registration.ProfessionalBodyFirstName = j["ProfessionalBodyFirstName"].ToObject<string>();
            registration.ProfessionalBodyLastName = j["ProfessionalBodyLastName"].ToObject<string>();
            registration.ProfessionalBodyPosition = j["ProfessionalBodyPosition"].ToObject<string>();

            registration.AcceptanceDetailsAccepted = (bool)j["AcceptanceDetailsAccepted"];
            registration.AcceptanceDetailsReason = j["AcceptanceDetailsReason"].ToObject<string>();
            registration.ProfessionalBodySignatureDate = (DateTime)j["ProfessionalBodySignatureDate"];

            registration.Lga = (string) j["Lga"];
            
            registration.ReferenceNumber = (string) j["ReferenceNumber"];

            registration.AmountPaid = (decimal)j["AmountPaid"];
            registration.RegistrationCosts = j.Value<decimal>("RegistrationCosts");

            registration.Created = (DateTime)j["Created"];
            registration.Deleted = (bool)j["Deleted"];
            registration.Modified = (DateTime)j["Modified"];

            return registration;

        }
예제 #6
0
		void DbInit()
		{
			NHibernateHelper.CreateSessionFactory(NHibernateHelper.Dialect.Sqlite, true);

			using (var session = NHibernateHelper.CreateSessionFactory())
			{
				using (var transaction = session.BeginTransaction())
				{
					// Add state
					var state01 = new State { Name = "Federal Capital Territory", Active = true };

					// Add locations
					var state01Location01 = new Location { Name = "Abaji" };
					var state01Location02 = new Location { Name = "Abuja" };
					var state01Location03 = new Location { Name = "Gwagwalada" };
					var state01Location04 = new Location { Name = "Kuje" };
					var state01Location05 = new Location { Name = "Bwari" };
					var state01Location06 = new Location { Name = "Kwali" };

					// logical add of locations
					AddLocationsToState(state01,
						state01Location01,
						state01Location02,
						state01Location03,
						state01Location04,
						state01Location05,
						state01Location06
					);


					// insert categories (3 categories)
					var category01 = new Category { Name = "Urban"};
					var category02 = new Category { Name = "Semi-Urban" };
					var category03 = new Category { Name = "Informal" };

					// add costing (insert some category prices for each)
					var costing01 = new Costing { EffectiveDate = DateTime.Now, RegistrationCost = 300.00M, RenewalCost = 200.00M, Category = category01, State = state01,};
					var costing02 = new Costing { EffectiveDate = DateTime.Now, RegistrationCost = 200.00M, RenewalCost = 100.00M, Category = category02, State = state01, };
					var costing03 = new Costing { EffectiveDate = DateTime.Now, RegistrationCost = 100.00M, RenewalCost = 50.00M, Category = category03, State = state01, };

					AddCostingToCategory(category01, costing01);
					AddCostingToCategory(category02, costing02);
					AddCostingToCategory(category03, costing03);

					// insert permissions
					var permission01 = new Permission { Name = "Search Registrations" };
					var permission02 = new Permission { Name = "Perform Registrations" };
					var permission03 = new Permission { Name = "Manage Payments" };
					var permission04 = new Permission { Name = "Manage Masterfiles" };

					session.SaveOrUpdate(permission01);
					session.SaveOrUpdate(permission02);
					session.SaveOrUpdate(permission03);
					session.SaveOrUpdate(permission04);

					// insert roles
					var role01 = new Role { Name = "Admin"};
					var role02 = new Role { Name = "Clerk" };

					session.SaveOrUpdate(role01);
					session.SaveOrUpdate(role02);

					var perms = new List<Permission>(session.CreateCriteria(typeof(Permission)).List<Permission>());
					foreach (var p in perms)
					{
						var rp = new RolePermission
						{
							Role = role01,
							Permission = p
						};
						session.SaveOrUpdate(rp);
					}


					// insert user (state, role, permission)
					var user01 = new User
					{
						FirstName = "FCT Admin",
						LastName = "",
						Username = "******",
						Password = "******",
						EmailAddress = "*****@*****.**",
						Mobile = "",
						Active = true,
						Created = DateTime.Now,
						Modified = DateTime.Now,
						Roles = new List<Role>
						{
							role01,
							role02
						},
						State = state01
					};

					var user02 = new User
					{
						FirstName = "Lyall",
						LastName = "van der Linde",
						Username = "******",
						Password = "******",
						EmailAddress = "*****@*****.**",
						Mobile = "0793874802",
						Active = true,
						Created = DateTime.Now,
						Modified = DateTime.Now,
						Roles = new List<Role>
						{
							role02
						},
						State = state01
					};

					// add services
					var service01 = new Service { Name = "Doctors" };
					var service02 = new Service { Name = "Radiology" };
					var service03 = new Service { Name = "Pathology" };
					var service04 = new Service { Name = "Theatre" };

					session.SaveOrUpdate(service01);
					session.SaveOrUpdate(service02);
					session.SaveOrUpdate(service03);
					session.SaveOrUpdate(service04);

					// add staffings
					var staffings01 = new Staffing { Name = "Medical Doctor" };
					var staffings02 = new Staffing { Name = "Nurse" };
					var staffings03 = new Staffing { Name = "Medical Lab Assistant" };
					var staffings04 = new Staffing { Name = "Pharmacist" };

					session.SaveOrUpdate(staffings01);
					session.SaveOrUpdate(staffings02);
					session.SaveOrUpdate(staffings03);
					session.SaveOrUpdate(staffings04);

					// register establishment (location, category, renewal)
					var categories = new List<Category>(session.CreateCriteria(typeof(Category)).List<Category>());
					var category = categories.FirstOrDefault(x => x.Name.Equals("Urban"));

					var locations = new List<Location>(session.CreateCriteria(typeof(Location)).List<Location>());
					var location = locations.FirstOrDefault(x => x.State.Id == 1);

					var estType = new TypeOfEstablishment ();
					estType.Name = "Hospital";

					estType.AddStaff (staffings01);
					estType.AddStaff (staffings02);
					estType.AddStaff (staffings03);
					estType.AddStaff (staffings04);

					session.Save (estType);

					var body = new ProfessionalBody ();
					body.Name = "MEDICAL AND DENTAL COUNCIL OF NIGERIA (MDCN)";
					session.Save (body);

					//Staffing

					var registration = new Registration
					{
						Category = category,
						Location = location,
						LastRenewalDate = null,
						ProfessionalBodyAttendance = "",
						ProfessionalBodyFirstName = "",
						ProfessionalBodyLastName = "",
						ProfessionalBodyRemarks = "",
						ProfessionalBodyPosition = "",
						MedicalDirectorFirstName = "",
						AddressLine1 = "",
						AddressLine2 = "",
						MedicalDirectorEmailAddress = "",
						AcceptanceDetailsReason = "",
						ProprietorGender = "",
						ProprietorFirstName = "",
						ProprietorNinNumber = "",
						ProfessionalBodyInvolvement = "",
						ProprietorEmailAddress = "",
						Lga = "",
						CacNumber = "",
						MedicalDirectorNinNumber = "",
						MedicalDirectorLastName = "",
						RegistrationDate = DateTime.Now,
						MedicalDirectorGender = "",
						EstablishmentName = "",
						PhermcRegistrationNumber = "",
						AdministratorMobile1 = "",
						ProprietorIsMedicalDirector = false,
						AcceptanceDetailsAccepted = true,
						ProprietorMobile1 = "",
						MedicalDirectorMobile1 = "",
						LandMark = "",
						AdministratorFirstName = "",
						AdministratorLastName = "",
						AdministratorMobile2 = "",
						AmountPaid = 200.00M,
						Created = DateTime.Now,
						Deleted = false,
						MedicalDirectorMobile2 = "",
						Modified = DateTime.Now,
						NoOfBeds = 10,
						PaymentMethod = null,
						ProfessionalBodySignatureDate = DateTime.Now,
						ProprietorLastName = "",
						ProprietorMobile2 = "",
						ReferenceNumber = "",
						RegistrationCosts = 0,

						TypeOfEstablishment = estType,
						ProfessionalBody = body
					};

					// add services
					var services = new List<Service>(session.CreateCriteria(typeof(Service)).List<Service>());
					var servicesToInsert = services.Where(x => x.Id >= 1);
					foreach (var s in servicesToInsert)
					{
						var rs = new RegistrationService
						{
							Registration = registration,
							Service = s,
							Selected = true
						};
						registration.AddRegistrationService(rs);
					}




					// add staffing
					var numbersToAdd = 0;
					foreach (var s in estType.Staffings) {
						
						var rts = new RegistrationTypeOfEstablishmentStaffing ();
						rts.TypeOfEstablishment = estType;
						rts.Staffing = s;
						rts.NumberOfStaff = ++numbersToAdd;

						registration.AddRegistrationTypeOfEstablishmentStaffing (rts);
					}



					// insert transactionTypes
					var renewalType01 = new RenewalType
					{
						Name = "Registration"
					};
					var renewalType02 = new RenewalType
					{
						Name = "Renewal"
					};
					session.SaveOrUpdate(renewalType01);
					session.SaveOrUpdate(renewalType02);

					// insert paymentTypes
					var paymentTypes01 = new PaymentType
					{
						Name = "Cash"
					};
					var paymentTypes02 = new PaymentType
					{
						Name = "Bank Deposit"
					};
					session.SaveOrUpdate(paymentTypes01);
					session.SaveOrUpdate(paymentTypes02);

					var renewalType = new List<RenewalType>(session.CreateCriteria(typeof(RenewalType)).List<RenewalType>());
					var renewalTypeToInsert = renewalType.FirstOrDefault(x => x.Id >= 1);

					// insert a renewal
					var renewal = new Renewal
					{
						Registration = registration,
						Date = DateTime.Now,
						Amount = 200.00M,
						Paid = false,
						RenewalType = renewalTypeToInsert
					};

					// insert transactionTypes
					var transactionType01 = new TransactionType
					{
						Name = "Registration"
					};
					var transactionType02 = new TransactionType
					{
						Name = "Renewal"
					};
					session.SaveOrUpdate(transactionType01);
					session.SaveOrUpdate(transactionType02);

					// insert a payment
					var transactionType = new List<TransactionType>(session.CreateCriteria(typeof(TransactionType)).List<TransactionType>());
					var transactionTypeToInsert = transactionType.FirstOrDefault(x => x.Id >= 1);

					var newTransaction = new Transaction
					{
						Amount = 200.00M,
						Date = DateTime.Now,
						Renewal = renewal,
						TransactionType = transactionTypeToInsert,
						PaymentType =  paymentTypes01,
						ReceivedFrom = "Alison"
					};

					session.SaveOrUpdate(state01);
					session.SaveOrUpdate(category01);
					session.SaveOrUpdate(category02);
					session.SaveOrUpdate(category03);

					session.SaveOrUpdate(user01);
					session.SaveOrUpdate(user02);

					session.SaveOrUpdate(registration);
					//session.SaveOrUpdate(renewal);
					//session.SaveOrUpdate(newTransaction);


                    // *************

                    var q1 = new Question();
                    q1.Query = "A";

                    var q2 = new Question();
                    q2.Query = "B";

                    session.SaveOrUpdate(q1);
                    session.SaveOrUpdate(q2);

                    var survey = new Survey();
                    survey.Name = "Lyall";
                    survey.Surname = "van der Linde";
                    survey.EmailAddress = "*****@*****.**";
                    survey.MobileNumber = "0716541254";
                    survey.Registration = registration;

                    session.SaveOrUpdate(survey);

                    var surveyQuestion = new SurveyQuestion();
                    surveyQuestion.Survey = survey;
                    surveyQuestion.Question = q1.Query;
                    surveyQuestion.Rating = 4.2;

                    session.SaveOrUpdate(surveyQuestion);

                    surveyQuestion = new SurveyQuestion();
                    surveyQuestion.Survey = survey;
                    surveyQuestion.Question = q2.Query;
                    surveyQuestion.Rating = 5.3;

                    session.SaveOrUpdate(surveyQuestion);

                    // *************

					transaction.Commit();
				}
			}

		}
예제 #7
0
		public static void AddStaffToRegistration(Registration registration, params Staffing[] staffings)
		{
			foreach (var staff in staffings)
			{
				//registration.AddRegistrationStaffing(staff);
			}
		}