Example #1
0
        public int StudentDel(Model.StudentModel st)
        {
            Student est = new Student()
            {
                Id = st.Id
            };

            return(Delete(est));
        }
 public FmStudentMain(FmLogin fmLogin, UserModel userModel)
 {
     InitializeComponent();
     this.fmLogin = fmLogin;
     this.userModel = userModel;
     StudentBusiness sBusiness = new StudentBusiness();
     this.studentModel = sBusiness.getStuBySid(sBusiness.getSidByUid(userModel.Uid));
     fmLogin.Hide();
 }
Example #3
0
        //Search:
        public DataTable SearchStuInfo(StudentModel objStudentModel)
        {
            //string SqlString = "Select * From Student Where StuNum='" + objStudentModel.StuNum + "'";

            // string SqlString = "Select * From V_Student_All_Info where 班级='11应用嵌入式班'";
               string SqlString = "Select * From V_Student_All_Info where 学号='"+objStudentModel.StuNum+"'or 学生姓名='"+objStudentModel.StuName+"'or 班级='"+objStudentModel.ClaName+"'";

             return (objDataBaseOperateClass2.ShowTable(SqlString));
        }
Example #4
0
 private void btnClear_Click(object sender, EventArgs e)
 {
     #region 把编辑框的内容内容转成一个消息框弹出:
     StudentModel objStudentModel = new StudentModel();
     objStudentModel.StuNum = txtStuNum.Text;
     objStudentModel.StuName = txtStuName.Text;
     objStudentModel.StuSex = cbxStuSex.Text;
     objStudentModel.Birthday = dtBirthday.Value.ToString("yyy-mm-dd");
     objStudentModel.Address = txtAddress.Text;
     string OutString = "姓名:" + objStudentModel.StuName + "\n";
     OutString += "学号:" + objStudentModel.StuNum + "\n";
     OutString += "性别:" + objStudentModel.StuSex + "\n";
     OutString += "出生日期:" + objStudentModel.Birthday + "\n";
     OutString += "地址:" + objStudentModel.Address + "\n";
     MessageBox.Show(OutString, "学生信息");
     #endregion
 }
Example #5
0
        //Add:
        public bool InsertStudent(StudentModel objStudentModel)
        {
            //string SqlString ="Insert into Student(StuNum,StuName,StuSex,Policity,Birthday,Favor,StuScore,Meno,ClaNum,Phone,Address) Values('"+objStudentModel.StuNum+"','"+objStudentModel.StuName+"','"+objStudentModel.StuSex+"','"+objStudentModel.Policity+"','"+objStudentModel.Birthday+"','"+objStudentModel.Favor+"','"+objStudentModel.StuScore+"','"+objStudentModel.Meno+"','"+objStudentModel.ClaNum+"','"+objStudentModel.Phone+"','"+objStudentModel.Address+"')";

            string SqlString = "Insert into V_Student_All_Info(学号,学生姓名,性别,出生日期,政治面目,班级编号,爱好,综合分,评价,联系电话,联系地址) Values('" + objStudentModel.StuNum + "','" + objStudentModel.StuName + "','" + objStudentModel.StuSex + "','" + objStudentModel.Birthday + "','" + objStudentModel.Policity + "','" + objStudentModel.ClaNum + "','" + objStudentModel.Favor + "','" + objStudentModel.StuScore + "','" + objStudentModel.Meno + "','" + objStudentModel.Phone + "','" + objStudentModel.Address + "')";

            try
            {
                if (objDataBaseOperateClass2.GetExecute(SqlString))
                    return (true);
                else
                    return (false);
            }
            catch(Exception e1)
            {
                MessageBox.Show("学号不能重复。\n请检查后再添加。"+e1);
                return (false);
            }
        }
