Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("tiendaId,nombre,direccion,telefono")] tienda tienda)
        {
            if (id != tienda.tiendaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tienda);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!tiendaExists(tienda.tiendaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tienda));
        }
Example #2
0
        public ActionResult GetById(int id)
        {
            TiendaDAO dao = new TiendaDAO();
            tienda    c   = dao.GetById(id);

            DireccionDAO daod = new DireccionDAO();
            direccion    d    = daod.GetById(Convert.ToInt32(c.ID_DIRECCION));


            var jsnResult = new
            {
                ID          = c.ID,
                IDD         = d.ID,
                NOMBRE      = c.NOMBRE,
                RESPONSABLE = c.ID_RESPONSABLE,
                CREDITO_FM  = c.CREDITO_FABRICACION_MAX,
                CREDITO_F   = c.CREDITO_FABRICACION,
                CREDITO_C   = c.CREDITO_COMERCIALIZACION,
                CREDITO_CM  = c.CREDITO_COMERCIALIZACION_MAX,
                ACTIVO      = c.ACTIVO,
                CALLE       = d.CALLE,
                NUM_EXT     = d.NUM_EXTERIOR,
                NUM_INT     = d.NUM_INTERIOR,
                CIUDAD      = d.CIUDAD,
                COLONIA     = d.COLONIA,
                MUNICIPIO   = d.MUNICIPIO,
                CP          = d.CP,
                PAIS        = d.ID_PAIS,
                ESTADO      = d.ID_ESTADO,
                Success     = true
            };

            return(Json(jsnResult, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public async Task <IActionResult> Create([Bind("tiendaId,nombre,direccion,telefono")] tienda tienda)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tienda);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tienda));
        }
Example #4
0
        public globalTicket(List <detallesTicket> dt, venta xventa)
        {
            this.xventa   = xventa;
            this.detalles = dt;
            this.codebar  = new cb();
            this.xform    = new Form();
            this.db       = new dbop();
            this.xcliente = this.db.getclientAsobject(this.xventa.idcliente);

            this.xtienda = this.db.getTienda();

            this.myfont = new Font("Lucida Console", 7, FontStyle.Regular);

            this.brush      = new SolidBrush(Color.Black);
            this.marginLeft = 5;
            this.vertical   = 0;
            this.widthDoc   = inchesCM * 100 * 8; // AUTOMATIZAR PARA FORMATOS
            this.heightDoc  = 0;
            this.setAttribs(dt.Count);

            this.nombretienda   = this.xtienda.nombre.ToUpper();
            this.rfc            = "RFC " + this.xtienda.rfc;
            this.direccion      = this.xtienda.calle.ToUpper() + " #" + this.xtienda.numero.ToString().ToUpper();
            this.colonia        = "COL. " + this.xtienda.colonia.ToUpper();
            this.ciudad         = (this.xtienda.ciudad + "," + this.xtienda.estado).ToUpper();
            this.telefono       = "TEL. " + this.xtienda.telefono.ToUpper();
            this.fecha          = ">>FECHA: " + this.xventa.fecha.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture) + " >>HORA: " + this.xventa.hora.ToString();
            this.numticket      = ">>TICKET #: " + this.db.getticketid(this.xventa.idventa).ToString();
            this.clientename    = ">>CLIENTE: " + this.xcliente.nombre.ToUpper();
            this.subtotalletra  = "SUBTOTAL $";
            this.subtotal       = this.xventa.subtotal.ToString("F1").Replace(",", ".");
            this.totalletra     = "TOTAL $";
            this.total          = this.xventa.total.ToString("F2").Replace(",", ".");
            this.descuentoletra = "DESCUENTO $";
            this.descuento      = this.xventa.descuentoextra.ToString("F1").Replace(",", ".");

            this.ivaletra = "IVA $";
            this.iva      = (this.xventa.subtotal / 100 * 16).ToString("F1").Replace(",", ".");

            this.precioletra = "PROXIMAMENTE";
            this.leyenda     = "¡Gracias por su compra!";

            this.cantidad   = "Cant.";
            this.producto   = "Producto";
            this.preciounit = "P.Unit";
            this.importe    = "Importe";

            this.xconvierte  = new convierte();
            this.xtotalletra = this.xconvierte.getstring(this.xventa.total).ToUpper() + "MN.";
        }
