private void btnSearch_Click(object sender, EventArgs e)
        {
            if (txtBoxSearch.Text != "")
            {
                string searchText = txtBoxSearch.Text.ToLower();

                List <tblProduct> list = dbe.tblProducts.Where(p => p.ProductID.ToString() == searchText ||
                                                               p.Description.ToLower() == searchText ||
                                                               p.Description.ToLower().StartsWith(searchText) ||
                                                               (searchText.Length >= 3 && p.Description.ToLower().Contains(searchText))).ToList();

                if (list.Count == 0)
                {
                    FormError successMessage = new FormError();
                    successMessage.changeButtonTwo.Hide();
                    successMessage.changeTitle      = "Error";
                    successMessage.changeLabel.Text = "Cannot found the product";
                    successMessage.ShowDialog();
                }

                else
                {
                    dataGridViewTblProducts.DataSource = list;
                }
            }
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dataGridViewTblProducts.Rows.Count != 0)
            {
                FormError confirmDialog = new FormError();
                confirmDialog.changeLabel.Text = "Delete this product?\n"
                                                 + dataGridViewTblProducts.CurrentRow.Cells[0].Value + "."
                                                 + dataGridViewTblProducts.CurrentRow.Cells[2].Value;

                confirmDialog.changeTitle          = "Confirm Delete";
                confirmDialog.changeButtonTwo.Text = "Cancel";
                confirmDialog.ShowDialog();


                if (FormError.getClickResult_FormError())
                {
                    int remove = (int)dataGridViewTblProducts.CurrentRow.Cells[0].Value;

                    tblProduct product = dbe.tblProducts.First(p => p.ProductID == remove);

                    dbe.tblProducts.Remove(product);
                    dbe.SaveChanges();

                    dataGridViewTblProducts.DataSource = dbe.tblProducts.ToList();
                    FormError successMessage = new FormError();
                    successMessage.changeButtonTwo.Hide();
                    successMessage.changeTitle      = "Deleted";
                    successMessage.changeLabel.Text = "Product Deleted";
                    successMessage.ShowDialog();
                }
            }
            txtBoxSearch.Text = "";
        }
