Exemplo n.º 1
0
        public int ReturnUserIdByName(string UserName)
        {
            CFiscalYear cf           = new CFiscalYear();
            int         fiscalYearId = cf.CheckFiscalYear();

            if (fiscalYearId < 0)
            {
                return(-2);
            }
            else
            {
                var query = (from a in obj.Users where a.name == UserName select a.id).FirstOrDefault();

                return(Convert.ToInt32(query));
            }
        }
Exemplo n.º 2
0
        public int ValidateUser(Models.MUsers mu)
        {
            CFiscalYear cf           = new CFiscalYear();
            int         fiscalYearId = cf.CheckFiscalYear();

            if (fiscalYearId < 0)
            {
                return(-2);
            }
            else
            {
                var query  = (from a in obj.Users where a.name == mu.name select a.password).FirstOrDefault();
                var query1 = (from a in obj.Users where a.name == mu.name select a.Approved).FirstOrDefault();
                if (query == mu.password && query1.ToString() == "1")
                {
                    return(fiscalYearId);
                }
                else
                {
                    return(-1);
                }
            }
        }