Пример #1
0
        public int UpdateATest(string uid, string id, int order, int time, string result)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.TestInfoIDAL test    = factory.getTestInstance();
            OxcoderIDAL.UserIDAL     user    = factory.getUserInstance();
            string tid = test.GetTestID(id);

            Model.Quiz p1 = searchQuizInfo(id, order);
            if (result.Equals(p1.output) || p1.output == "")
            {
                test.UpdateATest(tid, order, time);
                SqlDataReader rd = user.UserInfo(uid);
                if (rd.Read())
                {
                    int price1 = Convert.ToInt32(rd["User_Level"].ToString());
                    int price  = Convert.ToInt32(rd["User_Price"].ToString()) + time / 10;
                    if ((price - 4000) / 1000 > 0)
                    {
                        user.UpdateUserLevel((price1 + 1).ToString(), price.ToString(), uid);
                    }
                    user.UpdateUserLevel(rd["User_Level"].ToString(), price.ToString(), uid);
                }
            }
            if (order == 2)
            {
                DataRow dr = test.GetTestDetail(tid).Tables[0].Rows[0];
                if (dr["Test_Quiz0_State"].ToString().Equals("-1") && dr["Test_Quiz1_State"].ToString().Equals("-1") && dr["Test_Quiz2_State"].ToString().Equals("-1"))
                {
                    test.SetTestState(tid);
                }
            }
            return(1);
        }
Пример #2
0
        public int UpdateATest(string uid,string id, int order, int time, string result)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.TestInfoIDAL test = factory.getTestInstance();
            OxcoderIDAL.UserIDAL user = factory.getUserInstance();
            string tid = test.GetTestID(id);
            Model.Quiz p1 = searchQuizInfo(id, order);
            if (result.Equals(p1.output) || p1.output == "")
            {
                test.UpdateATest(tid, order, time);
                SqlDataReader rd = user.UserInfo(uid);
                if (rd.Read())
                {
                    int price1 = Convert.ToInt32(rd["User_Level"].ToString());
                    int price = Convert.ToInt32(rd["User_Price"].ToString()) + time / 10;
                    if ((price - 4000) / 1000 > 0)
                        user.UpdateUserLevel((price1 + 1).ToString(), price.ToString(), uid);
                    user.UpdateUserLevel(rd["User_Level"].ToString(), price.ToString(), uid);
                }

            }
            if(order==2)
            {
                DataRow dr = test.GetTestDetail(tid).Tables[0].Rows[0];
                if (dr["Test_Quiz0_State"].ToString().Equals("-1") && dr["Test_Quiz1_State"].ToString().Equals("-1") && dr["Test_Quiz2_State"].ToString().Equals("-1"))
                    test.SetTestState(tid);
            }
            return 1;
        }
Пример #3
0
        public int SendResetEmail(string email)
        {
            OxcoderIFactory.IFactory       factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.UserIDAL           dalad   = factory.getUserInstance();
            OxcoderIDAL.EnterpriseInfoIDAL en      = factory.getEnterpriseInstance();
            // dalad.SendEmail(id, md5);
            //TODO:发邮件
            MailMessage mailMsg = new MailMessage();

            mailMsg.From = new MailAddress("*****@*****.**");
            mailMsg.To.Add(email);
            mailMsg.Subject = "请重置密码";
            string        activeCode     = Guid.NewGuid().ToString().Substring(0, 8);
            StringBuilder contentBuilder = new StringBuilder();

            contentBuilder.Append("请点击下面的链接完成密码重置");
            contentBuilder.Append("<a href='http://*****:*****@qq.com", "hmh299222");
            int state = 0;

            //判断用户类型
            if (dalad.CheckUserEmail(email) == 1)
            {
                if (dalad.SendUserEmail(email, activeCode) != 0)
                {
                    client.Send(mailMsg);
                    state = 1;
                }
                else
                {
                    state = 0;
                }
            }
            else if (en.CheckEnterpriceEmail(email) == 1)
            {
                if (en.SendEnterpriceEmail(email, activeCode) != 0)
                {
                    client.Send(mailMsg);
                    state = 1;
                }
                else
                {
                    state = 0;
                }
            }
            return(state);
        }
Пример #4
0
        public User GetUserID(string email)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.UserIDAL dalad = factory.getUserInstance();
            SqlDataReader dr = dalad.GetUserID(email);
            Model.User user = new Model.User();
            if (dr.Read()) {
            user.User_ID = dr["User_ID"].ToString();
            user.User_Name = dr["User_Name"].ToString();

            }
            return user;
        }
Пример #5
0
 public Boolean ActiveUserAccount(string email, string activeCode)
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL dalad = factory.getUserInstance();
     string activeCode2 = dalad.ActiveUserAccount(email);
     if (activeCode.Equals(activeCode2) && dalad.ChangeUserState(email) == 1)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Пример #6
0
        public User GetUserID(string email)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.UserIDAL     dalad   = factory.getUserInstance();
            SqlDataReader            dr      = dalad.GetUserID(email);

            Model.User user = new Model.User();
            if (dr.Read())
            {
                user.User_ID   = dr["User_ID"].ToString();
                user.User_Name = dr["User_Name"].ToString();
            }
            return(user);
        }
Пример #7
0
        public Boolean ActiveUserAccount(string email, string activeCode)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.UserIDAL     dalad   = factory.getUserInstance();
            string activeCode2 = dalad.ActiveUserAccount(email);

            if (activeCode.Equals(activeCode2) && dalad.ChangeUserState(email) == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #8
0
 public int RegisterUser(string email, string password)
 {
     OxcoderIFactory.IFactory       factory    = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL           dalad      = factory.getUserInstance();
     OxcoderIDAL.EnterpriseInfoIDAL enterprice = factory.getEnterpriseInstance();
     Model.User user = new Model.User();
     user.User_ID       = Guid.NewGuid().ToString();
     user.User_Email    = email;
     user.User_Password = password;
     if (dalad.CheckUserEmail(email) == 0 && enterprice.CheckEnterpriceEmail(email) == 0)
     {
         return(dalad.RegisterUser(user));
     }
     else
     {
         return(0);
     }
 }
Пример #9
0
        public User UserInfo(string userID)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.UserIDAL     dalad   = factory.getUserInstance();
            User          userInfo           = new User();
            SqlDataReader rd = dalad.UserInfo(userID);

            if (rd.Read())
            {
                userInfo.User_ID       = rd["User_ID"].ToString();
                userInfo.User_Email    = rd["User_Email"].ToString();
                userInfo.User_Name     = rd["User_Name"].ToString();
                userInfo.User_Password = rd["User_Password"].ToString();
                userInfo.User_Age      = rd["User_Age"].ToString();
                userInfo.User_Level    = rd["User_Level"].ToString();
                userInfo.User_Price    = rd["User_Price"].ToString();
                userInfo.User_Phone    = rd["User_Phone"].ToString();
                userInfo.User_Sex      = rd["User_Sex"].ToString();
            }
            return(userInfo);
        }
Пример #10
0
        public int SendUserEmail(string emailTo)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.UserIDAL     dalad   = factory.getUserInstance();
            // dalad.SendEmail(id, md5);
            //TODO:发邮件
            MailMessage mailMsg = new MailMessage();

            mailMsg.From = new MailAddress("*****@*****.**");
            mailMsg.To.Add(emailTo);
            mailMsg.Subject = "请激活注册账号";
            string        activeCode     = Guid.NewGuid().ToString().Substring(0, 8);
            StringBuilder contentBuilder = new StringBuilder();

            contentBuilder.Append("请点击下面的链接完成激活注册");
            string type = "User";

            contentBuilder.Append("<a href='http://*****:*****@qq.com", "hmh299222");
            if (dalad.SendUserEmail(emailTo, activeCode) != 0)
            {
                client.Send(mailMsg);
                return(1);
            }
            else
            {
                return(0);
            }
        }
Пример #11
0
 public Boolean UserLogin(String email, String password)
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL     dalad   = factory.getUserInstance();
     Model.User user = new Model.User();
     user = dalad.UserLogin(email);
     if (user.User_Password != null)
     {
         if (user.User_Password.Equals(password) && user.User_State.Equals("1"))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Пример #12
0
 //提交重置密码
 public int SetPassword(string email,string newPwd)
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL dalad = factory.getUserInstance();
     return dalad.SetPassword(email,newPwd);
 }
Пример #13
0
        public int SendResetEmail(string email)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.UserIDAL dalad = factory.getUserInstance();
            OxcoderIDAL.EnterpriseInfoIDAL en = factory.getEnterpriseInstance();
            // dalad.SendEmail(id, md5);
            //TODO:发邮件
            MailMessage mailMsg = new MailMessage();
            mailMsg.From = new MailAddress("*****@*****.**");
            mailMsg.To.Add(email);
            mailMsg.Subject = "请重置密码";
            string activeCode = Guid.NewGuid().ToString().Substring(0, 8);
            StringBuilder contentBuilder = new StringBuilder();
            contentBuilder.Append("请点击下面的链接完成密码重置");
            contentBuilder.Append("<a href='http://*****:*****@qq.com", "hmh299222");
            int state = 0;
            //判断用户类型
            if (dalad.CheckUserEmail(email) == 1)
            {
                if (dalad.SendUserEmail(email, activeCode) != 0)
                {
                    client.Send(mailMsg);
                    state = 1;
                }
                else
                {
                    state = 0;

                }
            }else if(en.CheckEnterpriceEmail(email) == 1){
                if (en.SendEnterpriceEmail(email, activeCode) != 0)
                {
                    client.Send(mailMsg);
                    state = 1;
                }
                else
                {
                    state = 0;

                }
            }
            return state;
        }
Пример #14
0
 public int UpdateUserLevel(string level,string price,string userID)
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL dalad = factory.getUserInstance();
     return dalad.UpdateUserLevel(level,price,userID);
 }
Пример #15
0
 public int UpdateUserInfo(User user)
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL dalad = factory.getUserInstance();
     return dalad.UpdateUserInfo(user);
 }
Пример #16
0
        public Boolean UserLogin(String email, String password)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.UserIDAL dalad = factory.getUserInstance();
            Model.User user = new Model.User();
            user = dalad.UserLogin(email);
            if (user.User_Password!=null)
            {
                if (user.User_Password.Equals(password)&&user.User_State.Equals("1"))
                {
                    return true;
                }
                else {
                    return false;
                }

            }
            else
            {
                return false;
            }
        }
Пример #17
0
 public User UserInfo(string userID)
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL dalad = factory.getUserInstance();
     User userInfo = new User();
     SqlDataReader rd = dalad.UserInfo(userID);
     if(rd.Read()){
         userInfo.User_ID = rd["User_ID"].ToString();
         userInfo.User_Email = rd["User_Email"].ToString();
         userInfo.User_Name = rd["User_Name"].ToString();
         userInfo.User_Password = rd["User_Password"].ToString();
         userInfo.User_Age =  rd["User_Age"].ToString();
         userInfo.User_Level = rd["User_Level"].ToString();
         userInfo.User_Price = rd["User_Price"].ToString();
         userInfo.User_Phone = rd["User_Phone"].ToString();
         userInfo.User_Sex = rd["User_Sex"].ToString();
     }
     return userInfo;
 }
Пример #18
0
 public DataSet AllUserInfo()
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL     dalad   = factory.getUserInstance();
     return(dalad.AllUserInfo());
 }
Пример #19
0
 public int Count()
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL     dalad   = factory.getUserInstance();
     return(dalad.Count());
 }
Пример #20
0
 public int UpdateUserInfo(User user)
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL     dalad   = factory.getUserInstance();
     return(dalad.UpdateUserInfo(user));
 }
Пример #21
0
 public int UpdateUserLevel(string level, string price, string userID)
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL     dalad   = factory.getUserInstance();
     return(dalad.UpdateUserLevel(level, price, userID));
 }
Пример #22
0
 //提交重置密码
 public int SetPassword(string email, string newPwd)
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL     dalad   = factory.getUserInstance();
     return(dalad.SetPassword(email, newPwd));
 }
Пример #23
0
 public DataSet AllUserInfo()
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL dalad = factory.getUserInstance();
     return dalad.AllUserInfo();
 }
Пример #24
0
 public int SendUserEmail(string emailTo)
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL dalad = factory.getUserInstance();
     // dalad.SendEmail(id, md5);
     //TODO:发邮件
     MailMessage mailMsg = new MailMessage();
     mailMsg.From = new MailAddress("*****@*****.**");
     mailMsg.To.Add(emailTo);
     mailMsg.Subject = "请激活注册账号";
     string activeCode = Guid.NewGuid().ToString().Substring(0, 8);
     StringBuilder contentBuilder = new StringBuilder();
     contentBuilder.Append("请点击下面的链接完成激活注册");
     string type = "User";
     contentBuilder.Append("<a href='http://*****:*****@qq.com", "hmh299222");
     if (dalad.SendUserEmail(emailTo, activeCode) != 0)
     {
         client.Send(mailMsg);
         return 1;
     }
     else
     {
         return 0;
     }
 }
Пример #25
0
 public int Count()
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.UserIDAL dalad = factory.getUserInstance();
     return dalad.Count();
 }
Пример #26
0
        public int RegisterEnterprice(string email, string password)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.UserIDAL user = factory.getUserInstance();
            OxcoderIDAL.EnterpriseInfoIDAL dalad = factory.getEnterpriseInstance();
            Model.Enterprice enterprice = new Model.Enterprice();
            enterprice.Enterprice_ID = Guid.NewGuid().ToString();
            enterprice.Enterprice_Email = email;
            enterprice.Enterprice_Password = password;
            if (dalad.CheckEnterpriceEmail(email) == 0 && user.CheckUserEmail(email)==0)
            {
                return dalad.RegisterEnterprice(enterprice);
            }
            else
            {

                return 0;
            }
        }