예제 #1
0
        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);
        }
예제 #2
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);
        }
예제 #3
0
        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);
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
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);
        }
예제 #7
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);
        }
예제 #8
0
        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);
        }
예제 #9
0
        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);
        }
예제 #10
0
        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);
        }
예제 #11
0
        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);
        }
예제 #12
0
        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);
        }
예제 #13
0
        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);
        }
예제 #14
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);
        }
예제 #15
0
        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);
        }
예제 #16
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);
        }
예제 #17
0
        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 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);
        }
예제 #19
0
        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);
        }
예제 #20
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);
        }
예제 #21
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);
        }
예제 #22
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);
        }
예제 #23
0
        public int GuardarEstado(Ca_Estado edo)
        {
            int val = 0;

            try
            {
                using (ClusmextContext context = new ClusmextContext())
                {
                    if (edo.Id_Estado > 0)
                    {
                        context.Entry(edo).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(edo).State = EntityState.Added;
                    }
                    val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(val);
        }
예제 #24
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);
        }
예제 #25
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);
        }
예제 #26
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);
        }
예제 #27
0
        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);
        }
예제 #28
0
        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);
        }
예제 #29
0
        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);
        }
예제 #30
0
        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);
        }