コード例 #1
0
 public static int AddQuestion2DA(DTO.CauHoi2DA ch)
 {
     return(DAL.CauHoiNangCao.AddQuestion2DA(ch));
 }
コード例 #2
0
ファイル: CauHoiNangCao.cs プロジェクト: 2MonCsharp/C-3Layer
        public static int AddQuestion2DA(DTO.CauHoi2DA ch)
        {
            string cmd = "EXEC Nhapcauuhoi2dapan '" + ch.Cauhoi + "','" + ch.MsChuDe + "',N'" + ch.DapAn1 + "',N'" + ch.DapAn2 + "','" + ch.DA1right + "','" + ch.DA2right + "'";

            return(ConnectDB.ExecuteNonQuery(cmd));
        }
コード例 #3
0
        private void AddQuestion()
        {
            int countDA = 2;

            if (rtb_DA3.TextLength > 0)
            {
                if (rtb_DA4.TextLength > 0)
                {
                    countDA = 4;
                }
                else
                {
                    countDA = 3;
                }
            }

            if (countDA == 2)
            {
                DTO.CauHoi2DA ch = new DTO.CauHoi2DA();
                ch.Cauhoi = rtb_cauHoi.Text;
                ch.DapAn1 = rtb_DA1.Text;
                ch.DapAn2 = rtb_DA2.Text;
                if (cb_DA1.Checked)
                {
                    ch.DA1right = "1";
                }
                else
                {
                    ch.DA1right = "0";
                }
                if (cb_DA2.Checked)
                {
                    ch.DA2right = "1";
                }
                else
                {
                    ch.DA1right = "0";
                }
                ch.MsChuDe = cbb_Chude.SelectedValue.ToString();
                BLL.CauHoiNangCao.AddQuestion2DA(ch);
            }
            if (countDA == 3)
            {
                DTO.CauHoi3DA ch = new DTO.CauHoi3DA();
                ch.Cauhoi = rtb_cauHoi.Text;
                ch.DapAn1 = rtb_DA1.Text;
                ch.DapAn2 = rtb_DA2.Text;
                ch.DapAn3 = rtb_DA3.Text;
                if (cb_DA1.Checked)
                {
                    ch.DA1right = "1";
                }
                else
                {
                    ch.DA1right = "0";
                }
                if (cb_DA2.Checked)
                {
                    ch.DA2right = "1";
                }
                else
                {
                    ch.DA2right = "0";
                }
                if (cb_DA3.Checked)
                {
                    ch.DA3right = "1";
                }
                else
                {
                    ch.DA3right = "0";
                }
                ch.MsChuDe = cbb_Chude.SelectedValue.ToString();
                BLL.CauHoiNangCao.AddQuestion2DA(ch);
            }
            if (countDA == 4)
            {
                DTO.CauHoi4DA ch = new DTO.CauHoi4DA();
                ch.Cauhoi = rtb_cauHoi.Text;
                ch.DapAn1 = rtb_DA1.Text;
                ch.DapAn2 = rtb_DA2.Text;
                ch.DapAn3 = rtb_DA3.Text;
                ch.DapAn4 = rtb_DA4.Text;
                if (cb_DA4.Checked)
                {
                    ch.DA4right = "1";
                }
                else
                {
                    ch.DA4right = "0";
                }
                if (cb_DA3.Checked)
                {
                    ch.DA3right = "1";
                }
                else
                {
                    ch.DA3right = "0";
                }
                if (cb_DA1.Checked)
                {
                    ch.DA1right = "1";
                }
                else
                {
                    ch.DA1right = "0";
                }
                if (cb_DA2.Checked)
                {
                    ch.DA2right = "1";
                }
                else
                {
                    ch.DA2right = "0";
                }
                ch.MsChuDe = cbb_Chude.SelectedValue.ToString();
                BLL.CauHoiNangCao.AddQuestion4DA(ch);
            }
        }