Exemplo n.º 1
0
        //删除成绩
        private void btnDeleteStu_Click(object sender, RoutedEventArgs e)
        {
            selesco = smDgScoreLsit.SelectedItem as StuCoreExt;
            if (selesco == null)
            {
                System.Windows.Forms.MessageBox.Show("请选择要删除的学员!", "提示");
                return;
            }
            StuCoreExt scorE = scoreManager.GetStudentById(selesco.StudentID);

            if (scorE != null)
            {
                System.Windows.Forms.MessageBox.Show("您选择的学员信息已删除", "提示");
            }
            MessageBoxResult mbox = MessageBox.Show("您确定要删除【" + scorE.StudentName + "】", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);

            if (mbox == MessageBoxResult.OK)
            {
                if (scoreManager.DeleScore(scorE.StudentID))
                {
                    MessageBox.Show("删除成功");
                    RefreshDG();
                }
                else
                {
                    MessageBox.Show("删除失败");
                }
            }
        }
Exemplo n.º 2
0
 //输入学号失焦事件
 private void textstuId_LostFocus(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(textstuId.Text))
     {
         System.Windows.Forms.MessageBox.Show("学号不能为空!!!", "提示");
         textstuId.Focus();
     }
     else
     {
         int stuId = Convert.ToInt32(textstuId.Text.Trim());
         //先判断是否存在此学生,再判断是否存在成绩
         stuexe = stumanage.GetStudentById(stuId); //获取到学生信息
         scoexe = scomanage.GetStudentById(stuId); //获取学生的成绩信息
         //1.判断是否存在此学生,存在的话,再判断是否已经存储成绩
         if (stuexe != null)
         {
             //2.判断是否已有成绩
             if (scoexe == null)                           //如果没有成绩
             {
                 labStuName.Content  = stuexe.StudentName; //姓名显示
                 labStuClass.Content = stuexe.ClassName;   //学号显示
             }
             else
             {
                 System.Windows.Forms.MessageBox.Show("已有成绩,请重新输入!!!", "友情提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                 textstuId.Focus();
             }
         }
         else
         {
             System.Windows.Forms.MessageBox.Show("不存在此学生,请重新输入!!!", "友情提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
             textstuId.Focus();
         }
     }
 }
Exemplo n.º 3
0
 public FrmUpdateScoreInfo(StuCoreExt scorexe)
 {
     score = scorexe;
     InitializeComponent();
     labStuName.Content   = scorexe.StudentName;
     labStuID.Content     = scorexe.StudentID;
     textCsharpScore.Text = scorexe.CSharp.ToString();
     textSqlScore.Text    = scorexe.SQLServerDB.ToString();
 }
Exemplo n.º 4
0
 /// <summary>
 /// 修改学员成绩
 /// </summary>
 /// <param name="score">学员对象</param>
 /// <returns></returns>
 public bool UpScore(StuCoreExt score)
 {
     if (scoserver.UpScore(score) <= 0)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 添加学员
        /// </summary>
        /// <param name="sco"></param>
        /// <returns></returns>
        public bool AddScore(StuCoreExt sco)
        {
            int addsc = scoserver.AddScore(sco);

            if (addsc <= 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 通过学号查询成绩信息
        /// </summary>
        /// <param name="id">学号</param>
        /// <returns></returns>
        public StuCoreExt GetScoreById(int id)
        {
            string        sql    = "SELECT ScoreList.StudentID, StudentName,StudentClass.ClassName,CSharp,SQLServerDB,ScoreUpdateTime  FROM ScoreList JOIN Students ON ScoreList.StudentID=Students.StudentID JOIN StudentClass ON Students.ClassID=StudentClass.ClassID WHERE ScoreList.StudentID=" + id + "";
            SqlDataReader reader = DBHelper.SQLHelper.DataReader(sql);
            StuCoreExt    score  = null;

            while (reader.Read())
            {
                score = new StuCoreExt()
                {
                    StudentID       = Convert.ToInt32(reader["StudentID"]),
                    StudentName     = reader["StudentName"].ToString(),
                    ClassName       = reader["ClassName"].ToString(),
                    CSharp          = Convert.ToInt32(reader["CSharp"]),
                    SQLServerDB     = Convert.ToInt32(reader["SQLServerDB"]),
                    ScoreUpdateTime = Convert.ToDateTime(reader["ScoreUpdateTime"])
                };
            }
            return(score);
        }
Exemplo n.º 7
0
        //修改成绩
        private void btnUpdateStu_Click(object sender, RoutedEventArgs e)
        {
            selesco = smDgScoreLsit.SelectedItem as StuCoreExt;
            try
            {
                if (selesco == null)
                {
                    MessageBox.Show("请选择要修改的学员!", "提示");
                    return;
                }
            }
            catch (Exception)
            {
                System.Windows.Forms.MessageBox.Show("请选定学员!");
                return;
            }
            StuCoreExt         objscor         = scoreManager.GetStudentById(selesco.StudentID);
            FrmUpdateScoreInfo updateScoreInfo = new FrmUpdateScoreInfo(objscor);

            updateScoreInfo.ShowDialog();
            //刷新DG中学员信息
            RefreshDG();
        }
Exemplo n.º 8
0
        /// <summary>
        /// 修改学员成绩
        /// </summary>
        /// <param name="scor">成绩对象</param>
        /// <returns></returns>
        public int UpScore(StuCoreExt scor)
        {
            string sql = string.Format("UPDATE ScoreList SET CSharp={0},SQLServerDB={1} WHERE StudentID={2}", scor.CSharp, scor.SQLServerDB, scor.StudentID);

            return(DBHelper.SQLHelper.ExecuteNonQurey(sql));
        }
Exemplo n.º 9
0
        /// <summary>
        /// 添加学员成绩
        /// </summary>
        /// <param name="sco"></param>
        /// <returns></returns>
        public int AddScore(StuCoreExt sco)
        {
            string sql = string.Format("INSERT ScoreList VALUES ({0},{1},{2},'{3}')", sco.StudentID, sco.CSharp, sco.SQLServerDB, sco.ScoreUpdateTime);

            return(DBHelper.SQLHelper.ExecuteNonQurey(sql));
        }