Exemple #1
0
        private void btn_Edit_Click(object sender, EventArgs e)
        {
            try
            {
                if (txt_NumTel.Text != "")
                {
                    Telephone = txt_NumTel.Text;

                    result = MessageBox.Show("¿Desea Editar el Teléfono de este Usuario?", "Modificar Teléfono Cliente", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (result == DialogResult.OK)
                    {
                        tatu.UpdateQuery(Telephone, id_Telephone);

                        MercaFacil_2DataSetTableAdapters.LogTableAdapter logta
                            = new MercaFacil_2DataSetTableAdapters.LogTableAdapter();

                        logta.Insert("Modificación de Teléfono", "Se Modificó el Teléfono", System.DateTime.Now, id_User);
                    }
                }
                else
                {
                    MessageBox.Show("Llene Correctamente los Datos...", "¡Atención!", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                }

                txt_NumTel.Clear();
            }
            catch (Exception error)
            {
                MessageBox.Show("Ha Ocurrido el Siguiente Error: " + error, "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btn_Edit_Click(object sender, EventArgs e)
        {
            try
            {
                if (txt_NumTel.Text != "")
                {
                    telephone = txt_NumTel.Text;

                    result = MessageBox.Show("¿Desea Editar el Teléfono de este Cliente?", "Modificar Teléfono Cliente", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (result == DialogResult.OK)
                    {
                        tatc.UpdateQuery(telephone, id_telephone);

                        MercaFacil_2DataSetTableAdapters.LogTableAdapter logta
                            = new MercaFacil_2DataSetTableAdapters.LogTableAdapter();

                        logta.Insert("modificación de teléfono", "Se modificó el Teléfono", System.DateTime.Now, id_user);

                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Por favor, Revice los datos", "Modificar Teléfono Cliente",
                                    MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }

                txt_NumTel.Clear();
            }
            catch (Exception error)
            {
                MessageBox.Show("Ha Ocurrido el Siguiente Error: " + error, "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        private void btn_Confirm_Click(object sender, EventArgs e)
        {
            DialogResult result;

            try
            {
                if (txt_NumTel.Text != "")
                {
                    telephone = txt_NumTel.Text;

                    result = MessageBox.Show("¿Desea Agregar el Teléfono a este Usuario?", "Agregar Teléfono Usuario", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                    if (result == DialogResult.OK)
                    {
                        tatu.Insert(id_User, telephone);
                        MercaFacil_2DataSetTableAdapters.LogTableAdapter logTa
                            = new MercaFacil_2DataSetTableAdapters.LogTableAdapter();

                        logTa.Insert("Teléfono Agregado", "Se Agregó un Teléfono", System.DateTime.Now, currentUser);
                    }

                    result = MessageBox.Show("¿Desea Agregar otro Teléfono a este Usuario?", "Agregar Teléfono Usuario", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                    if (result == DialogResult.OK)
                    {
                        txt_NumTel.Clear();
                    }
                    else
                    {
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Llene Correctamente los Datos...", "¡Atención!", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                }
            }
            catch (Exception error)
            {
                MessageBox.Show("Ha Ocurrido el Siguiente Error: " + error, "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #4
0
        private void lbl_Ventas_Click(object sender, EventArgs e)
        {
            bool number = int.TryParse(txt_Amount.Text, out int n);

            if (number)
            {
                if (txt_Amount.Text != "" && Convert.ToInt32(txt_Amount.Text) > 0)
                {
                    MercaFacil_2DataSetTableAdapters.Detalle_ProductoTableAdapter dpta
                        = new MercaFacil_2DataSetTableAdapters.Detalle_ProductoTableAdapter();

                    MercaFacil_2DataSetTableAdapters.LogTableAdapter lta
                        = new MercaFacil_2DataSetTableAdapters.LogTableAdapter();

                    dpta.Insert(barcode, Convert.ToDateTime(dateTimePicker1.Value.Date), Convert.ToInt32(txt_Amount.Text));

                    lta.Insert("Ingresó fecha vencimiento", "Se registró fecha", System.DateTime.Now, id_user);
                }
            }
        }
        private void btn_Confirm_Click(object sender, EventArgs e)
        {
            try
            {
                MercaFacil_2DataSetTableAdapters.LogTableAdapter logta
                    = new MercaFacil_2DataSetTableAdapters.LogTableAdapter();

                if (txt_NumTel.Text != "")
                {
                    telephone = txt_NumTel.Text;

                    result = MessageBox.Show("¿Desea Agregar el telefono a este Cliente?", "Agregar Teléfono Cliente", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (result == DialogResult.OK)
                    {
                        tatc.Insert(id_Client, telephone);
                        logta.Insert("Se registró un teléfono", "Agregado por el usuario n. " + id_User, System.DateTime.Now, id_User);
                    }
                }

                txt_NumTel.Clear();

                result = MessageBox.Show("¿Desea Agregar otro telefono a este Cliente?", "Agregar Teléfono Cliente", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                if (result == DialogResult.OK)
                {
                    txt_NumTel.ResetText();
                }
                else
                {
                    this.Close();
                }
            }
            catch (Exception error)
            {
                MessageBox.Show("Ha Ocurrido el Siguiente Error: " + error, "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btn_Return_Click(object sender, EventArgs e)
        {
            try
            {
                if (returnList.Count > 0)
                {
                    DialogResult result = MessageBox.Show("Confimar Devolución", "Devolución", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                    if (result == DialogResult.OK)
                    {
                        MercaFacil_2DataSetTableAdapters.LogTableAdapter logta
                            = new MercaFacil_2DataSetTableAdapters.LogTableAdapter();

                        dvta.Insert(nFactura, txt_Description.Text, System.DateTime.Now);

                        logta.Insert("Devolución", "Se creó una devolución", System.DateTime.Now, id_user);

                        result = MessageBox.Show("¿Desea Regresar los productos a la tienda?", "Devolución", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                        if (result == DialogResult.OK)
                        {
                            foreach (ShoppingCart prd in returnList)
                            {
                                pta.IncreStock(prd.Quantity, prd.Product.Barcode);
                                logta.Insert("Se Aumentó Stock", "Debido a una devolución", System.DateTime.Now, id_user);
                            }
                        }

                        int id_return = (int)dvta.MaxId();

                        foreach (ShoppingCart prd in returnList)
                        {
                            ddvta.Insert(prd.Product.Barcode, id_return, prd.Quantity);
                            logta.Insert("Se registró una devolución", "Devolución", System.DateTime.Now, id_user);
                            dfvta.DevolverProducto(nFactura, prd.Product.Barcode);
                            logta.Insert("Se Devolvió un producto", "Devolución", System.DateTime.Now, id_user);
                        }

                        MercaFacil_2DataSet.Detalle_Factura_VentaDataTable detalleFact;

                        detalleFact = dfvta.GetDataByNumFact(nFactura);

                        bool dev = false;

                        foreach (MercaFacil_2DataSet.Detalle_Factura_VentaRow dfvr in detalleFact)
                        {
                            if (dfvr.Devuelto == 1)
                            {
                                dev = true;
                                break;
                            }
                        }

                        if (dev)
                        {
                            fvta.AnotarFactura(nFactura);
                            logta.Insert("Se anotó una factura", "Debido a devolución", System.DateTime.Now, id_user);
                        }

                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Ingrese al Menos un Producto", "Devolución", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                }
            }


            catch (Exception error)
            {
                MessageBox.Show("Ha Ocurrido el Siguiente Error: " + error, "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }