Ejemplo n.º 1
0
        private void txtFileName_Leave(object sender, EventArgs e)
        {
            if (txtFileName.Text.Length <= 4)
            {
                Ep.SetError(txtFileName, "Type the File Name First..." +
                            "Name Should Be More Than 5 Characters");
                txtFileName.Focus();
                txtFileName.Text = "";
                return;
            }

            string l = txtFileName.Text.Substring(0, 4).ToString();

            if ((l == "PRJ_") || (l == "prj_") || (l == "Prj_"))
            {
                txtFileName.Text = "Prj_" + (txtFileName.Text.ToUpper().Substring(4));
                Ep.Clear();
                return;
            }
            else
            {
                txtFileName.Text = "Prj_" + txtFileName.Text.ToUpper();
                Ep.Clear();
            }
        }
Ejemplo n.º 2
0
 private void ComboBox2_Leave(object sender, EventArgs e)
 {
     if (ComboBox2.Text != "")
     {
         Ep.Clear();
     }
 }
Ejemplo n.º 3
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            try
            {
                DBO.AccountsConnection = new System.Data.SqlClient.SqlConnection(DBO.Connection);
                DBO.AccountsConnection.Open();
                DBO.AccountTransaction = DBO.AccountsConnection.BeginTransaction();
                for (int i = 0; i < grdVoucher.RowCount; i++)
                {
                    String AccountId       = grdVoucher.Rows[i].Cells[1].Value.ToString();
                    String Edate           = Convert.ToDateTime(grdVoucher.Rows[i].Cells[0].Value.ToString()).ToShortDateString();
                    String AccountNum      = grdVoucher.Rows[i].Cells[2].Value.ToString();
                    String Description     = grdVoucher.Rows[i].Cells[3].Value.ToString();
                    String TransactionType = grdVoucher.Rows[i].Cells[4].Value.ToString();
                    String Amount          = grdVoucher.Rows[i].Cells[5].Value.ToString();
                    if (Amount == "0")
                    {
                        Amount = grdVoucher.Rows[i].Cells[6].Value.ToString();
                    }

                    Accounts.InsertJournalAndPosting(AccountId, AccountNum, Amount, Description, TransactionType, Convert.ToDateTime(Edate));
                }
                DBO.AccountTransaction.Commit();
                DBO.AccountsConnection.Close();
                ClearControls();
            }
            catch (Exception Ep)
            {
                DBO.AccountTransaction.Rollback();
                DBO.AccountsConnection.Close();
                MessageBox.Show(Ep.ToString());
            }
        }
Ejemplo n.º 4
0
 private void ComboBox6_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ComboBox6.Text != "")
     {
         Ep.Clear();
     }
 }
Ejemplo n.º 5
0
        private void btnBoton1_Click(object sender, EventArgs e)
        {
            //Mensaje de advertencia de que no se han llenado los campos adecuados
            if (txtMatricula.Text == "")
            {
                Ep.SetError(txtMatricula, "No ha ingresado matricula");
            }


            if (txtNombre.Text == "")
            {
                Ep.SetError(txtNombre, "No ha ingresado Nombre");
            }

            if (txtSemestre.Text == "")
            {
                Ep.SetError(txtSemestre, "No ha ingresado semestre");
            }

            if (txtSemestre.Text == "")
            {
                Ep.SetError(txtCarrera, "No ha ingresado Carrera");
            }

            if (txtTelefono.Text == "")
            {
                Ep.SetError(txtTelefono, "No ha ingresado telefono");
            }

            if (txtCal.Text == "")
            {
                Ep.SetError(txtCal, "No ha ingresado Calificacion");
            }


            //try catch para mostrar al alumno en caso de que los datos que entren no sean adecuados
            try
            {
                Alumno Al = new Alumno();
                Al.Matricula = txtMatricula.Text;
                Al.Nombre    = txtNombre.Text;
                Al.Semestre  = Convert.ToInt32(txtSemestre.Text);
                Al.carrera   = txtCarrera.Text;
                Al.Telefono  = Convert.ToInt32(txtTelefono.Text);

                //confirmacion de que el usuario se ah creado
                throw new ExepcionEspecial("su alumno se creo exitosamente");
            }
            catch (FormatException ex)
            {
                //mensaje de error al ingresar un dato no adecuado
                MessageBox.Show("Error en registrar alumno" + ex.Message);
            }

            catch (ExepcionEspecial espEx)
            {
                MessageBox.Show(espEx.Message);
            }
        }
Ejemplo n.º 6
0
    public void PrintHeaders()
    {
        Extractor.Instance.ClearData();

        foreach (PakElement Ep in _Elements.ToArray())
        {
            Extractor.Instance.AddData("" + Ep.Id, Ep.GetExtention(), "" + Ep.Header.ZSize, "" + Ep.Header.Size, "Extract", Ep.Header.Software);
        }
    }
Ejemplo n.º 7
0
 public bool Send(byte[] data)
 {
     try
     {
         UdpServer.Send(data, data.Length, Ep.ToIpEndPoint());
     }
     catch (Exception ex) { log.Error(ex); return(false); }
     return(true);
 }
        /// <summary>
        /// Recepción de datos del puerto serial enviados por arduino
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            //-------------------------Recepción de datos del arduino------------------------------
            _bufferint = serialPort1.ReadLine();

            //-------------Convirtiendo valores recibidos a datos tipo double------------------

            bool valnum1 = double.TryParse(_bufferint, out _data1);

            //-------------------Muestreo de datos para filtrar errores de medición-------------

            if (valnum1)   // Validando que el dato recibido sea un número
            {
                _dataHcsr04 = _data1;
                ErrorIntegral(_dataHcsr04 * 0.017);
                _sumHcsr04 = _sumHcsr04 + _dataHcsr04;
                _contador++;
            }

            //--------------Promediando datos del muestreo y calculando distancias------------------

            if (_contador == 29)
            {
                _promHcsr04 = _sumHcsr04 / 30;
                _contador   = 0;
                _sumHcsr04  = 0;
                _sumTime    = 0;

                _distanceHcsr04 = _promHcsr04 * 0.017;
                ErrorProporcional(_distanceHcsr04);
                ErrorDerivativo(_distanceHcsr04);

                //-------------Mandando distancia sensada por el sensor al monitor------------------

                BufferContentHcsr04(Math.Round(_distanceHcsr04, 1).ToString());
                BufferOutEp(Ep.ToString());
                BufferOutEint(Ei.ToString());
                BufferOutEderiv(Ed.ToString());
                BufferOutPwm(_pwmPid.ToString());

                //-----------------Envio de datos al arduino y graficación---------------------------
                serialPort1_SenddataProportional(_distanceHcsr04);
                Updategraph(i++, _distanceHcsr04);
                serialPort1.DiscardInBuffer();

                //-----------------Añadiendo datos a lista para su ingreso al excel-------------------
                Posiciones.Add(_distanceHcsr04);
                Errores.Add(Ep);

                if (i > 100)
                {
                    i = 0;
                }
            }
        }
Ejemplo n.º 9
0
        public void btnBoton1_Click(object sender, EventArgs e)
        {
            //hacemos una condicion para saber si se cumple lo que se pide
            if (txtMatricula.Text == "")
            {
                Ep.SetError(txtMatricula, "No ha ingresado matricula");
            }


            if (txtNombre.Text == "")
            {
                Ep.SetError(txtNombre, "No ha ingresado Nombre");
            }

            if (txtSemestre.Text == "")
            {
                Ep.SetError(txtSemestre, "No ha ingresado semestre");
            }

            if (txtSemestre.Text == "")
            {
                Ep.SetError(txtCarrera, "No ha ingresado Carrera");
            }

            if (txtTelefono.Text == "")
            {
                Ep.SetError(txtTelefono, "No ha ingresado telefono");
            }

            //aqui se atrapan los errores y se regresan
            try
            {
                Alumno Al = new Alumno();
                Al.Matricula = txtMatricula.Text;
                Al.Nombre    = txtNombre.Text;
                Al.Semestre  = Convert.ToInt32(txtSemestre.Text);
                Al.carrera   = txtCarrera.Text;
                Al.Telefono  = Convert.ToInt32(txtTelefono.Text);
                throw new ExepcionEspecial("alumno no se creo exitosamente");
            }
            //atrapala excepcion y la muestra al usuario
            catch (FormatException ex)
            {
                MessageBox.Show("Error al registrar alumno" + ex.Message);
            }
            catch (ExepcionEspecial esp)
            {
                MessageBox.Show(Convert.ToString(esp));
            }
            finally
            {
                Ep.Clear();
            }
        }
Ejemplo n.º 10
0
        private void cmdAceptar_Click(object sender, EventArgs e)
        {
            if (txtMatricula.Text == "")
            {
                Ep.SetError(txtMatricula, "No ha ingresado matricula");
            }


            if (txtNombre.Text == "")
            {
                Ep.SetError(txtNombre, "No ha ingresado Nombre");
            }

            if (txtSemestre.Text == "")
            {
                Ep.SetError(txtSemestre, "No ha ingresado semestre");
            }

            if (txtSemestre.Text == "")
            {
                Ep.SetError(txtCarrera, "No ha ingresado Carrera");
            }

            if (txtTelefono.Text == "")
            {
                Ep.SetError(txtTelefono, "No ha ingresado telefono");
            }


            try
            {
                Alumno Al = new Alumno();
                Al.Matricula = txtMatricula.Text;
                Al.Nombre    = txtNombre.Text;
                Al.Semestre  = Convert.ToInt32(txtSemestre.Text);
                Al.carrera   = txtCarrera.Text;
                Al.Telefono  = Convert.ToDouble(txtTelefono.Text);

                //throw new ExepcionEspecial("su alumno se creo exitosamente");
            }
            catch (FormatException ex)
            {
                MessageBox.Show("Error en registrar alumno" + ex.Message);
            }

            catch (Excepcion_Especial espex)
            {
                MessageBox.Show(espex.Message);
            }
            finally
            {
                Ep.Clear();
            }
        }
Ejemplo n.º 11
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == " ")                                     //Condicion por si el TextBox esta vacio
            {
                Ep.SetError(textBox1, "No ha Ingresado Matricula");       //Mensaje de aviso
            }
            else if (textBox2.Text == " ")                                //Condicion por si el TextBox esta vacio
            {
                Ep.SetError(textBox2, "No se ha Ingresado el Nombre");    //Mensaje de aviso
            }
            else if (textBox3.Text == " ")                                //Condicion por si el TextBox esta vacio
            {
                Ep.SetError(textBox3, "No se ha Ingresado el Semestre");  //Mensaje de aviso
            }
            else if (textBox4.Text == " ")                                //Condicion por si el TextBox esta vacio
            {
                Ep.SetError(textBox4, "No se ha Ingresasddo la Carrera"); //Mensaje de aviso
            }
            else if (textBox5.Text == " ")                                //Condicion por si el TextBox esta vacio
            {
                Ep.SetError(textBox5, "No se ha Ingresado el Telefono");  //Mensaje de aviso
            }

            try                                                 //Try-Catch por si el TextBox de la matricula no es un valor numerico
            {
                A.Matricula = Convert.ToInt32(textBox1.Text);   //Convertimos a Int la Matricula

                MessageBox.Show(Convert.ToString(A.Matricula)); //Mensaje de la matricula ingresada
            }
            catch (FormatException ex)
            {
                MessageBox.Show(ex.ToString());                         //Mensaje con toda esa madre del error

                MessageBox.Show("Error, ingrese valores Numericos..."); //Mensaje de aviso
            }

            try                                                         //Try-Catch por si se crea el alumno con los valores que se deben o no
            {
                throw new Excepcion_Especial("¡Creado Correctamente!"); //Mensaje de aviso
            }
            catch (FormatException ex)
            {
                MessageBox.Show("Error en registrar alumno... " + ex.Message); //Mensaje de aviso mas el error
            }
            catch (Excepcion_Especial espex)
            {
                MessageBox.Show(espex.Message); //Mensaje de aviso
            }
            finally
            {
                Ep.Clear(); //Limpiamos el eeror...
            }
        }
