public int InsertConcepto(TrvRepConceptos concepto)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (concepto.IdTrvRepConceptos > 0)
                    {
                        context.Entry(concepto).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(concepto).State = EntityState.Added;
                    }

                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
Exemple #2
0
        public int Guardar(Ca_Bancos item)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (item.Id_Banco > 0)
                    {
                        context.Entry(item).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(item).State = EntityState.Added;
                    }

                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
        public int InsertManual(Manuales m, out int newID)
        {
            int val = 0;

            newID = 0;
            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (m.IdManual > 0)
                    {
                        context.Entry(m).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(m).State = EntityState.Added;
                    }

                    val = context.SaveChanges();
                    if (val != 0)
                    {
                        newID = m.IdManual;
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
        public int CreateEditList(InvListaPedidos list, out int newID)
        {
            int count = 0;

            newID = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (list.IdListaPedido > 0)
                    {
                        context.Entry(list).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(list).State = EntityState.Added;
                    }

                    count = context.SaveChanges();
                    newID = list.IdListaPedido;
                }
            }
            catch (Exception ex)
            {
            }

            return(count);
        }
        public int InsertComment(TaksComentarios comment)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (comment.IdTaksComentario > 0)
                    {
                        context.Entry(comment).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(comment).State = EntityState.Added;
                    }

                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
        public int GuardarConcepto(Conceptos item)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (item.Id_Conceptos > 0)
                    {
                        item = context.Conceptos.Where(x => x.Id_Conceptos == item.Id_Conceptos).SingleOrDefault();
                        context.Entry(item).State = EntityState.Deleted;
                    }
                    else
                    {
                        context.Entry(item).State = EntityState.Added;
                    }
                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
        public int InsertRequest(TrvReq req)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (req.IdTrvReq > 0)
                    {
                        context.Entry(req).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(req).State = EntityState.Added;
                    }

                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
        public int UpdateNewsFeed(NewsFeed i)
        {
            int val   = 0;
            int newID = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (i.IdItem > 0)
                    {
                        context.Entry(i).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(i).State = EntityState.Added;
                    }

                    val   = context.SaveChanges();
                    newID = i.IdItem;
                }
            }
            catch (Exception ex)
            {
            }

            return(newID);
        }
Exemple #9
0
        public int ClearNotification(Notifications n)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (n.IdNotification > 0)
                    {
                        context.Entry(n).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(n).State = EntityState.Added;
                    }

                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
        public int InsertTicket(TaksAdmon ticket, out int newID)
        {
            int val = 0;

            newID = 0;
            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (ticket.IdTaks > 0)
                    {
                        context.Entry(ticket).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(ticket).State = EntityState.Added;
                    }

                    val = context.SaveChanges();
                    if (val != 0)
                    {
                        newID = ticket.IdTaks;
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
Exemple #11
0
        public int Guardarclabe(Ca_Clabe item)
        {
            int Val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (item.Id_Clabe > 0)
                    {
                        context.Entry(item).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(item).State = EntityState.Added;
                    }
                    Val = context.SaveChanges();
                    if (Val == 1)
                    {
                        Re_Bancos_Empresa re = new Re_Bancos_Empresa();
                        re.Id_Empresa = item.Id_Empresa;
                        re.Id_Banco   = item.Id_Banco;
                        re.F_Alta     = DateTime.Now;
                        re.Creado_por = item.Creado_por;
                        re.Activo     = true;
                        Val           = GuardarRelacion(re);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(Val);
        }
Exemple #12
0
        public int Guardar(CA_Areas areas)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (areas.Id_CA_Area > 0)
                    {
                        context.Entry(areas).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(areas).State = EntityState.Added;
                    }

                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
Exemple #13
0
        public int InsertServicio(Servicios s)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (s.IdServicios > 0)
                    {
                        context.Entry(s).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(s).State = EntityState.Added;
                    }

                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
Exemple #14
0
        public int InsertAF(Activo_Fijo af)
        {
            int newID = 0;
            int val   = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (af.Id_Activo > 0)
                    {
                        context.Entry(af).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(af).State = EntityState.Added;
                    }

                    val   = context.SaveChanges();
                    newID = af.Id_Activo;
                }
            }
            catch (Exception ex)
            {
            }
            return(newID);
        }
        public int InsertItem(InvInventario i, out int newID)
        {
            int val = 0;

            newID = -1;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (i.IdInventario > 0)
                    {
                        context.Entry(i).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(i).State = EntityState.Added;
                    }

                    val = context.SaveChanges();

                    newID = i.IdInventario;
                }
            }
            catch (Exception ex)
            {
            }

            return(val);
        }