Ejemplo n.º 3
0
        private void bunifuDropdown2_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown1.selectedIndex != -1 && bunifuDropdown2.selectedIndex != -1)//daca au fost selectate amandoua dropDown-urile
                {
                    bunifuCustomDataGrid1.Rows.Clear();
                    this.idSpecializareSelectata = SpecializariId.ElementAt(bunifuDropdown1.selectedIndex);
                    this.idAnScolarSelectat      = IdAniScolari.ElementAt(bunifuDropdown2.selectedIndex);

                    var catalog = new CatalogEntities1();
                    var student = from c in catalog.Students
                                  where c.SpecializareID == idSpecializareSelectata && c.AnScolarDeInceputID == idAnScolarSelectat
                                  select c;

                    foreach (var st in student)
                    { //adaugam in dataGrid
                        this.AddStudentDataGrid(st.Nume, st.Prenume);
                    }
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Ejemplo n.º 4
0
        public void AdaugareAniDropDown()
        {
            try
            {
                bunifuDropdown2.Clear();
                IDAniScolari = new List <int>();
                var catalog    = new CatalogEntities1();
                var aniScolari = from a in catalog.AnScolars
                                 select a;
                foreach (var a in aniScolari)
                {
                    bunifuDropdown2.AddItem(a.AnPrimar + "-" + a.AnSecundar);
                    IDAniScolari.Add(a.AnScolarID);
                }

                //adauga ani I II III IV
                bunifuDropdown3.Clear();
                for (int i = 0; i < 4; i++)
                {
                    bunifuDropdown3.AddItem(Ani[i]);
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Ejemplo n.º 5
0
        private void RetornarEndeudamientoDirectoCodeudor(object sender, EventArgs args)
        {
            try
            {
                if (this.formVarialblesAnalisisMicro.tbxIngresosCodeudor.Text != string.Empty && this.formVarialblesAnalisisMicro.tbxEgresosCodeudor.Text != string.Empty &&
                    this.formVarialblesAnalisisMicro.tbxCuotasCentralesDeRiesgo.Text != string.Empty && this.formVarialblesAnalisisMicro.tbxUtilidadBrutaMicro.Text != string.Empty &&
                    this.formVarialblesAnalisisMicro.tbxIngresosFamiliaresYOtros.Text != string.Empty && this.formVarialblesAnalisisMicro.tbxGastosDelNegocio.Text != string.Empty &&
                    this.formVarialblesAnalisisMicro.tbxGastosFamiliaresYOtros.Text != string.Empty)

                {
                    double endeudamientoDirectoCodeudor;

                    endeudamientoDirectoCodeudor = ((Convert.ToDouble(this.formVarialblesAnalisisMicro.tbxEgresosCodeudor.Text) +
                                                     Convert.ToDouble(this.formVarialblesAnalisisMicro.tbxCuota.Text)) / Convert.ToDouble(this.formVarialblesAnalisisMicro.tbxIngresosCodeudor.Text));
                    this.formVarialblesAnalisisMicro.tbxEndeudamientoDirectoCodeudor.Text = endeudamientoDirectoCodeudor.ToString("0.00%");


                    Cache.EndeudamientoDirectoCodeudorMicro = endeudamientoDirectoCodeudor;
                }
            }
            catch
            {
                using (formError = new FormError("Error en el formato numérico de las variables de entrada"))
                {
                    formError.ShowDialog();
                }
            }
        }
Ejemplo n.º 6
0
        private async void ExportarArchivoPDF(object sender, EventArgs eventArgs)
        {
            if (Cache.CriterioDelAnalista == string.Empty)
            {
                using (formError = new FormError("Complete toda la información del crédito antes de exportar un archivo PDF"))
                {
                    formError.ShowDialog();
                }
            }

            else
            {
                using (formConfirmacion = new FormConfirmacion("¿Desea generar un archivo PDF con la información del crédito?"))
                {
                    DialogResult result = formConfirmacion.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        CodigoComun.Alerta("Exportando, espere", FormVentanaEmergente.enmTipo.info);
                        await MostrarAlertaPDF();

                        CodigoComun.Alerta("Archivo exportado", FormVentanaEmergente.enmTipo.exito);
                        using (formAviso = new FormAviso($"Archivo guardo en la ruta: {ruta}"))
                        {
                            formAviso.ShowDialog();
                        }
                    }
                }

                EsconderSubMenu();
            }
        }
Ejemplo n.º 7
0
 private void RetornarEndeudamientoGlobal(object sender, EventArgs args)
 {
     try
     {
         if (this.formVariablesAnalisisComercial.tbxDeduccionesColilla.Text != string.Empty &&
             this.formVariablesAnalisisComercial.tbxCuotaCentrales.Text != string.Empty &&
             this.formVariablesAnalisisComercial.tbxCuotasACancelar.Text != string.Empty &&
             this.formVariablesAnalisisComercial.tbxIngresos.Text != string.Empty &&
             this.formVariablesAnalisisComercial.cbxVivienda.Text != string.Empty &&
             this.formVariablesAnalisisComercial.tbxOtrosIngresos.Text != string.Empty &&
             (this.formVariablesAnalisisComercial.rbtnCiudad.Checked == true || this.formVariablesAnalisisComercial.rbtnMunicipio.Checked == true))
         {
             CodigoComun.Alerta("Correcto", FormVentanaEmergente.enmTipo.exito);
             CalcularEndeudamientoGlobal();
         }
         else
         {
             formError = new FormError("Datos insuficientes para calcular el endeudamiento global.");
             formError.ShowDialog();
         }
     }
     catch (Exception e)
     {
         formError = new FormError($"Error: {e}");
         formError.ShowDialog();
     }
 }
Ejemplo n.º 8
0
 int IdDepartamentSelectat;//tinem minte ce departament a fost selectat
 private void bunifuDropdown1_onItemSelected(object sender, EventArgs e)
 {
     try
     {
         if (bunifuDropdown1.selectedIndex != -1)//daca a fost selectat ceva
         {
             bunifuDropdown3.Clear();
             bunifuDropdown4.Clear();
             bunifuDropdown2.Clear();
             IdSpecializari        = new List <int>();
             IdDepartamentSelectat = idDepartamente.ElementAt(bunifuDropdown1.selectedIndex);
             var catalog      = new CatalogEntities1();
             var specializare = from c in catalog.Specializares//luam toate specializarile care apartin departamentului
                                where c.DepartamentID == IdDepartamentSelectat
                                select c;
             //adaugam specializarile in al doilea dropDown
             foreach (var spec in specializare)
             {
                 adaugareSpecializariDropDown(spec.Nume, spec.SpecializareID);
             }
         }
     }
     catch (Exception ex)
     {
         FormError newForm = new FormError();
         newForm.SetText(ex.ToString());
         newForm.ShowDialog();
     }
 }
Ejemplo n.º 9
0
        public void RetornarAfectacionColilla(object sender, EventArgs args)
        {
            double afectacionColilla;

            try
            {
                if (this.formVariables.tbxDeduccionesColilla.Text != string.Empty && this.formVariables.tbxCuotasCreditoCacelarNomina.Text != string.Empty &&
                    this.formVariables.tbxIngresos.Text != string.Empty)
                {
                    CodigoComun.Alerta("Correcto", FormVentanaEmergente.enmTipo.exito);
                    afectacionColilla = AfectacionColilla.CalcularAfectacionColilla(Convert.ToDouble(this.formVariables.tbxDeduccionesColilla.Text),
                                                                                    Convert.ToDouble(this.formVariables.tbxCuota.Text), Convert.ToDouble(this.formVariables.tbxCuotasCreditoCacelarNomina.Text),
                                                                                    Convert.ToDouble(this.formVariables.tbxIngresos.Text));
                    this.formVariables.tbxAfectacionColilla.Text = afectacionColilla.ToString("0.00%");
                    Cache.AfectacionColilla = afectacionColilla;
                }
                else
                {
                    formError = new FormError("Datos insuficientes para calcular la afectacion colilla.");
                    formError.ShowDialog();
                }
            }
            catch (Exception e)
            {
                formError = new FormError($"Error: {e}");
                formError.ShowDialog();
            }
        }
Ejemplo n.º 10
0
        private void RetornarDisponible(object senderm, EventArgs args)
        {
            double disponible;

            try
            {
                if (this.formVariables.tbxIngresos.Text != string.Empty &&
                    this.formVariables.tbxDeduccionesColilla.Text != string.Empty &&
                    this.formVariables.tbxCuotasCreditoCacelarNomina.Text != string.Empty &&
                    this.formVariables.tbxDeduccionesDeSeguridadSocial.Text != string.Empty &&
                    this.formVariables.tbxOtrasDeduccionesColilla.Text != string.Empty &&
                    this.formVariables.tbxOtrosIngresos.Text != string.Empty &&
                    (this.formVariables.rbtnCiudad.Checked == true || this.formVariables.rbtnMunicipio.Checked == true) &&
                    this.formVariables.cbxVivienda.Text != string.Empty &&
                    this.formVariables.tbxCuotasACancelar.Text != string.Empty && this.formVariables.cbxFormaDePago.Text != string.Empty)

                {
                    if (this.formVariables.cbxFormaDePago.Text == "Nomina")
                    {
                        CodigoComun.Alerta("Correcto", FormVentanaEmergente.enmTipo.exito);
                        if (this.formVariables.cbxLeyLibranza.Checked == false)
                        {
                            disponible = Disponible.CalcularDisponibleNominaSinLibranza(Convert.ToDouble(this.formVariables.tbxIngresos.Text),
                                                                                        Convert.ToDouble(this.formVariables.tbxDeduccionesColilla.Text),
                                                                                        Convert.ToDouble(this.formVariables.tbxCuotasCreditoCacelarNomina.Text));
                            this.formVariables.tbxDisponible.Text = disponible.ToString("N2");
                            Cache.Disponible = disponible;
                        }

                        else if (this.formVariables.cbxLeyLibranza.Checked == true)
                        {
                            disponible = Disponible.CalcularDisponibleNominaConLibranza(Convert.ToDouble(this.formVariables.tbxIngresos.Text),
                                                                                        Convert.ToDouble(this.formVariables.tbxDeduccionesDeSeguridadSocial.Text), Convert.ToDouble(this.formVariables.tbxOtrasDeduccionesColilla.Text),
                                                                                        Convert.ToDouble(this.formVariables.tbxCuotasCreditoCacelarNomina.Text));
                            this.formVariables.tbxDisponible.Text = disponible.ToString("N2");
                            Cache.Disponible = disponible;
                        }
                    }
                    else if (this.formVariables.cbxFormaDePago.Text == "Caja")
                    {
                        CodigoComun.Alerta("Correcto", FormVentanaEmergente.enmTipo.exito);
                        disponible = Disponible.CalcularDisponibleCaja(Convert.ToDouble(this.formVariables.tbxIngresos.Text),
                                                                       Convert.ToDouble(this.formVariables.tbxOtrosIngresos.Text), Convert.ToDouble(this.formVariables.tbxDeduccionesColilla.Text),
                                                                       RetornarDANECiudadPueblo(), RetornarDANEVivienda(), Convert.ToDouble(this.formVariables.tbxCuotasACancelar.Text));
                        this.formVariables.tbxDisponible.Text = disponible.ToString("N2");
                        Cache.Disponible = disponible;
                    }
                }
                else
                {
                    formError = new FormError("Datos insuficientes para calcular el disponible.");
                    formError.ShowDialog();
                }
            }
            catch (Exception e)
            {
                formError = new FormError($"Error: {e}");
                formError.ShowDialog();
            }
        }
Ejemplo n.º 11
0
 private void LlamarFormError(string mensaje)
 {
     using (formError = new FormError(mensaje))
     {
         formError.ShowDialog();
     }
 }
Ejemplo n.º 12
0
        private void RetornarTotalIngresos(Object sender, EventArgs args)
        {
            OcultarCheckBox();
            AdvertenciaCambioDeFormaDePago();
            try
            {
                if (this.formVariables.tbxIngresos.Text != string.Empty && this.formVariables.tbxOtrosIngresos.Text != string.Empty)
                {
                    double ingresos      = Convert.ToDouble(this.formVariables.tbxIngresos.Text);
                    double otrosIngresos = Convert.ToDouble(this.formVariables.tbxOtrosIngresos.Text);

                    if (this.formVariables.cbxFormaDePago.Text == "Nomina")
                    {
                        double totalIngresos = CodigoComun.CalcularTotalIngresos(ingresos, otrosIngresos, 1);
                        this.formVariables.tbxTotalIngresos.Text = totalIngresos.ToString("N2");
                    }
                    else
                    {
                        double totalIngresos = CodigoComun.CalcularTotalIngresos(ingresos, otrosIngresos, 0.8);
                        this.formVariables.tbxTotalIngresos.Text = totalIngresos.ToString("N2");
                    }
                }
            }
            catch
            {
                formError = new FormError("El Valor de los ingresos no debe ser cero o un valor inválido");
                formError.ShowDialog();
            }
        }
Ejemplo n.º 13
0
        private void bunifuDropdown2_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown2.selectedIndex != -1)
                {
                    IdAnScolari = new List <int>();
                    bunifuCustomDataGrid1.Rows.Clear();
                    bunifuDropdown3.Clear();
                    bunifuDropdown4.Clear();
                    bunifuDropdown5.Clear();
                    bunifuDropdown6.Clear();
                    bunifuMaterialTextbox1.Text = "";
                    bunifuMaterialTextbox2.Text = "";
                    this.IdSpecializareSelectat = IdSpecializari.ElementAt(bunifuDropdown2.selectedIndex);

                    var catalog = new CatalogEntities1();
                    var ani     = from a in catalog.AnScolars
                                  select a;
                    foreach (var a in ani)//adaugam fiecare an in dropDown3
                    {
                        AddAnScolarDropDown(a.AnPrimar, a.AnSecundar, a.AnScolarID);
                    }
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Ejemplo n.º 14
0
 private void AbrirFormAnalisisCredito(object sender, EventArgs args)
 {
     if (this.formVarialblesAnalisisMicro.tbxNombres.Text != string.Empty &&
         this.formVarialblesAnalisisMicro.cbxPeriodicidad.Text != string.Empty && this.formVarialblesAnalisisMicro.cbxGarantia.Text != string.Empty &&
         this.formVarialblesAnalisisMicro.tbxProfesion.Text != string.Empty &&
         this.formVarialblesAnalisisMicro.tbxCargo.Text != string.Empty && this.formVarialblesAnalisisMicro.tbxOcupacion.Text != string.Empty &&
         this.formVarialblesAnalisisMicro.cbxEstadoCivil.Text != string.Empty && this.formVarialblesAnalisisMicro.contadorEdad.Value != 0 &&
         this.formVarialblesAnalisisMicro.cbxVivienda.Text != string.Empty &&
         this.formVarialblesAnalisisMicro.contadorEstrato.Value != 0 && (this.formVarialblesAnalisisMicro.rbtnCiudad.Checked == true ||
                                                                         this.formVarialblesAnalisisMicro.rbtnMunicipio.Checked == true) && this.formVarialblesAnalisisMicro.tbxEmpresa.Text != string.Empty &&
         this.formVarialblesAnalisisMicro.tbxActividadEconomica.Text != string.Empty && this.formVarialblesAnalisisMicro.cbxTipoDeContrato.Text != string.Empty &&
         this.formVarialblesAnalisisMicro.contadorAntLaboral.Value != 0 && this.formVarialblesAnalisisMicro.tbxIngresos.Text != string.Empty &&
         this.formVarialblesAnalisisMicro.tbxOtrosIngresos.Text != string.Empty &&
         this.formVarialblesAnalisisMicro.contadorScore.Value != 0 &&
         this.formVarialblesAnalisisMicro.cbxCalificacion.Text != string.Empty && this.formVarialblesAnalisisMicro.tbxIngresosCodeudor.Text != string.Empty &&
         this.formVarialblesAnalisisMicro.tbxEgresosCodeudor.Text != string.Empty && this.formVarialblesAnalisisMicro.tbxEndeudamientoDirectoCodeudor.Text != string.Empty)
     {
         GeneracionDatosCache();
         formAnalisisDeCredito = new FormAnalisisDeCredito();
         formAnalisisDeCredito.ShowDialog();
     }
     else
     {
         formError = new FormError("Ingrese el valor de todas las variables de entrada iniciales para la validación de políticas internas del crédito");
         formError.ShowDialog();
     }
 }
Ejemplo n.º 15
0
        int idSpecializareSelectata;//tinem minte ce Specializare a fost selectata
        private void bunifuDropdown2_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown2.selectedIndex != -1)
                { //daca a fost selectat ceva
                    bunifuDropdown4.Clear();
                    bunifuDropdown3.Clear();
                    IdAniScolari = new List <int>();
                    this.idSpecializareSelectata = IdSpecializari.ElementAt(bunifuDropdown2.selectedIndex);

                    ////punem sa afisam toti aniiScolari: 2015-2016...
                    var catalog  = new CatalogEntities1();
                    var AnScolar = from c in catalog.AnScolars
                                   select c;
                    //adaugam indexii anilor si anii in dropdown
                    string anScolar_string = "";
                    foreach (var anscl in AnScolar)
                    {
                        anScolar_string = anscl.AnPrimar.ToString() + "-" + anscl.AnSecundar.ToString();
                        adaugareAniScoloariDropDown(anScolar_string, anscl.AnScolarID);
                    }
                }
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.ToString());
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Ejemplo n.º 16
0
        int AnSelectat;//anul pe care il selecteaza : 1,2,3,4
        private void bunifuDropdown3_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown3.selectedIndex != -1)
                {
                    this.AnSelectat = IdAni.ElementAt(bunifuDropdown3.selectedIndex);
                    //afisam toate grupele cu an-ul selectat, anscolarIdSelectat, SpecializareId-Selectata
                    var catalog = new CatalogEntities1();
                    var grupe   = from c in catalog.Grupas
                                  where c.An == AnSelectat && c.AnScolarID == idAnScolarSelectat && c.SpecializareID == idSpecializareSelectata
                                  select c;

                    foreach (var grupa in grupe)
                    {
                        //adaugam in gridview
                        this.adaugareGrupaGridView(grupa.Nume);
                    }
                }
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.ToString());
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Ejemplo n.º 17
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (txtBoxSearch.Text != "")
            {
                string searchText = txtBoxSearch.Text.ToLower();

                List <tblUser> list = dbe.tblUsers.Where(p => p.UserID.ToString() == searchText || p.Lastname.ToLower() == searchText ||
                                                         p.Lastname.ToLower().StartsWith(searchText) ||
                                                         (searchText.Length >= 3 && p.Lastname.ToLower().Contains(searchText) || p.Firstname.ToLower().Contains(searchText)) ||
                                                         p.Firstname.ToLower() == searchText || p.Firstname.ToLower().StartsWith(searchText) ||
                                                         (searchText.Contains(p.Firstname) && searchText.Contains(p.Lastname))).ToList();


                if (list.Count == 0)
                {
                    FormError successMessage = new FormError();
                    successMessage.changeButtonTwo.Hide();
                    successMessage.changeTitle      = "Error";
                    successMessage.changeLabel.Text = "Cannot find the employee.";
                    successMessage.ShowDialog();

                    txtBoxSearch.Text = "";
                }

                else
                {
                    dataGridViewTblUser.DataSource = list;
                }
            }
        }