Ejemplo n.º 12
0
        private void ButtonAceptar_Click(object sender, EventArgs e)
        {
            Dato data = new Dato();

            if (TxtMatricula.Text == " ")
            {
                Ep.SetError(TxtMatricula, "Matricula no ha sido ingresada");
            }
            else if (TxtNombre.Text == " ")
            {
                Ep.SetError(TxtNombre, "Nombre sin ingresar");
            }
            else if (TxtSemestre.Text == " ")
            {
                Ep.SetError(TxtSemestre, "Escribe un semestre");
            }
            else if (TxtCarrera.Text == " ")
            {
                Ep.SetError(TxtCarrera, "Coloca una carrera");
            }
            else if (TxtTelefono.Text == " ")
            {
                Ep.SetError(TxtTelefono, "Teclea un numero de telefono");
            }
            try
            {
                data.Matricula = Convert.ToInt32(TxtMatricula.Text);
                MessageBox.Show(Convert.ToString(data.Matricula));
            }
            catch (FormatException ex)
            {
                MessageBox.Show(ex.ToString());
                MessageBox.Show("Favor de ingresar exclusivamente numeros");
            }
            try
            {
                throw new Excepcion_Especial("ha sido creado de modo correcto");
            }
            catch (FormatException ex)
            {
                MessageBox.Show("Error al registrar al alumno" + ex.Message);
            }
            catch (Excepcion_Especial espEx)
            {
                MessageBox.Show(espEx.Message);
            }
            finally
            {
                Ep.Clear();
            }
        }
