示例#1
0
        private void FrmCadastrarBazar_Load(object sender, EventArgs e)
        {
            var form = "Bazar";

            if (CondicaoAtualizar)
            {
                this.Text = "Atualizar registro - " + form;
            }
            if (CondicaoDeletar)
            {
                this.Text = "Deletar registro - " + form;
            }
            if (CondicaoDetalhes)
            {
                this.Text = "Detalhes registro - " + form;
            }
            if (!CondicaoDeletar && !CondicaoAtualizar && !CondicaoDetalhes)
            {
                this.Text = "Cadastro - " + form;
            }

            Bazar a = (Bazar)modelo;

            try{ txtValor.Text = a.Valor.ToString(); } catch (Exception ex) { MessageBox.Show(modelo.exibirMensagemErro(ex, 2)); }
            try { checkBoxPagou.Checked = a.Pago; } catch (Exception ex)  { MessageBox.Show(modelo.exibirMensagemErro(ex, 2)); }
        }
示例#2
0
        private void txtValor_TextChanged(object sender, EventArgs e)
        {
            Bazar a = (Bazar)modelo;

            try { a.Validar(txtValor.Text, "Valor"); }
            catch (Exception ex) { MessageBox.Show(modelo.exibirMensagemErro(ex, 2)); }
        }
示例#3
0
        public int insertRequest1(Bazar bazar)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "INSERT INTO vmmRequestChart VALUES ('" + bazar.userName + "','" + bazar.date + "'," + book.breakfast + "," + book.lunch + "," + book.dinner + ",'" + bazar.items + "','" + bazar.quantity + "'," + bazar.amount + ")";
            return(db.ExeNonQuery(cmd));
        }
示例#4
0
        public void DeleteInfoEB(Bazar ba)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "Delete from vmmBazarChart where UserId='" + ba.id + "'and Date='" + ba.date + "'";
            db.DeleteExeReader(cmd);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Bazar bazar = db.Bazars.Find(id);

            db.Bazars.Remove(bazar);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#6
0
        public int insertBazar(Bazar bazar)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "INSERT INTO vmmBazarChart VALUES (" + bazar.userID + ",'" + bazar.date + "','" + bazar.userName + "','" + bazar.items + "','" + bazar.quantity + "'," + bazar.amount + ",'" + bazar.refManager + "')";
            return(db.ExeNonQuery(cmd));
        }
示例#7
0
        public int UpdateBazar(Bazar ba)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "UPDATE vmmBazarChart set Quantity= '" + ba.quantity + "',Price=" + ba.amount + " where UserId='" + ba.id + "' and Date='" + ba.date + "' and Items='" + ba.items + "'";
            return(db.ExeNonQuery(cmd));
        }
 public ActionResult Edit([Bind(Include = "Id,Date,Name,Amount")] Bazar bazar)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bazar).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(bazar));
 }
示例#9
0
        private void txt_numero_id_TextChanged(object sender, EventArgs e)
        {
            Bazar a = (Bazar)modelo;

            try
            {
                a.Pessoa_ = int.Parse(txt_numero_id.Text);
            }
            catch { MessageBox.Show("Informe um numero de identificação do comprador."); }
        }
        public ActionResult Create([Bind(Include = "Id,Date,Name,Amount")] Bazar bazar)
        {
            if (ModelState.IsValid)
            {
                db.Bazars.Add(bazar);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(bazar));
        }
示例#11
0
        public void SeedBazarData()
        {
            Bazar bazar = new Bazar
            {
                Name    = "چراغ برق",
                Address = "میدان بهارستان - خیابان اکباتان"
            };

            _context.Bazar.Add(bazar);
            _context.SaveChanges();
        }
示例#12
0
        private void checkBoxPagou_CheckedChanged(object sender, EventArgs e)
        {
            Bazar a = (Bazar)modelo;

            if (checkBoxPagou.Checked)
            {
                a.Pago = true;
            }
            else
            {
                a.Pago = false;
            }
        }
示例#13
0
        public async Task <IActionResult> Add(BazarToAdd bazarToAdd)
        {
            Bazar personel = _mapper.Map <Bazar>(bazarToAdd);

            _repo.Add(personel);

            if (await _repo.SaveAllAsync())
            {
                return(NoContent());
            }

            throw new Exception($"افزودن با مشکل مواجه شد");
        }
        // GET: Bazars/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Bazar bazar = db.Bazars.Find(id);

            if (bazar == null)
            {
                return(HttpNotFound());
            }
            return(View(bazar));
        }
