protected void lvList_ItemCommand(object sender, ListViewCommandEventArgs e) { HiddenField hdnIdNome = (HiddenField)e.Item.FindControl("hdnIdNome"); HiddenField hdnDescricao = (HiddenField)e.Item.FindControl("hdnDescricao"); string idAcao = CRB.BOSS.Funcoes.Criptografia.Encrypt(hdnIdNome.Value); switch (e.CommandName) { case "Editar": Response.Redirect("Form.aspx?IdNome=" + idAcao); break; case "Visualizar": Response.Redirect("Form.aspx?IdNome=" + idAcao + "&ReadOnly=1"); break; case "Excluir": Ok ok = new Ok(Excluir); Popup popup = (Popup)this.Page.Master.FindControl("popup"); popup.Modulo = CRB.BOSS.Autenticacao.Modulo.Modulo.Atual; popup.Titulo = CRB.BOSS.Autenticacao.Modulo.Modulo.Funcionalidade; popup.Mensagem = "Deseja realmente excluir?"; popup.Tipo = InformacoesAlerta.TipoConfirma; popup.param = hdnIdNome.Value + ";" + hdnDescricao.Value; popup.ExecOk = ok; popup.BotaoOk.OnClientClick = String.Empty; popup.Mostrar(); break; } }
public void map_without_adapter() { var record = Substitute.For <IDataRecord>(); var actual = new Ok(); record["Id"].Returns("Hej"); var sut = new PropertyMapping <Ok>("Id", (o, o1) => o.Id = (string)o1, o => o.Id); sut.Map(record, actual); actual.Id.Should().Be("Hej"); }
protected void btnExcluir_Click(object sender, ImageClickEventArgs e) { Ok ok = new Ok(Excluir); Popup popup = (Popup)this.Page.Master.FindControl("popup"); popup.Modulo = CRB.BOSS.Autenticacao.Modulo.Modulo.Atual; popup.Titulo = CRB.BOSS.Autenticacao.Modulo.Modulo.Funcionalidade; popup.Mensagem = "Deseja realmente excluir?"; popup.Tipo = InformacoesAlerta.TipoConfirma; popup.param = hdnCodConcessionaria.Value + ";" + hdnCodEmpresa.Value + ";" + hdnCodBanco.Value + ";" + hdnDataInicial.Value; popup.ExecOk = ok; popup.BotaoOk.OnClientClick = String.Empty; popup.Mostrar(); }
/// <summary> /// Метод отрабатывает если Журнал с ок не создан дольше будеь добавлять элементы /// </summary> public void CreateJurnalOk(string pathjurnal, string znacenie, string okeys) { OkJurnal okey = new OkJurnal() { Ok = new Ok[1] }; Ok ok = new Ok() { Inn = znacenie, Message = okeys, DateTimeUse = DateTime.Now, DateTimeUseSpecified = true }; okey.Ok[0] = ok; SerializerClassToXml(pathjurnal, okey, typeof(OkJurnal)); }
public override int GetHashCode() { int hashCode = 493339093; hashCode = hashCode * -1521134295 + Ok.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <T> .Default.GetHashCode(Result); hashCode = hashCode * -1521134295 + ErrorCode.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Description); hashCode = hashCode * -1521134295 + EqualityComparer <ResponseParameters> .Default.GetHashCode(Parameters); return(hashCode); }
public void use_column_name_and_not_property_name_in_the_record() { var record = Substitute.For <IDataRecord>(); var actual = new Ok(); record["Id2"].Returns("Hej"); var sut = new PropertyMapping <Ok>("Id", (o, o1) => o.Id = (string)o1, ok => ok.Id); sut.ColumnName = "Id2"; sut.Map(record, actual); actual.Id.Should().Be("Hej"); }
public void should_replace_dbnull_with_the_defined_replacement_value_when_mapping_column_value() { var record = Substitute.For <IDataRecord>(); var actual = new Ok(); record["Age"].Returns(DBNull.Value); var sut = new PropertyMapping <Ok>("Age", (o, o1) => o.Age = (int)o1, ok => ok.Age); sut.NullValue = 1; sut.Map(record, actual); actual.Age.Should().Be(1); }
public void skip_db_null_value() { var record = Substitute.For <IDataRecord>(); var actual = new Ok(); record["Id2"].Returns(DBNull.Value); var sut = new PropertyMapping <Ok>("Id", (o, o1) => o.Id = (string)o1, ok => ok.Id); sut.ColumnName = "Id2"; sut.Map(record, actual); actual.Id.Should().BeNull(); }
public void use_the_adapter_son() { var record = Substitute.For <IDataRecord>(); var actual = new Ok(); record["Id"].Returns("Hej"); var sut = new PropertyMapping <Ok>("Id", (o, o1) => o.Id = (string)o1, ok => ok.Id); sut.ColumnToPropertyAdapter = o => o + "Hello"; sut.Map(record, actual); actual.Id.Should().Be("HejHello"); }
public void get_keys() { var expected = new Ok { FirstName = "Arne", Id = "22" }; var sut = new CrudEntityMapper <Ok>("Users"); sut.Freeze(); var keys = sut.GetKeys(expected); keys.Length.Should().Be(1); keys[0].Value.Should().Be(expected.Id); }
private void InitializeControls() { okButton = new StandardButton(20) { Position = new Point(3, Height - 4), Text = "OK" }; okButton.Click += (sender, args) => Ok?.Invoke(this, EventArgs.Empty); Add(okButton); cancelButton = new StandardButton(20) { Position = new Point(27, Height - 4), Text = "Cancel" }; cancelButton.Click += (sender, args) => Cancel?.Invoke(this, EventArgs.Empty); Add(cancelButton); launchEditorButton = new StandardButton(40) { Position = new Point(3, 12), Text = "Launch Code Editor" }; launchEditorButton.Click += (sender, args) => LaunchEditor?.Invoke(this, EventArgs.Empty); Add(launchEditorButton); var textBoxTheme = new TextBoxTheme { Normal = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255)), Focused = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255)) }; spellNameTextBox = new TextBox(60) { Position = new Point(3, 5), Theme = textBoxTheme, MaxLength = 50 }; Add(spellNameTextBox); manaCostTextBox = new TextBox(15) { Position = new Point(3, 8), IsNumeric = true, AllowDecimal = false, Theme = textBoxTheme, MaxLength = 10 }; Add(manaCostTextBox); }
public static Result <Skill, SkillError> New(Name name, Level level) { if (name == null) { return(Error <Skill, SkillError> .Value(SkillError.EmptyName)); } if (level == null) { return(Error <Skill, SkillError> .Value(SkillError.NoLevel)); } return(Ok <Skill, SkillError> .Value(new Skill(name, level))); }
public void Done(bool isSuccess) { ProcessOutputTimer.Stop(); AddOutput("Done"); ProgressBar.Visible = false; Ok.Enabled = true; Ok.Focus(); AcceptButton = Ok; Abort.Enabled = false; #if !__MonoCS__ if (GitCommands.Settings.RunningOnWindows() && TaskbarManager.IsPlatformSupported) { try { TaskbarManager.Instance.SetProgressState(isSuccess ? TaskbarProgressBarState.Normal : TaskbarProgressBarState.Error); TaskbarManager.Instance.SetProgressValue(100, 100); } catch (InvalidOperationException) { } } #endif if (isSuccess) { picBoxSuccessFail.Image = GitUI.Properties.Resources.success; } else { picBoxSuccessFail.Image = GitUI.Properties.Resources.error; } splitContainer1.Panel2Collapsed = false; errorOccurred = !isSuccess; if (showOnError && !isSuccess) { // For some reason setting the state to normal interferes with // proper parent centering... WindowState = FormWindowState.Normal; CenterToParent(); Visible = true; } if (isSuccess && (showOnError || (UseDialogSettings && GitCommands.Settings.CloseProcessDialog))) { Close(); } }
/// <summary> /// Returns true if InputStepImpl instances are equal /// </summary> /// <param name="other">Instance of InputStepImpl to be compared</param> /// <returns>Boolean</returns> public bool Equals(InputStepImpl other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Class == other.Class || Class != null && Class.Equals(other.Class) ) && ( Links == other.Links || Links != null && Links.Equals(other.Links) ) && ( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Message == other.Message || Message != null && Message.Equals(other.Message) ) && ( Ok == other.Ok || Ok != null && Ok.Equals(other.Ok) ) && ( Parameters == other.Parameters || Parameters != null && other.Parameters != null && Parameters.SequenceEqual(other.Parameters) ) && ( Submitter == other.Submitter || Submitter != null && Submitter.Equals(other.Submitter) )); }
public void Done(bool isSuccess) { try { AppendMessageCrossThread("Done"); ProgressBar.Visible = false; Ok.Enabled = true; Ok.Focus(); AcceptButton = Ok; Abort.Enabled = false; #if !__MonoCS__ if (GitCommands.Utils.EnvUtils.RunningOnWindows() && TaskbarManager.IsPlatformSupported) { try { TaskbarManager.Instance.SetProgressState(isSuccess ? TaskbarProgressBarState.Normal : TaskbarProgressBarState.Error); TaskbarManager.Instance.SetProgressValue(100, 100); } catch (InvalidOperationException) { } } #endif if (isSuccess) { picBoxSuccessFail.Image = GitUI.Properties.Resources.success; } else { picBoxSuccessFail.Image = GitUI.Properties.Resources.error; } errorOccurred = !isSuccess; if (isSuccess && !showOnError && (UseDialogSettings && AppSettings.CloseProcessDialog)) { Close(); } } finally { if (ModalControler != null) { ModalControler.EndModal(isSuccess); } } }
private void InitializeControls() { okButton = new StandardButton(20) { Position = new Point(3, Height - 4), Text = "OK" }; okButton.Click += (sender, args) => Ok?.Invoke(this, EventArgs.Empty); Add(okButton); DoForAllStats((y, stat) => { AddStatSelector(6, y, stat); }); }
public DefaultStringEditor() { InitializeComponent(); m_textBox = new MyTextBox(drawWindow1, () => new RectangleF(0, 0, drawWindow1.Width, drawWindow1.Height), MyTextBox.InputFormEnum.Text, AutoCompleteSuggestions, x => MyTextBox.TextBoxBorderDaniel, 4, Fonts.Default); m_textBox.RequestedAreaChanged += () => { //Draw window is the whole control so we can just modify the control MinimumSize = new Size(0, (int)m_textBox.RequestedArea.Height); Size = m_textBox.RequestedArea.ToSize(); }; m_textBox.EnterPressed += () => Ok.Execute(); m_textBox.SpecialEnter = true; MyTextBox.SetupCallbacks(drawWindow1, m_textBox); }
public async Task OkObjectResult_ExecuteAsync_SetsStatusCode() { // Arrange var result = new Ok <string>("Hello"); var httpContext = new DefaultHttpContext() { RequestServices = CreateServices() }; // Act await result.ExecuteAsync(httpContext); // Assert Assert.Equal(StatusCodes.Status200OK, httpContext.Response.StatusCode); }
public void should_be_able_to_convert_null_value_to_dbnull() { var record = Substitute.For <IDataRecord>(); var entity = new Ok() { Age = 1 }; var sut = (IPropertyMapping) new PropertyMapping <Ok>("Age", (o, o1) => o.Age = (int)o1, ok => ok.Age); sut.NullValue = 1; var actual = sut.GetValue(entity); actual.Should().Be(DBNull.Value); }
private void falseNegatives_SelectedIndexChanged(object sender, EventArgs e) { int i = ((ListBox)sender).SelectedIndex; if (((Instruction)((ListBox)sender).SelectedItem) != null) { Program2.SetSelected(((Instruction)((ListBox)sender).SelectedItem).index, true); } if (i != -1) { falsePositives.ClearSelected(); Ok.ClearSelected(); } //falseNegatives.SelectedIndex = i; //falseNegatives.SelectedIndex = i; }
public DefaultEnumEditor() { InitializeComponent(); drawWindow1.SizeChanged += (a, args) => m_comboBox.AreaChanged(); m_comboBox = new TControl(drawWindow1, () => new RectangleF(0, 0, drawWindow1.Width, drawWindow1.Height), true, m_comboBoxItems, Fonts.Default); m_comboBox.SetupCallbacks(); m_comboBox.RequestedAreaChanged += () => { MinimumSize = new Size(0, (int)m_comboBox.RequestedArea.Height); Size = m_comboBox.RequestedArea.ToSize(); drawWindow1.Size = Size; //This should not be necessary, due to docking, but for some reason is. }; m_comboBox.SelectionChanged += () => m_parameter.EditorSelected = m_comboBox.SelectedItem.Contents; m_comboBox.EnterPressed += () => { Ok.Execute(); }; }
public void ShouldFindAnEventParticipantBasedOnEventIdAndContactId() { const int contactId = 234; const int eventId = 2345; const string token = "asl;gh"; var evtPar = FactoryGirl.NET.FactoryGirl.Build <MpEventParticipant>(); var eventParticpant = new Ok <MpEventParticipant>(evtPar); _apiUserRepository.Setup(m => m.GetToken()).Returns(token); _eventParticipantRepository.Setup(m => m.GetEventParticipantByContactAndEvent(contactId, eventId, token)).Returns(eventParticpant); var res = _fixture.GetEventParticipantByContactAndEvent(contactId, eventId); Assert.IsInstanceOf <EventParticipantDTO>(res); Assert.AreEqual(evtPar.EventParticipantId, res.EventParticipantId); }
public DefaultDynamicEnumEditor() { InitializeComponent(); m_comboBoxItems = (new ExtraLazyEnumerable <TItem>(() => m_parameter.Options.Select(ch => new TItem(ch, ch)))); m_comboBox = new TControl(drawWindow1, () => new RectangleF(0, 0, drawWindow1.Width, drawWindow1.Height), true, m_comboBoxItems, Fonts.Default); m_comboBox.SetupCallbacks(); m_comboBox.RequestedAreaChanged += () => { //Draw window is the whole control so we can just modify the control MinimumSize = new Size(0, (int)m_comboBox.RequestedArea.Height); Size = m_comboBox.RequestedArea.ToSize(); Invalidate(true); }; m_comboBox.EnterPressed += () => { Ok.Execute(); }; }
public SerializedPayload Serialize(Ok ok) { var binaryWriter = ObjectPool.Shared.Rent <BinaryProtocolWriter>(); try { return(binaryWriter .WriteType(PayloadType.Ok) .WriteId(ok.Id) .ToSerializedPayload()); } finally { ObjectPool.Shared.Return(binaryWriter); } }
public MessageBoxYesNo(string message, bool showNo, bool isError) { InitializeComponent(); messageText.Text = message; if (showNo == false) { Cancel.Visibility = Visibility.Collapsed; Ok.SetValue(Grid.ColumnSpanProperty, 2); } if (isError) { messageText.Foreground = new SolidColorBrush(Colors.Red); } _hideStoryboard = ((Storyboard)Application.Current.Resources["hideWindow"]).Clone(); }
public static Result <Physical, PhysicalError> New(Level strength, Level dexterity, Level stamina) { if (strength == null) { return(Error <Physical, PhysicalError> .Value(PhysicalError.NoStrength)); } if (dexterity == null) { return(Error <Physical, PhysicalError> .Value(PhysicalError.NoDexterity)); } if (stamina == null) { return(Error <Physical, PhysicalError> .Value(PhysicalError.NoStamina)); } return(Ok <Physical, PhysicalError> .Value(new Physical(strength, dexterity, stamina))); }
public void setupServer() { byte[] bytes = simulatorComm.getUdpClient().Receive(ref simulatorComm.getLocalIpEndPoint()); string msg = Utils.decodeBytes(bytes); if (msg == Command.getKeyword()) { simulatorComm.getTelloStateIpEndPoint() = new IPEndPoint(simulatorComm.getLocalIpEndPoint().Address, simulatorComm.telloStatePort); stateBroadcastThread.Start(); state.setInCommandMode(true); simulatorComm.sendMessage(Ok.getKeyword(), simulatorComm.getUdpClient(), simulatorComm.getLocalIpEndPoint()); serverLoop(); } }
private void InitializeControls() { closeButton = new StandardButton(15) { Position = new Point(Width - 17, Height - 4), Text = "[ESC] Cancel" }; closeButton.Click += (sender, args) => OnExit(); Add(closeButton); okButton = new StandardButton(15) { Position = new Point(Width - 37, Height - 4), Text = "[ENTER] OK" }; okButton.Click += (sender, args) => Ok?.Invoke(this, EventArgs.Empty); Add(okButton); }
public void ShouldGetProjectDetailsAndUseNickname() { const int projectId = 564; const string apiToken = "clevelandsux"; var mpProject = new MpProject { AddressId = 1, InitiativeId = 2, LocationId = 3, OrganizationId = 4, ProjectId = projectId, ProjectStatusId = 5, ProjectTypeId = 6, ProjectName = "Make Cleveland Great (Again?)", City = "Cleveland", State = "OH" }; var mpGroupConnector = new MpGroupConnector { PrimaryContactId = 234, PrimaryContactEmail = "*****@*****.**", PrimaryContactFirstName = "Drew", PrimaryContactLastName = "Carey", PrimaryContactNickname = "D" }; var returnVal = new Ok <MpProject>(mpProject); var groupConnectorReturn = new Ok <MpGroupConnector>(mpGroupConnector); _apiUserRepository.Setup(m => m.GetToken()).Returns(apiToken); _projectRepository.Setup(m => m.GetProject(projectId, apiToken)).Returns(returnVal); _projectRepository.Setup(m => m.GetGroupConnector(projectId, apiToken)).Returns(groupConnectorReturn); var project = _fixture.GetProject(projectId); Assert.AreEqual(mpProject.AddressId, project.AddressId); Assert.AreEqual(mpProject.ProjectId, project.ProjectId); Assert.AreEqual("Cleveland, OH", project.Location); Assert.AreEqual("D Carey", project.ContactDisplayName); _apiUserRepository.VerifyAll(); _projectRepository.VerifyAll(); }
public static Result <Level, LevelError> New(int max, int value) { if (max <= 0) { return(Error <Level, LevelError> .Value(LevelError.NegativeOrZeroMaxLevel)); } if (value <= 0) { return(Error <Level, LevelError> .Value(LevelError.NegativeOrZeroLevel)); } if (value > max) { return(Error <Level, LevelError> .Value(LevelError.LevelSupperiorToMax)); } return(Ok <Level, LevelError> .Value(new Level(max, value))); }
public DefaultAudioEditor() { InitializeComponent(); //TODO: AUDIO: Suggest paths that exist for autoCompleteSuggestions m_textBox = new MyTextBox(drawWindow1, () => new RectangleF(0, 0, drawWindow1.Width, drawWindow1.Height), MyTextBox.InputFormEnum.Path, null, x => MyTextBox.TextBoxBorderDaniel, 4, Fonts.Default); m_textBox.RequestedAreaChanged += () => { int extraHeight = (Size.Height - drawWindow1.Size.Height).Clamp(0, int.MaxValue); drawWindow1.MinimumSize = new Size(0, (int)m_textBox.RequestedArea.Height); MinimumSize = new Size(MinimumSize.Width, (int)m_textBox.RequestedArea.Height + extraHeight); drawWindow1.Size = m_textBox.RequestedArea.ToSize(); Size = new Size(Width, m_textBox.RequestedArea.ToSize().Height + extraHeight); }; m_textBox.EnterPressed += () => Ok.Execute(); m_textBox.SpecialEnter = true; MyTextBox.SetupCallbacks(drawWindow1, m_textBox); drawWindow1.SizeChanged += new EventHandler(drawWindow1_SizeChanged); }
public void startConnection() { sendMessage(Command.getKeyword(), droneUDPClient, commandIpEndPoint); string msg = getResponse(droneUDPClient, commandIpEndPoint); if (msg == Ok.getKeyword()) { Console.WriteLine("Connected to drone successfully at " + droneIp + ":" + commandPort + "."); thread.Start(); } else { Console.WriteLine("ERROR: Failed to connect to drone at " + droneIp + ":" + commandPort + "."); setErrorState(true); } }
public void Excluir(string id) { try { List<string> ids = id.Split(';').ToList(); CRB.BOSS.Financeiro.Repasse.Repasse.Excluir(int.Parse(ids[0]), int.Parse(ids[1]), int.Parse(ids[2]), int.Parse(ids[3])); Popup popup = (Popup)this.Page.Master.FindControl("popup"); Ok ok = new Ok(Redirect); popup.Modulo = CRB.BOSS.Autenticacao.Modulo.Modulo.Atual; popup.Titulo = CRB.BOSS.Autenticacao.Modulo.Modulo.Funcionalidade; popup.ExecOk = ok; popup.Mensagem = "Deseja realmente excluir?"; popup.Tipo = InformacoesAlerta.TipoAlerta; popup.Mostrar(); } catch (Exception ex) { CRB.BOSS.UI.Controle.Popup.Mensagem.Formulario(ex); } }
protected void lvLista_ItemCommand(object sender, ListViewCommandEventArgs e) { HiddenField hdnCodConcessionaria = (HiddenField)e.Item.FindControl("hdnCodConcessionaria"); HiddenField hdnData = (HiddenField)e.Item.FindControl("hdnData"); Literal lblCodEmpresa = (Literal)e.Item.FindControl("lblCodEmpresa"); Literal lblCodBanco = (Literal)e.Item.FindControl("lblCodBanco"); switch (e.CommandName) { case "Editar": Response.Redirect("Form.aspx?IdConcessionaria=" + CRB.BOSS.Funcoes.Criptografia.Encrypt(hdnCodConcessionaria.Value) + "&IdEmpresa=" + CRB.BOSS.Funcoes.Criptografia.Encrypt(lblCodEmpresa.Text) + "&IdBanco=" + CRB.BOSS.Funcoes.Criptografia.Encrypt(lblCodBanco.Text) + "&DataInicial=" + CRB.BOSS.Funcoes.Criptografia.Encrypt(hdnData.Value)); break; case "Visualizar": Response.Redirect("Form.aspx?IdConcessionaria=" + CRB.BOSS.Funcoes.Criptografia.Encrypt(hdnCodConcessionaria.Value) + "&IdEmpresa=" + CRB.BOSS.Funcoes.Criptografia.Encrypt(lblCodEmpresa.Text) + "&IdBanco=" + CRB.BOSS.Funcoes.Criptografia.Encrypt(lblCodBanco.Text) + "&DataInicial=" + CRB.BOSS.Funcoes.Criptografia.Encrypt(hdnData.Value) + "&ReadOnly=1"); break; case "Excluir": Popup popup = (Popup)this.Page.Master.FindControl("popup"); Ok ok = new Ok(Excluir); popup.Modulo = CRB.BOSS.Autenticacao.Modulo.Modulo.Atual; popup.Titulo = CRB.BOSS.Autenticacao.Modulo.Modulo.Funcionalidade; popup.Mensagem = "Deseja realmente excluir?"; popup.Tipo = InformacoesAlerta.TipoConfirma; popup.param = hdnCodConcessionaria.Value + ";" + lblCodEmpresa.Text + ";" + lblCodBanco.Text + ";" + hdnData.Value; popup.ExecOk = ok; popup.BotaoOk.OnClientClick = "var btn = this; setTimeout(function(){CarregarLista(btn) }, 1000)"; popup.Mostrar(); break; } }
public void Executar(Ok ok) { ExecOk = ok; }