Ejemplo n.º 13
0
        /*
         * public static BigInteger Pow(BigInteger value, BigInteger exponent)
         * {
         *  BigInteger originalValue = value;
         *  while (exponent-- > 1)
         *      value = BigInteger.Multiply(value, originalValue);
         *  return value;
         * }*/
        public static MyRSAProvider.MyMyKeys GenerateKey(int Keysize)
        {
            //initialize constructor
            MyRSAProvider.MyMyKeys MyKeys = new MyRSAProvider.MyMyKeys();
            //Get prime P
            P = GetPrime(Keysize);
            //Get prime Q
            Q = GetPrime(Keysize);
            //calculate the modulus
            N = GetN(P, Q);
            //calculate the totient or phi
            To = GetTotient(P, Q);
            // Get the value of the public exponent...(65537)
            E = GetE();
            //compute the value of the private exponent such that  (D*E % To) = 1
            D = GetD(E, To);
            //calculate other properties of the private and public keys to be used in chinese remender theorem
            Dp   = D % (P - 1);
            Dq   = D % (Q - 1);
            Ep   = E % (P - 1);
            Eq   = E % (Q - 1);
            Qinv = GetD(Q, P);
            //get the keysize into our constructor
            MyKeys.KeySize = Keysize;
            //do checks to see that everything is in other else calculate again
            if (P == 0 || Q == 0 || N == 0 || To == 0 || D == 0 || P == Q || (D * E % To) != 1)
            {
                GenerateKey(Keysize);
            }
            //Add the private key values to the constructor
            MyKeys.PrivateKey.Add(new MyRSAProvider.PrivateKey {
                D = D.ToString(), N = N.ToString(), Dp = Dp.ToString(), Dq = Dq.ToString(), Qinv = Qinv.ToString(), P = P.ToString(), Q = Q.ToString()
            });
            //Add the public key values to the constructor
            MyKeys.PublicKey.Add(new MyRSAProvider.PublicKey {
                E = E.ToString(), N = N.ToString(), Ep = Ep.ToString(), Eq = Eq.ToString(), Qinv = Qinv.ToString(), P = P.ToString(), Q = Q.ToString()
            });

            return(MyKeys);
        }
        public EntitySalesRepositoryTests()
        {
            _scope     = new TransactionScope(TransactionScopeOption.RequiresNew, TransactionScopeAsyncFlowOption.Enabled);
            _container = CompositionRoot.GetContainer();
            _EntityEp  = new Ep
            {
                EpGuid       = Guid.NewGuid(),
                ValidFrom    = _targetSqlDate,
                ValidTo      = _targetSqlDate,
                PlaceId      = PlaceId,
                EpSystem     = string.Empty,
                OFFC         = string.Empty,
                AutorizeDate = _targetSqlDate,
                AK           = string.Empty,
                Comment      = string.Empty,
                CreatedDate  = _minSqlDate,
                ModifiedDate = _minSqlDate
            };
            _EntityEp = new Ep
            {
                EpGuid       = Guid.NewGuid(),
                ValidFrom    = _targetSqlDate,
                ValidTo      = _targetSqlDate,
                PlaceId      = PlaceId,
                EpSystem     = string.Empty,
                OFFC         = string.Empty,
                AutorizeDate = _targetSqlDate,
                AK           = string.Empty,
                Comment      = string.Empty,
                CreatedDate  = _minSqlDate,
                ModifiedDate = _minSqlDate
            };
            _EntityEp = new Ep
            {
                EpGuid       = Guid.NewGuid(),
                ValidFrom    = _targetSqlDate,
                ValidTo      = _targetSqlDate,
                PlaceId      = PlaceId,
                EpSystem     = string.Empty,
                OFFC         = string.Empty,
                AutorizeDate = _targetSqlDate,
                AK           = string.Empty,
                Comment      = string.Empty,
                CreatedDate  = _minSqlDate,
                ModifiedDate = _minSqlDate
            };
            _EntityEntityalePoint = new BasePoint
            {
                BasePointGuid = FakeBasePointId,
                Deal          = new Deal
                {
                    Code = AgencyCode
                },
                TownCode          = "OVB",
                Address           = string.Empty,
                BasePointTypeGuid = Guid.Parse("18D2C60A-9718-4ED0-BA31-8E563A17FF4A"),
                CreatedDate       = _minSqlDate,
                ModifiedDate      = _minSqlDate,
                Systematic        = SystematicType.UesET,
                Eps = new[]
                {
                    _EntityEp
                }
            };
            _UesEtBasePoint = new BasePoint
            {
                BasePointGuid = FakeBasePointId,
                Deal          = new Deal
                {
                    Code = AgencyCode
                },
                TownCode          = "OVB",
                Address           = string.Empty,
                BasePointTypeGuid = Guid.Parse("18D2C60A-9718-4ED0-BA31-8E563A17FF4A"),
                CreatedDate       = _minSqlDate,
                ModifiedDate      = _minSqlDate,
                Systematic        = SystematicType.UesET,
                Eps = new[]
                {
                    _EntityEp
                }
            };
            _UesBasePoint = new UesBasePoint
            {
                Id           = Guid.NewGuid(),
                BasePointId  = BasePointId,
                DealCode     = AgencyCode,
                ValidFrom    = _targetSqlDate,
                ValidTo      = _targetSqlDate,
                CreatedDate  = _minSqlDate,
                ModifiedDate = _minSqlDate,
                TownCode     = "MOW",
                Address      = string.Empty,
                SaleType     = 0,
                Organization = new Organization
                {
                    Code         = AgencyCode,
                    Role         = "~",
                    CreatedDate  = _minSqlDate,
                    ModifiedDate = _minSqlDate
                },
                EntityBasePoints = new[]
                {
                    _UesEtBasePoint
                }
            };
            _firstEntity = new Entity
            {
                EntityGuid        = Guid.NewGuid(),
                Number            = FirstEntityNumber,
                EntityExpirations = new[]
                {
                    new EntityExpiration
                    {
                        EntityExpirationGuid = Guid.NewGuid(),
                        BasePointGuid        = _UesEtBasePoint.BasePointGuid,
                        IsActive             = true,
                        ValidFrom            = _targetSqlDate,
                        ValidTo      = _targetSqlDate,
                        ModifiedDate = _minSqlDate
                    }
                }
            };
            _secondEntity = new Entity
            {
                EntityGuid        = Guid.NewGuid(),
                Number            = SecondEntityNumber,
                EntityExpirations = new[]
                {
                    new EntityExpiration
                    {
                        EntityExpirationGuid = Guid.NewGuid(),
                        BasePointGuid        = _UesEtBasePoint.BasePointGuid,
                        IsActive             = true,
                        ValidFrom            = _targetSqlDate,
                        ValidTo      = _targetSqlDate,
                        ModifiedDate = _minSqlDate
                    }
                }
            };
            _notActiveEntity = new Entity
            {
                EntityGuid        = Guid.NewGuid(),
                Number            = NonActiveEntityNumber,
                EntityExpirations = new[]
                {
                    new EntityExpiration
                    {
                        EntityExpirationGuid = Guid.NewGuid(),
                        BasePointGuid        = _UesEtBasePoint.BasePointGuid,
                        IsActive             = false,
                        ValidFrom            = _targetSqlDate,
                        ValidTo      = _targetSqlDate,
                        ModifiedDate = _minSqlDate
                    }
                }
            };
            _expiredEntity = new Entity
            {
                EntityGuid        = Guid.NewGuid(),
                Number            = NonActiveEntityNumber,
                EntityExpirations = new[]
                {
                    new EntityExpiration
                    {
                        EntityExpirationGuid = Guid.NewGuid(),
                        BasePointGuid        = _UesEtBasePoint.BasePointGuid,
                        IsActive             = true,
                        ValidFrom            = _minSqlDate,
                        ValidTo      = _minSqlDate,
                        ModifiedDate = _minSqlDate
                    }
                }
            };
            _futureEntity = new Entity
            {
                EntityGuid        = Guid.NewGuid(),
                Number            = NonActiveEntityNumber,
                EntityExpirations = new[]
                {
                    new EntityExpiration
                    {
                        EntityExpirationGuid = Guid.NewGuid(),
                        BasePointGuid        = _UesEtBasePoint.BasePointGuid,
                        IsActive             = false,
                        ValidFrom            = _targetSqlDate.AddDays(1),
                        ValidTo      = _targetSqlDate.AddDays(1),
                        ModifiedDate = _minSqlDate
                    }
                }
            };
            _newEntityEntity = new EntityEntity(new EntityEntityDataAccessModel
            {
                Number         = NewEntityEntityNumber,
                SystematicType = EntitySystematicType.ElioET,
                ValidFrom      = DateTime.Now,
                ValidTo        = DateTime.Now.AddDays(1),
                Places         = new List <EntityPlaceDataAccessModel>
                {
                    {
                        new EntityPlaceDataAccessModel
                        {
                            Pcc = "~~~~1",
                            AuthorizationDate = DateTime.Now
                        }
                    }
                }
            });
            _newSabreEtEntity = new EntityEntity(new EntityEntityDataAccessModel
            {
                Number         = NewEntityEntityNumber,
                SystematicType = EntitySystematicType.SabreET,
                ValidFrom      = DateTime.Now,
                ValidTo        = DateTime.Now.AddDays(1),
                Places         = new List <EntityPlaceDataAccessModel>
                {
                    {
                        new EntityPlaceDataAccessModel
                        {
                            Pcc = "AZ12",
                            AuthorizationDate = DateTime.Now,
                        }
                    }
                }
            });
            _newSrnEntity = new EntityEntity(new EntityEntityDataAccessModel
            {
                Number         = NewEntityEntityNumber,
                SystematicType = EntitySystematicType.Srn,
                ValidFrom      = DateTime.Now,
                ValidTo        = DateTime.Now.AddDays(1),
                SrnEntity      = new SrnEntityDataAccessModel
                {
                    Agn      = "12Ааа",
                    Grp      = "4211111111",
                    SrnPools = new List <SrnPoolDataAccessModel>
                    {
                        new SrnPoolDataAccessModel
                        {
                            PoolNumber        = "Аааа12",
                            AuthorizationDate = DateTime.Now
                        }
                    }
                }
            });


            CreateEntityForTestInDatabase();
        }
Ejemplo n.º 15
0
        public void LoadIntellisenseResults(List <Diagnostic> hc)
        {
            lock (s_obs)
            {
                if (ef == null)
                {
                    return;
                }

                ScriptControl.ScriptControl scr = null;

                VSSolution vs = null;

                string filename = "";

                if (ef != null)
                {
                    if (ef.scr != null)
                    {
                        scr = ef.scr;
                    }
                }

                ToolStripComboBox b = toolStripComboBox1;

                int i = b.SelectedIndex;

                vs = ef.GetVSSolution();

                VSProject vp = null;
                //if (vs != null)
                //    vp = vs.MainVSProject;

                //dg.SuspendLayout();

                //LI = new ArrayList();

                //if (vp != null)
                //    if (i == 2)
                //    {
                //        foreach (IntErrors e in DD)
                //        {
                //            if (vp != null)
                //                if (e.vp != vp)
                //                    continue;

                //            int rowId = dg.Rows.Add();
                //            DataGridViewRow row = dg.Rows[rowId];

                //            row.Cells[0].Value = "";
                //            row.Cells[1].Value = ve_resource.Breakall_6323;
                //            row.Cells[2].Value = "e.Code";
                //            row.Cells[3].Value = e.e.Message;
                //            row.Cells[4].Value = Path.GetFileNameWithoutExtension(e.vp.FileName);
                //            row.Cells[5].Value = Path.GetFileName(e.file);
                //            row.Cells[6].Value = e.e.Region.BeginLine.ToString();
                //            row.Cells[7].Value = "project";

                //            string message = e.e.Message;

                //            //if (message.StartsWith("UnknownIdentifier") == true)
                //            //    MessageBox.Show("Unknown identifier");

                //            //v.Checked = true;

                //            row.Tag = e;

                //            //lv.Items.Add(v);
                //        }
                //        dg.ResumeLayout();
                //        return;
                //    }

                //if (i == 3 || i == 0)
                {
                    if (hc != null)
                    {
                    }

                    //filename = d.FileName;

                    foreach (/*IntErrors e in DD*/ Diagnostic hs in hc)
                    {
                        //if (filename != "")
                        //    if (e.file != filename)
                        //        continue;

                        Diagnostic dc = hs;// hc[hs];

                        filename = dc.Location.SourceTree.FilePath;

                        AvalonDocument d = scr.FileOpened(filename, false);

                        int hash = dc.GetMessage().GetHashCode();

                        if (hcd.ContainsKey(hash))
                        {
                            continue;
                        }

                        int    line = 0;
                        string file = "";
                        if (dc.Location != Microsoft.CodeAnalysis.Location.None)
                        {
                            if (dc.Location.SourceTree != null)
                            {
                                file = dc.Location.SourceTree.FilePath;// syntaxTree.FilePath;
                                FileLinePositionSpan c = dc.Location.GetLineSpan();
                                line = c.StartLinePosition.Line;
                            }
                        }

                        int             rowId = dg.Rows.Add();
                        DataGridViewRow row   = dg.Rows[rowId];
                        row.InheritedStyle.BackColor = Color.FromKnownColor(KnownColor.Control);
                        //dg.Rows.Remove(row);
                        //dg.Rows.Insert(0, row);
                        row.Cells[0].Value = dc.Descriptor.Category;
                        if (dc.Severity.ToString() == "Error")
                        {
                            row.Cells[1].Value = new Bitmap(ve_resource.Breakall_6323, 15, 15);
                            Ep.Add(row);
                        }
                        else if (dc.Severity.ToString() == "Warning")
                        {
                            row.Cells[1].Value = new Bitmap(ve_resource.StatusWarning_16x, 15, 15);
                            Wp.Add(row);
                        }
                        else
                        {
                            row.Cells[1].Value = new Bitmap(ve_resource.StatusHelp_256x, 15, 15);
                            Mp.Add(row);
                        }

                        row.Cells[2].Value = dc.Descriptor.Id;
                        row.Cells[3].Value = dc.GetMessage();

                        if (dc.Location != Microsoft.CodeAnalysis.Location.None)
                        {
                            if (vp != null)
                            {
                                row.Cells[4].Value = Path.GetFileNameWithoutExtension(vp.FileName);
                            }
                            else if (dc.Location != Microsoft.CodeAnalysis.Location.None)
                            {
                                if (dc.Location.SourceTree != null)
                                {
                                    row.Cells[4].Value = Path.GetFileNameWithoutExtension(dc.Location.SourceTree.FilePath);
                                }
                            }
                        }
                        row.Cells[5].Value = Path.GetFileName(file);
                        if (line > 0)
                        {
                            row.Cells[6].Value = d.GetLineExtended(line) + 1;
                        }
                        row.Cells[7].Value = "project";

                        //row.Cells[0].Value = "";
                        //row.Cells[1].Value = ve_resource.Errors;
                        //row.Cells[2].Value = "e.Code";
                        //row.Cells[3].Value = e.e.Message;
                        //row.Cells[4].Value = Path.GetFileNameWithoutExtension(e.vp.FileName);
                        //row.Cells[5].Value = Path.GetFileName(e.file);
                        //row.Cells[6].Value = e.e.Region.BeginLine.ToString();
                        //row.Cells[7].Value = "project";

                        //ListViewItem v = new ListViewItem();
                        //v.Text = "";
                        //v.SubItems.Add("");
                        //v.SubItems.Add("e.Code");
                        //v.SubItems.Add(e.e.Message);
                        //v.SubItems.Add(Path.GetFileNameWithoutExtension(e.vp.FileName));
                        //v.SubItems.Add(Path.GetFileName(e.c.FileName));
                        //v.SubItems.Add(e.e.Region.BeginLine.ToString());
                        //v.SubItems.Add("project");

                        //v.Checked = true;

                        row.Tag = dc;

                        dg.Rows.Remove(row);
                        dg.Rows.Insert(0, row);

                        hcd.Add(hash, row);

                        //lv.Items.Add(v);
                    }

                    dg.ResumeLayout();

                    //ef.scr.FocusActiveDocument();
                    return;
                }

                //ArrayList F = ef.scr.GetOpenFiles();

                /*
                 * foreach (IntErrors e in DD)
                 * {
                 *  //ListViewItem v = new ListViewItem();
                 *  //v.Text = "";
                 *  //v.SubItems.Add("");
                 *  //v.SubItems.Add("e.Code");
                 *  //v.SubItems.Add(e.e.Message);
                 *  //v.SubItems.Add(Path.GetFileNameWithoutExtension(e.c.FileName));
                 *  //v.SubItems.Add(Path.GetFileName(e.c.FileName));
                 *  //v.SubItems.Add(e.e.Region.BeginLine.ToString());
                 *  //v.SubItems.Add("project");
                 *
                 *  //v.Checked = true;
                 *
                 *  int rowId = dg.Rows.Add();
                 *  DataGridViewRow row = dg.Rows[rowId];
                 *  row.InheritedStyle.BackColor = Color.FromKnownColor(KnownColor.Control);
                 *
                 *  row.Cells[0].Value = "";
                 *  row.Cells[1].Value = ve_resource.Errors;
                 *  row.Cells[2].Value = "e.Code";
                 *  row.Cells[3].Value = e.e.Message;
                 *  row.Cells[4].Value = Path.GetFileNameWithoutExtension(e.vp.FileName);
                 *  row.Cells[5].Value = Path.GetFileName(e.file);
                 *  row.Cells[6].Value = e.e.Region.BeginLine.ToString();
                 *  row.Cells[7].Value = "project";
                 *
                 *  //string message = e.e.Message;
                 *
                 *  //if (message.StartsWith("UnknownIdentifier") == true)
                 *  //{
                 *  //    // MessageBox.Show("Unknown identifier");
                 *
                 *  //    string[] cc = e.e.Message.Split(" ".ToCharArray());
                 *
                 *  //    Document d = ef.scr.FileOpened(e.c.FileName);
                 *
                 *  //    //foreach (Row r in d.Editor.Document)
                 *  //    //    foreach (Word w in r)
                 *  //    //        w.HasError = false;
                 *
                 *  //    if (d != null)
                 *  //    {
                 *  //        // MessageBox.Show("File has been found");
                 *
                 *  //        if (e.e.Region.BeginLine < 0)
                 *  //            continue;
                 *
                 *  //        d.SuspendLayout();
                 *
                 *  //        Row r = d.Editor.Document[e.e.Region.BeginLine];
                 *
                 *  //        foreach (Word w in r)
                 *  //        {
                 *  //            string[] bb = w.Text.Split(";".ToCharArray());
                 *
                 *  //            foreach (string dd in bb)
                 *
                 *  //                if (dd == cc[1])
                 *  //                {
                 *  //                    // MessageBox.Show("Identifier found");
                 *
                 *  //                    w.HasError = true;
                 *
                 *  //                    //d.Refresh();
                 *  //                }
                 *  //        }
                 *
                 *  //        d.ResumeLayout();
                 *  //    }
                 *
                 *  //}
                 *
                 *  row.Tag = e;
                 * }
                 *
                 * ef.scr.LoadErrors(DD);
                 *
                 * dg.ResumeLayout();
                 */
            }
        }
