Esempio n. 1
0
        public UserBE SearchIdUser(int SEARIDUSE)
        {
            EmploActiEntities BDEA = new EmploActiEntities();
            UserBE            idus = new UserBE();

            try
            {
                idus = (from User in BDEA.User
                        where User.IdUser == SEARIDUSE
                        select new UserBE
                {
                    IdUser = User.IdUser,
                    NameUser = User.NameUser,
                    Password = User.Password
                }).FirstOrDefault();
            }
            catch (Exception EX)
            {
            }
            finally
            {
                BDEA.Dispose();
            }
            return(idus);
        }
Esempio n. 2
0
        public AnswerResponseBE ValidatioUserPassword(string USERNAME, string PASSWORD)
        {
            AnswerResponseBE  AR   = new AnswerResponseBE();
            EmploActiEntities BDEA = new EmploActiEntities();

            try
            {
                User user = new User();
                user = BDEA.User.Where(x => x.NameUser == USERNAME && x.Password == PASSWORD).FirstOrDefault();
                if (user != null)
                {
                    AR.CodeError        = 0;
                    AR.DescriptionError = "Usuario correcto";
                }
                else
                {
                    AR.CodeError        = 2;
                    AR.DescriptionError = "Usuario y contraseña incorrecta, favor verifique la información";
                }
            }
            catch (Exception EX)
            {
                AR.CodeError        = 1;
                AR.DescriptionError = "Hubo un error";
            }
            finally
            {
                BDEA.Dispose();
            }
            return(AR);
        }
Esempio n. 3
0
        public AnswerResponseBE UpdateActivities(ActivitiesBE UPACTI)
        {
            AnswerResponseBE  AR   = new AnswerResponseBE();
            EmploActiEntities BDEA = new EmploActiEntities();

            try
            {
                Activities activities = new Activities();
                activities = BDEA.Activities.Where(x => x.ActivitiesCode == UPACTI.ActivitiesCode).FirstOrDefault();
                if (activities != null)
                {
                    activities.NameActivities = UPACTI.NameActivities;

                    BDEA.SaveChanges();

                    AR.CodeError        = 0;
                    AR.DescriptionError = "Se ha actualizado la actividad correctamente";
                }
                else
                {
                    AR.CodeError        = 2;
                    AR.DescriptionError = "El registro no existe, por favor verifique la información";
                }
            }
            catch (Exception EX)
            {
                AR.CodeError        = 1;
                AR.DescriptionError = "Hubo un error";
            }
            finally
            {
                BDEA.Dispose();
            }
            return(AR);
        }
Esempio n. 4
0
        public List <TimeActivityBE> SearchTimActiIdUse(int SEARTIMACTIDUS)
        {
            List <TimeActivityBE> ltstimeactiidus = new List <TimeActivityBE>();
            EmploActiEntities     BDEA            = new EmploActiEntities();

            try
            {
                ltstimeactiidus = (from TimeActivity in BDEA.TimeActivity
                                   where TimeActivity.IdUser == SEARTIMACTIDUS
                                   select new TimeActivityBE
                {
                    CodeTimeActivity = TimeActivity.CodeTimeActivity,
                    ActivitiesCode = TimeActivity.ActivitiesCode,
                    NameActivities = TimeActivity.Activities.NameActivities,
                    DateActivity = TimeActivity.DateActivity,
                    Hours = TimeActivity.Hours,
                    IdUser = TimeActivity.IdUser
                }).ToList();
            }
            catch (Exception EX)
            {
            }
            finally
            {
                BDEA.Dispose();
            }
            return(ltstimeactiidus);
        }
Esempio n. 5
0
        public List <TimeActivityBE> GetTimeActivityAll()
        {
            List <TimeActivityBE> ltstimeacti = new List <TimeActivityBE>();
            EmploActiEntities     BDEA        = new EmploActiEntities();

            try
            {
                ltstimeacti = (from TimeActivity in BDEA.TimeActivity
                               select new TimeActivityBE
                {
                    CodeTimeActivity = TimeActivity.CodeTimeActivity,
                    ActivitiesCode = TimeActivity.ActivitiesCode,
                    NameActivities = TimeActivity.Activities.NameActivities,
                    DateActivity = TimeActivity.DateActivity,
                    Hours = TimeActivity.Hours,
                    IdUser = TimeActivity.IdUser
                }).ToList();
            }
            catch (Exception EX)
            {
            }
            finally
            {
                BDEA.Dispose();
            }
            return(ltstimeacti);
        }
Esempio n. 6
0
        public List <TimeActivityBE> SearchActivityCode(int SEARTACTICOD)
        {
            EmploActiEntities     BDEA       = new EmploActiEntities();
            List <TimeActivityBE> idTimeacti = new List <TimeActivityBE>();

            try
            {
                idTimeacti = (from TimeActivity in BDEA.TimeActivity
                              where TimeActivity.ActivitiesCode == SEARTACTICOD
                              select new TimeActivityBE
                {
                    CodeTimeActivity = TimeActivity.CodeTimeActivity,
                    ActivitiesCode = TimeActivity.ActivitiesCode,
                    NameActivities = TimeActivity.Activities.NameActivities,
                    DateActivity = TimeActivity.DateActivity,
                    Hours = TimeActivity.Hours,
                    IdUser = TimeActivity.IdUser,
                }).ToList();
            }
            catch (Exception EX)
            {
            }
            finally
            {
                BDEA.Dispose();
            }
            return(idTimeacti);
        }
Esempio n. 7
0
        public AnswerResponseBE DeleteTimeActivity(int TIMEACTIVITECODE)
        {
            AnswerResponseBE  AR   = new AnswerResponseBE();
            EmploActiEntities BDEA = new EmploActiEntities();

            try
            {
                var idTimeacti = BDEA.TimeActivity.Where(x => x.CodeTimeActivity == TIMEACTIVITECODE).FirstOrDefault();
                if (idTimeacti != null)
                {
                    BDEA.TimeActivity.Remove(idTimeacti);
                    BDEA.SaveChanges();
                    AR.CodeError        = 0;
                    AR.DescriptionError = "Se eliminó con éxito";
                }
                else
                {
                    AR.CodeError        = 1;
                    AR.DescriptionError = "El registro no existe";
                }
            }
            catch (Exception EX)
            {
                AR.CodeError        = 2;
                AR.DescriptionError = "Hubo un error";
            }
            finally
            {
                BDEA.Dispose();
            }
            return(AR);
        }
Esempio n. 8
0
        public TimeActivityBE SearchCodeTimeActivity(int SEARTIMACTCOD)
        {
            EmploActiEntities BDEA       = new EmploActiEntities();
            TimeActivityBE    idTimeacti = new TimeActivityBE();

            try
            {
                idTimeacti = (from TimeActivity in BDEA.TimeActivity
                              where TimeActivity.CodeTimeActivity == SEARTIMACTCOD
                              select new TimeActivityBE
                {
                    CodeTimeActivity = TimeActivity.CodeTimeActivity,
                    ActivitiesCode = TimeActivity.ActivitiesCode,
                    NameActivities = TimeActivity.Activities.NameActivities,
                    DateActivity = TimeActivity.DateActivity,
                    Hours = TimeActivity.Hours,
                    IdUser = TimeActivity.IdUser,
                }).FirstOrDefault();
            }
            catch (Exception EX)
            {
            }
            finally
            {
                BDEA.Dispose();
            }
            return(idTimeacti);
        }
Esempio n. 9
0
        public AnswerResponseBE InsertTimeActivity(TimeActivityBE ITIMAC)
        {
            AnswerResponseBE  AR   = new AnswerResponseBE();
            EmploActiEntities BDEA = new EmploActiEntities();

            try
            {
                int CountTimeActi = 0;
                CountTimeActi = BDEA.TimeActivity.Where(x => x.CodeTimeActivity == ITIMAC.CodeTimeActivity).ToList().Count();
                if (CountTimeActi == 0)
                {
                    TimeActivity TIMACT = new TimeActivity();
                    TIMACT.ActivitiesCode = ITIMAC.ActivitiesCode;
                    TIMACT.DateActivity   = ITIMAC.DateActivity;
                    TIMACT.Hours          = ITIMAC.Hours;
                    TIMACT.IdUser         = ITIMAC.IdUser;

                    BDEA.TimeActivity.Add(TIMACT);
                    BDEA.SaveChanges();

                    AR.CodeError        = 0;
                    AR.DescriptionError = "Se ha insertado el tiempo / actividad correctamente";
                }
                else
                {
                    AR.CodeError        = 2;
                    AR.DescriptionError = "El registro ya existe, por favor verifique la información";
                }
            }
            catch (Exception EX)
            {
                AR.CodeError        = 1;
                AR.DescriptionError = "Hubo un error";
            }
            finally
            {
                BDEA.Dispose();
            }
            return(AR);
        }
Esempio n. 10
0
        public AnswerResponseBE InsertUser(UserBE IUSER)
        {
            AnswerResponseBE  AR   = new AnswerResponseBE();
            EmploActiEntities BDEA = new EmploActiEntities();

            try
            {
                int CountUser = 0;
                CountUser = BDEA.User.Where(x => x.IdUser == IUSER.IdUser).ToList().Count();
                if (CountUser == 0)
                {
                    User US = new User();
                    US.NameUser = IUSER.NameUser;
                    US.Password = IUSER.Password;

                    BDEA.User.Add(US);
                    BDEA.SaveChanges();

                    AR.CodeError        = 0;
                    AR.DescriptionError = "Se ha insertado el usuario correctamente";
                }
                else
                {
                    AR.CodeError        = 2;
                    AR.DescriptionError = "El registro ya existe, por favor verifique la información";
                }
            }
            catch (Exception EX)
            {
                AR.CodeError        = 1;
                AR.DescriptionError = "Hubo un error";
            }
            finally
            {
                BDEA.Dispose();
            }
            return(AR);
        }
Esempio n. 11
0
        public AnswerResponseBE InsertActivities(ActivitiesBE IACT)
        {
            AnswerResponseBE  AR   = new AnswerResponseBE();
            EmploActiEntities BDEA = new EmploActiEntities();

            try
            {
                int CountActi = 0;
                CountActi = BDEA.Activities.Where(x => x.ActivitiesCode == IACT.ActivitiesCode).ToList().Count();
                if (CountActi == 0)
                {
                    Activities ACTIV = new Activities();
                    ACTIV.NameActivities = IACT.NameActivities;
                    ACTIV.IdUser         = IACT.IdUser;

                    BDEA.Activities.Add(ACTIV);
                    BDEA.SaveChanges();

                    AR.CodeError        = 0;
                    AR.DescriptionError = "Se ha insertado la actividad correctamente";
                }
                else
                {
                    AR.CodeError        = 2;
                    AR.DescriptionError = "El registro ya existe, por favor verifique la información";
                }
            }
            catch (Exception EX)
            {
                AR.CodeError        = 1;
                AR.DescriptionError = "Hubo un error";
            }
            finally
            {
                BDEA.Dispose();
            }
            return(AR);
        }
Esempio n. 12
0
        public List <ActivitiesBE> GetActivitiesAll()
        {
            List <ActivitiesBE> ltsactivi = new List <ActivitiesBE>();
            EmploActiEntities   BDEA      = new EmploActiEntities();

            try
            {
                ltsactivi = (from Activities in BDEA.Activities
                             select new ActivitiesBE
                {
                    ActivitiesCode = Activities.ActivitiesCode,
                    NameActivities = Activities.NameActivities
                }).ToList();
            }
            catch (Exception EX)
            {
            }
            finally
            {
                BDEA.Dispose();
            }
            return(ltsactivi);
        }
Esempio n. 13
0
        public AnswerResponseBE UpdateTimeActivity(TimeActivityBE UPTIMEACT)
        {
            AnswerResponseBE  AR   = new AnswerResponseBE();
            EmploActiEntities BDEA = new EmploActiEntities();

            try
            {
                TimeActivity timeactivity = new TimeActivity();
                timeactivity = BDEA.TimeActivity.Where(x => x.CodeTimeActivity == UPTIMEACT.CodeTimeActivity).FirstOrDefault();
                if (timeactivity != null)
                {
                    timeactivity.ActivitiesCode = UPTIMEACT.ActivitiesCode;
                    timeactivity.DateActivity   = UPTIMEACT.DateActivity;
                    timeactivity.Hours          = UPTIMEACT.Hours;

                    BDEA.SaveChanges();

                    AR.CodeError        = 0;
                    AR.DescriptionError = "Se ha actualizado el tiempo / actividad correctamente";
                }
                else
                {
                    AR.CodeError        = 2;
                    AR.DescriptionError = "El registro no existe, por favor verifique la información";
                }
            }
            catch (Exception EX)
            {
                AR.CodeError        = 1;
                AR.DescriptionError = "Hubo un error";
            }
            finally
            {
                BDEA.Dispose();
            }
            return(AR);
        }
Esempio n. 14
0
        public AnswerResponseBE UpdateUser(UserBE UPUSER)
        {
            AnswerResponseBE  AR   = new AnswerResponseBE();
            EmploActiEntities BDEA = new EmploActiEntities();

            try
            {
                User user = new User();
                user = BDEA.User.Where(x => x.IdUser == UPUSER.IdUser).FirstOrDefault();
                if (user != null)
                {
                    user.NameUser = UPUSER.NameUser;
                    user.Password = UPUSER.Password;

                    BDEA.SaveChanges();

                    AR.CodeError        = 0;
                    AR.DescriptionError = "Se ha actualizado el usuario correctamente";
                }
                else
                {
                    AR.CodeError        = 2;
                    AR.DescriptionError = "El registro no existe, por favor verifique la información";
                }
            }
            catch (Exception EX)
            {
                AR.CodeError        = 1;
                AR.DescriptionError = "Hubo un error";
            }
            finally
            {
                BDEA.Dispose();
            }
            return(AR);
        }
Esempio n. 15
0
        public List <UserBE> GetUserAll()
        {
            List <UserBE>     ltsuser = new List <UserBE>();
            EmploActiEntities BDEA    = new EmploActiEntities();

            try
            {
                ltsuser = (from User in BDEA.User
                           select new UserBE
                {
                    IdUser = User.IdUser,
                    NameUser = User.NameUser,
                    Password = User.Password
                }).ToList();
            }
            catch (Exception EX)
            {
            }
            finally
            {
                BDEA.Dispose();
            }
            return(ltsuser);
        }
Esempio n. 16
0
        public ActivitiesBE SearchCodeActivities(int SEARACTCOD)
        {
            EmploActiEntities BDEA   = new EmploActiEntities();
            ActivitiesBE      idacti = new ActivitiesBE();

            try
            {
                idacti = (from Activities in BDEA.Activities
                          where Activities.ActivitiesCode == SEARACTCOD
                          select new ActivitiesBE
                {
                    ActivitiesCode = Activities.ActivitiesCode,
                    NameActivities = Activities.NameActivities
                }).FirstOrDefault();
            }
            catch (Exception EX)
            {
            }
            finally
            {
                BDEA.Dispose();
            }
            return(idacti);
        }