Esempio n. 1
0
        public void insert(string staffID, ScoreDTO value)
        {
            string cmd = "SP_INS_DIEM";
            SqlCmd = new SqlCommand(cmd, SqlCon);
            SqlCmd.CommandType = CommandType.StoredProcedure;

            SqlParameter StaffID = new SqlParameter("@MANV", SqlDbType.VarChar, 20, "MANV");
            StaffID.IsNullable = false;
            StaffID.Direction = ParameterDirection.Input;
            StaffID.Value = staffID;
            SqlCmd.Parameters.Add(StaffID);

            SqlParameter StudentID = new SqlParameter("@MASV", SqlDbType.VarChar, 20, "MASV");
            StudentID.IsNullable = false;
            StudentID.Direction = ParameterDirection.Input;
            StudentID.Value = value.StudentID;
            SqlCmd.Parameters.Add(StudentID);

            SqlParameter CourseID = new SqlParameter("@MAHP", SqlDbType.VarChar, 20, "MAHP");
            CourseID.IsNullable = false;
            CourseID.Direction = ParameterDirection.Input;
            CourseID.Value = value.CourseID;
            SqlCmd.Parameters.Add(CourseID);

            SqlParameter Score = new SqlParameter("@DIEMTHI", SqlDbType.VarBinary, 8000, "DIEMTHI");
            Score.IsNullable = false;
            Score.Direction = ParameterDirection.Input;
            Score.Value = value.Score;
            SqlCmd.Parameters.Add(Score);

            this.executeNonQuery();
        }
Esempio n. 2
0
 public void addScore(string staffID, ScoreDTO value)
 {
     scoredao.insert(staffID, value);
 }
Esempio n. 3
0
        private void button_Commit3_Click(object sender, EventArgs e)
        {
            try
            {
                ScoreDTO scoredto = new ScoreDTO();

                RSA_Encrypt = new RSACryptoServiceProvider();

                if (publicKey != "")
                    RSA_Encrypt.FromXmlString(publicKey);
                else if (comboKey != "")
                    RSA_Encrypt.FromXmlString(comboKey);
                else
                {
                    MessageBox.Show("Bạn chưa nhập key. Vui lòng nhập key trước khi thực hiện thao tác này.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                string temp = string.Format("{0}", float.Parse(textBox_Score3.Text));
                byte[] encryptedScore = RSA_Encrypt.Encrypt(Encoding.ASCII.GetBytes(temp), true);

                scoredto.StudentID = textBox_Student3.Text;
                scoredto.CourseID = textBox_CourseID3.Text;
                scoredto.Score = encryptedScore;

                scorebll.addScore(_staffdto.StaffID, scoredto);

                textBox_Student3.Text = "";
                textBox_CourseID3.Text = "";
                textBox_Score3.Text = "";
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }