private void Btn_GenerarPresupuesto_Click(object sender, RoutedEventArgs e) { try { PrincipalPermission MyPermission = new PrincipalPermission(NombreUsuario, "P1"); MyPermission.Demand(); string[,] vs = new string[ListaConceptosAgregados.Items.Count, 7]; datosPresupuesto[0] = TXT_Propietario.Text; datosPresupuesto[1] = TXT_Solicitante.Text; datosPresupuesto[3] = TXT_Metros.Text; for (int x = 0; x < ListaConceptosAgregados.Items.Count; x++) { PresupuestoAgregado presupuestoAgregado = (PresupuestoAgregado)ListaConceptosAgregados.Items[x]; vs[x, 0] = presupuestoAgregado.ID.ToString(); vs[x, 1] = presupuestoAgregado.Tipo; vs[x, 2] = presupuestoAgregado.ConceptoA.ToString(); vs[x, 3] = presupuestoAgregado.ImporteA.ToString(); vs[x, 4] = presupuestoAgregado.CantidadA.ToString(); vs[x, 5] = presupuestoAgregado.TotalA.ToString(); vs[x, 6] = presupuestoAgregado.eliminado.ToString(); } if (idpresupuesto == 0) { idpresupuesto = presupuesto.Insertar(TXT_Etiqueta.Text, TXT_Solicitante.Text, TXT_Propietario.Text, TXT_Genero.Text, Convert.ToDecimal(TXT_Metros.Text), Convert.ToDecimal(Total.Text), EstadoPresupuesto.SelectedIndex, IdTipodeproyecto, 1); } if (idpresupuesto != 0) { IngresarDatos(vs); PresupuestoLicenciaConstrucción construcción = new PresupuestoLicenciaConstrucción(idpresupuesto, vs, datosPresupuesto); construcción.ShowDialog(); } else { MessageBox.Show(presupuesto.Mensaje); } } catch (Exception ex) { } }
protected void BtnSiguiente_Click(object sender, EventArgs e) { if (TbIdPresupuesto.Text == string.Empty) { if (Session["CobroDetalle"] != null) { pre = (Presupuesto)Session["PresupuestoDetalle"]; } OtenerDatos(); if (pre.Insertar()) { Alert("Presupuesto Se Guardo Corectamente"); VistaGridView.DataSource = null; VistaGridView.DataBind(); Limpiar(); } else { Alert("Presupuesto No Se Pudo Guardar Corectamente "); } } else { OtenerDatos(); Limpiar(); if (pre.Modificar()) { Alert("Presupuesto Se Modificada Corectamente"); } else { Alert("Presupuesto No Se Modificar Corectamente"); } } }
protected void GuardarButton_Click(object sender, EventArgs e) { if (PresupuestoTextBox.Enabled) { Presupuesto presupuesto = new Presupuesto(); LlenarDatos(presupuesto); if (presupuesto.Insertar()) { Utilitarios.ShowToastr(this, "Edicion exitosa", "Exito", "success"); } Limpiar(); } else { Presupuesto presupuesto = new Presupuesto(); presupuesto.PresupuestoId = Convert.ToInt16(PresupuestoTextBox.Text); LlenarDatos(presupuesto); if (presupuesto.Editar()) { Utilitarios.ShowToastr(this, "Edicion exitosa", "Exito", "success"); } Limpiar(); } }
private void Btn_GuardarLicencia_Click(object sender, RoutedEventArgs e) { try { PrincipalPermission MyPermission = new PrincipalPermission(NombreUsuario, "L2"); MyPermission.Demand(); if (F == false) { bool n = false; n = ProyectoLicencia.Actualizar(IDlicen, dockcheck[0], dockcheck[1], dockcheck[2], dockcheck[3], dockcheck[4], dockcheck[5], dockcheck[6], dockcheck[7]); if (n == true) { PantallaCheck check = new PantallaCheck(); check.Show(); } else { MessageBox.Show(ProyectoLicencia.Mensaje); } } } catch (Exception ex) { } try { PrincipalPermission MyPermission = new PrincipalPermission(NombreUsuario, "L1"); MyPermission.Demand(); if (F == true) { if (IDpresupuesto == 0) { IDpresupuesto = presupuesto.Insertar(TXT_Etiqueta.Text, TXT_NombreCliente.Text, TXT_Propietario.Text, TXT_Genero.Text, Convert.ToDecimal(TXT_Metros.Text), 0, 1, IdTipodeproyecto, 1); if (IDpresupuesto != 0) { IDlicen = ProyectoLicencia.Insertar(dockcheck[0], dockcheck[1], dockcheck[2], dockcheck[3], dockcheck[4], dockcheck[5], dockcheck[6], dockcheck[7], 1, IDpresupuesto, IDcliente, IDinmueble, 1); if (IDlicen != 0) { PantallaCheck check = new PantallaCheck(); check.Show(); F = false; DesactivarCampos(); } else if (IDlicen == 0) {//elimina el prosupuesto si la licencia no se registro corretamente presupuesto.Depurar(IDpresupuesto); MessageBox.Show(ProyectoLicencia.Mensaje); } } else { MessageBox.Show(presupuesto.Mensaje); } } else if (IDpresupuesto != 0) { IDlicen = ProyectoLicencia.Insertar(dockcheck[0], dockcheck[1], dockcheck[2], dockcheck[3], dockcheck[4], dockcheck[5], dockcheck[6], dockcheck[7], 1, IDpresupuesto, IDcliente, IDinmueble, 1); if (IDlicen != 0) { PantallaCheck check = new PantallaCheck(); check.Show(); F = false; DesactivarCampos(); } else { MessageBox.Show(ProyectoLicencia.Mensaje); } } } } catch (Exception ex) { } }
public void InsertarTest() { presupuesto.AgregarDetalle(1, 500); Assert.IsTrue(presupuesto.Insertar()); }