示例#15
0
        /// <summary>
        /// Chequea datos del formulario
        /// Genera el atributo venta con todos los datos y la lista de productos a partir de la grilla
        /// </summary>
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtFactura.Text) ||
                string.IsNullOrWhiteSpace(txtCliente.Text) ||
                cmbCajas.SelectedIndex == -1 ||
                dtProductosVenta.Rows.Count == 0)
            {
                MessageBox.Show("Por favor complete todos los datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                this.venta    = new Venta <Producto>();
                venta.factura = int.Parse(txtFactura.Text);
                venta.cliente = txtCliente.Text;
                venta.caja    = (ECaja)Enum.Parse(typeof(ECaja), cmbCajas.SelectedIndex.ToString());

                foreach (DataRow item in dtProductosVenta.Rows)
                {
                    int       id     = int.Parse(item["Id"].ToString());
                    string    nombre = item["Nombre"].ToString();
                    string    marca  = item["Marca"].ToString();
                    double    precio = double.Parse(item["PrecioUnitario"].ToString());
                    string    tipo   = item["Tipo"].ToString();
                    EMaterial material;
                    DateTime  vencimiento;
                    if (tipo == "Congelado")
                    {
                        vencimiento = DateTime.Parse(item["FechaVencimiento"].ToString());
                        Congelado c = new Congelado(id, nombre, marca, precio, vencimiento);
                        venta += c;
                    }
                    else
                    {
                        material = (EMaterial)Enum.Parse(typeof(EMaterial), item["Material"].ToString());
                        Bazar b = new Bazar(id, nombre, marca, precio, material);
                        venta += b;
                    }
                }

                this.Close();
            }
        }
示例#16
0
        static void Main(string[] args)
        {
            Congelado c1 = new Congelado(1, "Espinaca", "Carrefour", 50, DateTime.Now.AddDays(30));
            Congelado c2 = new Congelado(2, "Hamburguesas", "Paty", 150.50, DateTime.Now.AddDays(10));
            Congelado c3 = new Congelado(3, "Espinaca", "Carrefour", 50, DateTime.Now.AddDays(20));

            Bazar b1 = new Bazar(4, "Balde", "Colombraro", 300, EMaterial.Plastico);
            Bazar b2 = new Bazar(5, "Jarra", "Luxury", 122.35, EMaterial.Vidrio);
            Bazar b3 = new Bazar(6, "Silla", "Maderera San Juan", 1500, EMaterial.Madera);

            Comercio c = new Comercio();

            try
            {
                Venta <Producto> v1 = new Venta <Producto>(1, "Juan Perez", ECaja.CajaUno);
                v1.CambioEstado += venta_EventoCambioEstado;
                v1 += c1;
                v1 += b1;

                Console.WriteLine("Nueva venta: \n{0}", v1.ToString());
                c += v1;

                Venta <Producto> v2 = new Venta <Producto>(2, "Jorge Rojas", ECaja.CajaDos);
                v2.CambioEstado += venta_EventoCambioEstado;
                v2 += c2;
                v2 += c3;

                Console.WriteLine("Nueva venta: \n{0}", v2.ToString());
                c += v2;

                Venta <Producto> v3 = new Venta <Producto>(1, "Pedro Gonzales", ECaja.CajaTres);
                v3.CambioEstado += venta_EventoCambioEstado;
                v3 += b2;
                v3 += b3;

                Console.WriteLine("Nueva venta: \n{0}", v3.ToString());
                c += v3;
            }
            catch (FacturaRepetidaException ex)
            {
                Console.WriteLine(ex.Message);
            }

            System.Threading.Thread.Sleep(11000);
            Console.WriteLine("Presione una tecla para continuar ...");
            Console.ReadKey();

            Console.Clear();
            Console.WriteLine(c.ToString());
            Console.WriteLine("Presione una tecla para continuar ...");
            Console.ReadKey();

            Console.Clear();
            Exportador <List <Venta <Producto> > > exp = new Exportador <List <Venta <Producto> > >();
            string archivo = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\ventas.xml";

            try
            {
                exp.Exportar(archivo, c.Ventas);
                Console.WriteLine("Se ha exportado los datos de ventas al archivo '{0}'", archivo);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine("Fin del test. Presione una tecla para terminar ...");
            Console.ReadKey();
        }
示例#17
0
        private void mask_data_recebimento_MaskInputRejected(object sender, MaskInputRejectedEventArgs e)
        {
            Bazar a = (Bazar)modelo;

            a.Validar(mask_data_recebimento.Text, "DataRecebimento");
        }