public static AcmeClient GetClient(VaultConfig config, RegistrationInfo reg) { var c = GetClient(config); c.Signer = GetSigner(reg.SignerProvider); c.Signer.Init(); c.Registration = reg.Registration; if (reg.SignerState != null) { using (var s = new MemoryStream(Convert.FromBase64String( reg.SignerState))) { c.Signer.Load(s); } } else { using (var s = new MemoryStream()) { c.Signer.Save(s); reg.SignerState = Convert.ToBase64String(s.ToArray()); } } return c; }
public InstanceProducer(RegistrationInfo info, UltraLightContainer container, object instance, Func<object> factory) { _info = info; _container = container; _instance = instance; _factory = factory; }
public void CreateRegistration( RegistrationId i, RegistrationInfo info, IDomainIdentityService ids, IUserIndexService uniqueness, PasswordGenerator generator) { var problems = new List<string>(); // we do all the checks at registration phase if (uniqueness.IsLoginRegistered(info.ContactEmail)) { problems.Add(string.Format("Email '{0}' is already taken.", info.ContactEmail)); } if (!string.IsNullOrEmpty(info.OptionalUserIdentity)) { if (uniqueness.IsIdentityRegistered(info.OptionalUserIdentity)) { problems.Add(string.Format("Identity '{0}' is already taken.", info.OptionalUserIdentity)); } } var userDisplay = info.OptionalUserDisplay; if (string.IsNullOrEmpty(userDisplay)) { userDisplay = string.Format("{0}", info.CustomerName); } var password = info.OptionalUserPassword; if (string.IsNullOrEmpty(password)) { password = generator.CreatePassword(6); } // TODO: we are checking contact uniqueness, but can use user name var login = info.ContactEmail; if (string.IsNullOrEmpty(login)) { login = info.ContactEmail; } if (problems.Any()) { Apply(new RegistrationFailed(i, info, problems.ToArray())); return; } var id = ids.GetId(); var host = info.Headers.FirstOrDefault(h => h.Key == "UserHostAddress"); var security = new SecurityInfo(new SecurityId(id), login, password, userDisplay, info.OptionalUserIdentity); var customer = new CustomerInfo(new CustomerId(id), info.CustomerName, userDisplay, info.ContactEmail, info.OptionalCompanyPhone, info.OptionalCompanyUrl); Apply(new RegistrationCreated(i, info.CreatedUtc, customer, security)); // if no problems }
private void ParseRegInfo(byte[] Content) { try { reginfo info = null; using (Stream stream = new MemoryStream(Content)) { XmlSerializer serializer = new XmlSerializer(typeof(reginfo)); info = serializer.Deserialize(stream) as reginfo; if (info.registration != null) { if (String.Equals("full", info.state.ToString(), StringComparison.CurrentCultureIgnoreCase)) { this.registrations.Clear(); } foreach (registration reg in info.registration) { if (reg.contact == null || reg.contact.Length == 0) { continue; } foreach (contact c in reg.contact) { RegistrationInfo registrationInfo = this.registrations.FirstOrDefault(x => String.Equals(x.Id, reg.id) && String.Equals(x.ContactId, c.id)); bool isNew = (registrationInfo == null); if (isNew) { registrationInfo = new RegistrationInfo(); registrationInfo.Id = reg.id; registrationInfo.AoR = reg.aor; registrationInfo.ContactId = c.id; registrationInfo.ContactUriString = c.uri; } registrationInfo.RegistrationState = reg.state; registrationInfo.ContactDisplayName = (c.displayname == null) ? String.Empty : c.displayname.Value; registrationInfo.ContactEvent = c.@event; registrationInfo.ContactExpires = (Int32)((c.expiresSpecified) ? c.expires : 0); registrationInfo.ContactState = c.state; if (isNew) { this.registrations.Add(registrationInfo); } } } } } // Remove terminated registration this.registrations.RemoveAll(x => x.ContactState == contactState.terminated); } catch (Exception ex) { LOG.Error(ex); } }
public OutputSocketMessageWithUsers Execute(object val, string myLogin, Guid actId) { #region Тестовые данные /* { * "execFun": "OrganizationAddMember", * "data": { * "login": "******", * "password": "******", * "nickName": "Serj", * "transactionId": "80f7efc032cd4a2c97f89fca11ad3701" * } * } */ #endregion OutputSocketMessage output = new OutputSocketMessage("OrganizationAddMember", actId, true, "", new { }); OutputSocketMessageWithUsers rez = new OutputSocketMessageWithUsers(); using (var db = new RaidaContext()) { Members owner = db.Members.Include(o => o.organization).First(it => it.login.Equals(myLogin)); if (owner.organization != null && owner.organization.owner == owner) { Registration registration = new Registration(); rez = registration.Execute(val, myLogin, actId); rez.msgForOwner.callFunction = "OrganizationAddMember"; if (rez.msgForOwner.success) { try { RegistrationInfo info = DeserializeObject.ParseJSON <RegistrationInfo>(val, output, out rez); Organizations organization = db.Organizations.Include(m => m.members).First(it => it == owner.organization); Members newMember = db.Members.First(it => it.login.Equals(info.login.Trim(), StringComparison.CurrentCultureIgnoreCase)); newMember.organization = organization; organization.members.Add(newMember); db.SaveChanges(); output.data = new { newMember.login, nickName = newMember.nick_name }; rez.msgForOwner = output; } catch (Exception e) { Console.WriteLine(e.Message); } } } else { output.success = false; output.msgError = "You a not consist in organization or a not organization owner"; rez.msgForOwner = output; } } return(rez); }
static bool ValidateCustomInspectorRegistration(Type type, RegistrationInfo info) { if (type.IsAbstract) { return(false); } if (!type.IsGenericType) { return(true); } var inspectedType = type.GetRootType().GetGenericArguments()[0]; if (inspectedType.IsArray) { info.CacheInvalidInspectorType(type, RegistrationStatus.UnsupportedGenericArrayInspector); return(false); } if (!inspectedType.IsGenericType) { info.CacheInvalidInspectorType(type, RegistrationStatus.UnsupportedGenericInspectorForNonGenericType); return(false); } if (null == type.GetInterface(nameof(IExperimentalInspector))) { info.CacheInvalidInspectorType(type, RegistrationStatus.UnsupportedUserDefinedGenericInspector); return(false); } var rootArguments = inspectedType.GetGenericArguments(); var arguments = GetGenericArguments(type); if (arguments.Length > rootArguments.Length) { info.CacheInvalidInspectorType(type, RegistrationStatus.GenericArgumentsDoNotMatchInspectedType); return(false); } var set = new HashSet <Type>(rootArguments); foreach (var argument in arguments) { set.Remove(argument); } if (set.Count == 0) { return(true); } info.CacheInvalidInspectorType(type, RegistrationStatus.UnsupportedPartiallyResolvedGenericInspector); return(false); }
public Supplier() { CertificateSources = new List <CertificateSource>(); Registration = new RegistrationInfo(); OrderRules = new List <OrderSendRules>(); Prices = new List <Price>(); RegionalData = new List <RegionalData>(); Type = ServiceType.Supplier; }
/// <summary> /// Get the details of the specified registration account. /// </summary> /// <param name="userName">user name of the user.</param> /// <returns>Details of the specified registration account.</returns> public RegistrationInfo GetDetails(string userName) { // Get an instance of the Registration DAO using the DALFactory IRegistration dao = (IRegistration)DALFactory.DAO.Create(DALFactory.Module.Registration); RegistrationInfo registration = dao.GetDetails(userName); return(registration); }
protected void btnRegister_click(Object sender, EventArgs e) { using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext()) { if (FileUpload1.PostedFile != null) { string imgpath = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName); //string imgpath = Server.MapPath("/rImg"); if (imgpath != "") { FileUpload1.SaveAs(Server.MapPath("~/Images/GrocerImage/" + (imgpath))); } //FileUpload1.SaveAs(imgpath + "/" + FileUpload1.FileName); mstGrocerDtl g = new mstGrocerDtl(); //var g = (from s in db.mstGrocerDtls where s.GrocerId == int.Parse(Session["GrocId"].ToString()) select s).FirstOrDefault(); if (imgpath != "") { g.image = ("/Images/GrocerImage/" + (imgpath)); } g.AreaCode = int.Parse(ddlArea.Text); g.ShopName = txtSName.Text; g.ShopRegNo = txtSRegNo.Text; g.ShopAddr = txtShopAddr.Text; g.ShopOwnName = txtOwnNm.Text; g.MobNo = txtMobNo.Text; g.Email = txtEmailId.Text; g.ShopOwnAdhar = txtOwnAdhar.Text; g.BankAccNumber = txtAccountNo.Text; g.IFSCcode = txtIFSCcode.Text; // g.image = ("GrocerImg/" + FileUpload1.FileName); g.IsDelete = false; // g.Lattitude = null; //g.Longitude = null; //db.mstGrocerDtls.InsertOnSubmit(g); db.SubmitChanges(); RegistrationInfo d = new RegistrationInfo(); d.RegistrationDateTime = DateTime.Now; d.CategoryId = 2; d.MobileNo = txtMobNo.Text; d.Password = txtpass.Text; d.UserID = g.GrocerId; d.Isdelete = false; //db.RegistrationInfos.InsertOnSubmit(d); db.SubmitChanges(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Registration Successfully')", true); //Response.Redirect("GrocerProfile.aspx"); pnlAddShop.Visible = false; Panel2.Visible = true; showdata(); } } }
public RegistrationInfo GetUserDetails(string userName) { // Get an instance of the Registration BO Registration bll = new Registration(); RegistrationInfo registration = bll.GetDetails(userName); return(registration); }
public RegistrationInfo GetDetails(int userId) { // Get an instance of the Registration BO Registration bll = new Registration(); RegistrationInfo registration = bll.GetDetails(userId); return(registration); }
static CustomInspectorDatabase() { s_InspectorsPerType = new Dictionary <Type, List <Type> >(); s_GenericArgumentsPerType = new Dictionary <Type, Type[]>(); s_RootGenericArgumentsPerType = new Dictionary <Type, Type[]>(); s_RegistrationInfo = new RegistrationInfo(); RegisterCustomInspectors(s_RegistrationInfo); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Install the control. /// </summary> /// <param name="dockHost">The control that hosts the browser</param> /// <param name="cache">The cache (needed in case we have to create the English LDS file /// on the fly)</param> /// <param name="normalStyle">The normal style (needed in case we have to create the /// English LDS file on the fly)</param> /// <returns> /// <c>true</c> if the browser was installed successfully; <c>false</c> /// otherwise. /// </returns> /// ------------------------------------------------------------------------------------ public bool Install(Control dockHost, FdoCache cache, IStStyle normalStyle) { while (true) { try { RegistrationInfo.AllowP6RegistrationCode = true; RegistrationInfo.AllowAccessToResources(); string paratextProjectDir = ScrImportP6Project.ProjectDir; if (!String.IsNullOrEmpty(paratextProjectDir)) { string englishLdsPathname = Path.Combine(paratextProjectDir, "English.lds"); if (!File.Exists(englishLdsPathname)) { ParatextLdsFileAccessor ldsAccessor = new ParatextLdsFileAccessor(cache); UsfmStyEntry normalUsfmStyle = new UsfmStyEntry(); StyleInfoTable styleTable = new StyleInfoTable(normalStyle.Name, cache.LanguageWritingSystemFactoryAccessor); normalUsfmStyle.SetPropertiesBasedOnStyle(normalStyle); styleTable.Add(normalStyle.Name, normalUsfmStyle); styleTable.ConnectStyles(); ldsAccessor.WriteParatextLdsFile(englishLdsPathname, cache.LanguageWritingSystemFactoryAccessor.GetWsFromStr("en"), normalUsfmStyle); } } ScrTextCollection.Initialize(); break; } catch (Exception e) { try { ReflectionHelper.SetField(typeof(ScrTextCollection), "initialized", false); } catch (Exception reflectionHelperException) { throw new ContinuableErrorException("Paratext resource browser failed to initialize." + Environment.NewLine + reflectionHelperException.Message, e); } if (MessageBox.Show(dockHost.FindForm(), String.Format( Properties.Resources.kstidCannotDisplayResourcePane, Application.ProductName, e.Message), Application.ProductName, MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2) != DialogResult.Retry) { return(false); } } } m_toolStrip.Text = "USFM Resource Browser"; m_extender = new DockExtender(dockHost); dockHost.Controls.Add(this); m_floaty = m_extender.Attach(this, m_toolStrip, true); this.SendToBack(); return(true); }
/// <summary>Adds the parameter specification</summary> public static RegistrationInfo WithParameter(this RegistrationInfo info, Parameter parameter) { if (info.Parameters == null) { info.Parameters = new List <Parameter>(); } info.Parameters.Add(parameter); return(info); }
/// <summary> /// Inserts a registration account with user Work Space Area. /// </summary> /// <param name="registration">Registration Information of the user.</param> /// <param name="workSpacePath">String Path in which Workspase Directory</param> public int InsertWithWorkSpaceDirectory(RegistrationInfo registration, string workSpacePath) { int UserId = 0; SqlParameter[] registrationparameters = GetRegistrationParameters(); SqlParameter[] registrationAddressParameters; SetRegistrationParameters(registrationparameters, registration); using (SqlConnection connection = new SqlConnection(SQLHelper.CONNECTION_STRING)) { connection.Open(); using (SqlTransaction transaction = connection.BeginTransaction()) { try { SQLHelper.ExecuteNonQuery(transaction, CommandType.Text, SQLHelper.GetSQLStatement(MODULE_NAME, "SQL_INSERT_ACCOUNT"), registrationparameters); UserId = (int)registrationparameters[12].Value; registrationAddressParameters = GetRegistrationAddressParameters(); SetRegistrationAddressParameters(UserId, registrationAddressParameters, registration); SQLHelper.ExecuteNonQuery(transaction, CommandType.Text, SQLHelper.GetSQLStatement(MODULE_NAME, "SQL_INSERT_ACCOUNT_SHIPPINGADDRESS"), registrationAddressParameters); if (registration.CreditCard != null) { CreditCardInfo creditCard = registration.CreditCard; UpdateCreditCard(UserId, ref creditCard, transaction); } workSpacePath += UserId.ToString(); System.IO.Directory.CreateDirectory(workSpacePath); AuditEntryInfo auditEntry = new AuditEntryInfo(Module.Registration, registration.UserName, "User Registered", UserId, UserId); AuditTrail.WriteEntry(auditEntry, transaction); transaction.Commit(); } catch { transaction.Rollback(); throw; } } } return(UserId); }
// returns null if there is no active IntelliSense Server. static RegistrationInfo GetActiveRegistrationInfo() { var activeString = Environment.GetEnvironmentVariable(ActiveServerVariable); if (string.IsNullOrEmpty(activeString)) { return(null); } return(RegistrationInfo.FromRegistrationString(activeString)); }
public RegistrationInfo GetRegistrationInfo(AddRegistrationCommand command) { var model = new RegistrationInfo { VehicleModel = command.VehicleModel, VehicleDeviceId = command.VehicleDeviceId }; return(model); }
public void ShouldRegisterUser() { // Arrange var registrationInfo = new RegistrationInfo() { Addresses = new List <AddressInfo>() { new AddressInfo() { AddressLine1 = "123", City = "Redmond", CountryName = "USA", PostalCode = "12345", StateProvinceId = 33 } }, CreditCards = new List <CreditCardInfo>() { new CreditCardInfo() { CardNumber = "1111222233334444", CardType = "VISA", ExpMonth = 1, ExpYear = 2015 } }, EmailAddresses = new List <string>() { "*****@*****.**" }, FirstName = "Test", LastName = "User", Password = "******" }; var person = new Person() { PersonGuid = Guid.NewGuid() }; var personRepository = new StubIPersonRepository() { SavePersonPerson = newPerson => person }; var shoppingCartRepository = new StubIShoppingCartRepository() { GetShoppingCartString = shoppingCartId => new ShoppingCart(person.PersonGuid.ToString()) }; var orderRepository = new StubISalesOrderRepository() { IsOrderSavedGuid = shoppingCartId => false }; var controller = new AccountController(personRepository, shoppingCartRepository, orderRepository, new StubIStateProvinceRepository()); SetupControllerForTests(controller); // Act var result = controller.Register(registrationInfo); // Assert Assert.AreEqual(result.StatusCode, HttpStatusCode.Created); }
protected void btnRegister_click(Object sender, EventArgs e) { using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext()) { if (FileUpload1.PostedFile != null) { string imgpath = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName); //string imgpath = Server.MapPath("/rImg"); if (imgpath != "") { FileUpload1.SaveAs(Server.MapPath("~/Images/DeliveryBoyImage/" + (imgpath))); } //FileUpload1.SaveAs(imgpath + "/" + FileUpload1.FileName); mstDeliveryBoyDtl g = new mstDeliveryBoyDtl(); if (imgpath != "") { g.image = ("/Images/GrocerImage/" + (imgpath)); } g.AreaCode = int.Parse(ddlArea.Text); g.DeliverBoyName = txtSName.Text; g.DeliverBoyRegNo = txtSRegNo.Text; g.DeliverBoyAddr = txtShopAddr.Text; //g. = txtOwnNm.Text; g.MobNo = txtMobNo.Text; g.Email = txtEmailId.Text; g.DeliverBoyOwnAdhar = txtOwnAdhar.Text; g.BankAccNo = txtAccountNo.Text; g.IFSCcode = txtIFSCcode.Text; // g.image = ("GrocerImg/" + FileUpload1.FileName); g.IsDelete = false; // g.Lattitude = null; //g.Longitude = null; db.mstDeliveryBoyDtls.InsertOnSubmit(g); db.SubmitChanges(); RegistrationInfo d = new RegistrationInfo(); d.RegistrationDateTime = DateTime.Now; d.CategoryId = 4; d.MobileNo = txtMobNo.Text; d.Password = txtpass.Text; d.UserID = g.DeliveryBoyId; d.Isdelete = false; db.RegistrationInfos.InsertOnSubmit(d); db.SubmitChanges(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Registration Successfully')", true); pnlAddShop.Visible = false; pnlgrid.Visible = true; showdata(); } } }
public void Init() { userData = new UserData { Login = "******", Id = "123" }; registrationInfo = new RegistrationInfo { Login = userData.Login }; }
private void GetServiceEndpoint(Message requestMessage, out Binding binding, out EndpointAddress endpointAddress) { var requestHeader = requestMessage.Headers.FirstOrDefault(it => it.Name == "Route"); string contractNamespace = requestHeader.Namespace.Trim(); string[] contractNamespaceParts = contractNamespace.Split(':'); string listienUri = ""; List <KeyValuePair <int, RegistrationInfo> > results; if (contractNamespaceParts.Count() > 2) { listienUri = contractNamespaceParts[2].Trim(); string contractKey = contractNamespaceParts[0] + ":" + contractNamespaceParts[1]; // get a list of all registered service entries for the specified contract results = (from item in RouterService.RegistrationList where item.Value.ContractNamespace.Equals(contractKey) && item.Value.listenUri == listienUri select item).ToList(); } else { // get a list of all registered service entries for the specified contract results = (from item in RouterService.RegistrationList where item.Value.ContractNamespace.Equals(contractNamespace) select item).ToList(); } // get last address used int index = 0; if (!RouterService.RoundRobinCount.ContainsKey(contractNamespace)) { RouterService.RoundRobinCount.Add(contractNamespace, 0); } else { int lastIndex = RouterService.RoundRobinCount[contractNamespace]; if (++lastIndex > results.Count <KeyValuePair <int, RegistrationInfo> >() - 1) { lastIndex = 0; } index = lastIndex; RouterService.RoundRobinCount[contractNamespace] = index; } RegistrationInfo regInfo = results.ElementAt <KeyValuePair <int, RegistrationInfo> >(index).Value; Uri addressUri = new Uri(regInfo.Address); binding = ConfigurationUtility.GetRouterBinding(addressUri.Scheme); endpointAddress = new EndpointAddress(regInfo.Address); }
public async Task <IdentityResult> Register(RegistrationInfo regInfo) { var user = new User { UserName = regInfo.Username, FullName = regInfo.FullName, Email = regInfo.EmailAddress, MadicalInstitution = regInfo.Institution.ConvertToModel() }; return(await _userManager.CreateAsync(user, regInfo.Password)); }
void OnRegistrationInfoFound(RegistrationInfo info) { var delimiter = _foundRegistrations != 0 ? ", " : string.Empty; Log( $"{delimiter}{info.SearchText}" ); InvokeAction( () => { LinkLabel link = CreateLinkLabel( text: $"{info.SearchText} ( {info.RecordsCount} )", url: info.SearchUrl ); flowPanel.Controls.Add( link ); } ); ++_foundRegistrations; }
/// <summary> /// Register the consumer by sending a formatted request to a SQS. This request contains a /// URL to the queue this method will poll for a response. The response will be checked /// via a GUID provided in the request and returned in the reply. The response will also /// contain a SNS Topic that will be used to send updates to. /// /// If no reply on long poll return null. /// </summary> public IJobQueue Register() { IAWSContext awsCtx = Turbine.Consumer.AWS.AppUtility.GetContext(); var registerMsg = new Register(); registerMsg.Id = Guid.NewGuid(); registerMsg.InstanceID = awsCtx.InstanceId; registerMsg.AMI = awsCtx.AmiId; regInfo = SimpleMessageConnect.SendReceive(registerMsg); this.jobQueue = new JobQueue(regInfo); return(jobQueue); }
public RegistrationInfo GetRegistrationInfo(int clientId) { Client client = Clients.Where(c => c.Id == clientId).ToList()[0]; ClientSoftwareProfile clientSoftwareProfile = ClientInfos.Where(i => i.Client.Id == client.Id).FirstOrDefault(); RegistrationInfo regInfo = new RegistrationInfo(); regInfo.ClientId = client.Id; regInfo.FirstRegisteredDate = (DateTime)client.DateRegistered; regInfo.RegisteredTo = client.ClientName; return(regInfo); }
public void Register(RegistrationInfo regInfo) { if (!RouterService.RegistrationList.ContainsKey(regInfo.GetHashCode())) { RouterService.RegistrationList.Add(regInfo.GetHashCode(), regInfo); } else { RouterService.RegistrationList.Remove(regInfo.GetHashCode()); RouterService.RegistrationList.Add(regInfo.GetHashCode(), regInfo); } }
public void TestGetRegistrationInfo() { MockServices.MockSubscriptionDataManager mockSubscriptionDataManager = new MockServices.MockSubscriptionDataManager(); MockServices.MockSubscriptionWebService mockSubscriptionWebService = new MockServices.MockSubscriptionWebService(); RegistrationInfo expected = mockSubscriptionDataManager.GetRegistrationInfo(2); RegistrationInfo actual = mockSubscriptionWebService.GetRegistrationInfo(2); Assert.IsTrue(expected.ClientId == actual.ClientId, "Registration Info Client Ids are not equal, expected {0}, actual {1}", expected.ClientId, actual.ClientId); Assert.IsTrue(expected.FirstRegisteredDate == actual.FirstRegisteredDate, "Registration Info FirstRegisteredDates are not equal, expected {0}, actual {1}", expected.FirstRegisteredDate, actual.FirstRegisteredDate); Assert.IsTrue(expected.RegisteredTo == actual.RegisteredTo, "Registration Info RegisteredTo are not equal, expected {0}, actual {1}", expected.RegisteredTo, actual.RegisteredTo); }
// returns null if there are none registered static RegistrationInfo GetHighestPublishedRegistration() { var servers = Environment.GetEnvironmentVariable(ServersVariable); if (servers == null) { Debug.Print("!!! ERROR: ServersVariable not set"); return(null); } return(servers.Split(';') .Select(str => RegistrationInfo.FromRegistrationString(str)) .Max()); }
public RegistrationInfo RegisterProduct(string productCode) { ClientSoftwareProfile clientSoftwareProfile = ClientInfos.Where(c => c.ProductCode == productCode).ToList()[0]; Client client = Clients.Where(c => c.Id == clientSoftwareProfile.Client.Id).FirstOrDefault(); RegistrationInfo regInfo = new RegistrationInfo(); regInfo.ClientId = client.Id; regInfo.FirstRegisteredDate = (DateTime)client.DateRegistered; regInfo.RegisteredTo = client.ClientName; return(regInfo); }
void OnRegistrationInfoFound(RegistrationInfo info) { var delimiter = _foundRegistrations != 0 ? ", " : string.Empty; Log($"{delimiter}{info.SearchText}"); InvokeAction(() => { LinkLabel link = CreateLinkLabel( text: $"{info.SearchText} ( {info.RecordsCount} )", url: info.SearchUrl); flowPanel.Controls.Add(link); }); ++_foundRegistrations; }
public async Task <IActionResult> Post(RegistrationInfo userInfo) { var checkResult = await _registrationService.RegisterAsync(userInfo); if (checkResult.Equals(WisTResponse.Registered)) { return(Ok()); } else { return(BadRequest()); } }
private void Run(RegistrationInfo regInfo) { var jobQueue = new Turbine.Consumer.AWS.Data.Contract.JobQueue(regInfo); Turbine.Consumer.Data.Contract.Behaviors.IJobConsumerContract contract; do { Debug.WriteLine("Find Next Job", GetType().Name); contract = jobQueue.GetNext(); }while (contract == null); contract.Setup(); }
/* { "execFun": "registration", * "data": { * "login": "******", * "password": "******", * "nickName": "gosha", * "transactionId": "80f7efc032dd4a7c97f69fca51ad3001" * } * } */ public OutputSocketMessageWithUsers Execute(object val, string myLogin, Guid actId) { OutputSocketMessage output = new OutputSocketMessage("registration", actId, true, "", new { }); OutputSocketMessageWithUsers rez = new OutputSocketMessageWithUsers(); RegistrationInfo info = DeserializeObject.ParseJSON <RegistrationInfo>(val, output, out rez); if (info == null) { return(rez); } using (var db = new RaidaContext()) { if (db.Members.Any(it => it.login.Equals(info.login.Trim(), StringComparison.CurrentCultureIgnoreCase))) { output.success = false; output.msgError = "This login already exists"; } else { Guid privateId = Guid.NewGuid(); while (db.Members.Any(it => it.private_id == privateId)) { privateId = Guid.NewGuid(); } info.password = Argon2.Hash(info.password, 1, 512, 8); //Hashing password Members member = new Members { private_id = privateId, login = info.login.Trim().ToLower(), pass = info.password, nick_name = info.nickName, last_use = SystemClock.GetInstance().CurrentTime, description_fragment = "", photo_fragment = "", kb_bandwidth_used = 0, online = false, }; db.Members.Add(member); Transaction.saveTransaction(db, info.transactionId, Transaction.TABLE_NAME.MEMBERS, privateId.ToString(), member); db.SaveChanges(); } } rez.msgForOwner = output; return(rez); }
protected override void ProcessRecord() { using (var vlt = Util.VaultHelper.GetVault(VaultProfile)) { vlt.OpenStorage(); var v = vlt.LoadVault(); AcmeRegistration r = null; var ri = new RegistrationInfo { Id = EntityHelper.NewId(), Alias = Alias, Label = Label, Memo = Memo, SignerProvider = Signer, }; try { using (var c = ClientHelper.GetClient(v, ri)) { c.Init(); c.GetDirectory(true); r = c.Register(Contacts); if (AcceptTos) { r = c.UpdateRegistration(agreeToTos: true); } ri.Registration = r; if (v.Registrations == null) { v.Registrations = new EntityDictionary <RegistrationInfo>(); } v.Registrations.Add(ri); } } catch (AcmeClient.AcmeWebException ex) { ThrowTerminatingError(PoshHelper.CreateErrorRecord(ex, ri)); return; } vlt.SaveVault(v); WriteObject(r); } }
// Attempts to activate the server described by registrationInfo // return true for success, false for any problems static bool ActivateServer(RegistrationInfo registrationInfo) { // Suppress errors if things go wrong, including unexpected return types. try { var result = ExcelDna.Integration.XlCall.Excel(ExcelDna.Integration.XlCall.xlUDF, registrationInfo.GetControlMacroName(), ControlMessageActivate); return((bool)result); } catch (Exception ex) { Logger.Initialization.Error(ex, $"IntelliSenseServer {registrationInfo.ToRegistrationString()} could not be activated."); return(false); } }
/// <summary> /// Displays the project with a specified id. /// </summary> /// <param name="id">The id of the project.</param> public void Add() { #region Logging if (log.IsDebugEnabled) log.Debug(Messages.MethodEnter); #endregion RegistrationInfo regInfo = new RegistrationInfo(); this.PropertyBag["regInfo"] = regInfo; this.AddToBreadcrumbTrail(new Link() { Text = "Users", Controller = "user", Action = "default" }); this.AddToBreadcrumbTrail(new Link() { Text = "New" }); this.RenderBreadcrumbTrail(); #region Logging if (log.IsDebugEnabled) log.Debug(Messages.MethodLeave); #endregion }
public bool SaveRegistrationInfo(string UserId, string UserName, string Age, string Gender, string Mobile, string Email, string Password) { var registrationInfo = new RegistrationInfo(); using (var context = new CccHackEntities()) { registrationInfo = new RegistrationInfo { Age = Convert.ToInt32(Age), Email = Email, Gender = Gender, Mobile = Convert.ToDecimal(Mobile), UserId = Convert.ToInt32(UserId), Password = Password, AdminIndicator = Convert.ToInt32(UserId) == 558965 ? "Y" : "N", UserName = UserName }; context.RegistrationInfoes.Add(registrationInfo); context.SaveChanges(); } return true; }
private void ProcessPostSave( RegistrationService registrationService, Registration registration, List<int> previousRegistrantIds, RockContext rockContext ) { try { SavePersonNotes( rockContext, previousRegistrantIds, registration ); AddRegistrantsToGroup( rockContext, registration ); string appRoot = ResolveRockUrl( "~/" ); string themeRoot = ResolveRockUrl( "~~/" ); var confirmation = new Rock.Transactions.SendRegistrationConfirmationTransaction(); confirmation.RegistrationId = registration.Id; confirmation.AppRoot = appRoot; confirmation.ThemeRoot = themeRoot; Rock.Transactions.RockQueue.TransactionQueue.Enqueue( confirmation ); var notification = new Rock.Transactions.SendRegistrationNotificationTransaction(); notification.RegistrationId = registration.Id; notification.AppRoot = appRoot; notification.ThemeRoot = themeRoot; Rock.Transactions.RockQueue.TransactionQueue.Enqueue( notification ); var newRegistration = registrationService .Queryable( "Registrants.PersonAlias.Person,Registrants.GroupMember,RegistrationInstance.Account,RegistrationInstance.RegistrationTemplate.Fees,RegistrationInstance.RegistrationTemplate.Discounts,RegistrationInstance.RegistrationTemplate.Forms.Fields.Attribute,RegistrationInstance.RegistrationTemplate.FinancialGateway" ) .Where( r => r.Id == registration.Id ) .FirstOrDefault(); if ( newRegistration != null ) { RegistrationInstanceState = newRegistration.RegistrationInstance; RegistrationState = new RegistrationInfo( newRegistration, rockContext ); RegistrationState.PreviousPaymentTotal = registrationService.GetTotalPayments( registration.Id ); } } catch ( Exception postSaveEx ) { ShowWarning( "The following occurred after processing your " + RegistrationTerm, postSaveEx.Message ); ExceptionLogService.LogException( postSaveEx, Context, RockPage.PageId, RockPage.Layout.SiteId, CurrentPersonAlias ); } }
private void ProcessPostSave( bool isNewRegistration, Registration registration, List<int> previousRegistrantIds, RockContext rockContext ) { try { SavePersonNotes( rockContext, previousRegistrantIds, registration ); AddRegistrantsToGroup( rockContext, registration ); string appRoot = ResolveRockUrl( "~/" ); string themeRoot = ResolveRockUrl( "~~/" ); if ( isNewRegistration ) { var confirmation = new Rock.Transactions.SendRegistrationConfirmationTransaction(); confirmation.RegistrationId = registration.Id; confirmation.AppRoot = appRoot; confirmation.ThemeRoot = themeRoot; Rock.Transactions.RockQueue.TransactionQueue.Enqueue( confirmation ); var notification = new Rock.Transactions.SendRegistrationNotificationTransaction(); notification.RegistrationId = registration.Id; notification.AppRoot = appRoot; notification.ThemeRoot = themeRoot; Rock.Transactions.RockQueue.TransactionQueue.Enqueue( notification ); } var registrationService = new RegistrationService( new RockContext() ); var newRegistration = registrationService.Get( registration.Id ); if ( newRegistration != null ) { if ( isNewRegistration ) { if ( RegistrationTemplate.RequiredSignatureDocumentTemplateId.HasValue ) { string email = newRegistration.ConfirmationEmail; if ( string.IsNullOrWhiteSpace( email ) && newRegistration.PersonAlias != null && newRegistration.PersonAlias.Person != null ) { email = newRegistration.PersonAlias.Person.Email; } Guid? adultRole = Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT.AsGuid(); var groupMemberService = new GroupMemberService( rockContext ); foreach ( var registrant in newRegistration.Registrants.Where( r => r.PersonAlias != null && r.PersonAlias.Person != null ) ) { var assignedTo = registrant.PersonAlias.Person; var registrantIsAdult = adultRole.HasValue && groupMemberService .Queryable().AsNoTracking() .Any( m => m.PersonId == registrant.PersonAlias.PersonId && m.GroupRole.Guid.Equals( adultRole.Value ) ); if ( !registrantIsAdult && newRegistration.PersonAlias != null && newRegistration.PersonAlias.Person != null ) { assignedTo = newRegistration.PersonAlias.Person; } else { if ( !string.IsNullOrWhiteSpace( registrant.PersonAlias.Person.Email ) ) { email = registrant.PersonAlias.Person.Email; } } if ( DigitalSignatureComponent != null ) { var sendDocumentTxn = new Rock.Transactions.SendDigitalSignatureRequestTransaction(); sendDocumentTxn.SignatureDocumentTemplateId = RegistrationTemplate.RequiredSignatureDocumentTemplateId.Value; sendDocumentTxn.AppliesToPersonAliasId = registrant.PersonAlias.Id; sendDocumentTxn.AssignedToPersonAliasId = assignedTo.PrimaryAliasId ?? 0; sendDocumentTxn.DocumentName = string.Format( "{0}_{1}", RegistrationInstanceState.Name.RemoveSpecialCharacters(), registrant.PersonAlias.Person.FullName.RemoveSpecialCharacters() ); sendDocumentTxn.Email = email; Rock.Transactions.RockQueue.TransactionQueue.Enqueue( sendDocumentTxn ); } } } newRegistration.LaunchWorkflow( RegistrationTemplate.RegistrationWorkflowTypeId, newRegistration.ToString() ); newRegistration.LaunchWorkflow( RegistrationInstanceState.RegistrationWorkflowTypeId, newRegistration.ToString() ); } RegistrationInstanceState = newRegistration.RegistrationInstance; RegistrationState = new RegistrationInfo( newRegistration, rockContext ); RegistrationState.PreviousPaymentTotal = registrationService.GetTotalPayments( registration.Id ); } } catch ( Exception postSaveEx ) { ShowWarning( "The following occurred after processing your " + RegistrationTerm, postSaveEx.Message ); ExceptionLogService.LogException( postSaveEx, Context, RockPage.PageId, RockPage.Layout.SiteId, CurrentPersonAlias ); } }
internal static void RegisterHandler(Type grType, GRConfiguration grConf, string ev, GestureEventHandler handler) { System.Diagnostics.Debug.Assert(handler.Target is IGestureListener, "Attempting to register a handler for an instance of class " + handler.Target.GetType().ToString() + " which doesn't implement the interface IGestureListener."); int priorityNumber; if (!s_priorityNumbersTable.ContainsKeys(grType, grConf)) { priorityNumber = 0; s_priorityNumbersTable[grType, grConf] = priorityNumber; } else priorityNumber = s_priorityNumbersTable[grType, grConf]; RegistrationInfo grInfo = new RegistrationInfo(grType, grConf, priorityNumber, ev, handler); if (grType.IsSubclassOf(typeof(GlobalGestureRecognizer))) { s_ggrRegistry.Add(grInfo); // update subscribed GRManagers foreach (GroupGRManager grManager in s_subscribedGRManagers) grManager.UpdateGGR(grInfo); } else { s_lgrRegistry.Add(grInfo); // TODO: if LGRs are associated to the group's FINAL target list then dynamic update should be done } }
public override Cci.CompilationUnitSnippet GetCompilationUnitSnippetFor(string fullPathToSource, string buildAction){ if (fullPathToSource == null || !File.Exists(fullPathToSource)){Debug.Assert(false); return null;} StreamReader sr = new StreamReader(fullPathToSource); Cci.DocumentText docText = new Cci.DocumentText(new Cci.StringSourceText(sr.ReadToEnd(), true)); sr.Close(); Cci.Document doc; Cci.IParserFactory parserFactory; if (string.Compare(buildAction, "Compile", true, System.Globalization.CultureInfo.InvariantCulture) == 0){ #if Xaml if (string.Compare(Path.GetExtension(fullPathToSource), ".xaml", true, System.Globalization.CultureInfo.InvariantCulture) == 0){ doc = Microsoft.XamlCompiler.Compiler.CreateXamlDocument(fullPathToSource, 1, docText); parserFactory = new XamlParserFactory(); }else{ #endif doc = Compiler.CreateSpecSharpDocument(fullPathToSource, 1, docText); parserFactory = new ParserFactory(); #if Xaml } #endif }else if (string.Compare(buildAction, "EmbeddedResource", true, System.Globalization.CultureInfo.InvariantCulture) == 0){ if (string.Compare(Path.GetExtension(fullPathToSource), ".resx", true, System.Globalization.CultureInfo.InvariantCulture) == 0 || string.Compare(Path.GetExtension(fullPathToSource), ".txt", true, System.Globalization.CultureInfo.InvariantCulture) == 0){ RegistrationInfo regInfo = new RegistrationInfo(); string resgenPath = regInfo.GetResgenPath(); if (resgenPath == null) return null; parserFactory = new Cci.ResgenFactory(resgenPath); doc = Compiler.CreateSpecSharpDocument(fullPathToSource, 1, docText); }else return null; }else{ return null; } if (doc == null) return null; return new Cci.CompilationUnitSnippet(new Cci.Identifier(fullPathToSource), parserFactory, new Cci.SourceContext(doc)); }
/// <summary> /// Saves the changes. /// </summary> /// <returns></returns> private int? SaveChanges() { if ( !string.IsNullOrWhiteSpace( TransactionCode ) ) { ShowError( string.Empty, "You have already completed this " + RegistrationTerm.ToLower() ); return null; } Registration registration = null; if ( RegistrationState != null && RegistrationState.Registrants.Any() && RegistrationTemplate != null ) { var rockContext = new RockContext(); var registrationService = new RegistrationService( rockContext ); bool isNewRegistration = true; var previousRegistrants = new List<int>(); if ( RegistrationState.RegistrationId.HasValue ) { var previousRegistration = registrationService.Get( RegistrationState.RegistrationId.Value ); if ( previousRegistration != null ) { isNewRegistration = false; previousRegistrants = previousRegistration.Registrants .Where( r => r.PersonAlias != null ) .Select( r => r.PersonAlias.PersonId ) .ToList(); } } try { bool hasPayment = ( RegistrationState.PaymentAmount ?? 0.0m ) > 0.0m; // Save the registration registration = SaveRegistration( rockContext, hasPayment ); if ( registration != null ) { // If there is a payment being made, process the payment if ( hasPayment ) { string errorMessage = string.Empty; if ( !ProcessPayment( rockContext, registration, out errorMessage ) ) { throw new Exception( errorMessage ); } } try { // If there is a valid registration, and nothing went wrong processing the payment, add registrants to group and send the notifications if ( registration != null ) { SavePersonNotes( rockContext, previousRegistrants, registration ); AddRegistrantsToGroup( rockContext, registration ); string appRoot = ResolveRockUrl( "~/" ); string themeRoot = ResolveRockUrl( "~~/" ); var confirmation = new Rock.Transactions.SendRegistrationConfirmationTransaction(); confirmation.RegistrationId = registration.Id; confirmation.AppRoot = appRoot; confirmation.ThemeRoot = themeRoot; Rock.Transactions.RockQueue.TransactionQueue.Enqueue( confirmation ); var notification = new Rock.Transactions.SendRegistrationNotificationTransaction(); notification.RegistrationId = registration.Id; notification.AppRoot = appRoot; notification.ThemeRoot = themeRoot; Rock.Transactions.RockQueue.TransactionQueue.Enqueue( notification ); var newRegistration = registrationService .Queryable( "Registrants.PersonAlias.Person,Registrants.GroupMember,RegistrationInstance.Account,RegistrationInstance.RegistrationTemplate.Fees,RegistrationInstance.RegistrationTemplate.Discounts,RegistrationInstance.RegistrationTemplate.Forms.Fields.Attribute,RegistrationInstance.RegistrationTemplate.FinancialGateway" ) .Where( r => r.Id == registration.Id ) .FirstOrDefault(); if ( newRegistration != null ) { RegistrationInstanceState = newRegistration.RegistrationInstance; RegistrationState = new RegistrationInfo( newRegistration, rockContext ); RegistrationState.PreviousPaymentTotal = registrationService.GetTotalPayments( registration.Id ); } } } catch ( Exception postSaveEx ) { ShowWarning( "The following occurred after processing your " + RegistrationTerm, postSaveEx.Message ); ExceptionLogService.LogException( postSaveEx, Context, RockPage.PageId, RockPage.Layout.SiteId, CurrentPersonAlias ); } } } catch ( Exception ex ) { ExceptionLogService.LogException( ex, Context, this.RockPage.PageId, this.RockPage.Site.Id, CurrentPersonAlias ); string message = ex.Message; while ( ex.InnerException != null ) { ex = ex.InnerException; message = ex.Message; } ShowError( "An Error Occurred Processing Your " + RegistrationTerm, ex.Message ); // Try to delete the registration if it was just created try { if ( isNewRegistration && registration != null && registration.Id > 0 ) { RegistrationState.RegistrationId = null; using ( var newRockContext = new RockContext() ) { HistoryService.DeleteChanges( newRockContext, typeof( Registration ), registration.Id ); var newRegistrationService = new RegistrationService( newRockContext ); var newRegistration = newRegistrationService.Get( registration.Id ); if ( newRegistration != null ) { newRegistrationService.Delete( newRegistration ); newRockContext.SaveChanges(); } } } } catch { } return (int?)null; } } return registration != null ? registration.Id : (int?)null; }
public void Register() { RegistrationInfo regInfo = new RegistrationInfo(); this.PropertyBag["regInfo"] = regInfo; }
/// <summary> /// Sets the registration state /// </summary> private void SetRegistrationState() { string registrationSlug = PageParameter( REGISTRATION_SLUG_PARAM_NAME ); int? registrationInstanceId = PageParameter( REGISTRATION_INSTANCE_ID_PARAM_NAME ).AsIntegerOrNull(); int? registrationId = PageParameter( REGISTRATION_ID_PARAM_NAME ).AsIntegerOrNull(); int? groupId = PageParameter( REGISTRATION_GROUP_ID_PARAM_NAME ).AsIntegerOrNull(); int? campusId = PageParameter( REGISTRATION_CAMPUS_ID_PARAM_NAME ).AsIntegerOrNull(); // Not inside a "using" due to serialization needing context to still be active var rockContext = new RockContext(); // An existing registration id was specified if ( registrationId.HasValue ) { var registrationService = new RegistrationService( rockContext ); var registration = registrationService .Queryable( "Registrants.PersonAlias.Person,Registrants.GroupMember,RegistrationInstance.Account,RegistrationInstance.RegistrationTemplate.Fees,RegistrationInstance.RegistrationTemplate.Discounts,RegistrationInstance.RegistrationTemplate.Forms.Fields.Attribute,RegistrationInstance.RegistrationTemplate.FinancialGateway" ) .Where( r => r.Id == registrationId.Value ) .FirstOrDefault(); if ( registration != null ) { RegistrationInstanceState = registration.RegistrationInstance; RegistrationState = new RegistrationInfo( registration, rockContext ); RegistrationState.PreviousPaymentTotal = registrationService.GetTotalPayments( registration.Id ); } } // A registration slug was specified if ( RegistrationState == null && !string.IsNullOrWhiteSpace( registrationSlug ) ) { var dateTime = RockDateTime.Now; var linkage = new EventItemOccurrenceGroupMapService( rockContext ) .Queryable( "RegistrationInstance.Account,RegistrationInstance.RegistrationTemplate.Fees,RegistrationInstance.RegistrationTemplate.Discounts,RegistrationInstance.RegistrationTemplate.Forms.Fields.Attribute,RegistrationInstance.RegistrationTemplate.FinancialGateway" ) .Where( l => l.UrlSlug == registrationSlug && l.RegistrationInstance != null && l.RegistrationInstance.IsActive && l.RegistrationInstance.RegistrationTemplate != null && l.RegistrationInstance.RegistrationTemplate.IsActive && (!l.RegistrationInstance.StartDateTime.HasValue || l.RegistrationInstance.StartDateTime <= dateTime ) && (!l.RegistrationInstance.EndDateTime.HasValue || l.RegistrationInstance.EndDateTime > dateTime ) ) .FirstOrDefault(); if ( linkage != null ) { RegistrationInstanceState = linkage.RegistrationInstance; GroupId = linkage.GroupId; RegistrationState = new RegistrationInfo( CurrentPerson ); } } // A group id and campus id were specified if ( RegistrationState == null && groupId.HasValue && campusId.HasValue ) { var dateTime = RockDateTime.Now; var linkage = new EventItemOccurrenceGroupMapService( rockContext ) .Queryable( "RegistrationInstance.Account,RegistrationInstance.RegistrationTemplate.Fees,RegistrationInstance.RegistrationTemplate.Discounts,RegistrationInstance.RegistrationTemplate.Forms.Fields.Attribute,RegistrationInstance.RegistrationTemplate.FinancialGateway" ) .Where( l => l.GroupId == groupId && l.EventItemOccurrence != null && l.EventItemOccurrence.CampusId == campusId && l.RegistrationInstance != null && l.RegistrationInstance.IsActive && l.RegistrationInstance.RegistrationTemplate != null && l.RegistrationInstance.RegistrationTemplate.IsActive && ( !l.RegistrationInstance.StartDateTime.HasValue || l.RegistrationInstance.StartDateTime <= dateTime ) && ( !l.RegistrationInstance.EndDateTime.HasValue || l.RegistrationInstance.EndDateTime > dateTime ) ) .FirstOrDefault(); if ( linkage != null ) { RegistrationInstanceState = linkage.RegistrationInstance; GroupId = linkage.GroupId; RegistrationState = new RegistrationInfo( CurrentPerson ); } } // A registratio instance id was specified if ( RegistrationState == null && registrationInstanceId.HasValue ) { var dateTime = RockDateTime.Now; RegistrationInstanceState = new RegistrationInstanceService( rockContext ) .Queryable( "Account,RegistrationTemplate.Fees,RegistrationTemplate.Discounts,RegistrationTemplate.Forms.Fields.Attribute,RegistrationTemplate.FinancialGateway" ) .Where( r => r.Id == registrationInstanceId.Value && r.IsActive && r.RegistrationTemplate != null && r.RegistrationTemplate.IsActive && ( !r.StartDateTime.HasValue || r.StartDateTime <= dateTime ) && ( !r.EndDateTime.HasValue || r.EndDateTime > dateTime ) ) .FirstOrDefault(); if ( RegistrationInstanceState != null ) { RegistrationState = new RegistrationInfo( CurrentPerson ); } } if ( RegistrationState != null && !RegistrationState.Registrants.Any() ) { SetRegistrantState( 1 ); } }
/// <summary> /// Restores the view-state information from a previous user control request that was saved by the <see cref="M:System.Web.UI.UserControl.SaveViewState" /> method. /// </summary> /// <param name="savedState">An <see cref="T:System.Object" /> that represents the user control state to be restored.</param> protected override void LoadViewState( object savedState ) { base.LoadViewState( savedState ); string json = ViewState[REGISTRATION_INSTANCE_STATE_KEY] as string; if ( string.IsNullOrWhiteSpace( json ) ) { SetRegistrationState(); } else { RegistrationInstanceState = JsonConvert.DeserializeObject<RegistrationInstance>( json ); } json = ViewState[REGISTRATION_STATE_KEY] as string; if ( string.IsNullOrWhiteSpace( json ) ) { RegistrationState = new RegistrationInfo(); } else { RegistrationState = JsonConvert.DeserializeObject<RegistrationInfo>( json ); } SignInline = ViewState[SIGN_INLINE_KEY] as bool? ?? false; DigitalSignatureComponentTypeName = ViewState[DIGITAL_SIGNATURE_COMPONENT_TYPE_NAME_KEY] as string; if ( !string.IsNullOrWhiteSpace( DigitalSignatureComponentTypeName )) { DigitalSignatureComponent = DigitalSignatureContainer.GetComponent( DigitalSignatureComponentTypeName ); } GroupId = ViewState[GROUP_ID_KEY] as int?; CampusId = ViewState[CAMPUS_ID_KEY] as int?; CurrentPanel = ViewState[CURRENT_PANEL_KEY] as int? ?? 0; CurrentRegistrantIndex = ViewState[CURRENT_REGISTRANT_INDEX_KEY] as int? ?? 0; CurrentFormIndex = ViewState[CURRENT_FORM_INDEX_KEY] as int? ?? 0; minimumPayment = ViewState[MINIMUM_PAYMENT_KEY] as decimal?; CreateDynamicControls( false ); }
/// <summary> /// Saves the changes. /// </summary> /// <returns></returns> private int? SaveChanges() { Registration registration = null; if ( !string.IsNullOrWhiteSpace( TransactionCode ) ) { ShowError( string.Empty, "You have already completed this " + RegistrationTerm.ToLower() ); } else { try { if ( RegistrationState != null && RegistrationState.Registrants.Any() && RegistrationTemplate != null ) { var rockContext = new RockContext(); rockContext.WrapTransaction( () => { bool hasPayment = ( RegistrationState.PaymentAmount ?? 0.0m ) > 0.0m; if ( RegistrationState.RegistrationId.HasValue ) { registration = new RegistrationService( rockContext ).Get( RegistrationState.RegistrationId.Value ); } else { registration = SaveRegistration( rockContext, hasPayment ); } if ( registration != null ) { if ( hasPayment ) { string errorMessage = string.Empty; if ( !ProcessPayment( rockContext, registration, out errorMessage ) ) { registration = null; throw new Exception( errorMessage ); } } if ( registration != null ) { string appRoot = ResolveRockUrl( "~/" ); string themeRoot = ResolveRockUrl( "~~/" ); var confirmation = new Rock.Transactions.SendRegistrationConfirmationTransaction(); confirmation.RegistrationId = registration.Id; confirmation.AppRoot = appRoot; confirmation.ThemeRoot = themeRoot; Rock.Transactions.RockQueue.TransactionQueue.Enqueue( confirmation ); var notification = new Rock.Transactions.SendRegistrationNotificationTransaction(); notification.RegistrationId = registration.Id; notification.AppRoot = appRoot; notification.ThemeRoot = themeRoot; Rock.Transactions.RockQueue.TransactionQueue.Enqueue( notification ); } } } ); // Re-create State if ( registration != null ) { var registrationService = new RegistrationService( rockContext ); var newRegistration = registrationService .Queryable( "Registrants.PersonAlias.Person,Registrants.GroupMember,RegistrationInstance.Account,RegistrationInstance.RegistrationTemplate.Fees,RegistrationInstance.RegistrationTemplate.Discounts,RegistrationInstance.RegistrationTemplate.Forms.Fields.Attribute,RegistrationInstance.RegistrationTemplate.FinancialGateway" ) .AsNoTracking() .Where( r => r.Id == registration.Id ) .FirstOrDefault(); if ( newRegistration != null ) { RegistrationInstanceState = newRegistration.RegistrationInstance; RegistrationState = new RegistrationInfo( newRegistration, rockContext ); RegistrationState.PreviousPaymentTotal = registrationService.GetTotalPayments( registration.Id ); } } } } catch ( Exception ex ) { ExceptionLogService.LogException( ex, Context, this.RockPage.PageId, this.RockPage.Site.Id, CurrentPersonAlias ); ShowError( "An Error Occurred Processing Your " + RegistrationTerm, ex.Message ); return (int?)null; } } return registration != null ? registration.Id : (int?)null; }
/// <summary> /// Sets the registration state /// </summary> private bool SetRegistrationState() { string registrationSlug = PageParameter( SLUG_PARAM_NAME ); int? registrationInstanceId = PageParameter( REGISTRATION_INSTANCE_ID_PARAM_NAME ).AsIntegerOrNull(); int? registrationId = PageParameter( REGISTRATION_ID_PARAM_NAME ).AsIntegerOrNull(); int? groupId = PageParameter( GROUP_ID_PARAM_NAME ).AsIntegerOrNull(); int? campusId = PageParameter( CAMPUS_ID_PARAM_NAME ).AsIntegerOrNull(); int? eventOccurrenceId = PageParameter( EVENT_OCCURRENCE_ID_PARAM_NAME ).AsIntegerOrNull(); // Not inside a "using" due to serialization needing context to still be active var rockContext = new RockContext(); // An existing registration id was specified if ( registrationId.HasValue ) { var registrationService = new RegistrationService( rockContext ); var registration = registrationService .Queryable( "Registrants.PersonAlias.Person,Registrants.GroupMember,RegistrationInstance.Account,RegistrationInstance.RegistrationTemplate.Fees,RegistrationInstance.RegistrationTemplate.Discounts,RegistrationInstance.RegistrationTemplate.Forms.Fields.Attribute,RegistrationInstance.RegistrationTemplate.FinancialGateway" ) .Where( r => r.Id == registrationId.Value ) .FirstOrDefault(); if ( registration == null ) { ShowError( "Error", "Registration not found" ); return false; } if ( CurrentPersonId == null ) { ShowWarning( "Please log in", "You must be logged in to access this registration." ); return false; } // Only allow the person that was logged in when this registration was created. // If the logged in person, registered on someone elses behalf (for example, husband logged in, but entered wife's name as the Registrar), // also allow that person to access the regisratiuon if ( ( registration.PersonAlias != null && registration.PersonAlias.PersonId == CurrentPersonId.Value ) || ( registration.CreatedByPersonAlias != null && registration.CreatedByPersonAlias.PersonId == CurrentPersonId.Value ) ) { RegistrationInstanceState = registration.RegistrationInstance; RegistrationState = new RegistrationInfo( registration, rockContext ); RegistrationState.PreviousPaymentTotal = registrationService.GetTotalPayments( registration.Id ); } else { ShowWarning( "Sorry", "You are not allowed to view or edit the selected registration since you are not the one who created the registration." ); return false; } // set the max number of steps in the progress bar numHowMany.Value = registration.Registrants.Count(); this.ProgressBarSteps = numHowMany.Value * FormCount + 2; // set group id if ( groupId.HasValue ) { GroupId = groupId; } else if ( !string.IsNullOrWhiteSpace( registrationSlug ) ) { var dateTime = RockDateTime.Now; var linkage = new EventItemOccurrenceGroupMapService( rockContext ) .Queryable().AsNoTracking() .Where( l => l.UrlSlug == registrationSlug && l.RegistrationInstance != null && l.RegistrationInstance.IsActive && l.RegistrationInstance.RegistrationTemplate != null && l.RegistrationInstance.RegistrationTemplate.IsActive && ( !l.RegistrationInstance.StartDateTime.HasValue || l.RegistrationInstance.StartDateTime <= dateTime ) && ( !l.RegistrationInstance.EndDateTime.HasValue || l.RegistrationInstance.EndDateTime > dateTime ) ) .FirstOrDefault(); if ( linkage != null ) { GroupId = linkage.GroupId; } } } // A registration slug was specified if ( RegistrationState == null && !string.IsNullOrWhiteSpace( registrationSlug ) ) { var dateTime = RockDateTime.Now; var linkage = new EventItemOccurrenceGroupMapService( rockContext ) .Queryable( "RegistrationInstance.Account,RegistrationInstance.RegistrationTemplate.Fees,RegistrationInstance.RegistrationTemplate.Discounts,RegistrationInstance.RegistrationTemplate.Forms.Fields.Attribute,RegistrationInstance.RegistrationTemplate.FinancialGateway" ) .Where( l => l.UrlSlug == registrationSlug && l.RegistrationInstance != null && l.RegistrationInstance.IsActive && l.RegistrationInstance.RegistrationTemplate != null && l.RegistrationInstance.RegistrationTemplate.IsActive && ( !l.RegistrationInstance.StartDateTime.HasValue || l.RegistrationInstance.StartDateTime <= dateTime ) && ( !l.RegistrationInstance.EndDateTime.HasValue || l.RegistrationInstance.EndDateTime > dateTime ) ) .FirstOrDefault(); if ( linkage != null ) { RegistrationInstanceState = linkage.RegistrationInstance; GroupId = linkage.GroupId; RegistrationState = new RegistrationInfo( CurrentPerson ); } } // A group id and campus id were specified if ( RegistrationState == null && groupId.HasValue && campusId.HasValue ) { var dateTime = RockDateTime.Now; var linkage = new EventItemOccurrenceGroupMapService( rockContext ) .Queryable( "RegistrationInstance.Account,RegistrationInstance.RegistrationTemplate.Fees,RegistrationInstance.RegistrationTemplate.Discounts,RegistrationInstance.RegistrationTemplate.Forms.Fields.Attribute,RegistrationInstance.RegistrationTemplate.FinancialGateway" ) .Where( l => l.GroupId == groupId && l.EventItemOccurrence != null && l.EventItemOccurrence.CampusId == campusId && l.RegistrationInstance != null && l.RegistrationInstance.IsActive && l.RegistrationInstance.RegistrationTemplate != null && l.RegistrationInstance.RegistrationTemplate.IsActive && ( !l.RegistrationInstance.StartDateTime.HasValue || l.RegistrationInstance.StartDateTime <= dateTime ) && ( !l.RegistrationInstance.EndDateTime.HasValue || l.RegistrationInstance.EndDateTime > dateTime ) ) .FirstOrDefault(); CampusId = campusId; if ( linkage != null ) { RegistrationInstanceState = linkage.RegistrationInstance; GroupId = linkage.GroupId; RegistrationState = new RegistrationInfo( CurrentPerson ); } } // A registration instance id was specified if ( RegistrationState == null && registrationInstanceId.HasValue ) { var dateTime = RockDateTime.Now; RegistrationInstanceState = new RegistrationInstanceService( rockContext ) .Queryable( "Account,RegistrationTemplate.Fees,RegistrationTemplate.Discounts,RegistrationTemplate.Forms.Fields.Attribute,RegistrationTemplate.FinancialGateway" ) .Where( r => r.Id == registrationInstanceId.Value && r.IsActive && r.RegistrationTemplate != null && r.RegistrationTemplate.IsActive && ( !r.StartDateTime.HasValue || r.StartDateTime <= dateTime ) && ( !r.EndDateTime.HasValue || r.EndDateTime > dateTime ) ) .FirstOrDefault(); if ( RegistrationInstanceState != null ) { RegistrationState = new RegistrationInfo( CurrentPerson ); } } // If registration instance id and event occurrence were specified, but a group (linkage) hasn't been loaded, find the first group for the event occurrence if ( RegistrationInstanceState != null && eventOccurrenceId.HasValue && !groupId.HasValue ) { var eventItemOccurrence = new EventItemOccurrenceService( rockContext ) .Queryable() .Where( o => o.Id == eventOccurrenceId.Value ) .FirstOrDefault(); if ( eventItemOccurrence != null ) { CampusId = eventItemOccurrence.CampusId; var linkage = eventItemOccurrence.Linkages .Where( l => l.RegistrationInstanceId == RegistrationInstanceState.Id ) .FirstOrDefault(); if ( linkage != null ) { GroupId = linkage.GroupId; } } } if ( RegistrationState != null && RegistrationState.FamilyGuid == Guid.Empty && RegistrationTemplate != null && RegistrationTemplate.RegistrantsSameFamily != RegistrantsSameFamily.Ask ) { RegistrationState.FamilyGuid = Guid.NewGuid(); } if ( RegistrationState != null && !RegistrationState.Registrants.Any() ) { SetRegistrantState( 1 ); } if ( RegistrationTemplate != null && RegistrationTemplate.FinancialGateway != null ) { var threeStepGateway = RegistrationTemplate.FinancialGateway.GetGatewayComponent() as ThreeStepGatewayComponent; Using3StepGateway = threeStepGateway != null; if ( Using3StepGateway ) { Step2IFrameUrl = ResolveRockUrl( threeStepGateway.Step2FormUrl ); } } return true; }
/// <summary> /// Restores the view-state information from a previous user control request that was saved by the <see cref="M:System.Web.UI.UserControl.SaveViewState" /> method. /// </summary> /// <param name="savedState">An <see cref="T:System.Object" /> that represents the user control state to be restored.</param> protected override void LoadViewState( object savedState ) { base.LoadViewState( savedState ); string json = ViewState[REGISTRATION_INSTANCE_STATE_KEY] as string; if ( string.IsNullOrWhiteSpace( json ) ) { SetRegistrationState(); } else { RegistrationInstanceState = JsonConvert.DeserializeObject<RegistrationInstance>( json ); } json = ViewState[REGISTRATION_STATE_KEY] as string; if ( string.IsNullOrWhiteSpace( json ) ) { RegistrationState = new RegistrationInfo(); } else { RegistrationState = JsonConvert.DeserializeObject<RegistrationInfo>( json ); } GroupId = ViewState[GROUP_ID_KEY] as int?; CurrentPanel = ViewState[CURRENT_PANEL_KEY] as int? ?? 0; CurrentRegistrantIndex = ViewState[CURRENT_REGISTRANT_INDEX_KEY] as int? ?? 0; CurrentFormIndex = ViewState[CURRENT_FORM_INDEX_KEY] as int? ?? 0; CreateDynamicControls( false ); }
public static RegistrationInfo Parse(string input) { var info = new RegistrationInfo(); var array = input.Split(new[] { '|' }); info.Code1 = array[0]; info.SeriaDr = array[1]; info.Code2 = array[2]; info.OrganWydajacyNazwa = array[3]; info.OrganWydajacyUlica = array[4]; info.OrganWydajacyMiasto = array[5]; info.Code3 = array[6]; info.NrRejestracyjny = array[7]; info.MarkaPojazdu = array[8]; info.TypPojazdu = array[9]; info.WariantPojazdu = array[10]; info.WersjaPojazdu = array[11]; info.ModelPojazdu = array[12]; info.VinNrNadwozia = array[13]; info.DataWydaniaAktualnegoDr = array[14]; info.Code4 = array[15]; info.NazwaPosiadaczaDr = array[16]; info.ImionaPosiadaczaDr = array[17]; info.NazwiskoPosiadaczaDr = array[18]; info.Code5PosiadaczaDr = array[19]; info.PeselRegonPosiadaczaDr = array[20]; info.KodPocztowyPosiadaczaDr = array[21]; info.MiastoPosiadaczaDr = array[22]; info.PowiatPosiadaczaDr = array[23]; info.UlicaPosiadaczaDr = array[24]; info.NrDomuPosiadaczaDr = array[25]; info.NrLokaluPosiadaczaDr = array[26]; info.NazwaWlascicielaPojazdu = array[27]; info.ImionaWlascicielaPojazdu = array[28]; info.NazwiskoWlascicielaPojazdu = array[29]; info.Code6WlascicielaPojazdu = array[30]; info.PeselRegonWlascicielaPojazdu = array[31]; info.KodPocztowyWlascicielaPojazdu = array[32]; info.MiastoWlascicielaPojazdu = array[33]; info.PowiatWlascicielaPojazdu = array[34]; info.UlicaWlascicielaPojazdu = array[35]; info.NrDomuWlascicielaPojazdu = array[36]; info.NrLokaluWlascicielaPojazdu = array[37]; info.MaksymalnaMasaCalkowita = array[38]; info.DopuszczalnaMasaCalkowitaPojazdu = array[39]; info.DopuszczalnaMasaCalkowitaZespoluPojazdow = array[40]; info.MasaWlasna = array[41]; info.KategoriaPojazdu = array[42]; info.NrSwiadectwaHomologacjiTypuPojazdu = array[43]; info.LiczbaOsi = array[44]; info.MaksymalnaMasaCalkowitaPrzyczepyZHamulcem = array[45]; info.MaksymalnaMasaCalkowitaPrzyczepyBezHamulca = array[46]; info.StosunekMocyDoCiezaru = array[47]; info.Pojemnosc = array[48]; info.MocSilnika = array[49]; info.RodzajPaliwa = array[50]; info.DataPierwszejRejestracji = array[51]; info.MiejscaSiedzace = array[52]; info.MiejscaStojace = array[53]; info.RodzajPojazdu = array[54]; info.Przeznaczenie = array[55]; info.RokProdukcji = array[56]; info.DopuszczalnaLadownosc = array[57]; info.NajwiekszyDopuszczalnyNaciskOsi = array[58]; info.NrKartyPojazdu = array[59]; info.KodITS = array[60]; info.Code7 = array[61]; info.Code8 = array[62]; info.Code9 = array[63]; info.Code10 = array[64]; info.Code11 = array[65]; return info; }