Ejemplo n.º 16
0
        private void ButtonAceptar_Click(object sender, EventArgs e)
        {
            // Aqui instanciamos nuestro objeto despues de eso creamos varias condiciones donde decimos que si el usuario deja un
            // espacio donde se supone que tiene que ingresar un valor alfanumerico entonces ahi entran nuestras condiciones
            // donde si el usuario no ingresa nada le manda un aviso
            Dato d = new Dato();

            if (TxtMatricula.Text == " ")
            {
                Ep.SetError(TxtMatricula, "No ha ingresado la Matricula");
            }
            else if (TxtNombre.Text == " ")
            {
                Ep.SetError(TxtNombre, "No ha ingresado el Nombre");
            }
            else if (TxtSemestre.Text == " ")
            {
                Ep.SetError(TxtSemestre, "No ha ingresado el Semestre");
            }
            else if (TxtCarrera.Text == " ")
            {
                Ep.SetError(TxtCarrera, "No ha ingresado la Carrera");
            }
            else if (TxtTelefono.Text == " ")
            {
                Ep.SetError(TxtTelefono, "No ha ingresado el Telefono");
            }
            // Aqui ya comenzamos con nuestros Try catch el cual lo que hacemos es que le asignamos que nuestro valor de
            // nuestro Txt sea int, asi arrojamos un mensaje de nuestra matricula, si no es asi aqui entra nuestro catch el cual
            // tiene una excepcion la cual nos dira en que linea esta el error o la falla y igual nos mostrara un mensaje
            try
            {
                d.Matricula = Convert.ToInt32(TxtMatricula.Text);
                MessageBox.Show(Convert.ToString(d.Matricula));
            }
            catch (FormatException ex)
            {
                MessageBox.Show(ex.ToString());
                MessageBox.Show("Valor incorrecto, ingrese solo numeros");
            }
            // Aqui volvemos a hacer otro try catch pero en este no influye mucho ya que nuestras variables son de tipo string
            // y lo que hacemos solo es imprimir por mensaje lo que el usuario ingreso
            try
            {
                d.Nombre   = TxtNombre.Text;
                d.Semestre = TxtSemestre.Text;
                d.Carrera  = TxtCarrera.Text;
                d.Telefono = TxtTelefono.Text;
                MessageBox.Show(d.Nombre);
                MessageBox.Show(d.Semestre);
                MessageBox.Show(d.Carrera);
                MessageBox.Show(d.Telefono);
            }
            catch
            {
                MessageBox.Show("Listo");
            }
            // Aqui en este Try catch usamos nuestra sobrecarga la cual habiamos creado en la clase Excepcion Especial
            // la cual enviamos como parametro un string y aplicamos un AplicationExcepcion, en nuestro catch si hay un error
            // nos mostraria solo un mensaje donde nos diria error al registrar junto con el mensaje
            try
            {
                throw new Excepcion_Especial("Se creo correctamente");
            }
            catch (FormatException ex)
            {
                MessageBox.Show("Error en registrar alumno" + ex.Message);
            }
            catch (Excepcion_Especial espEx)
            {
                MessageBox.Show(espEx.Message);
            }
            finally
            {
                Ep.Clear();
            }
        }