Example #6
0
        //Update:
        public bool Updatestudent(StudentModel objStudentModel)
        {
            //StuNum='"+objStudentModel.StuNum+"',
            string SqlString;
            //SqlString = "update  dbo.Student set StuName='"+objStudentModel.StuName+"',StuSex='"+objStudentModel.StuSex+"',Policity='"+objStudentModel.Policity+"',Birthday='"+objStudentModel.Birthday+"',Favor='"+objStudentModel.Favor+"',StuScore='"+objStudentModel.StuScore+"',Meno='"+objStudentModel.Meno+"',ClaNum='"+objStudentModel.ClaNum+"',Phone='"+objStudentModel.Phone+"',Address='"+objStudentModel.Address+"' where StuNum='"+objStudentModel.StuNum+"'";

            SqlString = "update V_Student_All_Info set 学号='" + objStudentModel.StuNum + "',学生姓名='" + objStudentModel.StuName + "',性别='" + objStudentModel.StuSex + "',出生日期='" + objStudentModel.Birthday + "',政治面目='" + objStudentModel.Policity + "',班级编号='" + objStudentModel.ClaNum + "',爱好='" + objStudentModel.Favor + "',综合分='" + objStudentModel.StuScore + "',评价='" + objStudentModel.Meno + "',联系电话='" + objStudentModel.Phone + "',联系地址='" + objStudentModel.Address + "'where 学号='"+objStudentModel.StuNum+"'";

            try
            {
                if (objDataBaseOperateClass2.GetExecute(SqlString))
                    return (true);
                else
                    return (false);
            }

            catch (Exception e1)
            {
                MessageBox.Show("错误信息"+e1);
                return (false);
            }
        }
 public int updatestudent(StudentModel stuModel)
 {
     return new StudentService().update(stuModel);
 }
Example #8
0
 public bool UpdateStudent(StudentModel objStudentModel)
 {
     return (objStudentDAL.Updatestudent(objStudentModel));
 }
Example #9
0
 public DataTable SearchStuInfo(StudentModel objStudentModel)
 {
     return (objStudentDAL.SearchStuInfo(objStudentModel));
 }
Example #10
0
 public bool InsertStudent(StudentModel objstudentClass1)
 {
     return (objStudentDAL.InsertStudent(objstudentClass1));
 }
 //学生列表编辑后保存
 private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
 {
     StudentModel stuModelToBeUpdated = new StudentModel();
     StudentBusiness stuBusiness = new StudentBusiness();
     //int sid = int.Parse(this.dataGridView1.CurrentRow.Cells["sid"].Value.ToString());
     stuModelToBeUpdated.Sid = int.Parse(this.dataGridView1.CurrentRow.Cells["sid"].Value.ToString());
     stuModelToBeUpdated.Stunum = this.dataGridView1.CurrentRow.Cells["stunum"].Value.ToString();
     stuModelToBeUpdated.Sname = this.dataGridView1.CurrentRow.Cells["sname"].Value.ToString();
     stuModelToBeUpdated.Startyear = this.dataGridView1.CurrentRow.Cells["startyear"].Value.ToString();
     stuModelToBeUpdated.Gender = this.dataGridView1.CurrentRow.Cells["gender"].Value.ToString() == "男" ? 1 : 0;
     if (this.dataGridView1.CurrentCell.ColumnIndex == this.dataGridView1.Columns["collegeid"].Index)
     {
         stuModelToBeUpdated.Collegeid = int.Parse(this.dataGridView1.CurrentRow.Cells["collegeid"].Value.ToString());
     }
     else
     {
         stuModelToBeUpdated.Collegeid = int.Parse(this.dataGridView1.CurrentRow.Cells["college_id"].Value.ToString());
     }
     //stuModelToBeUpdated = stuBusiness.getStuBySid(sid);
     int result = stuBusiness.updatestudent(stuModelToBeUpdated);
     if (result != 0)
     {
         MessageBox.Show("更新成功");
     }
     else
     {
         MessageBox.Show("更新失败");
     }
 }