コード例 #1
0
ファイル: AgregarUsuario.cs プロジェクト: luis-wq/BasesyM
        private void MetroButton1_Click(object sender, EventArgs e)
        {
            DialogResult pregunta;

            pregunta = MetroFramework.MetroMessageBox.Show(this, "¿Desea cancelar el proceso?", "Cancelar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (pregunta == DialogResult.Yes)
            {
                Padre.Enabled = true;
                Padre.FocusMe();
                Padre.CargarDatos();
                this.Close();
            }
        }
コード例 #2
0
 private void BtnEliminar_Click(object sender, EventArgs e)
 {
     if (bandera == 0)
     {
         pad.Enabled = true;
         pad.FocusMe();
         this.Close();
     }
     else if (bandera == 6)
     {
         pod.Enabled = true;
         pod.FocusMe();
         this.Close();
         pod.listarTabla();
     }
     else
     {
         Padre.Enabled = true;
         Padre.FocusMe();
         this.Close();
         Padre.CargarDatos();
     }
 }
コード例 #3
0
        private void AgregarClienteBueno()
        {
            Boolean isCorrect = false;
            Boolean clienteExiste;
            String  razon = txtRazonSocial.Text, rfc = txtRFC.Text, correo = txtCorreo.Text, sitioW = txtSitioWeb.Text;
            string  cel1 = txtCelular.Text, cel2 = txtCelular2.Text, telofi = txtTelOfi.Text, calle = txtCalle.Text;
            string  colonia = txtColonia.Text, numE = txtNumeroE.Text, numI = txtNumeroI.Text, ciudad = txtCiudad.Text;
            string  estado = txtEstado.Text, pais = txtPais.Text, cp = txtCP.Text, referencia = txtReferencia.Text, observaciones = txtObservaciones.Text;

            if (!tipo_cliente_cambio)
            {
                isCorrect = false;
                MetroFramework.MetroMessageBox.
                Show(this, " Selecciona un tipo de cliente", "Error al ingresar nuevo cliente", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (string.IsNullOrEmpty(razon) || string.IsNullOrEmpty(rfc) || string.IsNullOrEmpty(correo) || string.IsNullOrEmpty(sitioW) ||
                    string.IsNullOrEmpty(cel1) || string.IsNullOrEmpty(cel2) || string.IsNullOrEmpty(telofi) || string.IsNullOrEmpty(calle) ||
                    string.IsNullOrEmpty(colonia) || string.IsNullOrEmpty(numE) || string.IsNullOrEmpty(ciudad) || string.IsNullOrEmpty(estado) ||
                    string.IsNullOrEmpty(pais) || string.IsNullOrEmpty(cp) || string.IsNullOrEmpty(referencia) || string.IsNullOrEmpty(observaciones))
                {
                    isCorrect = false;
                    MetroFramework.MetroMessageBox.
                    Show(this, " Ingrese todos los datos", "Error al ingresar nuevo cliente", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    isCorrect = true;
                }
            }
            BD metodos = new BD();

            BD.ObtenerConexion();
            clienteExiste = metodos.clienteExiste(rfc);
            BD.CerrarConexion();

            if (clienteExiste == true)
            {
                MetroFramework.MetroMessageBox.
                Show(this, "Ya existe un cliente con el RFC: " + rfc, "Error al ingresar nuevo cliente", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (isCorrect)
            {
                //Agregar Cliente.
                BD.ObtenerConexion();
                agregar = metodos.agregarCliente(razon, rfc, correo, sitioW, calle, colonia, numE, numI, referencia, ciudad, estado, pais, cp, cel1, cel2, telofi, ComboBoxTipoCliente.Text, observaciones, id);
                BD.CerrarConexion();


                if (agregar == true)
                {
                    DialogResult pregunta;
                    pregunta = MetroFramework.MetroMessageBox.Show(this, "Cliente agregado correctamente, ¿Desea agregar otro cliente?", "Cliente agregado", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (pregunta == DialogResult.Yes)
                    {
                        limpiarTextBox();
                    }
                    else if (pregunta == DialogResult.No)
                    {
                        /*
                         * Padre.Close();
                         * Inicio home = new Inicio(id);
                         * home.Show();
                         * home.FocusMe();
                         */
                        Padre.Enabled = true;
                        Padre.FocusMe();
                        Padre.CargarDatos();
                        this.Close();
                    }
                }
                else if (agregar == false)
                {
                    MetroFramework.MetroMessageBox.
                    Show(this, "Revisa tu conexión a internet e intentalo de nuevo.", "Error de conexíón", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #4
0
ファイル: AgregarCotizacion.cs プロジェクト: luis-wq/BasesyM
        private void CargarCotizacion()
        {
            /*            BD.InsertarCotizacion(id_cliente,id_usuario,observacion,envio,nocotizacioncliente,isproduccion,fecha,
             *            cargoextra,tablaMDF
             *              , tablaPINO,tablamoldura,prioridad);*/
            int    idCliente   = Convert.ToInt32(datosClientes.Rows[comboCliente.SelectedIndex]["id_cliente"]);
            int    idUsuario   = Convert.ToInt32(id);
            string observacion = Convert.ToString(txtObservaciones.Text);

            if (observacion.Equals(""))
            {
                observacion = "NINGUNA";
            }
            double envio;

            try
            {
                envio = Convert.ToDouble(txtEnvio.Text);
            }
            catch {
                envio = 0;
            }
            int noCotizacionCliente;
            int nocotizacion = Convert.ToInt32(datosClientes.Rows[comboCliente.SelectedIndex]["nocotizacion"]);

            if (nocotizacion == 0)
            {
                noCotizacionCliente = 1;
            }
            else
            {
                noCotizacionCliente = nocotizacion + 1;
            }
            int    isProduccion = 0;
            string fecha        = obtenerFecha();
            double cargo;

            try
            {
                cargo = Convert.ToDouble(txtCargoExtra.Text);
            }
            catch {
                cargo = 0;
            }
            string prioridad = comboUrgencia.SelectedText;

            if (prioridad.Equals(""))
            {
                prioridad = "NORMAL";
            }
            string pesoTotalAux = txtPesoTotal.Text.Replace("k", "").Replace("g", "");
            double pesoTotal    = Convert.ToDouble(pesoTotalAux);

            agregar = BD.InsertarCotizacion(idCliente, idUsuario, observacion, envio, noCotizacionCliente, isProduccion, fecha, cargo, tablaMDF, tablaPINO, tablaMOLDURA, prioridad, pesoTotal, 0, "owo");
            BD.modificarNoCotizacion(idCliente, noCotizacionCliente);
            DataTable idCotizacionActual = BD.consultaIdCotizaion(idCliente, idUsuario);

            idCotizacion = Convert.ToInt32(idCotizacionActual.Rows[0]["id_cotizacion"]);
            if (agregar == true)
            {
                int i = 0;
                foreach (DataRow row in ItemCotizacion.Rows)
                {
                    int    idProducto = Convert.ToInt32(ItemCotizacion.Rows[i]["ID"]);
                    int    idColor    = Convert.ToInt32(ItemCotizacion.Rows[i]["Id_color"]);
                    int    idTipo     = Convert.ToInt32(ItemCotizacion.Rows[i]["Id_tipo"]);
                    int    cantida    = Convert.ToInt32(ItemCotizacion.Rows[i]["CANT"]);
                    int    cantidadA  = Convert.ToInt32(ItemCotizacion.Rows[i]["CANTA"]);
                    Double precioN    = Convert.ToInt32(ItemCotizacion.Rows[i]["PRECIO"]);
                    int    cantidadP  = 0;
                    if (cantida <= cantidadA)
                    {
                        cantidadP = 0;
                        cantidadA = cantidadA - cantida;
                        BD.AgregarDetalleCotizacion(idProducto, idColor, idTipo, idCotizacion, cantida, cantida, cantidadP, precioN);
                    }
                    else
                    {
                        cantidadP = cantida - cantidadA;
                        BD.AgregarDetalleCotizacion(idProducto, idColor, idTipo, idCotizacion, cantida, cantidadA, cantidadP, precioN);
                    }
//                    BD.AgregarDetalleCotizacion(idProducto, idColor, idTipo, idCotizacion, cantida,cantidadA,cantidadP);
                    modificarProducto(idProducto, cantidadA);
                    i++;
                }
                string precioFinalAux = txtTotal.Text.Replace("$", "");
                double precioFinal    = Convert.ToDouble(precioFinalAux);
                BD.AgregarCuentaCliente(idCotizacion, precioFinal);
                DialogResult pregunta;
                pregunta = MetroFramework.MetroMessageBox.Show(this, "Cotización agregada correctamente", "Cotización agregada", MessageBoxButtons.OK, MessageBoxIcon.Question);
                if (pregunta == DialogResult.OK)
                {
                    Padre.Enabled = true;
                    Padre.CargarDatos();
                    Padre.FocusMe();
                    this.Close();
                }
            }
            else if (agregar == false)
            {
                MetroFramework.MetroMessageBox.
                Show(this, "Revisa tu conexión a internet e intentalo de nuevo.", "Error de conexíón", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }