Example #1
0
        public static bool ThemLop(Entities.Lop lop)
        {
            DataTable dt = LopDAL.ThemLop(lop);

            foreach (DataRow row in dt.Rows)
            {
                if (row.ItemArray[0].ToString().Trim() == "0")
                {
                    return(true);
                }
            }

            return(false);
        }
Example #2
0
        private void ThemLop()
        {
            maLop = LopBLL.AutoMaLop();
            Entities.Lop lop = new Entities.Lop(maLop,
                                                cboLoaiLop.SelectedValue.ToString(),
                                                txtTaoLop.Text,
                                                Int32.Parse(txtNam.Text),
                                                cboGVCN.SelectedValue.ToString(),
                                                Int32.Parse(txtSS.Text));

            if (!LopBLL.ThemLop(lop))
            {
                MessageBox.Show("Thêm lớp thất bại");
            }
        }
Example #3
0
        public static DataTable ThemLop(Entities.Lop lop)
        {
            DataAccessHelper db  = new DataAccessHelper();
            SqlCommand       cmd = db.Command("THEMLOP");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@MaLop", lop.MaLop);
            cmd.Parameters.AddWithValue("@MaLoaiLop", lop.MaLoaiLop);
            cmd.Parameters.AddWithValue("@NamHoc", lop.NamHoc);
            cmd.Parameters.AddWithValue("@MaGV", lop.MaGV);
            cmd.Parameters.AddWithValue("@SiSo", lop.SiSo);
            cmd.Parameters.AddWithValue("@TenLop", lop.TenLop);

            SqlDataAdapter da = new SqlDataAdapter(cmd);

            db.dt = new DataTable();
            da.Fill(db.dt);
            return(db.dt);
        }