public bool EditMettingDeatils(MeetingViewModel model) { if (model != null) { using (dbContext = new OCASIAMeetingUOW()) { var mdl = dbContext.Repository <OCASIA.Meeting.DAL.Meeting>().GetAll().Where(a => a.MeetingID == model.MeetingID).FirstOrDefault(); if (mdl != null) { mdl.Abbreviation = model.Abbreviation; mdl.MeetingName = model.MeetingName; mdl.MeetingDescription = model.MeetingDescription; mdl.EventStartDate = model.EventStartDate; mdl.EventEndDate = model.EventEndDate; mdl.ApplicationStartDate = model.ApplicationStartDate; mdl.ApplicationEndDate = model.ApplicationEndDate; mdl.PageBannerPath = model.PageBannerPath != null ? model.PageBannerPath : mdl.PageBannerPath; mdl.FaqDescription = model.FaqDescription; mdl.FaqPath = model.FaqPath != null ? model.FaqPath : mdl.FaqPath; mdl.SchedulePath = model.SchedulePath != null ? model.SchedulePath : mdl.SchedulePath; mdl.OfficalEmail = model.OfficalEmail; mdl.Address = model.Address; mdl.PhoneNumber = model.PhoneNumber; mdl.FaxNumber = model.FaxNumber; mdl.RegistrationTabs = model.RegistrationTabs; mdl.UpdatedBy = model.CreatedBy; mdl.UpdateOn = DateTime.Now; dbContext.Repository <OCASIA.Meeting.DAL.Meeting>().Update(mdl); dbContext.SaveChanges(); } var obj = dbContext.Repository <OCASIA.Meeting.DAL.RegistrationTabDetail>().GetAll().Where(a => a.MeetingID == model.MeetingID).FirstOrDefault(); if (obj != null) { obj.MeetingID = mdl.MeetingID; obj.BasicDescription = model.BasicDescription; obj.Description1 = model.Description1; obj.Description1PicturePath = model.Description1PicturePath != null ? model.SchedulePath : obj.Description1PicturePath; obj.FileName1 = model.FileName1 != null ? model.FileName1 : obj.FileName1; obj.Description2 = model.Description2; obj.Description2PicturePath = model.Description2PicturePath != null ? model.Description2PicturePath : obj.Description2PicturePath; obj.FileName2 = model.FileName2 != null ? model.FileName2 : obj.FileName2; obj.Description3 = model.Description3; obj.Description3PicturePath = model.Description3PicturePath != null ? model.Description3PicturePath : obj.Description3PicturePath; obj.FileName3 = model.FileName3 != null ? model.FileName3 : obj.FileName3; obj.Description4 = model.Description4; obj.Description4PicturePath = model.Description4PicturePath != null ? model.Description4PicturePath : obj.Description4PicturePath; obj.FileName4 = model.FileName4 != null ? model.FileName4 : obj.FileName4; obj.RegistrationTabID = model.RegistrationTabID; obj.UpdatedBy = model.CreatedBy; obj.UpdateOn = DateTime.Now; dbContext.Repository <OCASIA.Meeting.DAL.RegistrationTabDetail>().Update(obj); dbContext.SaveChanges(); } return(true); } } return(false); }
public ActionResult LogOff(string Email) { if (!string.IsNullOrEmpty(Email)) { var user = db.Repository <ApplicationUser>().GetAll().Where(a => a.Email == Email).FirstOrDefault(); if (user != null) { user.LastLoginDate = DateTime.Now; db.Repository <ApplicationUser>().Update(user); db.SaveChanges(); } AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie); _meetingDetails = null; MeetingID = 0; } AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie); return(RedirectToAction("Login", "Participant")); }
/// <summary> /// Step 3: add travel details /// </summary> /// <param name="userDetail">Travel Details</param> /// <returns></returns> public bool UpdateTravelDetails(TravelDetailsModel travelDetail) { bool success = false; using (OCASIAMeetingUOW db = new OCASIAMeetingUOW()) { TravelDetail record = new TravelDetail(); if (travelDetail.TravelDetailID != 0) { record = db.Repository <TravelDetail>().GetAll().Where(el => el.IsActive && el.TravelDetailID == travelDetail.TravelDetailID).Select(el => el).FirstOrDefault(); } if (record == null) { return(false); } record.UserDetailID = travelDetail.UserDetailID; record.Address = travelDetail.Address; record.ArrivalDate = travelDetail.ArrivalDate; record.ArrivalAirport = travelDetail.ArrivalAirport; record.ArrivalFlightNumber = travelDetail.ArrivalFlightNumber; record.ArrivalTime = travelDetail.ArrivalTime; record.Comments = travelDetail.Comments; record.CreatedBy = travelDetail.CreatedBy; record.CreatedOn = DateTime.Now; record.DepartureDate = travelDetail.DepartureDate; record.DeparturelAirport = travelDetail.DeparturelAirport; record.DepartureTime = travelDetail.DepartureTime; record.NoCheckInBages = travelDetail.NoCheckInBages; record.IsActive = true; record.NoCheckInBages = travelDetail.NoCheckInBages; record.PhoneNumber = travelDetail.PhoneNumber; record.Desc1 = travelDetail.Desc1; record.Desc2 = travelDetail.Desc2; record.Desc3 = travelDetail.Desc3; if (travelDetail.TravelDetailID == 0) { db.Repository <TravelDetail>().Add(record); } else { db.Repository <TravelDetail>().Update(record); } db.SaveChanges(); success = true; } return(success); }
/// <summary> /// Step 1 : user creation /// </summary> /// <param name="model">Registration details</param> /// <returns></returns> public int RegisterUser(ParticipantRegistration model) { string createdBy = string.Empty; int userDetailsID = 0; #region Create useer using (OCASIAMeetingUOW db = new OCASIAMeetingUOW()) { var res = db.Repository <ApplicationUser>().GetAll().Where(f => f.Email == model.Email).FirstOrDefault(); if (res == null) { var user = new ApplicationUser() { UserName = model.Email, Email = model.Email, RoleCustomID = 3, IsActive = true, IspasswordActive = true }; var userManager = new Microsoft.AspNet.Identity.UserManager <ApplicationUser>(new Microsoft.AspNet.Identity.EntityFramework.UserStore <ApplicationUser>(new OCASIAMeetingContext())); var ures = userManager.Create(user, model.Password); if (ures.Succeeded) { // userManager.AddClaim(user.Id, new System.Security.Claims.Claim("FullName", model.Email)); Passwordhash mdl = new Passwordhash() { UserId = user.Id, Password = model.Password }; db.Repository <Passwordhash>().Add(mdl); db.SaveChanges(); createdBy = mdl.UserId; } } else { return(-1); } } #endregion if (string.IsNullOrEmpty(createdBy)) { return(userDetailsID); } userDetailsID = CreateUserDetails(model, createdBy); return(userDetailsID); }
/// <summary> /// Step 4 : Submitting or cancllation /// </summary> /// <param name="userDetailsId"></param> /// <param name="isCanclled"></param> /// <returns></returns> public bool UpdateUserConfirmtion(int userDetailsId, bool isSubmitted, bool isCanclled = false) { bool success = false; using (OCASIAMeetingUOW db = new OCASIAMeetingUOW()) { UserDetail response = db.Repository <UserDetail>().GetAll().Where(el => el.IsActive && el.Meetings.AllowRegistration && el.UserDetailID == userDetailsId).Select(el => el).FirstOrDefault(); if (response == null) { return(success); } response.IsCanclled = isCanclled; response.IsSubmitted = isSubmitted; db.Repository <UserDetail>().Update(response); db.SaveChanges(); success = true; } return(success); }
/// <summary> /// Step 2: User details /// </summary> /// <param name="userDetail">Personal details</param> /// <returns></returns> public bool UpdatePersonalDetails(UserDetailsModel userDetail, bool Isguest) { bool success = false; using (OCASIAMeetingUOW db = new OCASIAMeetingUOW()) { var response = db.Repository <UserDetail>().GetAll().Where(el => el.IsActive && el.UserDetailID == userDetail.UserDetailID).FirstOrDefault(); if (response == null) { return(success); } if (Isguest == true) { var res = db.Repository <UserDetail>().GetAll().Where(el => el.IsActive && el.IsGust == Isguest && el.UserDetailID == userDetail.UserDetailID).FirstOrDefault(); if (res == null) { UserDetail mdl = new UserDetail(); mdl.TitleID = userDetail.TitleID; mdl.GivenName = userDetail.GivenName; mdl.FamilyName = userDetail.FamilyName; mdl.Email = userDetail.Email; mdl.FirstLastName = userDetail.FirstLastName; mdl.AssitantEmail = userDetail.AssitantEmail; mdl.CountryOfResidanceID = userDetail.CountryOfResidanceID; mdl.CountryID = userDetail.CountryID; mdl.Organization = userDetail.Organization; mdl.OrganizationDesignation = userDetail.OrganizationDesignation; mdl.OrganizationFunction = userDetail.OrganizationFunction; mdl.Company = userDetail.Company; mdl.AddressLine1 = userDetail.AddressLine1; mdl.AddressLine2 = userDetail.AddressLine2; mdl.PostalCode = userDetail.PostalCode; mdl.City = userDetail.City; mdl.StateProvince = userDetail.StateProvince; mdl.TelephoneNumber = userDetail.TelephoneNumber; mdl.PassportNumber = userDetail.PassportNumber; mdl.UploadedPicturePath = userDetail.UploadedPicturePath; mdl.Desc4 = userDetail.Desc4; mdl.PassportCoptyPath = userDetail.PassportCoptyPath; mdl.DOB = userDetail.DOB; mdl.IssueDate = userDetail.IssueDate; mdl.Nationality = userDetail.Nationality; mdl.ExpiryDate = userDetail.ExpiryDate; mdl.Gender = userDetail.Gender; mdl.GuestOf = userDetail.UserDetailID.ToString(); mdl.IsGust = Isguest; mdl.IsActive = true; mdl.IsPublish = true; mdl.CreatedBy = userDetail.CreatedBy; mdl.CreatedOn = DateTime.Now; db.Repository <UserDetail>().Add(mdl); db.SaveChanges(); } else { res.TitleID = userDetail.TitleID; res.GivenName = userDetail.GivenName; res.FamilyName = userDetail.FamilyName; res.Email = userDetail.Email; res.FirstLastName = userDetail.FirstLastName; res.AssitantEmail = userDetail.AssitantEmail; res.CountryOfResidanceID = userDetail.CountryOfResidanceID; res.CountryID = userDetail.CountryID; res.Organization = userDetail.Organization; res.OrganizationDesignation = userDetail.OrganizationDesignation; res.OrganizationFunction = userDetail.OrganizationFunction; res.Company = userDetail.Company; res.AddressLine1 = userDetail.AddressLine1; res.AddressLine2 = userDetail.AddressLine2; res.PostalCode = userDetail.PostalCode; res.City = userDetail.City; res.StateProvince = userDetail.StateProvince; res.TelephoneNumber = userDetail.TelephoneNumber; res.PassportNumber = userDetail.PassportNumber; res.UploadedPicturePath = userDetail.UploadedPicturePath != null ? userDetail.UploadedPicturePath : null; res.Desc4 = userDetail.Desc4 != null ? userDetail.Desc4 : null; res.PassportCoptyPath = userDetail.PassportCoptyPath != null ? userDetail.PassportCoptyPath : null; res.DOB = userDetail.DOB; res.IssueDate = userDetail.IssueDate; res.Nationality = userDetail.Nationality; res.ExpiryDate = userDetail.ExpiryDate; res.Gender = userDetail.Gender; res.CreatedBy = userDetail.UpdatedBy; res.UpdateOn = DateTime.Now; db.Repository <UserDetail>().Update(res); db.SaveChanges(); } } else { response.FirstLastName = userDetail.FirstLastName; response.AssitantEmail = userDetail.AssitantEmail; response.CountryOfResidanceID = userDetail.CountryOfResidanceID; response.CountryID = userDetail.CountryID; response.Organization = userDetail.Organization; response.OrganizationDesignation = userDetail.OrganizationDesignation; response.OrganizationFunction = userDetail.OrganizationFunction; response.Company = userDetail.Company; response.AddressLine1 = userDetail.AddressLine1; response.AddressLine2 = userDetail.AddressLine2; response.PostalCode = userDetail.PostalCode; response.City = userDetail.City; response.StateProvince = userDetail.StateProvince; response.TelephoneNumber = userDetail.TelephoneNumber; response.PassportNumber = userDetail.PassportNumber; response.UploadedPicturePath = userDetail.UploadedPicturePath != null ? userDetail.UploadedPicturePath : null; response.Desc4 = userDetail.Desc4 != null ? userDetail.Desc4 : null; response.PassportCoptyPath = userDetail.PassportCoptyPath != null ? userDetail.PassportCoptyPath : null; response.DOB = userDetail.DOB; response.IssueDate = userDetail.IssueDate; response.Nationality = userDetail.Nationality; response.ExpiryDate = userDetail.ExpiryDate; response.UpdatedBy = userDetail.UpdatedBy; response.UpdateOn = DateTime.Now; response.Gender = userDetail.Gender; db.Repository <UserDetail>().Update(response); db.SaveChanges(); } success = true; } return(success); }