Ejemplo n.º 17
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            bool needReLoad = false;

            if (e.NavigationMode == NavigationMode.New)
            {
                needReLoad = true;
            }
            if (e.Parameter.GetType() == typeof(WatchingStatus))
            {
                var p = (WatchingStatus)e.Parameter;
                if (!(ViewModel.SubjectId == p.subject_id.ToString()))
                {
                    needReLoad = true;
                    ViewModel.InitViewModel();
                }
                ViewModel.SubjectId   = p.subject_id.ToString();
                ViewModel.ImageSource = p.image;
                ViewModel.NameCn      = p.name_cn;
                if (p.eps != null)
                {
                    ViewModel.eps.Clear();
                    foreach (var ep in p.eps)
                    {
                        var newEp = new Ep();
                        newEp.Id     = ep.id;
                        newEp.Sort   = ep.sort;
                        newEp.Status = ep.status;
                        newEp.Type   = ep.type;
                        newEp.NameCn = ep.name;
                        if (newEp.Type == 0)
                        {
                            newEp.Sort = "第 " + newEp.Sort + " 话";
                        }
                        else
                        {
                            newEp.Sort = ViewModel.GetEpisodeType(newEp.Type) + " " + newEp.Sort;
                        }
                        ViewModel.eps.Add(newEp);
                    }
                }
            }
            else if (e.Parameter.GetType() == typeof(Subject))
            {
                var p = (Subject)e.Parameter;
                if (!(ViewModel.SubjectId == p.Id.ToString()))
                {
                    needReLoad = true;
                    ViewModel.InitViewModel();
                }
                ViewModel.SubjectId   = p.Id.ToString();
                ViewModel.ImageSource = p.Images.Common;
                ViewModel.NameCn      = p.NameCn;
                ViewModel.AirDate     = p.AirDate;
                ViewModel.AirWeekday  = p.AirWeekday;
            }
            else if (e.Parameter.GetType() == typeof(Int32))
            {
                if (!(ViewModel.SubjectId == e.Parameter.ToString()))
                {
                    needReLoad = true;
                    ViewModel.InitViewModel();
                }
                ViewModel.SubjectId = e.Parameter.ToString();
            }

            if (needReLoad)
            {
                ViewModel.LoadDetails();
            }
        }