Example #5
0
        public tienda GetById(int id, ArtexConnection dbContext = null)
        {
            tienda consulta = null;

            try
            {
                dbContext = dbContext != null ? dbContext : new ArtexConnection();

                consulta = dbContext.tienda.Where(e => e.ID == id).FirstOrDefault();
            }
            catch (Exception e)
            {
            }

            return(consulta);
        }
        public printTicket(venta xventa, tienda xtienda)
        {
            this.xtienda   = xtienda;
            this.xventa    = xventa;
            this.db        = new dbop();
            this.reporte   = new rptticket();
            this.translate = new convierte();
            this.codbar    = new cb();

            this.xcliente = this.db.getclientAsobject(this.xventa.idcliente);

            this.pathcbar = Path.Combine(genericDefinitions.TICKETLOGOSPATH + @"\logocbar.png");
            this.pathlogo = Path.Combine(genericDefinitions.TICKETLOGOSPATH + @"\logotienda.png");

            this.widthcbar  = (int)(widthcbar * 50 / 2.54);
            this.heightcbar = (int)(heightcbar * 50 / 2.54);
        }
        private void update()
        {
            if (this.flag)
            {
                tienda send = new tienda();

                try
                {
                    send.calle       = this.txtcalle.Text;
                    send.ciudad      = this.txtciudad.Text;
                    send.colonia     = this.txtcolonia.Text;
                    send.cp          = this.txtcp.Text;
                    send.estado      = this.txtestado.Text;
                    send.logotienda  = imageOperations.getbytefromimage((Bitmap)this.pboximagen.BackgroundImage);
                    send.nombre      = this.txtnombre.Text;
                    send.numero      = int.Parse(this.txtnumero.Text);
                    send.pais        = this.txtpais.Text;
                    send.razonsocial = this.txtrazonsocial.Text;
                    send.rfc         = this.txtrfc.Text;
                    send.telefono    = this.txttelefono.Text;
                    send.idtienda    = this.xtienda.idtienda;
                }
                catch (Exception ex)
                {
                    genericDefinitions.error("Ingrese Datos Validos....\n" + ex.ToString());
                    return;
                }

                if (this.db.updateTienda(send))
                {
                    genericDefinitions.ok("Datos Actualizados");
                    this.xtienda = this.db.getTienda();
                    this.showinitialVals();
                    this.txtnombre.Focus();
                }
                else
                {
                    genericDefinitions.error("Ha ocurrido un error!");
                    this.showinitialVals();
                }
            }
            else
            {
                genericDefinitions.dangerInfo("Datos iguales!");
            }
        }
Example #8
0
        public int agregarTienda(tienda td)
        {
            using (contextData cdt = new contextData())
            {
                cdt.Configuration.LazyLoadingEnabled = false;

                try
                {
                    cdt.tienda.Add(td);
                    cdt.SaveChanges();
                    return(td.id);
                }
                catch (Exception ex)
                {
                    string mensaje = "";
                    Log.Error(ex, System.Reflection.MethodBase.GetCurrentMethod(), ref mensaje);
                    throw;
                }
            }
        }
Example #9
0
 public int agregarTienda(tienda td)
 {
     return(rt.agregarTienda(td));
 }
        private void global_settings()
        {
            InitializeComponent();
            this.FormClosed      += (sender, args) => { this.source.tienda = null; };
            this.txtrfc.MaxLength = 13;
            this.txtcp.MaxLength  = 5;

            behaviorDefinitions.txtOnlyNumbers(ref this.txtnumero);
            behaviorDefinitions.txtOnlyNumbers(ref this.txtcp);
            behaviorDefinitions.txtOnlyNumbers(ref this.txttelefono);

            this.Text = "Tienda";

            this.txtnombre.TextChanged             += (sender, args) => { this.flag = true; };
            this.btnloadimage.TextChanged          += (sender, args) => { this.flag = true; };
            this.txtcalle.TextChanged              += (sender, args) => { this.flag = true; };
            this.txtnumero.TextChanged             += (sender, args) => { this.flag = true; };
            this.txtcolonia.TextChanged            += (sender, args) => { this.flag = true; };
            this.txtcp.TextChanged                 += (sender, args) => { this.flag = true; };
            this.txtciudad.TextChanged             += (sender, args) => { this.flag = true; };
            this.txtestado.TextChanged             += (sender, args) => { this.flag = true; };
            this.txtpais.TextChanged               += (sender, args) => { this.flag = true; };
            this.txttelefono.TextChanged           += (sender, args) => { this.flag = true; };
            this.txtrazonsocial.TextChanged        += (sender, args) => { this.flag = true; };
            this.txtrfc.TextChanged                += (sender, args) => { this.flag = true; };
            this.pboximagen.BackgroundImageChanged += (sender, args) => { this.flag = true; };


            this.txtnombre.KeyPress += (a, b) => { if (b.KeyChar == (char)Keys.Enter)
                                                   {
                                                       this.btnloadimage.Focus();
                                                   }
            };
            this.btnloadimage.PreviewKeyDown += (a, b) => { this.txtcalle.Focus(); };
            this.txtcalle.KeyPress           += (a, b) => { if (b.KeyChar == (char)Keys.Enter)
                                                            {
                                                                this.txtnumero.Focus();
                                                            }
            };
            this.txtnumero.KeyPress += (a, b) => { if (b.KeyChar == (char)Keys.Enter)
                                                   {
                                                       this.txtcolonia.Focus();
                                                   }
            };
            this.txtcolonia.KeyPress += (a, b) => { if (b.KeyChar == (char)Keys.Enter)
                                                    {
                                                        this.txtcp.Focus();
                                                    }
            };
            this.txtcp.KeyPress += (a, b) => { if (b.KeyChar == (char)Keys.Enter)
                                               {
                                                   this.txtciudad.Focus();
                                               }
            };
            this.txtciudad.KeyPress += (a, b) => { if (b.KeyChar == (char)Keys.Enter)
                                                   {
                                                       this.txtestado.Focus();
                                                   }
            };
            this.txtestado.KeyPress += (a, b) => { if (b.KeyChar == (char)Keys.Enter)
                                                   {
                                                       this.txtpais.Focus();
                                                   }
            };
            this.txtpais.KeyPress += (a, b) => { if (b.KeyChar == (char)Keys.Enter)
                                                 {
                                                     this.txttelefono.Focus();
                                                 }
            };
            this.txttelefono.KeyPress += (a, b) => { if (b.KeyChar == (char)Keys.Enter)
                                                     {
                                                         this.txtrazonsocial.Focus();
                                                     }
            };
            this.txtrazonsocial.KeyPress += (a, b) => { if (b.KeyChar == (char)Keys.Enter)
                                                        {
                                                            this.txtrfc.Focus();
                                                        }
            };
            this.txtrfc.KeyPress += (a, b) => { if (b.KeyChar == (char)Keys.Enter)
                                                {
                                                    this.txtnombre.Focus();
                                                }
            };

            this.db = new dbop();

            this.xtienda = this.db.getTienda();


            this.leyenda = "Sin Asignar";

            this.ofd = new OpenFileDialog()
            {
                Title            = "Guardar Documento",
                Filter           = "Image files (*.jpg, *.jpeg, *.png) | *.jpg; *.jpeg; *.png",
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                CheckFileExists  = true,
                CheckPathExists  = true,
                RestoreDirectory = true
            };
        }
Example #11
0
        public JsonResult Guardar(TiendaModel model)
        {
            var rm = new ResponseModel();

            if (!ModelState.IsValid)
            {
                rm.message  = "Hubo un problema verifique sus datos e intente de nuevo.";
                rm.message += ExtensionMethods.GetAllErrorsFromModelState(this);
                return(Json(rm, JsonRequestBehavior.AllowGet));
            }
            using (ArtexConnection db = new ArtexConnection())
            {
                TiendaDAO dao    = new TiendaDAO();
                var       entity = dao.GetById(model.Id, db);

                /* DireccionDAO dir = new DireccionDAO();
                 * var entityD = dir.GetById(Convert.ToInt32(entity.ID_DIRECCION), db);*/

                if (entity == null)
                {
                    entity                              = new tienda();
                    entity.direccion                    = new direccion();
                    entity.NOMBRE                       = model.Nombre;
                    entity.ID_RESPONSABLE               = model.Responsable;
                    entity.CREDITO_FABRICACION_MAX      = model.Credito_FM;
                    entity.CREDITO_FABRICACION          = model.Credito_F;
                    entity.CREDITO_COMERCIALIZACION_MAX = model.Credito_CM;
                    entity.CREDITO_COMERCIALIZACION     = model.Credito_C;
                    entity.ACTIVO                       = model.Activo;
                    entity.direccion.CALLE              = model.Calle;
                    entity.direccion.NUM_EXTERIOR       = model.Num_Ext;
                    entity.direccion.NUM_INTERIOR       = model.Num_Int;
                    entity.direccion.COLONIA            = model.Colonia;
                    entity.direccion.CIUDAD             = model.Ciudad;
                    entity.direccion.MUNICIPIO          = model.Municipio;
                    entity.direccion.CP                 = model.CP;
                    entity.direccion.ID_PAIS            = model.Pais;
                    entity.direccion.ID_ESTADO          = model.Estado;

                    db.tienda.Add(entity);
                }
                else
                {
                    entity.direccion.CALLE        = model.Calle;
                    entity.direccion.NUM_EXTERIOR = model.Num_Ext;
                    entity.direccion.NUM_INTERIOR = model.Num_Int;
                    entity.direccion.COLONIA      = model.Colonia;
                    entity.direccion.CIUDAD       = model.Ciudad;
                    entity.direccion.MUNICIPIO    = model.Municipio;
                    entity.direccion.CP           = model.CP;
                    entity.direccion.ID_PAIS      = model.Pais;
                    entity.direccion.ID_ESTADO    = model.Estado;
                    entity.NOMBRE                       = model.Nombre;
                    entity.ID_RESPONSABLE               = model.Responsable;
                    entity.CREDITO_FABRICACION_MAX      = model.Credito_FM;
                    entity.CREDITO_FABRICACION          = model.Credito_F;
                    entity.CREDITO_COMERCIALIZACION_MAX = model.Credito_CM;
                    entity.CREDITO_COMERCIALIZACION     = model.Credito_C;
                    entity.ACTIVO                       = model.Activo;
                }

                if (db.SaveChanges() > 0 || db.Entry(entity).State == EntityState.Unchanged)
                {
                    rm.response = true;
                    rm.message  = "Sus datos se guardaron correctamente";
                    rm.function = "reload(true,'" + rm.message + "')";
                }
            }
            return(Json(rm, JsonRequestBehavior.AllowGet));
        }