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(); } } }
private void ButtonSave_Click(object sender, EventArgs e) { if (!new DecimalValidate().Check(textBoxVrijednost.Text)) { MessageBox.Show("Vrijednost nije ispravno unešena.", "Izmjena vrijednosti postavke", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { decimal vrijednost = decimal.Parse(textBoxVrijednost.Text); if (vrijednost > 1) { vrijednost /= 100.0m; } _postavke.Vrijednost = vrijednost; FormError validateResult = _postavke.ValidateData(); if (_postavke.ValidateData() == FormError.None) { if (_postavke.UpdateData()) { MessageBox.Show("Izmjena uspješna.", "Izmjena vrijednosti postavke", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } else { SetMessageLabel(validateResult); } } } }
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(); } }
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 = ""; }
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(); } }
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(); } } }
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(); } }
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(); } }
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(); } }
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 ButtonSave_Click(object sender, EventArgs e) { _grad.Sifra = textBoxSifra.Text; _grad.Prirez = decimal.Parse(textBoxPrirez.Text); _grad.Posta = comboBoxPosta.Text; _grad.Mjesto = comboBoxGrad.Text; _grad.Zupanija = comboBoxZupanija.Text; _grad.Drzava = "Hrvatska"; FormError validateResult = _grad.ValidateData(); if (checkBoxNoviGrad.Checked) { _grad.Id = 0; } if (validateResult == FormError.None) { if (_grad.Id == 0 && _grad.InsertNew()) { MessageBox.Show("Unos uspješan.", "Novi grad unešen", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } else if (_grad.UpdateData()) { MessageBox.Show("Izmjena uspješna.", "Izmjena podataka partnera", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } } else { SetMessageLabel(validateResult); } }
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 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(); } }
private static void WorkException(Exception ex) { // На всякий случай try { Form parentForm = null; if (FormManager.MainForm != null && !FormManager.MainForm.IsDisposed) { parentForm = FormManager.MainForm; } if (ex.IsAssignableTo(typeof(UserException))) { MessageBox.Show(parentForm, ex.Message, FormManager.AppCaptionName, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { if (Log != null) { Log.Write(LogMessageType.Error, ex.GetDebugInformation()); } FormError.TryShow(parentForm, ex); } } catch { } }
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(); } }
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(); } }
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; } } }
private void ButtonSave_Click(object sender, EventArgs e) { labelMessage.Text = ""; CreateNewPartner(); _partner.ExistsInDb(); FormError validateResult = _partner.ValidateData(); if (validateResult == FormError.None) { if (_partner.OpciPodaci.Id == 0 && _partner.InsertNew()) { MessageBox.Show("Unos uspješan.", "Novi partner unešen", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } else if (_partner.UpdateData()) { MessageBox.Show("Izmjena uspješna.", "Izmjena podataka partnera", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } } else { SetMessageLabel(validateResult); } }
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(); } }
private void LlamarFormError(string mensaje) { using (formError = new FormError(mensaje)) { formError.ShowDialog(); } }
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(); } }
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(); } }
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(); }
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(); } }
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 = ""; } } }
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(); } }
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(); } }
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(); } }
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(); } }
/// <summary> /// При прерывании вызывает исключение "Отменено пользователем.". /// Т.е. можно не обрабатывает DialogResult. /// </summary> public static System.Windows.Forms.DialogResult ShowDialog() { if (HasErrors) { Logger.Log.Error(string.Join("\n", Errors.Select(e => e.Message))); Errors.Sort(); var formErr = new FormError(true); var res = Application.ShowModalDialog(formErr); if (res != System.Windows.Forms.DialogResult.OK) { formErr.EnableDialog(false); //Application.ShowModelessDialog(formErr); throw new Exception("Отменено пользователем."); } return res; } else { return System.Windows.Forms.DialogResult.OK; } }
public static void Check(IEnumerable idsBlRefs, HashSet<string> ignoreBlocks) { curDepth = 0; _ignoreBlocks = ignoreBlocks; Database db = HostApplicationServices.WorkingDatabase; _errors = new List<Error>(); attemptedblocks = new HashSet<ObjectId>(); AllDublicBlRefInfos = new List<BlockRefDublicateInfo>(); dictBlRefInfos = new Dictionary<string, Dictionary<PointTree, List<BlockRefDublicateInfo>>>(); try { using (var t = db.TransactionManager.StartTransaction()) { if (idsBlRefs == null) { var ms = SymbolUtilityServices.GetBlockModelSpaceId(db).GetObject(OpenMode.ForRead) as BlockTableRecord; idsBlRefs = ms; } GetDublicateBlocks(idsBlRefs, Matrix3d.Identity, 0); t.Commit(); } // дублирующиеся блоки AllDublicBlRefInfos = dictBlRefInfos.SelectMany(s => s.Value.Values).Where(w => w.Count > 1) .SelectMany(s => s.GroupBy(g => g).Where(w => w.Skip(1).Any())) .Select(s => { var bi = s.First(); bi.CountDublic = s.Count(); bi.Dublicates = s.Skip(1).ToList(); return bi; }).ToList(); // Добавление дубликатов в результирующий список //AddTransformedToModelDublic(dublicBlRefInfos); } catch (Exception ex) { Logger.Log.Error(ex, $"CheckDublicateBlocks - {db.Filename}. {ex.StackTrace}"); return; } if (AllDublicBlRefInfos.Count == 0) { Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nДубликаты блоков не найдены."); } else { foreach (var dublBlRefInfo in AllDublicBlRefInfos) { Error err = new Error($"Дублирование блоков '{dublBlRefInfo.Name}' - {dublBlRefInfo.CountDublic} шт. в точке {dublBlRefInfo.Position.ToString()}", dublBlRefInfo.IdBlRef, dublBlRefInfo.TransformToModel, System.Drawing.SystemIcons.Error); err.Tag = dublBlRefInfo; _errors.Add(err); } } if (_errors.Count>0) { var formDublicates = new FormError(_errors, true); formDublicates.Text = "Дублирование блоков"; formDublicates.EnableDublicateButtons(); if (Application.ShowModalDialog(formDublicates) != System.Windows.Forms.DialogResult.OK) { formDublicates.EnableDialog(false); Application.ShowModelessDialog(formDublicates); throw new Exception("Отменено пользователем."); } } }
public override void Delete(FormError formError) { var error = formError as FormErrorMock; if (error == null) { return; } this._formErrors.Remove(error); }