Exemple #16
0
        public int InsertAndGetNotification(Notifications notification, out int newID)
        {
            int val = 0;

            newID = 0;
            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (notification.IdNotification > 0)
                    {
                        context.Entry(notification).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(notification).State = EntityState.Added;
                    }

                    val = context.SaveChanges();
                    if (val != 0)
                    {
                        newID = notification.IdNotification;
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
Exemple #17
0
        public int GuardarCompleto(Pagos Item)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext()) {
                    context.Entry(Item).State = EntityState.Modified;
                    val = context.SaveChanges();
                }
            }
            catch (Exception ex) {
            }
            return(val);
        }
Exemple #18
0
        public int GuardarRelacion(Re_Bancos_Empresa items)
        {
            int Val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext()) {
                    context.Entry(items).State = EntityState.Added;
                    Val = context.SaveChanges();
                }
            }
            catch (Exception ex) {
            }
            return(Val);
        }
        public int DeleteConcepto(TrvRepConceptos concepto)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    context.Entry(concepto).State = EntityState.Deleted;
                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
        public int ChangeStatus(TaksAdmon ticket)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    context.Entry(ticket).State = EntityState.Modified;
                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
        public int RemoveFromList(InvSolicitud item)
        {
            int count = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    context.Entry(item).State = EntityState.Deleted;
                    count = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(count);
        }
        public int InsertPedido(InvSolicitud s)
        {
            int           count  = 0;
            int           itemID = 0;
            InvInventario item   = new InvInventario();

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (s.IdSolicitud > 0)
                    {
                        context.Entry(s).State = EntityState.Modified;
                        //Si algún pedido se entregó, modificamos la cantidad en inventario
                        if (s.Entregado.Value)
                        {
                            item = GetItem(s.IdInventario);
                            item.EnExistencia -= s.Cantidad;
                            item.Dispobibles   = item.EnExistencia;
                            InsertItem(item, out itemID);
                        }
                        else
                        {
                            item = GetItem(s.IdInventario);
                            item.EnExistencia += s.Cantidad;
                            item.Dispobibles   = item.EnExistencia;
                            InsertItem(item, out itemID);
                        }
                    }
                    else
                    {
                        context.Entry(s).State = EntityState.Added;
                    }

                    count = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }

            return(count);
        }
        public int Eliminar(int id)
        {
            int Val = 0;
            Re_Proveedores_Empresa param;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    param = context.Re_Proveedores_Empresa.Where(x => x.Id_Proveedores_Empresa == id).SingleOrDefault();
                    context.Entry(param).State = EntityState.Deleted;
                    Val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(Val);
        }
        public int Guardar(Re_Usuario_Empresa item)
        {
            int Val = 0;

            try {
                using (ClusmextContext context = new ClusmextContext()) {
                    if (item.Id_Re_Usuario_Empresas > 0)
                    {
                        context.Entry(item).State = EntityState.Deleted;
                    }
                    else
                    {
                        context.Entry(item).State = EntityState.Added;
                    }
                    Val = context.SaveChanges();
                }
            }
            catch (Exception ex) {
            }
            return(Val);
        }
Exemple #25
0
        public int Guardar(Proyectos Item)
        {
            int Val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext()) {
                    if (Item.Id_Proyecto > 0)
                    {
                        context.Entry(Item).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(Item).State = EntityState.Added;
                    }
                    Val = context.SaveChanges();
                }
            }
            catch (Exception ex) {
            }
            return(Val);
        }
Exemple #26
0
        public int Guardar(CaTipoREjecucion item)
        {
            int Val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext()) {
                    if (item.IdTipoREjecucion > 0)
                    {
                        context.Entry(item).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(item).State = EntityState.Added;
                    }
                    Val = context.SaveChanges();
                }
            }
            catch (Exception ex) {
            }
            return(Val);
        }
        public int Guardar(Ca_Categoria categoria)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext()) {
                    if (categoria.Id_Categoria > 0)
                    {
                        context.Entry(categoria).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(categoria).State = EntityState.Added;
                    }
                    val = context.SaveChanges();
                }
            }
            catch (Exception ex) {
            }
            return(val);
        }
Exemple #28
0
        public int Guardar(Usuarios items)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (items.Id_Usuario > 0)
                    {
                        context.Entry(items).State = System.Data.Entity.EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(items).State = System.Data.Entity.EntityState.Added;
                    }
                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
Exemple #29
0
        public int GuardarRubro(Ca_Rubros rb)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (rb.Id_Rubro > 0)
                    {
                        context.Entry(rb).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(rb).State = EntityState.Added;
                    }
                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
        public int Guardar(Ca_Tipo_Servicio serv)
        {
            int Val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (serv.Id_tipo_servicio > 0)
                    {
                        context.Entry(serv).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(serv).State = EntityState.Added;
                    }
                    Val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(Val);
        }