Ejemplo n.º 18
0
        public void SetIndexCadru(int indexCadruSet)
        {
            try
            {
                bunifuDropdown2.Enabled = false;
                ListaAniMaterii         = new List <AnStudiu>();//o alocam de fiecare data
                ListaDetaliiGrupe       = new List <GrupaDetails>();

                this.indexCadru = indexCadruSet;

                var catalog = new CatalogEntities1();
                var materii = from c in catalog.Materies
                              where c.Profesor1ID == indexCadru || c.Profesor2ID == indexCadru || c.Asistent1ID == indexCadru || c.Asisten2ID == indexCadru
                              select c;

                bunifuDropdown1.Clear();
                foreach (var m in materii)//cautam pentru fiecare materie predata, toate grupele si luam anii
                {
                    var grupa = from g in catalog.Grupas
                                join c in catalog.AnScolars
                                on g.AnScolarID equals c.AnScolarID
                                where g.GrupaID == m.GrupaID
                                select new
                    {
                        AnPrimar       = c.AnPrimar,
                        AnSecundar     = c.AnSecundar,
                        NumeGrupa      = g.Nume,
                        IdGrupa        = g.GrupaID,
                        IdAn           = g.AnScolarID,
                        AnGrupa        = g.An,
                        SpecializareID = g.SpecializareID
                    };

                    if (grupa.Count() != 0)
                    { //daca s-a gasit un element, deoarece este o singura grupa cu id-ul respectiv
                        this.addAnMaterieLista(grupa.First().AnPrimar, grupa.First().AnSecundar);
                        //adaugam grupaID si anId in clasa
                        this.addDetaliuGrupaLista(grupa.First().IdGrupa, grupa.First().IdAn, grupa.First().NumeGrupa, grupa.First().AnGrupa, grupa.First().SpecializareID);//ne ajuta pentru dupa ce selecteaza anul
                    }
                }
                //trebuie sa sortam ListaAniMaterii
                // ListaAniMaterii.Sort();
                ListaAniMaterii.Sort((x, y) => x.an1.CompareTo(y.an1));


                foreach (AnStudiu k in this.ListaAniMaterii)//adaugam anii in care preda materii
                {
                    string addAn = k.an1.ToString() + "-" + k.an2.ToString();
                    bunifuDropdown1.AddItem(addAn);
                }

                bunifuDropdown2.Clear();//stergem dropdown-ul cu grupe pentru reconstruire
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Ejemplo n.º 19
0
        private void messageBox(int type)
        {
            FormError myMessageBox = new FormError();

            switch (type)
            {
            case 1:
                myMessageBox.changeButtonTwo.Hide();
                myMessageBox.changeLabel.Text = "Successful\nNew employee added.\n"
                                                + txtBoxFirstName.Text + " " + txtBoxLastName.Text;
                break;

            case 2:
                myMessageBox.changeButtonTwo.Hide();
                myMessageBox.changeLabel.Text = "Successful\nDelete employee.\n"
                                                + txtBoxFirstName.Text + " " + txtBoxLastName.Text;
                break;

            case 3:
                myMessageBox.changeButtonTwo.Hide();
                myMessageBox.changeLabel.Text = "Please fill out all the fields!"
                                                + txtBoxFirstName.Text + " " + txtBoxLastName.Text;
                break;

            case 4:
                myMessageBox.changeButtonTwo.Hide();
                myMessageBox.changeLabel.Text = "Sorry, that username is already taken!"
                                                + txtBoxFirstName.Text + " " + txtBoxLastName.Text;
                break;
            }

            myMessageBox.ShowDialog();
        }
Ejemplo n.º 20
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dataGridViewTblUser.Rows.Count != 0)
            {
                FormError confirmDialog = new FormError();
                confirmDialog.changeLabel.Text = "Delete this account?\n"
                                                 + dataGridViewTblUser.CurrentRow.Cells[1].Value
                                                 + " " + dataGridViewTblUser.CurrentRow.Cells[2].Value;

                confirmDialog.changeTitle          = "Confirm Delete";
                confirmDialog.changeButtonTwo.Text = "Cancel";
                confirmDialog.ShowDialog();


                if (FormError.getClickResult_FormError())
                {
                    int remove = (int)dataGridViewTblUser.CurrentRow.Cells[0].Value;

                    tblUser user = dbe.tblUsers.First(p => p.UserID == remove);
                    dbe.tblUsers.Remove(user);
                    dbe.SaveChanges();
                    messageBox(2);
                    dataGridViewTblUser.DataSource = dbe.tblUsers.ToList();
                    txtBoxSearch.Text = "";
                }
            }
        }
