public bool VerifyData(byte[] buffer, object halg, byte[] signature)
 {
     string str = Utils.ObjToOidValue(halg);
     byte[] rgbHash = Utils.ObjToHashAlgorithm(halg).ComputeHash(buffer);
     return this.VerifyHash(rgbHash, str, signature);
 }
Example #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     this.Close();
 }
Example #3
0
        private void simpleButton5_Click(object sender, EventArgs e)
        {

        }
Example #4
0
 private void btnNuevo_Click(object sender, EventArgs e)
 {
     estadoComponentes(TipoVista.Nuevo);
 }
Example #5
0
 private void btnCancelar_Click(object sender, EventArgs e)
 {
     estadoComponentes(TipoVista.Anular);
 }
        public static string WriteValue(object obj, JsonKeyValueType type, JsonFormatting format, int indent)
        {
            string result = "";

            switch (type)
            {
                case JsonKeyValueType.Text:
                    if (format == JsonFormatting.Compact)
                        result += "\"" + obj.ToString() + "\",";
                    else if (format == JsonFormatting.CompactReadable)
                        result += "\"" + obj.ToString() + "\", ";
                    else if (format == JsonFormatting.Indented)
                        result += "\"" + obj.ToString() + $"\",{Environment.NewLine}";

                    break;
                case JsonKeyValueType.DateTime:
                    if (format == JsonFormatting.Compact)
                        result += "\"" + JsonSerializer.SerializeDateTime((DateTime)obj) + "\",";
                    else if (format == JsonFormatting.CompactReadable)
                        result += "\"" + JsonSerializer.SerializeDateTime((DateTime)obj) + "\", ";
                    else if (format == JsonFormatting.Indented)
                        result += "\"" + JsonSerializer.SerializeDateTime((DateTime)obj) + $"\",{Environment.NewLine}";

                    break;
                case JsonKeyValueType.Boolean:
                case JsonKeyValueType.Numerical:
                    if (format == JsonFormatting.Compact)
                        result += obj.ToString().ToLower() + ",";
                    else if (format == JsonFormatting.CompactReadable)
                        result += obj.ToString().ToLower() + ", ";
                    else if (format == JsonFormatting.Indented)
                        result += obj.ToString().ToLower() + $",{Environment.NewLine}";

                    break;
                case JsonKeyValueType.Null:
                    if (format == JsonFormatting.Compact)
                        result += "null,";
                    else if (format == JsonFormatting.CompactReadable)
                        result += "null, ";
                    else if (format == JsonFormatting.Indented)
                        result += $"null, {Environment.NewLine}";

                    break;
                case JsonKeyValueType.Array:
                    if (format == JsonFormatting.Compact)
                        if (obj.GetType().IsArray) result += "[" + JsonSerializer.SerializeArray(((dynamic)obj), format, indent + 1) + "],"; else result += "[" + JsonSerializer.SerializeArray(((dynamic)obj).ToArray(), format, indent + 1) + "],";
                    else if (format == JsonFormatting.CompactReadable)
                        if (obj.GetType().IsArray) result += "[" + JsonSerializer.SerializeArray(((dynamic)obj), format, indent + 1) + "], "; else result += "[" + JsonSerializer.SerializeArray(((dynamic)obj).ToArray(), format, indent + 1) + "], ";
                    else if (format == JsonFormatting.Indented)
                        if (obj.GetType().IsArray) result += $"[{Environment.NewLine}" + JsonSerializer.SerializeArray(((dynamic)obj), format, indent + 1) + "],"; else result += $"[{Environment.NewLine}" + JsonSerializer.SerializeArray(((dynamic)obj).ToArray(), format, indent + 1) + $"],{Environment.NewLine}";

                    break;
                case JsonKeyValueType.Dictionary:
                    if (format == JsonFormatting.Compact)
                        result += "{" + JsonSerializer.SerializeDictionary(((dynamic)obj), format, indent + 1) + "},";
                    else if (format == JsonFormatting.CompactReadable)
                        result += "{" + JsonSerializer.SerializeDictionary(((dynamic)obj), format, indent + 1) + "}, ";
                    else if (format == JsonFormatting.Indented)
                        result += $"{{{Environment.NewLine}" + JsonSerializer.SerializeDictionary(((dynamic)obj), format, indent + 1) + $"}},{Environment.NewLine}";

                    break;
                case JsonKeyValueType.Object:
                    if (format == JsonFormatting.Compact)
                        result += JsonClassConverter.ConvertObjectToJson(obj, format, indent + 1) + ",";
                    else if (format == JsonFormatting.CompactReadable)
                        result += JsonClassConverter.ConvertObjectToJson(obj, format, indent + 1) + ", ";
                    else if (format == JsonFormatting.Indented)
                        result += JsonClassConverter.ConvertObjectToJson(obj, format, indent + 1) + $",{Environment.NewLine}";

                    break;                   
            }
            return result;
        }
Example #7
0
 protected override void PreRestart(Exception reason, object message)
 {
     // If we don't get any progress within 15 seconds then the service is unavailable
     Context.SetReceiveTimeout(TimeSpan.FromSeconds(15));
 }
Example #8
0
 private void SideBar_Loaded(object sender, RoutedEventArgs e)
 {
     _dashboard = _container.Resolve <Dashboard>();
     _region    = _regionManager.Regions["ContentRegion"];
     _region.Add(_dashboard);
 }
Example #9
0
 /// <summary>
 /// Returns true if objects are equal
 /// </summary>
 /// <param name="input">Object to be compared</param>
 /// <returns>Boolean</returns>
 public override bool Equals(object input)
 {
     return this.Equals(input as PaySlip);
 }
 /// <summary>
 /// Invoked when application execution is being resumed.
 /// </summary>
 /// <param name="sender">The source of the resume request.</param>
 /// <param name="e">Details about the resume request.</param>
 private void OnResuming(object sender, object e)
 {
     _reactPage.OnResume(Exit);
 }
Example #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.Bind();
 }
 /// <summary>
 /// Invoked when application execution is being suspended.  Application state is saved
 /// without knowing whether the application will be terminated or resumed with the contents
 /// of memory still intact.
 /// </summary>
 /// <param name="sender">The source of the suspend request.</param>
 /// <param name="e">Details about the suspend request.</param>
 private void OnSuspending(object sender, SuspendingEventArgs e)
 {
     _reactPage.OnSuspend();
 }
 /// <summary>
 /// Invoked when Navigation to a certain page fails
 /// </summary>
 /// <param name="sender">The Frame which failed navigation</param>
 /// <param name="e">Details about the navigation failure</param>
 private void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
 {
     throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
 }
Example #14
0
 // Отмена
 private void BAbort_Click(object sender, System.EventArgs e)
 {
     this.Close();
 }
Example #15
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     this.DialogResult = DialogResult.Cancel;
 }
Example #16
0
 private void btn_salir_Click(object sender, EventArgs e)
 {
     Application.Exit();
 }
Example #17
0
        /// <inheritdoc />
        public override bool Equals(object obj)
        {
            if (!(obj is TickFormatStop other)) return false;

            return ReferenceEquals(this, obj) || Equals(other);
        }
Example #18
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
Example #19
0
 public SenderMessagePair(IActorRef sender, object message)
 {
     this.Sender = sender;
     this.Message = message;
 }
Example #20
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// Reads a feature collection from its JSON representation
        /// </summary>
        /// <param name="reader">The reader</param>
        /// <param name="objectType">The object type</param>
        /// <param name="existingValue">The existing value</param>
        /// <param name="serializer">The serializer</param>
        /// <returns></returns>
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType == JsonToken.Null)
            {
                return null;
            }

            bool read = reader.Read();
            var fc = new FeatureCollection();
            while (reader.TokenType == JsonToken.PropertyName)
            {
                string val = (string)reader.Value;
                switch (val)
                {
                    case "features":
                        // move to begin of array
                        /*read = */
                        reader.Read();
                        if (reader.TokenType != JsonToken.StartArray)
                        {
                            throw new ArgumentException("Expected token '[' not found.");
                        }

                        // move to first feature
                        read = reader.Read();
                        while (read && reader.TokenType != JsonToken.EndArray)
                        {
                            fc.Add(serializer.Deserialize<Feature>(reader));
                            read = reader.Read();
                        }
                        read = reader.Read();
                        break;

                    case "type":
                        /*read = */
                        reader.Read();
                        if (reader.TokenType != JsonToken.String && (string)reader.Value != "FeatureCollection")
                        {
                            throw new ArgumentException("Expected value 'FeatureCollection' not found.");
                        }

                        read = reader.Read();
                        break;

                    case "bbox":
                        fc.BoundingBox = serializer.Deserialize<Envelope>(reader);
                        /*
                        read = reader.Read();
                        if (reader.TokenType != JsonToken.StartArray)
                            throw new ArgumentException("Expected token '{' not found.");

                        var env = serializer.Deserialize<double[]>(reader);
                        fc.BoundingBox = new Envelope(env[0], env[2], env[1], env[3]);

                        if (reader.TokenType != JsonToken.EndArray)
                            throw new ArgumentException("Expected token '}' not found.");

                        read = reader.Read();
                        */
                        break;

                    default:
                        // additional members are ignored: see https://code.google.com/p/nettopologysuite/issues/detail?id=186
                        /*
                         * see also: http://gis.stackexchange.com/a/25309/463
                         * "you can have a properties element at the top level of a feature collection,
                         * but don't expect any tools to know its there"
                         */
                        read = reader.Read(); // move next
                        // jump to next property
                        while (read && reader.TokenType != JsonToken.PropertyName)
                        {
                            read = reader.Read();
                        }

                        break;
                }
            }

            if (read && reader.TokenType != JsonToken.EndObject)
            {
                throw new ArgumentException("Expected token '}' not found.");
            }

            return fc;
        }
Example #22
0
 protected void btnImagetSearch_Click(object sender, EventArgs e)
 {
     this.BindData();
 }
Example #23
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            if (validarCampos()) //Esto verifica que se ha seleccionado algún item del comboBox
            {
                MessageBox.Show("No se puede crear un proveedor si no\ntiene todos sus datos completos.", "◄ AVISO | LEASEIN ►", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Cursor.Current = Cursors.Default;
                return;
            }

            llenar_Datos_Proveedor();
            if (proveedor.IdProveedor == 0)
            {
                if (MessageBox.Show("Estas seguro deseas Crear este Proveedor", "◄ AVISO | LEASEIN ►", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    int idProveedor = proveedorDA.GuardarNuevoProveedor(proveedor, this.nombreUsuario);

                    if (idProveedor > 0)
                    {
                        MessageBox.Show("Se guardó éxitosamente el Proveedor con ID: " + idProveedor, "◄ AVISO | LEASEIN ►", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        estadoComponentes(TipoVista.Guardar);
                    }
                    else if (idProveedor == 0)
                    {
                        MessageBox.Show("Ya existe un Proveedor con las mismas características", "◄ AVISO | LEASEIN ►", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    }
                    else
                    {
                        MessageBox.Show("No se pudo guardar el Proveedor", "◄ AVISO | LEASEIN ►", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    }
                }
            }
            else
            {
                proveedor.Estado = (chbActivo.Checked) ? 1 : 0;


                if (MessageBox.Show("Estas seguro que desea Guardar los cambios", "◄ AVISO | LEASEIN ►", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    int idProveedor;

                    idProveedor = proveedorDA.ModificarProveedor(proveedor, this.nombreUsuario);

                    if (idProveedor > 0)
                    {
                        MessageBox.Show("Se Modificó el proveedor con ID : " + proveedor.IdProveedor + " con exito", "◄ AVISO | LEASEIN ►", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        estadoComponentes(TipoVista.Guardar);
                    }
                    else if (idProveedor == 0)
                    {
                        MessageBox.Show("Ya existe un Proveedor con las mismas características", "◄ AVISO | LEASEIN ►", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    }
                    else
                    {
                        MessageBox.Show("No se pudo guardar los cambios del Proveedor", "◄ AVISO | LEASEIN ►", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    }
                }
            }

            Cursor.Current = Cursors.Default;
        }
Example #24
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            // Convert from view model int property to text

            return(value); // nothing to be done - this convert is about ensuring valid min input - see ConvertBack
        }
Example #25
0
 private void txtAbreviacion_TextChanged(object sender, EventArgs e)
 {
 }
Example #26
0
 private void Form1_Load(object sender, EventArgs e)
 {
 }
Example #27
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     SaveData();
 }
Example #28
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     this.DialogResult = DialogResult.OK;
 }
Example #29
0
 private void btnDefault_Click(object sender, EventArgs e)
 {
     SetDataTableToGrid(dt_AnalysisDefault);
 }
 public byte[] SignData(byte[] buffer, int offset, int count, object halg)
 {
     string str = Utils.ObjToOidValue(halg);
     byte[] rgbHash = Utils.ObjToHashAlgorithm(halg).ComputeHash(buffer, offset, count);
     return this.SignHash(rgbHash, str);
 }