Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int           userid   = int.Parse(Session["UserID"].ToString());
         int           kaoshiid = int.Parse(Session["KaoshiID"].ToString());
         SqlDataReader dr       = UserPageService.SelectUserPage(userid, kaoshiid);
         ListView1.DataSource = dr;
         ListView1.DataBind();
     }
 }
Exemplo n.º 2
0
 public void ChangeRank(float rank, int creativeId)
 {
     UserPageService.ChangeRank(rank, creativeId);
 }
Exemplo n.º 3
0
 public void ChangeAvatar(string src)
 {
     UserPageService.ChangeAvatar(UserPageService.UploadAvatar(src), User.Identity.GetUserId());
 }
Exemplo n.º 4
0
 public void Create(CreativeView creative)
 {
     UserPageService.CreateCreative(creative, User.Identity.GetUserId());
 }
Exemplo n.º 5
0
 public string GetUserCreatives(string userId)
 {
     return(UserPageService.GetUserCreatives(userId));
 }
Exemplo n.º 6
0
 public string GetMyCreatives()
 {
     return(UserPageService.GetUserCreatives(User.Identity.GetUserId()));
 }
Exemplo n.º 7
0
 public string GetUser(string userId)
 {
     return(UserPageService.GetUser(userId));
 }
Exemplo n.º 8
0
 public string GetMe()
 {
     return(UserPageService.GetUser(User.Identity.GetUserId()));
 }
Exemplo n.º 9
0
        protected void Button1_ServerClick1(object sender, EventArgs e)
        {
            //获取考卷ID
            int KaoJuanId  = int.Parse(Request.QueryString["id"].ToString());
            int sum        = 0;                                                                //初始化对的信息 默认为0个
            int Score      = 0;                                                                //初始化分数的信息 默认为0分
            int singlemark = int.Parse(((Label)GridView1.Rows[0].FindControl("Label4")).Text); //每一道单选题的分数

            foreach (GridViewRow dr in GridView1.Rows)

            //遍历每一行的数据
            {
                string str = "";
                if (((RadioButton)dr.FindControl("RadioButton1")).Checked)
                {
                    str = "A";
                }
                else if (((RadioButton)dr.FindControl("RadioButton2")).Checked)
                {
                    str = "B";
                }
                else if (((RadioButton)dr.FindControl("RadioButton3")).Checked)
                {
                    str = "C";
                }
                else if (((RadioButton)dr.FindControl("RadioButton4")).Checked)
                {
                    str = "D";
                }
                //逐个 判断 某一个单选框是否选中 即  选择的答案 ABCD  哪一个
                if (((Label)dr.FindControl("Label3")).Text.Trim() == str)
                //用户选择的答案 和正确答案 对比
                {
                    sum   = sum + 1;
                    Score = Score + singlemark;
                    //分数 增加
                    string   title = ((Label)dr.FindControl("Label2")).Text.Trim();
                    int      fid   = int.Parse(((Label)dr.FindControl("Label111")).Text.Trim());
                    UserPage up    = new UserPage();
                    up.Fid       = fid;
                    up.Title     = title;
                    up.UserID    = int.Parse(Session["UserID"].ToString());
                    up.KaoJuanID = KaoJuanId;
                    up.UserAns   = str;
                    UserPageService.Insert(up);
                    //将信息再插入到 用户试卷题目表里
                }
                else
                {
                    string   title = ((Label)dr.FindControl("Label2")).Text.Trim();
                    int      fid   = int.Parse(((Label)dr.FindControl("Label111")).Text.Trim());
                    UserPage up    = new UserPage();
                    up.Fid       = fid;
                    up.Title     = title;
                    up.UserID    = int.Parse(Session["UserID"].ToString());
                    up.KaoJuanID = KaoJuanId;
                    up.UserAns   = str;
                    UserPageService.Insert(up);
                    Mistakes Mt = new Mistakes();
                    Mt.UserID  = int.Parse(Session["UserID"].ToString());
                    Mt.ObID    = fid;
                    Mt.MisTime = DateTime.Now;
                    MistakesService.Insert(Mt);
                    //将信息再插入到 用户试卷题目表和错题表里
                }
                int id = int.Parse(Request.QueryString["id"].ToString());
                Session["KaoshiID"] = id;
                string UserName = Session["UserName"].ToString();
                //插入到 分数表 和 学生考试表
                Score sc = new Score();
                sc.UserID    = int.Parse(Session["UserID"].ToString());
                sc.KaoJuanID = id;
                sc.Scores    = Score;
                sc.UserName  = UserName;
                sc.Sum       = sum;
                int    j  = ScoreService.Insert(sc);
                KaoShi ks = new KaoShi();
                ks.PageID = id;
                ks.UserID = int.Parse(Session["UserID"].ToString());
                int i = KaoShiService.Insert(ks);
                if (i >= 1 && j >= 1)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "true", "<script>alert('答题成功!查看成绩!!');location='ExamResult.aspx'</script>");
                }
            }
        }
Exemplo n.º 10
0
        protected T DecorateViewModel <T>(T model) where T : BaseViewModel // T is extended with the baseviewmodel
        {
            if (UserService.IsLoggedIn())
            {
                UserPageDomain upd        = UserPageService.GetModel();
                string         thisUserId = UserService.GetCurrentUserId();
                model._IsLoggedIn = true;
                model._AccountId  = thisUserId;// attach the user id to the model (string value)
                Console.WriteLine("Right");

                model._UserName = upd.UserName;

                model._IsEmailConfirmed = upd.IsEmailConfirmed;

                model._UserEmail = upd.UserEmail;

                model._FirstName = upd.FirstName;

                model._LastName = upd.LastName;

                model._CompanyId = upd.CompanyId;

                model._UserPhone = upd.UserPhone;

                model._UserPhotoUrl = upd.UserPhotoUrl;

                model._CompanyOwnerId = upd.CompanyOwnerId;

                model._DateCreated = upd.DateCreated;

                model._CompanyName = upd.CompanyName;

                model._CompanyType = upd.CompanyType;

                model._CompanyEmail = upd.CompanyEmail;

                model._CompanyAddressString = upd.CompanyAddressString;

                model._CompanyPhotoUrl = upd.CompanyPhotoUrl;

                if (thisUserId != null)
                {
                    model._Auth = true;
                }

                if (_UserProfileService.IsCompanyAdmin(thisUserId))
                {
                    model._Admin = true;
                }

                if (_UserProfileService.IsCompanyOwner(thisUserId))
                {
                    model._Owner = true;
                    model._Admin = true;
                }
            }
            else
            {
                model._IsLoggedIn = false;
                Console.WriteLine("Wrong");
            }


            return(model); // return the value
        }