/// <summary> /// Unregister the profiler using %SystemRoot%\system\regsvr32.exe /// </summary> /// <param name="registration">User - use the /n /i:user switches</param> public static void Unregister(Registration registration) { if (registration == Registration.Normal || registration == Registration.User) { ExecuteRegsvr32(registration == Registration.User, false); } }
protected override bool Validator(Registration.Registration registration, DateTime datetime) { bool drive = true; int position = registration.Number.Length -1; String digit = registration.Number.Substring(position,1); string weekday = datetime.DayOfWeek.ToString(); if (weekday == WeekDay.week_day.Monday.ToString() && (digit == "1" || digit == "2")) { drive = false; } else if (weekday == WeekDay.week_day.Tuesday.ToString() && (digit == "3" || digit == "4")) { drive = false; } else if (weekday == WeekDay.week_day.Wednesday.ToString() && (digit == "5" || digit == "6")) { drive = false; } else if (weekday == WeekDay.week_day.Thursday.ToString() && (digit == "7" || digit == "8")) { drive = false; } else if (weekday == WeekDay.week_day.Friday.ToString() && (digit == "9" || digit == "0")) { drive = false; } return drive; }
public void ValidateTemplateRegistrationAfterRegister(Registration registration, string zumoInstallationId) { ValidateTemplateRegistration(registration); Assert.IsNotNull(registration.RegistrationId); Assert.IsTrue(registration.Tags.Contains(zumoInstallationId)); Assert.AreEqual(registration.Tags.Count(), DefaultTags.Length + 1); }
public void ValidateTemplateRegistration(Registration registration) { var mpnsTemplateRegistration = (MpnsTemplateRegistration)registration; Assert.AreEqual(mpnsTemplateRegistration.BodyTemplate, BodyTemplate); foreach (KeyValuePair<string, string> header in DefaultHeaders) { string foundKey = mpnsTemplateRegistration.MpnsHeaders.Keys.Single(s => s.ToLower() == header.Key.ToLower()); Assert.IsNotNull(foundKey); Assert.AreEqual(mpnsTemplateRegistration.MpnsHeaders[foundKey], header.Value); } foreach (KeyValuePair<string, string> header in DetectedHeaders) { string foundKey = mpnsTemplateRegistration.MpnsHeaders.Keys.Single(s => s.ToLower() == header.Key.ToLower()); Assert.IsNotNull(foundKey); Assert.AreEqual(mpnsTemplateRegistration.MpnsHeaders[foundKey], header.Value); } Assert.AreEqual(mpnsTemplateRegistration.MpnsHeaders.Count, DefaultHeaders.Count + DetectedHeaders.Count); foreach (string tag in DefaultTags) { Assert.IsTrue(registration.Tags.Contains(tag)); } Assert.AreEqual(mpnsTemplateRegistration.Name, DefaultToastTemplateName); Assert.AreEqual(mpnsTemplateRegistration.TemplateName, DefaultToastTemplateName); }
public static void SendInvitationEmail(string username, string sendername, string email,Guid teamid) { try { Registration reg = new Registration(); string tid = reg.MD5Hash(email); MailHelper mailhelper = new MailHelper(); string mailpath = HttpContext.Current.Server.MapPath("~/Layouts/Mails/SendInvitation.htm"); string html = File.ReadAllText(mailpath); string fromemail = ConfigurationManager.AppSettings["fromemail"]; string usernameSend = ConfigurationManager.AppSettings["username"]; string host = ConfigurationManager.AppSettings["host"]; string port = ConfigurationManager.AppSettings["port"]; string pass = ConfigurationManager.AppSettings["password"]; string urllogin = "******"; string registrationurl = "http://woosuite.socioboard.com/Registration.aspx?tid="+teamid; string Body = mailhelper.InvitationMail(html, username, sendername, "", urllogin, registrationurl); string Subject = "You've been Invited to " + username + " Moople Social Account"; // MailHelper.SendMailMessage(host, int.Parse(port.ToString()), fromemail, pass, email, string.Empty, string.Empty, Subject, Body); MailHelper.SendSendGridMail(host, Convert.ToInt32(port), fromemail, "", email, "", "", Subject, Body, usernameSend, pass); } catch (Exception ex) { logger.Error(ex.Message); } }
public string Login(string EmailId, string Password) { // try { UserRepository userrepo = new UserRepository(); Registration regObject = new Registration(); User user = userrepo.GetUserInfo(EmailId, regObject.MD5Hash(Password)); if (user != null) { return new JavaScriptSerializer().Serialize(user); } else { return "Invalid user name or password"; } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return null; } }
private void SubscribeToService() { try { // Get User User msgUser = new User(); var msg = new GetUserMessage(this, message => { msgUser = message; }); Messenger.Default.Send(msg); // Create Registration Registration registration = new Registration(); registration.URI = httpChannel.ChannelUri.ToString(); registration.UserId = msgUser.UserId; // Register CapitalServiceClient client = new CapitalServiceClient(); client.RegisterCompleted += (s, e) => { }; client.RegisterAsync(registration); } catch { } }
public object GetInstance(Container container, Registration reg) { if (reg.Instance == null) reg.Instance = reg.CreateInstance(container); return reg.Instance; }
// Register a node address for a given mesh ID public int Register(string meshId, PeerNodeAddress nodeAddress) { bool newMeshId = false; int registrationId; Registration registration = new Registration(meshId, nodeAddress); // Add the new registration to the registration table; update meshIdTable with the newly registered nodeAddress lock (registrationTable) { registrationId = nextRegistrationId++; lock (meshIdTable) { // Update the meshId table Dictionary<int, PeerNodeAddress> addresses; if (!meshIdTable.TryGetValue(meshId, out addresses)) { // MeshID doesn't exist and needs to be added to meshIdTable newMeshId = true; addresses = new Dictionary<int, PeerNodeAddress>(); meshIdTable[meshId] = addresses; } addresses[registrationId] = nodeAddress; // Add an entry to the registration table registrationTable[registrationId] = new Registration(meshId, nodeAddress); } } if (newMeshId) Console.WriteLine("Registered new meshId {0}", meshId); return registrationId; }
/* Register Button */ private void btnRegister_Click(object sender, EventArgs e) { try { custID = Convert.ToInt32(cmbCustomer.SelectedValue); prodCode = cmbProduct.SelectedValue.ToString(); regDate = DTPickerRegistration.Value; Registration rego = new Registration(custID, prodCode, regDate); //RegistrationDB.AddRegistration(rego); if (RegistrationDB.AddRegistration(rego) == true) { MessageBox.Show("Registration Complete."); clearForm(); } else { MessageBox.Show("Registration Failed."); } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } }
public String ValidateSchedule(Schedule.Schedule schedule, Registration.Registration vehicle) { String information = ""; try { if (comboBoxCountry.SelectedItem.ToString() == Registration.Country.country_name.Ecuador.ToString()) { vehicle = new Registration.EcuadorRegistration(this.textBoxRegistration.Text); schedule = new Schedule.EcuadorSchedule(); DateTime dt = new DateTime(); dt = Convert.ToDateTime(dateTimePicker.Text); if (!(schedule as Schedule.EcuadorSchedule).EcuadorValidator(vehicle, dt)) information = "El vehículo con matrícula " + vehicle.Number + " no puede conducir en la ciudad de Quito entre las las 7:00 y las 9:30 en la mañana y entre las 16:00 y las 19:30 en la tarde y noche."; else information = "El vehículo con matrícula " + vehicle.Number + " puede conducir libremente en la ciudad de Quito en la fecha seleccionada."; } else information = "Información solo disponible para " + Registration.Country.country_name.Ecuador.ToString(); } catch (Exception exception) { information = exception.Message; } return information; }
public HarmonizeConnector(Registration.IFactory registrationFactory, With.Messaging.Client.IEndpoint messagingEndpoint) { _registrationFactory = registrationFactory; _messagingEndpoint = messagingEndpoint; _registrations = new Registration.Collection(); }
public void ValidateTemplateRegistration(Registration registration) { var mpnsTemplateRegistration = (MpnsTemplateRegistration)registration; Assert.AreEqual(mpnsTemplateRegistration.BodyTemplate, BodyTemplate); foreach (KeyValuePair<string, string> header in DefaultHeaders) { Assert.IsTrue(mpnsTemplateRegistration.MpnsHeaders.ContainsKey(header.Key)); Assert.AreEqual(mpnsTemplateRegistration.MpnsHeaders[header.Key], header.Value); } foreach (KeyValuePair<string, string> header in DetectedHeaders) { Assert.IsTrue(mpnsTemplateRegistration.MpnsHeaders.ContainsKey(header.Key)); Assert.AreEqual(mpnsTemplateRegistration.MpnsHeaders[header.Key], header.Value); } Assert.AreEqual(mpnsTemplateRegistration.MpnsHeaders.Count, DefaultHeaders.Count + DetectedHeaders.Count); foreach (string tag in DefaultTags) { Assert.IsTrue(registration.Tags.Contains(tag)); } Assert.AreEqual(mpnsTemplateRegistration.Name, DefaultToastTemplateName); Assert.AreEqual(mpnsTemplateRegistration.TemplateName, DefaultToastTemplateName); }
private string[] AddRegister() { var regs = new Registration() { Adress = txtAdres.Text, BirthDate = txtDogumTar.Text, BirthPlace = txtDogumYeri.Text, Chapter = txtBolum.Text, FatherJob = txtBabaMeslek.Text, FatherName = txtBabaMeslek.Text, FatherTNo = txtBabaTCKNo.Text, MailAdress = txtMail.Text, MobileNumber = txtCepNo.Text, MotherJob = txtAnneMeslek.Text, MotherName = txtAnneAdi.Text, Name = txtAd.Text, Number = txtTel.Text, SchoolLeaver = txtMezunOkul.Text, Surname = txtSoyad.Text, TCKNo = txtTckNo.Text }; string[] returnResult = _registrationBusiness.AddRegistrtaion(regs); return returnResult; }
public void CheckEquality( Registration sut, string key, string other ) { sut.Key = key; Assert.True( sut.Equals( key ) ); Assert.False( sut.Equals( other ) ); }
public void a_AddValid() { var response = client.AddRegistration(entity); WasSuccessfulTest(response); Assert.True(response.Data.id > 0); Assert.True(response.Data.data_saved.id == response.Data.id); entity = response.Data.data_saved; }
public void ValidateTemplateRegistrationAfterRegister(Registration registration) { ValidateTemplateRegistration(registration); Assert.IsNotNull(registration.RegistrationId); // TODO: Uncomment when .Net Runtime implements installationID //Assert.IsTrue(registration.Tags.Contains(zumoInstallationId)); //Assert.AreEqual(registration.Tags.Count(), DefaultTags.Length + 1); }
private void ReplaceOriginalExpression(Registration decoratorRegistration) { this.e.Expression = decoratorRegistration.BuildExpression(this.e.InstanceProducer); this.e.ReplacedRegistration = decoratorRegistration; this.e.InstanceProducer.IsDecorated = true; }
internal override void Execute() { var cmdlet = (ReceiveTmxTestTaskCommand)Cmdlet; var clientSettings = ClientSettings.Instance; clientSettings.StopImmediately = false; var taskLoader = new TaskLoader(new RestRequestCreator()); // 20141020 squeezing a task to its proxy ITestTask task = null; // ITestTaskProxy task = null; // ITestTaskCodeProxy task = null; // temporarily // TODO: to a template method var startTime = DateTime.Now; while (!clientSettings.StopImmediately) { // TODO: move to aspect try { task = taskLoader.GetCurrentTask(); } catch (ClientNotRegisteredException) { if (Guid.Empty != ClientSettings.Instance.ClientId && string.Empty != ClientSettings.Instance.ServerUrl) { var registration = new Registration(new RestRequestCreator()); ClientSettings.Instance.ClientId = registration.SendRegistrationInfoAndGetClientId(ClientSettings.Instance.CurrentClient.CustomString); } // TODO: AOP Trace.TraceWarning("ReceiveTestTaskCommand.1"); // temporary Trace.TraceWarning("ClientNotRegisteredException"); throw; } catch (Exception e) { // NullreferenceException // TODO: AOP Trace.TraceWarning("ReceiveTestTaskCommand.2"); // temporary Trace.TraceWarning(e.Message); } if (null != task) break; if (!cmdlet.Continuous) if ((DateTime.Now - startTime).TotalSeconds >= cmdlet.Seconds) throw new Exception("Failed to receive a task in " + cmdlet.Seconds + " seconds"); System.Threading.Thread.Sleep(Preferences.ReceivingTaskSleepIntervalMilliseconds); } clientSettings.StopImmediately = false; clientSettings.CurrentTask = task; cmdlet.WriteObject(task); }
public void SetUp() { _testContext = new ExpandoObject(); _testContext.Exception = null; _guidFactory = MockRepository.GenerateMock<IGuidFactory>(); _registrationRepository = MockRepository.GenerateMock<IRegistrationRepository>(); _sut = new RegistrationService(_guidFactory, _registrationRepository); _request = new Registration(); }
public virtual Dojo Register(MartialArtist martialArtist) { var registration = new Registration {StudentId = martialArtist.Id, Active = true, DojoId = Id}; if (Registrations.Any(r => r.StudentId == martialArtist.Id)) throw new StudentAlreadyRegisteredException(this, martialArtist); Registrations.Add(registration); DomainEvents.Raise(new StudentRegistered(Id,martialArtist.Id,DateTime.Now)); return this; }
public void sendEmailConfirmation(Registration finalizedRegistration) { string confirmationMessageText = "Registration confirmed for: " + finalizedRegistration.RegistrationID; string confirmationMessageTitle = "Registration confirmed for: " + finalizedRegistration.RegistrationID; User confirmationMessageSender = new User("*****@*****.**"); Message confirmationMessage = new Message(new List<User> { finalizedRegistration.RegisteringUser }, confirmationMessageSender, confirmationMessageTitle, confirmationMessageText); }
/// <summary> /// Constructs a new DescriptorRegistrar instance /// </summary> public DescriptorRegistrar() { _registrations = new Dictionary<uint, Registration>(); _defaultRegistration = new Registration( 0, 0, (vi, di, oi) => new ObjectInfo(vi, di, oi)); }
internal InitializationContext(InstanceProducer producer, Registration registration) { // producer will be null when a user calls Registration.BuildExpression() directly, instead of // calling InstanceProducer.BuildExpression() or InstanceProducer.GetInstance(). Requires.IsNotNull(registration, nameof(registration)); this.Producer = producer; this.Registration = registration; }
public Endpoint(Hub.IFactory hubFactory, Registration.IFactory registrationFactory) { _debug = new ObservableStreamWriter(); _hubFactory = hubFactory; _registrationFactory = registrationFactory; _registrations = new Registration.Collection(); }
private void Handle(NewVehicle @event) { if (this.Registration != null) { throw new RuntimeException("Event processed twice!"); } this.Registration = new Registration(@event.RegistrationNumber); }
public void UpdateRegistration(Registration registration, RegistrationPostModel registrationPostModel, Student student, ModelStateDictionary modelState, bool adminUpdate = false) { CopyHelper.CopyRegistrationValues(registrationPostModel.Registration, registration); registration.GradTrack = registrationPostModel.GradTrack; NullOutBlankFields(registration); registration.SpecialNeeds = LoadSpecialNeeds(registrationPostModel.SpecialNeeds); UpdateCeremonyParticipations(registration, registrationPostModel.CeremonyParticipations, modelState, adminUpdate); AddRegistrationPetitions(registration, registrationPostModel.CeremonyParticipations, modelState); }
private static bool HasMatchingSignature(Registration candidate, IEnumerable<Type> argumentTypes) { var candidateParameterTypes = candidate.Definition.GetParameters().Select(x => x.GetType()); if (candidateParameterTypes.Count() != argumentTypes.Count()) { return false; } return true; }
public static void Register (IntPtr hwnd, Action<ThumbnailToolbar> toolbar_created_callback) { Win32WinProc proc = new Win32WinProc (WndProc); orig_winproc_dict[hwnd] = new Registration () { ManagedProc = proc, OrigWinProc = SetWindowLongW (hwnd, GWL_WNDPROC, Marshal.GetFunctionPointerForDelegate (proc)), CreationCallback = toolbar_created_callback }; }
public HybridRegistration(Type serviceType, Type implementationType, Func<bool> test, Registration trueRegistration, Registration falseRegistration, Lifestyle lifestyle, Container container) : base(lifestyle, container) { this.serviceType = serviceType; this.implementationType = implementationType; this.test = test; this.trueRegistration = trueRegistration; this.falseRegistration = falseRegistration; }
public ActionResult Register(string submit, string firstname, string lastname, string gender, string username, string password, string confirmpassword, string email, string telepon) { if (!string.IsNullOrEmpty(submit)) { Registration regs = new Registration(); Regex regexEmail = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"); Boolean matchEmail = regexEmail.IsMatch(email); Boolean phoneMatch = true; for (int i = 0; i < telepon.Length; i++) { phoneMatch = Char.IsNumber(telepon, i); if (phoneMatch == true) { continue; } else { phoneMatch = false; break; } } if (username == "" || password == "" || email == "" || telepon == "" || firstname == "" || lastname == "") { ViewBag.Color = "red"; ViewBag.Message = "No Empty Fields Are Allowed"; return(View()); } else if (matchEmail == false) { ViewBag.Color = "red"; ViewBag.Message = "Wrong Email Format"; return(View()); } else if (phoneMatch == false) { ViewBag.Color = "red"; ViewBag.Message = "Wrong Phone Number Format"; return(View()); } else if (confirmpassword != password) { ViewBag.Color = "red"; ViewBag.Message = "Password Isn't Match"; return(View()); } else { string encoded = Encryption(password); Guid guid = Guid.NewGuid(); using (ASPMVCDB db = new ASPMVCDB()) { // Check Email and Username Availability int objUser = db.Registration.Where(model => model.Username.Equals(username)).Count(); int objEmail = db.Registration.Where(model => model.Email.Equals(email)).Count(); if (objUser > 0 || objEmail > 0) { ViewBag.Color = "red"; ViewBag.Message = "Username or Email Is Already Registered"; return(View()); } else if (objUser > 0 && objEmail > 0) { ViewBag.Color = "red"; ViewBag.Message = "Username or Email Is Already Registered"; return(View()); } else { string uniqid = guid.ToString(); string VerifyCode = ScrambleWord(uniqid.Replace("-", "")); string code = VerifyCode.Substring(0, 10); regs.Id = uniqid; regs.Firstname = firstname; regs.Lastname = lastname; regs.Username = username; regs.Gender = gender; regs.Password = encoded; regs.ConfirmPassword = encoded; regs.Email = email; regs.Telepon = telepon; regs.ThemeLink = "~/Content/theme/default.jpg"; regs.Photo = "~/Content/img/default.jpg"; regs.IsActive = "0"; regs.VerifyActivationCode = code; db.Registration.Add(regs); db.SaveChanges(); Session["IDUser"] = uniqid; long milliseconds = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; TempData["code"] = code; TempData.Keep("code"); return(RedirectToRoute("Verify", new { id = milliseconds })); } } } } else { return(new EmptyResult()); } }
public RegController() { ViewBag.ErrorMessage = string.Empty; registration = new Registration(); }
public int GetUserList(Registration registration) { IService itemService = new Service(); return(itemService.GetUserList(registration)); }
public override async Task ExecuteAsync(Message message, TelegramBotClient client) { await Registration.SetStageAsync(message, client, RegStage.SetPlace); }
/// <summary> /// AddUserRegistration method implementation /// </summary> public override Registration AddUserRegistration(Registration reg, bool newkey = true) { if (SQLUtils.HasRegistration(_host, reg.UPN)) { return(SetUserRegistration(reg, newkey)); } string request = "INSERT INTO REGISTRATIONS (UPN, SECRETKEY, MAILADDRESS, PHONENUMBER, PIN, ENABLED, METHOD, OVERRIDE) VALUES (@UPN, @SECRETKEY, @MAILADDRESS, @PHONENUMBER, @PIN, @ENABLED, @METHOD, @OVERRIDE)"; SqlConnection con = new SqlConnection(_connectionstring); SqlCommand sql = new SqlCommand(request, con); SqlParameter prm1 = new SqlParameter("@UPN", SqlDbType.VarChar); sql.Parameters.Add(prm1); prm1.Value = reg.UPN; SqlParameter prm1a = new SqlParameter("@SECRETKEY", SqlDbType.VarChar); sql.Parameters.Add(prm1a); prm1a.Value = Guid.NewGuid().ToString().ToUpper(); SqlParameter prm2 = new SqlParameter("@MAILADDRESS", SqlDbType.VarChar); sql.Parameters.Add(prm2); if (string.IsNullOrEmpty(reg.MailAddress)) { prm2.Value = DBNull.Value; } else { prm2.Value = reg.MailAddress; } SqlParameter prm3 = new SqlParameter("@PHONENUMBER", SqlDbType.VarChar); sql.Parameters.Add(prm3); if (string.IsNullOrEmpty(reg.PhoneNumber)) { prm3.Value = DBNull.Value; } else { prm3.Value = reg.PhoneNumber; } SqlParameter prm4 = new SqlParameter("@PIN", SqlDbType.Int); sql.Parameters.Add(prm4); prm4.Value = reg.PIN; SqlParameter prm5 = new SqlParameter("@ENABLED", SqlDbType.Bit); sql.Parameters.Add(prm5); prm5.Value = reg.Enabled; SqlParameter prm6 = new SqlParameter("@METHOD", SqlDbType.Int); sql.Parameters.Add(prm6); prm6.Value = reg.PreferredMethod; SqlParameter prm7 = new SqlParameter("@OVERRIDE", SqlDbType.VarChar); sql.Parameters.Add(prm7); if (reg.OverrideMethod == null) { prm7.Value = string.Empty; } else { prm7.Value = reg.OverrideMethod; } con.Open(); try { int res = sql.ExecuteNonQuery(); if (newkey) { this.OnKeyDataEvent(reg.UPN, KeysDataManagerEventKind.add); } } catch (Exception ex) { DataLog.WriteEntry(ex.Message, System.Diagnostics.EventLogEntryType.Error, 5000); throw new Exception(ex.Message); } finally { con.Close(); } return(GetUserRegistration(reg.UPN)); }
/// <summary> /// GetUserRegistrations method implementation /// </summary> public override RegistrationList GetUserRegistrations(DataFilterObject filter, DataOrderObject order, DataPagingObject paging) { Dictionary <int, string> fliedlsvalues = new Dictionary <int, string> { { 0, " UPN " }, { 1, " MAILADDRESS " }, { 2, " PHONENUMBER " } }; Dictionary <int, string> operatorsvalues = new Dictionary <int, string> { { 0, " = @FILTERVALUE " }, { 1, " LIKE @FILTERVALUE +'%' " }, { 2, " LIKE '%'+ @FILTERVALUE +'%' " }, { 3, " <> @FILTERVALUE " }, { 4, " LIKE '%'+ @FILTERVALUE " }, { 5, " NOT LIKE '%' + @FILTERVALUE +'%' " } }; Dictionary <int, string> nulloperatorsvalues = new Dictionary <int, string> { { 0, " IS NULL " }, { 1, " IS NULL " }, { 2, " IS NULL " }, { 3, " IS NOT NULL " }, { 4, " IS NOT NULL " }, { 5, " IS NOT NULL " } }; Dictionary <int, string> methodvalues = new Dictionary <int, string> { { 0, " METHOD = 0 " }, { 1, " METHOD = 1 " }, { 2, " METHOD = 2 " }, { 3, " METHOD = 3 " }, { 4, " METHOD = 4 " } }; string request = string.Empty; switch (order.Column) { case DataOrderField.UserName: if (order.Direction == SortDirection.Ascending) { request = "SELECT ROW_NUMBER() OVER(ORDER BY UPN) AS NUMBER, ID, UPN, MAILADDRESS, PHONENUMBER, PIN, ENABLED, METHOD, OVERRIDE FROM REGISTRATIONS"; } else { request = "SELECT ROW_NUMBER() OVER(ORDER BY UPN DESC) AS NUMBER, ID, UPN, MAILADDRESS, PHONENUMBER, PIN, ENABLED, METHOD, OVERRIDE FROM REGISTRATIONS"; } break; case DataOrderField.Email: if (order.Direction == SortDirection.Ascending) { request = "SELECT ROW_NUMBER() OVER(ORDER BY MAILADDRESS) AS NUMBER, ID, UPN, MAILADDRESS, PHONENUMBER, PIN, ENABLED, METHOD, OVERRIDE FROM REGISTRATIONS"; } else { request = "SELECT ROW_NUMBER() OVER(ORDER BY MAILADDRESS DESC) AS NUMBER, ID, UPN, MAILADDRESS, PHONENUMBER, PIN, ENABLED, METHOD, OVERRIDE FROM REGISTRATIONS"; } break; case DataOrderField.Phone: if (order.Direction == SortDirection.Ascending) { request = "SELECT ROW_NUMBER() OVER(ORDER BY PHONENUMBER) AS NUMBER, ID, UPN, MAILADDRESS, PHONENUMBER, PIN, ENABLED, METHOD, OVERRIDE FROM REGISTRATIONS"; } else { request = "SELECT ROW_NUMBER() OVER(ORDER BY PHONENUMBER DESC) AS NUMBER, ID, UPN, MAILADDRESS, PHONENUMBER, PIN, ENABLED, METHOD, OVERRIDE FROM REGISTRATIONS"; } break; default: if (order.Direction == SortDirection.Ascending) { request = "SELECT ROW_NUMBER() OVER(ORDER BY ID) AS NUMBER, ID, UPN, MAILADDRESS, PHONENUMBER, PIN, ENABLED, METHOD, OVERRIDE FROM REGISTRATIONS"; } else { request = "SELECT ROW_NUMBER() OVER(ORDER BY ID DESC) AS NUMBER, ID, UPN, MAILADDRESS, PHONENUMBER, PIN, ENABLED, METHOD, OVERRIDE FROM REGISTRATIONS"; } break; } bool hasparameter = (string.Empty != filter.FilterValue); bool hasmethod = false; if (filter.FilterisActive) { if (hasparameter) { request += " WHERE"; string strfields = string.Empty; string stroperator = string.Empty; fliedlsvalues.TryGetValue((int)filter.FilterField, out strfields); request += strfields; if (filter.FilterValue != null) { operatorsvalues.TryGetValue((int)filter.FilterOperator, out stroperator); } else { nulloperatorsvalues.TryGetValue((int)filter.FilterOperator, out stroperator); } request += stroperator; } if (filter.FilterMethod != PreferredMethod.None) { string strmethod = string.Empty; methodvalues.TryGetValue((int)filter.FilterMethod, out strmethod); if (hasparameter) { request += " AND " + strmethod; } else { request += " WHERE " + strmethod; } hasmethod = true; } if (filter.EnabledOnly) { if ((hasparameter) || (hasmethod)) { request += " AND ENABLED=1"; } else { request += " WHERE ENABLED=1"; } } } if (paging.isActive) { request = "SELECT TOP " + _host.MaxRows.ToString() + " NUMBER, ID, UPN, MAILADDRESS, PHONENUMBER, PIN, ENABLED, METHOD, OVERRIDE FROM (" + request; request += ") AS TBL WHERE NUMBER BETWEEN " + ((paging.CurrentPage - 1) * paging.PageSize + 1) + " AND " + (paging.CurrentPage) * paging.PageSize; } SqlConnection con = new SqlConnection(_connectionstring); SqlCommand sql = new SqlCommand(request, con); if ((hasparameter) && (filter.FilterValue != null)) { SqlParameter prm = new SqlParameter("@FILTERVALUE", SqlDbType.VarChar); sql.Parameters.Add(prm); prm.Value = filter.FilterValue; } RegistrationList regs = new RegistrationList(); con.Open(); try { int i = 0; SqlDataReader rd = sql.ExecuteReader(); while (rd.Read()) { Registration reg = new Registration(); reg.ID = rd.GetInt64(1).ToString(); reg.UPN = rd.GetString(2); if (!rd.IsDBNull(3)) { reg.MailAddress = rd.GetString(3); } if (!rd.IsDBNull(4)) { reg.PhoneNumber = rd.GetString(4); } reg.PIN = rd.GetInt32(5); reg.Enabled = rd.GetBoolean(6); reg.PreferredMethod = (PreferredMethod)rd.GetInt32(7); if (!rd.IsDBNull(8)) { reg.OverrideMethod = rd.GetString(8); } else { reg.OverrideMethod = string.Empty; } reg.IsRegistered = true; regs.Add(reg); i++; } return(regs); } catch (Exception ex) { DataLog.WriteEntry(ex.Message, System.Diagnostics.EventLogEntryType.Error, 5000); throw new Exception(ex.Message); } finally { con.Close(); } }
public static Base FromStream(Stream stream) { // Check stream if (stream == null) { throw new ArgumentNullException(); } if (!stream.CanRead) { throw new ArgumentException("Stream can not be read"); } XmlReader reader = null; try { // Start reading XML header reader = XmlReader.Create(stream); if (reader.ReadToFollowing("Root") == false) { throw new ArgumentException("Unable to locate root element"); } // Determine the type of the XML file string name = reader.GetAttribute("Name"); string version = reader.GetAttribute("Version"); reader.Close(); // XML file doesn't meet our expected format if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(version)) { throw new ArgumentException("Unable to locate Name or Version attribute"); } string type = name + "_" + version; // Load file as known type Registration registration = null; lock (_types) { if (_types.ContainsKey(type)) { registration = _types[type]; } } if (registration == null) { throw new ArgumentException("No registered data class for type " + name + " v" + version); } // Verify document if (!string.IsNullOrEmpty(registration.Schema)) { stream.Seek(0, SeekOrigin.Begin); XmlReaderSettings readerSettings = new XmlReaderSettings(); readerSettings.ConformanceLevel = ConformanceLevel.Document; // Configure XSD validation readerSettings.ValidationType = ValidationType.Schema; readerSettings.Schemas.Add(registration.Namespace, registration.Schema); readerSettings.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings; // Validate document stream.Seek(0, SeekOrigin.Begin); reader = XmlReader.Create(stream, readerSettings); while (reader.Read()) { } reader.Close(); } // Deserialize stream.Seek(0, SeekOrigin.Begin); reader = XmlReader.Create(stream); XmlSerializer serializer = XML.GetSerializer(registration.Type); ErrorCatcher errorCatcher = new ErrorCatcher(); serializer.UnknownAttribute += new XmlAttributeEventHandler(errorCatcher.OnUnknownAttribute); serializer.UnknownElement += new XmlElementEventHandler(errorCatcher.OnUnknownElement); serializer.UnknownNode += new XmlNodeEventHandler(errorCatcher.OnUnknownNode); Base data = (Base)serializer.Deserialize(reader); // Verify output if (errorCatcher.Exceptions.Count > 0) { throw errorCatcher.Exceptions[0]; } if (data == null) { return(null); } // Upgrade data if needed while (data.CanUpgrade) { data = data.Upgrade(); } // Apply XSD information if (!string.IsNullOrEmpty(registration.Namespace) && !string.IsNullOrEmpty(registration.Schema)) { // TODO: figure out a way to set the 'xmlns' attribute data.XsiSchemaLocation = registration.Namespace + " " + registration.Schema; } else if (!string.IsNullOrEmpty(registration.Schema)) { data.XsiNoNamespaceSchemaLocation = registration.Schema; } // Everything went right, pfew return(data); } finally { // Close anything left open if (reader != null) { reader.Close(); } } }
public ActionResult Register(Registration tb) { return(View()); }
private static void RegisterDefaultInstance <T, TDefault>(this ContainerBuilder builder, Registration <T> registration, string name = null) where T : class where TDefault : class, T, new() { if (registration != null) { builder.Register(registration, name); } else { if (name == null) { builder.RegisterInstance(new TDefault()).As <T>(); } else { builder.RegisterInstance(new TDefault()).Named <T>(name); } } }
private static void RegisterDefaultType <T, TDefault>(this ContainerBuilder builder, Registration <T> registration, string name = null) where T : class where TDefault : T { if (registration != null) { builder.Register(registration, name); } else { if (name == null) { builder.RegisterType <TDefault>().As <T>(); } else { builder.RegisterType <TDefault>().Named <T>(name); } } }
public string InsertReg(Registration registration) { return(_registrationContext.InsertReg(registration)); }
private static void RegisterFromInterfaces(Type registration, IDictionary <Type, IList <Registration> > tempDict, Registration reg) { foreach (var type in registration.GetInterfaces().Where(type => typeof(IComponent).IsAssignableFrom(type))) { if (!tempDict.ContainsKey(type)) { tempDict.Add(type, new List <Registration>()); } tempDict[type].Add(reg); } }
private static void RegisterClassItSelf(Container container, Type registration, Registration reg) { if (registration.IsPublic) { container.AddRegistration(registration, reg); sW4.SimpleInjector.SimpleInjectorGenericFactory.RegisterNameAndType(registration); } }
internal static bool IsContainerControlledCollection(this Registration registration) => registration is ContainerControlledCollectionRegistration;
private static void register_running_assemblies(IEnumerable <Assembly> need_scan_assemblies, Registration registration) { var assemblies = new AssembliesImpl(need_scan_assemblies); registration.register <Assemblies>(() => assemblies); }
private ImmutableArray <IIncrementalAnalyzer> GetIncrementalAnalyzers(Registration registration, AnalyzersGetter analyzersGetter, bool onlyHighPriorityAnalyzer) { var orderedAnalyzers = analyzersGetter.GetOrderedAnalyzers(registration.Workspace, onlyHighPriorityAnalyzer); SolutionCrawlerLogger.LogAnalyzers(registration.CorrelationId, registration.Workspace, orderedAnalyzers, onlyHighPriorityAnalyzer); return(orderedAnalyzers); }
/// <summary> /// GetAllUserRegistrations method implementation /// </summary> public override RegistrationList GetAllUserRegistrations(DataOrderObject order, bool enabledonly = false) { string request = string.Empty; if (enabledonly) { request = "SELECT TOP " + _host.MaxRows.ToString() + " ID, UPN, MAILADDRESS, PHONENUMBER, PIN, ENABLED, METHOD, OVERRIDE FROM REGISTRATIONS WHERE ENABLED=1"; } else { request = "SELECT TOP " + _host.MaxRows.ToString() + " ID, UPN, MAILADDRESS, PHONENUMBER, PIN, ENABLED, METHOD, OVERRIDE FROM REGISTRATIONS"; } switch (order.Column) { case DataOrderField.UserName: request += " ORDER BY UPN"; break; case DataOrderField.Email: request += " ORDER BY MAILADDRESS"; break; case DataOrderField.Phone: request += " ORDER BY PHONENUMBER"; break; default: request += " ORDER BY ID"; break; } if (order.Direction == SortDirection.Descending) { request += " DESC"; } SqlConnection con = new SqlConnection(_connectionstring); SqlCommand sql = new SqlCommand(request, con); RegistrationList regs = new RegistrationList(); con.Open(); try { SqlDataReader rd = sql.ExecuteReader(); while (rd.Read()) { Registration reg = new Registration(); reg.ID = rd.GetInt64(0).ToString(); reg.UPN = rd.GetString(1); if (!rd.IsDBNull(2)) { reg.MailAddress = rd.GetString(2); } if (!rd.IsDBNull(3)) { reg.PhoneNumber = rd.GetString(3); } reg.PIN = rd.GetInt32(4); reg.Enabled = rd.GetBoolean(5); reg.PreferredMethod = (PreferredMethod)rd.GetInt32(6); if (!rd.IsDBNull(7)) { reg.OverrideMethod = rd.GetString(7); } else { reg.OverrideMethod = string.Empty; } reg.IsRegistered = true; regs.Add(reg); } return(regs); } catch (Exception ex) { DataLog.WriteEntry(ex.Message, System.Diagnostics.EventLogEntryType.Error, 5000); throw new Exception(ex.Message); } finally { con.Close(); } }
public string AddMembers(Registration obj) { try { U_USR_LgnDAL ologonDAL = new U_USR_LgnDAL(); U_USR_MASTERDAL oMstDAL = new U_USR_MASTERDAL(); U_USR_Lgn Lgnobj = new U_USR_Lgn(); U_USR_MASTER Mstobj = new U_USR_MASTER(); if (string.IsNullOrEmpty(ologonDAL.CheckEmail_Exist(obj.Email_Id))) { Mstobj.Usr_Id = Guid.NewGuid().ToString(); Mstobj.Usr_role_Id = ""; Mstobj.Date_Of_Birth = DateTime.Now; Mstobj.First_Name = obj.First_Name; Mstobj.Alt_Email_Id = string.Empty; Mstobj.Gender = string.Empty; Mstobj.Is_married = 0; Mstobj.Last_Name = string.Empty; Mstobj.Media_Id_Img = "1"; Mstobj.Address_Id = "1"; Mstobj.Rating = string.Empty; Mstobj.Updated_by = string.Empty; Mstobj.Updated_Date = DateTime.Now; Mstobj.Wed_anniversary = DateTime.Now; Mstobj.About_member = string.Empty; Mstobj.Created_by = string.Empty; Mstobj.Created_Date = DateTime.Now; var status = oMstDAL.InsertU_USR_MASTER(Mstobj); if (status) { Lgnobj.Login_Id = Guid.NewGuid().ToString(); Lgnobj.Login_status = 0; Lgnobj.Email_ID = obj.Email_Id; Lgnobj.Mobile_Number = obj.Phone_No; Lgnobj.Pwd = obj.Password; Lgnobj.Created_by = string.Empty; Lgnobj.Updated_by = string.Empty; Lgnobj.Updated_Date = DateTime.Now; Lgnobj.Created_Date = DateTime.Now; Lgnobj.Last_Login_Date = DateTime.Now; Lgnobj.Ip_Address = string.Empty; Lgnobj.Usr_Mst_Id = Mstobj.Usr_Id; status = ologonDAL.InsertU_USR_Lgn(Lgnobj); } if (status == true) { return("1"); } else { return("0"); // 0 indicates unsuccessfull } } else { return("2"); // 2 indicates email id already exists } } catch { return("0"); // 0 indicates unsuccessfull } }
/// <summary> /// SetUserRegistration method implementation /// </summary> public override Registration SetUserRegistration(Registration reg, bool resetkey = false) { if (!SQLUtils.HasRegistration(_host, reg.UPN)) { return(AddUserRegistration(reg, resetkey)); } string request = "UPDATE REGISTRATIONS SET MAILADDRESS = @MAILADDRESS, PHONENUMBER = @PHONENUMBER, PIN=@PIN, METHOD=@METHOD, OVERRIDE=@OVERRIDE, ENABLED=@ENABLED WHERE UPN=@UPN"; SqlConnection con = new SqlConnection(_connectionstring); SqlCommand sql = new SqlCommand(request, con); SqlParameter prm1 = new SqlParameter("@MAILADDRESS", SqlDbType.VarChar); sql.Parameters.Add(prm1); if (string.IsNullOrEmpty(reg.MailAddress)) { prm1.Value = DBNull.Value; } else { prm1.Value = reg.MailAddress; } SqlParameter prm2 = new SqlParameter("@PHONENUMBER", SqlDbType.VarChar); sql.Parameters.Add(prm2); if (string.IsNullOrEmpty(reg.PhoneNumber)) { prm2.Value = DBNull.Value; } else { prm2.Value = reg.PhoneNumber; } SqlParameter prm3 = new SqlParameter("@PIN", SqlDbType.Int); sql.Parameters.Add(prm3); prm3.Value = reg.PIN; SqlParameter prm4 = new SqlParameter("@METHOD", SqlDbType.Int); sql.Parameters.Add(prm4); prm4.Value = reg.PreferredMethod; SqlParameter prm5 = new SqlParameter("@OVERRIDE", SqlDbType.VarChar); sql.Parameters.Add(prm5); if (reg.OverrideMethod == null) { prm5.Value = string.Empty; } else { prm5.Value = reg.OverrideMethod; } SqlParameter prm6 = new SqlParameter("@ENABLED", SqlDbType.Bit); sql.Parameters.Add(prm6); prm6.Value = reg.Enabled; SqlParameter prm7 = new SqlParameter("@UPN", SqlDbType.VarChar); sql.Parameters.Add(prm7); prm7.Value = reg.UPN; con.Open(); try { int res = sql.ExecuteNonQuery(); if (resetkey) { this.OnKeyDataEvent(reg.UPN, KeysDataManagerEventKind.add); } } catch (Exception ex) { DataLog.WriteEntry(ex.Message, System.Diagnostics.EventLogEntryType.Error, 5000); throw new Exception(ex.Message); } finally { con.Close(); } return(GetUserRegistration(reg.UPN)); }
private bool SelectorMatches(Registration registration, Func <DocumentFilter, bool> documentFilter) => SelectorMatches(registration.RegisterOptions !, documentFilter);
private static void ReloadInspectors() { DefaultInspectors = Registration.GetRegisteredInspectors(); }
public void ValidateTemplateRegistrationBeforeRegister(Registration registration) { ValidateTemplateRegistration(registration); Assert.AreEqual(registration.Tags.Count(), DefaultTags.Length); Assert.IsNull(registration.RegistrationId); }
public ActionResult Register(Registration registrationInfo) { var profileservice = new ProfileService(); if (registrationInfo.btnSubmit == "action:lookup") { foreach (var modelValue in ModelState.Values) { modelValue.Errors.Clear(); } if (string.IsNullOrEmpty(registrationInfo.txtLookupSSN) || string.IsNullOrEmpty(registrationInfo.txtLookupPhone)) { ModelState.AddModelError("", Sitecore.Globalization.Translate.Text("Register_AccountNotFound")); } else { var ownerId = profileservice.GetOwnerNumber(registrationInfo.txtLookupSSN, registrationInfo.txtLookupPhone); if (string.IsNullOrEmpty(ownerId)) { ModelState.AddModelError("", Sitecore.Globalization.Translate.Text("Register_AccountNotFound")); } else { ValueProviderResult temp = new ValueProviderResult(ownerId, ownerId, CultureInfo.InvariantCulture); ModelState["txtOwnerId"].Value = temp; } } } else if (registrationInfo.btnSubmit == "action:register") { if (ModelState.IsValid) { if (registrationInfo.txtPassword.Contains(" ")) { ModelState.AddModelError("", Sitecore.Globalization.Translate.Text("Profile_PasswordInvalid")); } else { RegisterServiceModel serviceModel = new Services.RegisterServiceModel(); SitecoreProfileService scProfileService = new SitecoreProfileService(); ProfileService profileService = new ProfileService(); var scUserName = scProfileService.AddDomainToUserName(registrationInfo.txtOwnerId); if (scProfileService.SitecoreExists(scUserName)) { var user = scProfileService.GetUser(scUserName); if (user.Profile.Email == registrationInfo.txtAcctEmail) { ModelState.AddModelError("", Sitecore.Globalization.Translate.Text("Register_EmailAlreadyRestierToSameOwner")); } else { ModelState.AddModelError("", Sitecore.Globalization.Translate.Text("Register_OwnerAlreadyRegister")); } } else { bool allowRegistration = false; var username = scProfileService.GetUserByEmail(registrationInfo.txtAcctEmail); if (string.IsNullOrEmpty(username)) { var legacyUser = profileService.GetOwnerDemographic(registrationInfo.txtAcctEmail, null); if (legacyUser == null) { allowRegistration = true; } else if (legacyUser.OwnerId == registrationInfo.txtOwnerId) { allowRegistration = true; } } //Verify if the email already exists if (allowRegistration) { serviceModel.Email = registrationInfo.txtAcctEmail; serviceModel.OwnerId = registrationInfo.txtOwnerId; serviceModel.Password = registrationInfo.txtPassword; serviceModel.Phone = registrationInfo.txtPhone; serviceModel.SSN = registrationInfo.txtSSN; if (profileservice.Register(serviceModel)) { var loginResponse = profileservice.LoginUser(registrationInfo.txtAcctEmail, registrationInfo.txtPassword, null, null, null, null); Session["LoginEmail"] = registrationInfo.txtAcctEmail; Session["LoginPassword"] = registrationInfo.txtPassword; Session["EnrollAcctNo"] = registrationInfo.txtOwnerId; Session["ownerACCT"] = registrationInfo.txtOwnerId; Session["ownerRegisterReferrer"] = "Register"; Response.Redirect(UrlMapper.Map(registrationInfo.PostbackSuccessPageUrl), false); return(null); //RedirectRegistrationConfirmation(UrlMapper.Map(registrationInfo.PostbackSuccessPageUrl)); } else { ViewData["ShowUnsuccessMessage"] = "true"; } } else { ModelState.AddModelError("", Sitecore.Globalization.Translate.Text("Register_EmailMustBeUnique")); } } } } } return(base.Index()); }
private static Lazy <InstanceProducer> ToLazyInstanceProducer(Registration registration) => Helpers.ToLazy(new InstanceProducer(typeof(TService), registration));
public IActionResult Register(Registration registration) { //return View(registration); return(View("Register2", registration)); }
private async Task ValidateProducts( Registration registration, OrderItemDto[] data, IReadOnlyDictionary <int, Product> productMap, IReadOnlyDictionary <int, ProductVariant> variantMap, CancellationToken cancellationToken = default) { foreach (var dto in data) { if (dto.Quantity <= 0) { throw new InputException($"Invalid quantity for product {dto.ProductId}: {dto.Quantity}"); } if (!productMap.ContainsKey(dto.ProductId)) { throw new InputException($"Unknown product ID: {dto.ProductId}"); } if (dto.VariantId.HasValue) { if (!variantMap.ContainsKey(dto.VariantId.Value)) { throw new InputException($"Unknown product variant ID: {dto.VariantId}"); } if (variantMap[dto.VariantId.Value].ProductId != dto.ProductId) { throw new InputException( $"Wrong product ID: {dto.ProductId} for variant ID {dto.VariantId}"); } } var product = productMap[dto.ProductId]; if (product.EventInfoId != registration.EventInfoId) { if (product.Visibility == ProductVisibility.Event) { throw new InputException( $"Product {product.ProductId} doesn't belong to event {registration.EventInfoId}"); } if (product.Visibility == ProductVisibility.Collection) { var collections = await _eventCollectionRetrievalService .ListCollectionsAsync(new EventCollectionListRequest { Filter = new EventCollectionFilter { EventInfoId = registration.EventInfoId } }, new EventCollectionRetrievalOptions { LoadMappings = true }, cancellationToken); if (!collections.Any(c => c.EventMappings .Any(m => m.EventId == product.EventInfoId))) { throw new InputException( $"Product {product.ProductId} cannot be added to order for event {registration.EventInfoId}"); } } } } }
public IHttpActionResult RegistrationEvent([FromBody] Registration registration) { RegistrationHelper helper = new RegistrationHelper(); return(Ok(helper.RegistrationEvent(registration))); }
internal static bool IsSingletonInstanceRegistration(Registration registration) => registration is SingletonInstanceLifestyleRegistration;
private static void RegisterFromAttribute(ComponentAttribute attr, IDictionary <Type, IList <Registration> > tempDict, Registration registration) { var registrationType = attr.RegistrationType; if (!tempDict.ContainsKey(registrationType)) { tempDict.Add(registrationType, new List <Registration>()); } tempDict[registrationType].Add(registration); }
public object Get(Type policyInterface) { return(List.Get(RegistrationType, Name, policyInterface) ?? Registration.Get(policyInterface)); }