コード例 #1
0
ファイル: StuInfo.aspx.cs プロジェクト: huihao/evaluation
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                stu = Session["user"] as Model.WebUser;
                txtName.Text = stu.Name;
                txtIdCard.Text = stu.IdCard;
                txtSex.Text = stu.Sex;
                txtTel.Text = stu.Phone;

                DataSet collegeDS = bllCollege.GetAllList();
                CollegeList.DataSource = collegeDS.Tables["ds"].DefaultView;
                CollegeList.DataTextField = "Name";
                CollegeList.DataValueField = "Id";
                CollegeList.DataBind();
                CollegeList.Items.FindByValue(stu.CollegeId.ToString()).Selected = true;

                LoadMajor(Convert.ToInt32(stu.CollegeId));
                MajorList.Items.FindByValue(stu.MajorId.ToString()).Selected = true;

                LoadClass(Convert.ToInt32(stu.MajorId));
                ClassList.Items.FindByValue(stu.ClassId.ToString()).Selected = true;

            }
        }
コード例 #2
0
ファイル: ApplyList.aspx.cs プロジェクト: huihao/evaluation
 private void Bing()
 {
     user = Session["user"] as Model.WebUser;
     var set = bllMark.getListByStuCheckStep(Convert.ToInt16(user.StudentId));
     MarkRepeater.DataSource = set;
     MarkRepeater.DataBind();
 }
コード例 #3
0
ファイル: EditInfo.aspx.cs プロジェクト: huihao/evaluation
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                id = int.Parse(Request["id"]);
                DataSet ds = bllCollege.GetAllList();
                CollegeList.Items.Clear();
                CollegeList.DataSource = ds.Tables["ds"].DefaultView;

                CollegeList.DataTextField = "Name";
                CollegeList.DataValueField = "Id";
                CollegeList.DataBind();
                CollegeList.Items.Insert(0, new ListItem("请选择", "0"));

                user = bllUser.GetModel(id);

                txtName.Text = user.Name;
                txtIdCard.Text = user.IdCard;
                txtSex.Text = user.Sex;
                txtTel.Text = user.Phone;

                LoadMajorList(Convert.ToInt32(user.CollegeId));
                LoadClass(Convert.ToInt32(user.MajorId));
                if (user.CollegeId!=null)
                {
                    CollegeList.Items.FindByValue(user.CollegeId.ToString()).Selected = true;
                }
                if (user.MajorId!=null)
                {
                    MajorList.Items.FindByValue(user.MajorId.ToString()).Selected = true;
                }
                if (user.ClassId!=null)
                {
                    ClassList.Items.FindByValue(user.ClassId.ToString()).Selected = true;
                }

            }
        }
コード例 #4
0
ファイル: AddUser.aspx.cs プロジェクト: huihao/evaluation
        protected void Save_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtLogin.Text.Trim().Length==0)
            {
                strErr += "用户名不能为空!\\n";
            }
            if (this.txtPassWord.Text.Trim().Length == 0)
            {
                strErr += "PassWord不能为空!\\n";
            }

            if (this.txtName.Text.Trim().Length == 0)
            {
                strErr += "Name不能为空!\\n";
            }

            if (this.txtIdCard.Text.Trim().Length == 0)
            {
                strErr += "IdCard不能为空!\\n";
            }
            if (strErr != "")
            {
                Maticsoft.Common.MessageBox.Show(this, strErr);
                return;
            }

            string PassWord = this.txtPassWord.Text;
            string Name = this.txtName.Text;
            string IdCard = this.txtIdCard.Text;
            Eva.Model.WebUser model = new Eva.Model.WebUser();
            model.LoginId = txtLogin.Text;
            model.PassWord = PassWord;
            model.Name = Name;
            model.IdCard = IdCard;

            Eva.BLL.WebUser bll = new Eva.BLL.WebUser();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "UserList.aspx");
        }
