コード例 #1
0
ファイル: TestInfoBL.cs プロジェクト: MobileApps-BJTU/Web
        public int DeleteATest(string id)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.TestInfoIDAL dalad = factory.getTestInstance();

            return dalad.DeleteATest(id);
        }
コード例 #2
0
ファイル: TestInfoBL.cs プロジェクト: MobileApps-BJTU/Web
        public string GetTestID(string id)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.TestInfoIDAL dalad = factory.getTestInstance();

            return dalad.GetTestID(id);
        }
コード例 #3
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;
        }
コード例 #4
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);
        }
コード例 #5
0
ファイル: TestInfoBL.cs プロジェクト: MobileApps-BJTU/Web
        public DataSet GetTestDetail(string id)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.TestInfoIDAL dalad = factory.getTestInstance();

            DataSet ds = dalad.GetTestDetail(id);
            string cid = ds.Tables[0].Rows[0]["Test_ChallengeID"].ToString();
            OxcoderIDAL.SearchChallengeIDAL scidal = factory.getSearchInstance();
            DataSet ds2 = scidal.SearchByChallengeID(cid);

            return AddOtherInfo(ds,ds2);
        }
コード例 #6
0
ファイル: TestInfoBL.cs プロジェクト: MobileApps-BJTU/Web
        public int InsertATest(string challengeid, string userid)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.TestInfoIDAL dalad = factory.getTestInstance();
            Model.Test test = new Model.Test();
            test.Test_ID = Guid.NewGuid().ToString();
            test.Test_ChallengeID = challengeid;
            test.Test_UserID = userid;

            OxcoderIDAL.ChallengeInfoIDAL ci = factory.getChallengeInstance();
            ci.UpdateNum(challengeid,1);
            return dalad.InsertATest(test);
        }
コード例 #7
0
ファイル: UserBL.cs プロジェクト: MobileApps-BJTU/Web
 public double[] GetUserAbility(string userID)
 {
     OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
     OxcoderIDAL.TestInfoIDAL dalTest = factory.getTestInstance();
     string[] abilityTemp = dalTest.GetUserAbility(userID);
     double AvaTime = 500.00;
     double AvaTime1 = 100.00;
     double AvaTime2 = 100.00;
     double AvaTime3 = 100.00;
     double avarage = 5.00;
     double home = 5.00;
     double[] ability = new double[8];
     //专注度
     ability[0] = Convert.ToDouble(abilityTemp[0]) / AvaTime1 + Convert.ToDouble(abilityTemp[1]) / AvaTime2 + Convert.ToDouble(abilityTemp[1]) / AvaTime3;
     //熟练度
     ability[1] = (Convert.ToDouble(abilityTemp[0]) + Convert.ToDouble(abilityTemp[1]) + Convert.ToDouble(abilityTemp[2])) / AvaTime;
     //偏差值
     ability[2] = ability[1] - avarage;
     ability[3] = home;
     return ability;
 }
コード例 #8
0
ファイル: UserBL.cs プロジェクト: MobileApps-BJTU/Web
        public double[] GetUserAbility(string userID)
        {
            OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory();
            OxcoderIDAL.TestInfoIDAL dalTest = factory.getTestInstance();
            string[] abilityTemp             = dalTest.GetUserAbility(userID);
            double   AvaTime  = 500.00;
            double   AvaTime1 = 100.00;
            double   AvaTime2 = 100.00;
            double   AvaTime3 = 100.00;
            double   avarage  = 5.00;
            double   home     = 5.00;

            double[] ability = new double[8];
            //专注度
            ability[0] = Convert.ToDouble(abilityTemp[0]) / AvaTime1 + Convert.ToDouble(abilityTemp[1]) / AvaTime2 + Convert.ToDouble(abilityTemp[1]) / AvaTime3;
            //熟练度
            ability[1] = (Convert.ToDouble(abilityTemp[0]) + Convert.ToDouble(abilityTemp[1]) + Convert.ToDouble(abilityTemp[2])) / AvaTime;
            //偏差值
            ability[2] = ability[1] - avarage;
            ability[3] = home;
            return(ability);
        }