Ejemplo n.º 18
0
        private void Button3_Click(object sender, EventArgs e)
        {
            try
            {
                int X = 0;
                if (txtFileName.Text == "")
                {
                    Ep.SetError(txtFileName, "please select/Enter fileName.....");
                    txtFileName.Focus();
                    return;
                }
                if (ComboBox2.Text == "")
                {
                    Ep.SetError(ComboBox2, "please select Engine File.....");
                    ComboBox2.Focus();
                    return;
                }
                if (ComboBox3.Text == "")
                {
                    Ep.SetError(ComboBox3, "please select Sequence File.....");
                    ComboBox3.Focus();
                    return;
                }

                if (ComboBox4.Text == "")
                {
                    Ep.SetError(ComboBox4, "please select Limit File.....");
                    ComboBox4.Focus();
                    return;
                }

                if (ComboBox5.Text == "")
                {
                    Ep.SetError(ComboBox5, "please select Correction Standard.....");
                    ComboBox5.Focus();
                    return;
                }
                if (ComboBox6.Text == "")
                {
                    Ep.SetError(ComboBox6, "please Test Type Standard.....");
                    ComboBox6.Focus();
                    return;
                }
                for (X = 1; X < (DGPrj.RowCount); X++)
                {
                    if (DGPrj[1, X].Value == null)
                    {
                        Ep.SetError(DGPrj, "please Enter the Value .....");
                        DGPrj.Focus();
                        return;
                    }
                    else
                    {
                        Ep.Clear();
                    }
                }
                Format_Cells();
                X       = 0;
                flg_New = true;
                while (X < PrjGV.RowCount - 1)
                {
                    if (txtFileName.Text == PrjGV[0, X].Value.ToString())
                    {
                        flg_New = false;
                        Rw      = PrjGV.CurrentRow.Index;
                        break;
                    }
                    else
                    {
                        flg_New = true;
                    }
                    X++;
                }

                Rw = PrjGV.CurrentRow.Index;

                if (flg_New == false)
                {
                    Global.Open_Connection("General", "con");
                    MySqlCommand cmd = new MySqlCommand();
                    cmd.CommandText = "UPDATE tblProject SET " +
                                      " EngFile  = '" + ComboBox2.Text + "'," +
                                      " ProgFile  = '" + ComboBox3.Text + "'," +
                                      " LimitFile  = '" + ComboBox4.Text + "'," +
                                      " CorrFile  = '" + ComboBox5.Text + "'," +
                                      " Test_Type  = '" + ComboBox6.Text + "'," +
                                      " R_power  = '" + DGPrj[1, 0].Value.ToString() + "'," +
                                      " R_rpm  = '" + DGPrj[1, 1].Value.ToString() + "'," +
                                      " MT_Torque  = '" + DGPrj[1, 2].Value.ToString() + "'," +
                                      " MT_rpm  = '" + DGPrj[1, 3].Value.ToString() + "'," +
                                      " Fly_rpm  = '" + DGPrj[1, 4].Value.ToString() + "'," +
                                      " Idle_rpm  = '" + DGPrj[1, 5].Value.ToString() + "'," +
                                      " Max_Tq  = '" + DGPrj[1, 6].Value.ToString() + "'," +
                                      " Tq_Range  = '" + DGPrj[1, 7].Value.ToString() + "'," +
                                      " PTO_Ratio  = '" + DGPrj[1, 8].Value.ToString() + "'," +
                                      " PM_Log  = '" + DGPrj[1, 9].Value.ToString() + "'" +
                                      " WHERE ProjectFile = '" + txtFileName.Text + "'";
                    cmd.Connection = Global.con;
                    cmd.ExecuteNonQuery();
                    Load_DataGrid();
                    MessageBox.Show("File Updated .....");
                }
                else if (flg_New == true)
                {
                    Global.Open_Connection("General", "con");
                    MySqlCommand cmd = new MySqlCommand();
                    cmd.CommandText = "INSERT INTO tblProject VALUES ('" +
                                      txtFileName.Text + "','" +
                                      ComboBox2.Text + "','" +
                                      ComboBox3.Text + "','" +
                                      ComboBox4.Text + "','" +
                                      ComboBox5.Text + "','" +
                                      ComboBox6.Text + "','" +
                                      DGPrj[1, 0].Value + "','" +
                                      DGPrj[1, 1].Value + "','" +
                                      DGPrj[1, 2].Value + "','" +
                                      DGPrj[1, 3].Value + "','" +
                                      DGPrj[1, 4].Value + "','" +
                                      DGPrj[1, 5].Value + "','" +
                                      DGPrj[1, 6].Value + "','" +
                                      DGPrj[1, 7].Value + "','" +
                                      DGPrj[1, 8].Value + "','" +
                                      DGPrj[1, 9].Value + "')";
                    cmd.Connection = Global.con;
                    cmd.ExecuteNonQuery();
                    Load_DataGrid();
                    MessageBox.Show("File Saved .....");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Code:- 11004" + ex.Message);
            }
        }
        public static void EntityAreEqual(Entity Entity, EntityEntity EntityEntity, BasePoint BasePoint, Ep Ep)
        {
            Assert.Equal(Entity.EntityExpirations.First().EntityExpirationGuid, EntityEntity.Id);
            Assert.Equal(Entity.Number, EntityEntity.Number);
            Assert.Equal(Entity.EntityExpirations.First().ValidFrom, EntityEntity.ValidFrom);
            Assert.Equal(Entity.EntityExpirations.First().ValidTo, EntityEntity.ValidTo);
            Assert.Equal(BasePoint.Systematic.ToEntitySystematic(), EntityEntity.Systematic);

            var Place = EntityEntity.EntityPlaces.First();

            EtDirectPlaceAreEqual(Place, Ep);
        }
 public static void EtDirectPlaceAreEqual(EntityPlace Place, Ep Ep)
 {
     Assert.Equal(Ep.EpGuid, Place.Id);
     Assert.Equal(Ep.PlaceId, Place.Pcc);
     Assert.Equal(Ep.ValidFrom, Place.AuthorizationDate);
 }
Ejemplo n.º 21
0
        private void btnBoton1_Click(object sender, EventArgs e)
        {
            /* try
             * {
             *   int telefono = Convert.ToInt32(txtTelefono.Text);
             *   int Matricula = Convert.ToInt32(txtMatricula.Text);
             *   int Semestre = Convert.ToInt32(txtSemestre.Text);
             *
             *
             *   MessageBox.Show("Hello");
             * }
             * catch (Exception eX)
             * {   //El primero es un mensaje para el usuario
             *   MessageBox.Show("Valor incorrecto, Ingrese un nuevi valor");
             *   //El segundo es un mensaje pero para el desarollador
             *   MessageBox.Show(eX.ToString());
             * }
             * finally { txtTelefono.Focus(); };
             */

            //estos procesos ven si la condicion se cumple para hacer lo que esta alli senalado
            if (txtMatricula.Text == "")
            {
                Ep.SetError(txtMatricula, "No ha ingresado matricula");
            }


            if (txtNombre.Text == "")
            {
                Ep.SetError(txtNombre, "No ha ingresado Nombre");
            }

            if (txtSemestre.Text == "")
            {
                Ep.SetError(txtSemestre, "No ha ingresado semestre");
            }

            if (txtSemestre.Text == "")
            {
                Ep.SetError(txtCarrera, "No ha ingresado Carrera");
            }

            if (txtTelefono.Text == "")
            {
                Ep.SetError(txtTelefono, "No ha ingresado telefono");
            }

            //este proceso del try hace lo que esta dentro de los corchetes para atrapar errores con el catch y se regrese al error que senalo
            try
            {
                Alumno Al = new Alumno();
                Al.Matricula = txtMatricula.Text;
                Al.Nombre    = txtNombre.Text;
                Al.Semestre  = Convert.ToInt32(txtSemestre.Text);
                Al.carrera   = txtCarrera.Text;
                Al.Telefono  = Convert.ToInt32(txtTelefono.Text);
                throw new ExepcionEspecial("alumno no se creo exitosamente");
            }
            //atrapala excepcion del evento ex y la muestra al usuario con un mbox
            catch (FormatException ex)
            {
                MessageBox.Show("Error al registrar alumno" + ex.Message);
            }
            catch (ExepcionEspecial esp)
            {
                MessageBox.Show(Convert.ToString(esp));
            }
            finally
            {
                Ep.Clear();
            }
        }