Ejemplo n.º 21
0
        private void bunifuDropdown4_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown4.selectedIndex != -1)
                { //daca a fost selectat un AN
                    IdGrupe = new List <int>();
                    bunifuCustomDataGrid1.Rows.Clear();
                    bunifuDropdown5.Clear();
                    bunifuDropdown6.Clear();
                    bunifuMaterialTextbox1.Text = "";
                    bunifuMaterialTextbox2.Text = "";
                    this.AnSelectat             = IDAn.ElementAt(bunifuDropdown4.selectedIndex);//este direct anul pe care l-a selectat


                    //adaugam toate grupele corespunzatoare An,AnScolarID,SpecializareID
                    var catalog = new CatalogEntities1();
                    var grupe   = from g in catalog.Grupas
                                  where g.An == AnSelectat && g.AnScolarID == IdAnScolarSelectat && g.SpecializareID == IdSpecializareSelectat
                                  select g;
                    foreach (var g in grupe)//adaugam fiecare grupa in dropDown5
                    {
                        AddGrupeDropDown(g.Nume, g.GrupaID);
                    }
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Ejemplo n.º 22
0
        public void ResetAllTools()
        {
            try
            {
                IdDepartamente = new List <int>();
                bunifuCustomDataGrid1.Rows.Clear();
                bunifuDropdown1.Clear();
                bunifuDropdown2.Clear();
                bunifuDropdown3.Clear();
                bunifuDropdown4.Clear();
                bunifuDropdown5.Clear();
                bunifuDropdown6.Clear();
                bunifuMaterialTextbox1.Text = "";
                bunifuMaterialTextbox2.Text = "";

                //adaugam in primul dropDown toate departamentele care corespund id-ului facultatii
                var catalog      = new CatalogEntities1();
                var departamente = from d in catalog.Departamnets
                                   where d.FacultateID == this.idFacultate
                                   select d;
                foreach (var dep in departamente)
                {
                    //adaugam departamente in dropdown
                    this.AddDepartamentDropDown(dep.Nume, dep.DepartamentID);
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
        private void ConvertirTasa(object sender, EventArgs args)
        {
            formError = new FormError("Debe agregar un valor y tipo de tasa antes de simular");
            double valorTasa;

            if (this.formCalculadora.tbxAConvertir.Text != string.Empty && (this.formCalculadora.rbtTasaEfectiva1.Checked == true ||
                                                                            this.formCalculadora.rbtTasaNominal1.Checked == true))
            {
                if (this.formCalculadora.rbtTasaNominal1.Checked == true)
                {
                    CodigoComun.Alerta("Correcto", FormVentanaEmergente.enmTipo.exito);
                    valorTasa = (CodigoComun.NominalAEfectiva(Convert.ToDouble(this.formCalculadora.tbxAConvertir.Text)));
                }
                else if (this.formCalculadora.rbtTasaEfectiva1.Checked == true)
                {
                    CodigoComun.Alerta("Correcto", FormVentanaEmergente.enmTipo.exito);
                    valorTasa = (CodigoComun.EfectivaANominal(Convert.ToDouble(this.formCalculadora.tbxAConvertir.Text)));
                }
                else
                {
                    valorTasa = 0;
                }

                this.formCalculadora.tbxConvertida.Text = valorTasa.ToString("N3") + "%";
            }
            else
            {
                formError.ShowDialog();
            }
        }
Ejemplo n.º 24
0
        private void bunifuDropdown3_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown3.selectedIndex != -1)
                { //inseamna ca s-a selectat un an scolar
                    IDAn = new List <int>();
                    bunifuCustomDataGrid1.Rows.Clear();
                    bunifuDropdown4.Clear();
                    bunifuDropdown5.Clear();
                    bunifuDropdown6.Clear();
                    bunifuMaterialTextbox1.Text = "";
                    bunifuMaterialTextbox2.Text = "";
                    this.IdAnScolarSelectat     = IdAnScolari.ElementAt(bunifuDropdown3.selectedIndex);

                    //luam toate grupele care au AnScolarIdSelectat si SpecializareIdSelectata si returnam numai anii care exista
                    var catalog = new CatalogEntities1();
                    var grupe   = from g in catalog.Grupas
                                  where g.AnScolarID == IdAnScolarSelectat && g.SpecializareID == IdSpecializareSelectat
                                  select g;
                    //adaugam anii grupelo in dropDown4 ( sa fie adaugati o singura data)
                    foreach (var g in grupe)
                    {
                        AdaugareAnDropDown(g.An);
                    }
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
        private void ConvertirTasaDos(object sender, EventArgs args)
        {
            try
            {
                formError = new FormError("Debe agregar la DTF y los puntos a sumar antes de simular.");

                if (this.formCalculadora.tbxDTF.Text != string.Empty && !string.IsNullOrEmpty(this.formCalculadora.tbxPuntos.Text))
                {
                    double TasaEA      = CalcularTasaEA(Convert.ToDouble(this.formCalculadora.tbxDTF.Text), Convert.ToInt32(this.formCalculadora.tbxPuntos.Text));
                    double TasaMensual = CalcularTasaMensual(TasaEA);
                    this.formCalculadora.tbxTasaEA.Text      = (TasaEA / 100).ToString("0.00%");
                    this.formCalculadora.tbxTasaMensual.Text = (TasaMensual / 100).ToString("0.00%");
                    CodigoComun.Alerta("Correcto", FormVentanaEmergente.enmTipo.exito);
                }
                else
                {
                    formError.ShowDialog();
                }
            }
            catch (Exception)
            {
                using (formError = new FormError("La información no tiene el formato correcto "))
                {
                    formError.ShowDialog();
                }
            }
        }
Ejemplo n.º 26
0
 private void RetornarEstadosDeResultados(object sender, EventArgs args)
 {
     try
     {
         if (this.formVarialblesAnalisisMicro.tbxVentasMicro.Text != string.Empty && this.formVarialblesAnalisisMicro.tbxCostosDeVentasMicro.Text != string.Empty &&
             this.formVarialblesAnalisisMicro.tbxGastosDelNegocio.Text != string.Empty && this.formVarialblesAnalisisMicro.tbxIngresosFamiliaresYOtros.Text != string.Empty &&
             this.formVarialblesAnalisisMicro.tbxGastosFamiliaresYOtros.Text != string.Empty && this.formVarialblesAnalisisMicro.tbxCuotaCreditoARefinanciarMicro.Text != string.Empty)
         {
             CodigoComun.Alerta("Correcto", FormVentanaEmergente.enmTipo.exito);
             RetornarUtilidadBruta();
             RetornarUtilidadOPerdidaOperativa();
             RetornarUtilidadOPerdidaneta();
             RetornarUtilidadDisponible();
             RetornarMargenDeConfianza();
             RetornarCapacidadDePagoConCuota();
             RetornarEndeudamientoDirecto();
         }
         else
         {
             formError = new FormError("Ingrese las varialbes de entrada en el  estado de resultados para calcular las utilidades");
             formError.ShowDialog();
         }
     }
     catch
     {
         formError = new FormError("Error en el formato numérico de las variables de entrada");
         formError.ShowDialog();
     }
 }
Ejemplo n.º 27
0
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            //resetam toate toolurile
            bunifuDropdown1.Clear();
            bunifuDropdown2.Clear();
            bunifuDropdown3.Clear();
            bunifuMaterialTextbox3.Text = "";
            bunifuCustomDataGrid1.Rows.Clear();
            bunifuMaterialTextbox4.Text = "";
            bunifuMaterialTextbox5.Text = "";
            bunifuMaterialTextbox6.Text = "";
            bunifuMaterialTextbox7.Text = "";
            try
            {
                if (bunifuMaterialTextbox1.Text != "" && bunifuMaterialTextbox1.Text != "Adaugati Nume!" && bunifuMaterialTextbox2.Text != "" && bunifuMaterialTextbox2.Text != "Adaugati Prenume" && bunifuMaterialTextbox1.Text != "Acest student nu exista!" && bunifuMaterialTextbox2.Text != "Acest student nu exista!")
                {
                    this.NumeSelectat    = bunifuMaterialTextbox1.Text;
                    this.PrenumeSelectat = bunifuMaterialTextbox2.Text;

                    //cautam toti studentii cu numele respectiv si afisam CNP-urile
                    var catalog  = new CatalogEntities1();
                    var studenti = from s in catalog.Students
                                   where s.Nume.Equals(NumeSelectat) && s.Prenume.Equals(PrenumeSelectat)
                                   select s;
                    //verificam daca exista acest student
                    if (studenti.Count() != 0)
                    {                               //inseamna ca exista
                        foreach (var s in studenti) //adaugam CNP-urile in primul DropDown
                        {
                            this.AddCNPDropDown(s.CNP);
                        }
                    }
                    else
                    {
                        bunifuMaterialTextbox1.Text = "Acest student nu exista!";
                        bunifuMaterialTextbox2.Text = "Acest student nu exista!";
                    }
                }
                else
                {
                    if (bunifuMaterialTextbox1.Text == "")
                    {
                        bunifuMaterialTextbox1.Text = "Adaugati Nume!";
                    }
                    if (bunifuMaterialTextbox2.Text == "")
                    {
                        bunifuMaterialTextbox2.Text = "Adaugati Prenume";
                    }
                }
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.ToString());
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Ejemplo n.º 28
0
        public void add_materie(string numeMaterie, string prof1, string prof2, string asistent1, string asistent2, string procentCurs, string procentLab, string procentTeme, string procentProiect, string Examen, string credite, string notaCurs, string notaLaborator, string notaProiect, string notaFinala)
        {
            try
            {
                bunifuCustomDataGrid1.Rows.Add();
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[0].Value = numeMaterie;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[1].Value = return_numeCadru(prof1);            //cautam numele profesorului1 dupa id in functie
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[2].Value = return_numeCadru(prof2);            //cautam numele profesorului1 dupa id in functie
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[3].Value = return_numeCadru(asistent1);        //cautam numele profesorului1 dupa id in functie
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[4].Value = return_numeCadru(asistent2);        //cautam numele profesorului1 dupa id in functie
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[5].Value = procentCurs;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[6].Value = procentLab;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[7].Value = procentTeme;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[8].Value = procentProiect;
                Bitmap cale = null;
                if (Examen == "True")
                {
                    cale = new Bitmap("Green_Exam.png");
                }
                else
                {
                    cale = new Bitmap("Red_Exam.png");
                }

                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[9].Value  = cale;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[10].Value = credite;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[11].Value = notaCurs;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[12].Value = notaLaborator;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[13].Value = notaProiect;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[14].Value = notaFinala;
                if (notaFinala != "-")
                {//inseamna ca a pus nota
                    int Medie = Int32.Parse(notaFinala);
                    if (Medie >= 5)
                    {//admis
                        cale = new Bitmap("Pass_Exam.png");
                        bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[15].Value = cale;
                    }
                    else
                    {
                        cale = new Bitmap("Failed_Exam.png");
                        bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[15].Value = cale;
                    }
                }
                else
                {
                    cale = new Bitmap("Failed_Exam.png");
                    bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[15].Value = cale;
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Ejemplo n.º 29
0
        private void notImplemented(string message)
        {
            FormError incomplete = new FormError();

            incomplete.changeButtonOne.Text = "OK";
            incomplete.changeLabel.Text     = message;
            incomplete.changeTitle          = "Incomplete Functionality";
            incomplete.changeButtonTwo.Hide();
            incomplete.ShowDialog();
        }
Ejemplo n.º 30
0
        private void CargarForm(object sender, EventArgs args)
        {
            using (formError = new FormError("El salario mínimo no está almacenado en el sistema o tiene un valor de 0."))
            {
                this.formVentanaPrincipal.lblNombre.Text = Cache.NombreAnalista;

                if (Settings.Default.salario == 0)
                {
                    formError.ShowDialog();
                }
            }
        }