コード例 #1
0
        } //AddUser

        public int CheckUser(string email, string pw, out CUser aUser)
        {
            Table <Feb_member> users = theUserContext.GetTable <Feb_member>();

            IQueryable <Feb_member> tmpQ = from iter in users
                                           where iter.email == email && iter.pw == pw
                                           select iter;

            if (tmpQ.Count() > 0)
            {
                List <Feb_member> tmpUser = tmpQ.Take(1).ToList();
                aUser = new CUser();

                aUser.id         = tmpUser[0].id;
                aUser.email      = tmpUser[0].email;
                aUser.pw         = tmpUser[0].pw;
                aUser.nickname   = tmpUser[0].nickname;
                aUser.leave_chk  = tmpUser[0].leave_chk == 1 ? true : false;
                aUser.report_chk = tmpUser[0].report_chk == 1 ? true : false;

                return(1);
            }
            aUser = new CUser();
            return(0);
        }//checkUser
コード例 #2
0
        }//checkUser

        public List <CUser> GetUsers() //DB의 정보를
        {
            IQueryable <Feb_member> tmpR = theUserContext.Feb_member.OrderByDescending(x => x.id);  //the id를 기준으로 내림차순으로 select해온다는 것

            List <Feb_member> tmpL     = tmpR.ToList <Feb_member>();
            List <CUser>      resUsers = new List <CUser>();

            foreach (Feb_member iter in tmpL)
            {
                CUser tmpUser = new CUser();
                tmpUser.id         = iter.id;
                tmpUser.email      = iter.email;
                tmpUser.pw         = iter.pw;
                tmpUser.nickname   = iter.nickname;
                tmpUser.leave_chk  = iter.leave_chk == 1 ? true : false;
                tmpUser.report_chk = iter.report_chk == 1 ? true : false;  //1로저장되어있는건 true로 아닌 것은 false(0)

                resUsers.Add(tmpUser);
            }
            return(resUsers);  //외부에서 이 정보를 출력할거니까 리스트 채로 넘기는 함수
        }
コード例 #3
0
        } //생성자

        public int AddUser(ref CUser aUser)    //근데 여기서 ref안써도 되지 않나?
        {
            string tmp_email = aUser.email;
            int    tmpCount  = theUserContext.Feb_member.Where(x => x.email == tmp_email).Count();

            if (tmpCount > 0)
            {
                //같은 이메일 사용자가 있음
                return(0);
            }
            Feb_member tmp_user = new Feb_member();

            tmp_user.email      = aUser.email;
            tmp_user.pw         = aUser.pw;
            tmp_user.nickname   = aUser.nickname;
            tmp_user.leave_chk  = aUser.leave_chk ? 1 : 0;
            tmp_user.report_chk = aUser.report_chk ? 1 : 0;

            theUserContext.Feb_member.InsertOnSubmit(tmp_user);
            theUserContext.SubmitChanges();

            return(1);
        } //AddUser