コード例 #5
0
ファイル: WebUser.cs プロジェクト: huihao/evaluation
        public Eva.Model.WebUser Login(string sql)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 Id,LoginId,PassWord,AuthorityId,Name,StudentId,Sex,CollegeId,ClassId,MajorId,IdCard,Address,Phone from WebUser ");
            strSql.Append(" where " +sql);

            Eva.Model.WebUser model = new Eva.Model.WebUser();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"] != null && ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["LoginId"] != null && ds.Tables[0].Rows[0]["LoginId"].ToString() != "")
                {
                    model.LoginId = ds.Tables[0].Rows[0]["LoginId"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PassWord"] != null && ds.Tables[0].Rows[0]["PassWord"].ToString() != "")
                {
                    model.PassWord = ds.Tables[0].Rows[0]["PassWord"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AuthorityId"] != null && ds.Tables[0].Rows[0]["AuthorityId"].ToString() != "")
                {
                    model.AuthorityId = int.Parse(ds.Tables[0].Rows[0]["AuthorityId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Name"] != null && ds.Tables[0].Rows[0]["Name"].ToString() != "")
                {
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                }
                if (ds.Tables[0].Rows[0]["StudentId"] != null && ds.Tables[0].Rows[0]["StudentId"].ToString() != "")
                {
                    model.StudentId = int.Parse(ds.Tables[0].Rows[0]["StudentId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Sex"] != null && ds.Tables[0].Rows[0]["Sex"].ToString() != "")
                {
                    model.Sex = ds.Tables[0].Rows[0]["Sex"].ToString();
                }
                if (ds.Tables[0].Rows[0]["CollegeId"] != null && ds.Tables[0].Rows[0]["CollegeId"].ToString() != "")
                {
                    model.CollegeId = int.Parse(ds.Tables[0].Rows[0]["CollegeId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ClassId"] != null && ds.Tables[0].Rows[0]["ClassId"].ToString() != "")
                {
                    model.ClassId = int.Parse(ds.Tables[0].Rows[0]["ClassId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MajorId"] != null && ds.Tables[0].Rows[0]["MajorId"].ToString() != "")
                {
                    model.MajorId = int.Parse(ds.Tables[0].Rows[0]["MajorId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IdCard"] != null && ds.Tables[0].Rows[0]["IdCard"].ToString() != "")
                {
                    model.IdCard = ds.Tables[0].Rows[0]["IdCard"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Address"] != null && ds.Tables[0].Rows[0]["Address"].ToString() != "")
                {
                    model.Address = ds.Tables[0].Rows[0]["Address"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Phone"] != null && ds.Tables[0].Rows[0]["Phone"].ToString() != "")
                {
                    model.Phone = ds.Tables[0].Rows[0]["Phone"].ToString();
                }
                return model;
            }
            else
            {
                return null;
            }
        }
コード例 #6
0
ファイル: Add.aspx.cs プロジェクト: huihao/evaluation
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtLoginId.Text.Trim().Length==0)
            {
                strErr+="LoginId不能为空!\\n";
            }
            if(this.txtPassWord.Text.Trim().Length==0)
            {
                strErr+="PassWord不能为空!\\n";
            }
            if(!PageValidate.IsNumber(txtAuthorityId.Text))
            {
                strErr+="AuthorityId格式错误!\\n";
            }
            if(this.txtName.Text.Trim().Length==0)
            {
                strErr+="Name不能为空!\\n";
            }
            if(!PageValidate.IsNumber(txtStudentId.Text))
            {
                strErr+="StudentId格式错误!\\n";
            }
            if(this.txtSex.Text.Trim().Length==0)
            {
                strErr+="Sex不能为空!\\n";
            }
            if(!PageValidate.IsNumber(txtCollegeId.Text))
            {
                strErr+="CollegeId格式错误!\\n";
            }
            if(!PageValidate.IsNumber(txtClassId.Text))
            {
                strErr+="ClassId格式错误!\\n";
            }
            if(!PageValidate.IsNumber(txtMajorId.Text))
            {
                strErr+="MajorId格式错误!\\n";
            }
            if(this.txtIdCard.Text.Trim().Length==0)
            {
                strErr+="IdCard不能为空!\\n";
            }
            if(this.txtAddress.Text.Trim().Length==0)
            {
                strErr+="Address不能为空!\\n";
            }
            if(this.txtPhone.Text.Trim().Length==0)
            {
                strErr+="Phone不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            string LoginId=this.txtLoginId.Text;
            string PassWord=this.txtPassWord.Text;
            int AuthorityId=int.Parse(this.txtAuthorityId.Text);
            string Name=this.txtName.Text;
            int StudentId=int.Parse(this.txtStudentId.Text);
            string Sex=this.txtSex.Text;
            int CollegeId=int.Parse(this.txtCollegeId.Text);
            int ClassId=int.Parse(this.txtClassId.Text);
            int MajorId=int.Parse(this.txtMajorId.Text);
            string IdCard=this.txtIdCard.Text;
            string Address=this.txtAddress.Text;
            string Phone=this.txtPhone.Text;

            Eva.Model.WebUser model=new Eva.Model.WebUser();
            model.LoginId=LoginId;
            model.PassWord=PassWord;
            model.AuthorityId=AuthorityId;
            model.Name=Name;
            model.StudentId=StudentId;
            model.Sex=Sex;
            model.CollegeId=CollegeId;
            model.ClassId=ClassId;
            model.MajorId=MajorId;
            model.IdCard=IdCard;
            model.Address=Address;
            model.Phone=Phone;

            Eva.BLL.WebUser bll=new Eva.BLL.WebUser();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }
コード例 #7
0
ファイル: WebUser.cs プロジェクト: huihao/evaluation
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Eva.Model.WebUser DataRowToModel(DataRow row)
 {
     Eva.Model.WebUser model=new Eva.Model.WebUser();
     if (row != null)
     {
         if(row["Id"]!=null && row["Id"].ToString()!="")
         {
             model.Id=int.Parse(row["Id"].ToString());
         }
         if(row["LoginId"]!=null)
         {
             model.LoginId=row["LoginId"].ToString();
         }
         if(row["PassWord"]!=null)
         {
             model.PassWord=row["PassWord"].ToString();
         }
         if(row["AuthorityId"]!=null && row["AuthorityId"].ToString()!="")
         {
             model.AuthorityId=int.Parse(row["AuthorityId"].ToString());
         }
         if(row["Name"]!=null)
         {
             model.Name=row["Name"].ToString();
         }
         if(row["StudentId"]!=null && row["StudentId"].ToString()!="")
         {
             model.StudentId=int.Parse(row["StudentId"].ToString());
         }
         if(row["Sex"]!=null)
         {
             model.Sex=row["Sex"].ToString();
         }
         if(row["CollegeId"]!=null && row["CollegeId"].ToString()!="")
         {
             model.CollegeId=int.Parse(row["CollegeId"].ToString());
         }
         if(row["ClassId"]!=null && row["ClassId"].ToString()!="")
         {
             model.ClassId=int.Parse(row["ClassId"].ToString());
         }
         if(row["MajorId"]!=null && row["MajorId"].ToString()!="")
         {
             model.MajorId=int.Parse(row["MajorId"].ToString());
         }
         if(row["IdCard"]!=null)
         {
             model.IdCard=row["IdCard"].ToString();
         }
         if(row["Address"]!=null)
         {
             model.Address=row["Address"].ToString();
         }
         if(row["Phone"]!=null)
         {
             model.Phone=row["Phone"].ToString();
         }
     }
     return model;
 }
コード例 #8
0
ファイル: WebUser.cs プロジェクト: huihao/evaluation
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Eva.Model.WebUser GetModel(int Id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 Id,LoginId,PassWord,AuthorityId,Name,StudentId,Sex,CollegeId,ClassId,MajorId,IdCard,Address,Phone from WebUser ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters = {
                    new SqlParameter("@Id", SqlDbType.Int,4)
            };
            parameters[0].Value = Id;

            Eva.Model.WebUser model=new Eva.Model.WebUser();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }