Exemplo n.º 1
0
        public static bool updateTicket(Tickets Model)
        {
            bool result;

            using (HelpDeskApfEntities context = new HelpDeskApfEntities())
            {
                var ticket = context.TICKETS.FirstOrDefault(t => t.Id == Model.Id);
                try
                {
                    ticket.IssueId = Model.IssueId;
                    ticket.DestinationDivisionId = Model.DestinationDivisionId;
                    ticket.OrganizacionId        = Model.OrganizacionId;
                    ticket.RequestDepartamentId  = Model.RequestDepartamentId;
                    ticket.UserAssigned          = Model.UserAssigned;
                    ticket.UserRequestId         = Model.UserRequestId;
                    ticket.Titulo             = Model.Titulo;
                    ticket.Descripcion        = Model.Descripcion;
                    ticket.Fecha_Modificacion = DateTime.Now;

                    context.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    result = false;
                }
            }

            return(result);
        }
        public static bool Save(Usuarios_Seguidos model)
        {
            bool result;

            using (HelpDeskApfEntities context = new HelpDeskApfEntities())
            {
                try
                {
                    context.USUARIOS_SEGUIDOS.Add(model.ToTable());
                    context.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    result = false;
                }
            }

            return(result);
        }
Exemplo n.º 3
0
        public static bool Save(Preguntas model)
        {
            bool result;

            using (HelpDeskApfEntities context = new HelpDeskApfEntities())
            {
                try
                {
                    context.PREGUNTAS.Add(model.ToTable());
                    context.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    result = false;
                }
            }

            return(result);
        }
Exemplo n.º 4
0
        public static bool Save(Division model)
        {
            bool result;

            using (HelpDeskApfEntities context = new HelpDeskApfEntities())
            {
                try
                {
                    context.DIVISION.Add(model.ToTable());
                    context.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    result = false;
                }
            }

            return(result);
        }
        public static bool Save(User_Groups model)
        {
            bool result;

            using (HelpDeskApfEntities context = new HelpDeskApfEntities())
            {
                try
                {
                    context.USER_GROUPS.Add(model.ToTable());
                    context.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    result = false;
                }
            }

            return(result);
        }
Exemplo n.º 6
0
        public static bool Save(Tickets_Respuesta model)
        {
            bool result;

            using (HelpDeskApfEntities context = new HelpDeskApfEntities())
            {
                try
                {
                    context.TICKETS_RESPUESTA.Add(model.ToTable());
                    context.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    result = false;
                }
            }

            return(result);
        }
        public static bool Save(User_Followed_User model)
        {
            bool result;

            using (HelpDeskApfEntities context = new HelpDeskApfEntities())
            {
                try
                {
                    context.USER_FOLLOWED_USER.Add(model.ToTable());
                    context.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    result = false;
                }
            }

            return(result);
        }
        public static bool Save(Departamentos model)
        {
            bool result;

            using (HelpDeskApfEntities context = new HelpDeskApfEntities())
            {
                try
                {
                    context.DEPARTAMENTOS.Add(model.ToTable());
                    context.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    result = false;
                }
            }

            return(result);
        }
        public static bool Save(Issues Model)
        {
            bool result = false;

            using (HelpDeskApfEntities context = new HelpDeskApfEntities())
            {
                context.ISSUES.Add(Model.ToTable());

                try
                {
                    context.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    result = false;
                }
            }

            return(result);
        }
Exemplo n.º 10
0
        public static bool Save(Usuarios model)
        {
            bool result;
            bool modelIsNull = UtilsHelperGeneric <Usuarios> .modelIsNull(model);

            using (HelpDeskApfEntities context = new HelpDeskApfEntities())
            {
                try
                {
                    context.USUARIOS.Add(model.ToTable());
                    context.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    result = false;
                }
            }

            return(result);
        }
Exemplo n.º 11
0
        public static bool Save(Organizacion Model)
        {
            bool result = false;

            using (HelpDeskApfEntities context = new HelpDeskApfEntities())
            {
                context.ORGANIZACION.Add(Model.ToTable());

                try
                {
                    context.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    result = false;
                }
            }

            return(result);
        }
        //Todo: Get de Los usuarios seguidos por un usuario
        public static bool Delete(Usuarios_Seguidos rel)
        {
            bool result;

            using (var db = new HelpDeskApfEntities())
            {
                var rs = db.USUARIOS_SEGUIDOS.Where(x => x.UserId == rel.UserFollowedId).ToList();
                foreach (var i in rs)
                {
                    db.USUARIOS_SEGUIDOS.Remove(i);
                }
                try
                {
                    db.SaveChanges();
                    result = true;
                }
                catch (Exception ex)
                {
                    result = false;
                }
            }
            return(result);
        }
Exemplo n.º 13
0
        public static bool CloseTicket(Tickets Model)
        {
            bool result;

            using (HelpDeskApfEntities context = new HelpDeskApfEntities())
            {
                var ticket = context.TICKETS.FirstOrDefault(t => t.Id == Model.Id);
                try
                {
                    ticket.Fecha_Modificacion = DateTime.Now;
                    ticket.Fecha_Correcion    = DateTime.Now;
                    ticket.Estatus            = ((int)ESTATUS.RESUELTA);

                    context.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    result = false;
                }
            }

            return(result);
        }