public int Delete(clsCauLuaChon_DTO clcDTO) { try { ListDictionary _list = new ListDictionary(); _list.Add("MaCauLuaChon", clcDTO.MaCauLuaChon); int iReturn = obj.ExcSql("Delete_Cau_Lua_Chon", _list, CommandType.StoredProcedure); return iReturn; } catch (Exception) { //return ex.Message; return -1111; } }
public int Delete(clsCauLuaChon_DTO clcDTO) { try { ListDictionary _list = new ListDictionary(); _list.Add("MaCauLuaChon", clcDTO.MaCauLuaChon); int iReturn = obj.ExcSql("Delete_Cau_Lua_Chon", _list, CommandType.StoredProcedure); return(iReturn); } catch (Exception) { //return ex.Message; return(-1111); } }
public DataTable getCauLuaChon(clsCauLuaChon_DTO clcDTO) { ListDictionary _list = new ListDictionary(); _list.Add("MaCauLuaChon", clcDTO.MaCauLuaChon); _list.Add("NoiDungCLC", clcDTO.NoiDungCLC); DataTable dt = new DataTable(); try { dt = obj.GetDataTable("Select_Cau_Lua_Chon", CommandType.StoredProcedure); } catch { dt = null; } return dt; }
public int InsertUpdate(clsCauLuaChon_DTO clcDTO) { try { ListDictionary _list = new ListDictionary(); _list.Add("old_id", clcDTO.OldID); _list.Add("MaCauLuaChon", clcDTO.MaCauLuaChon); _list.Add("NoiDungCLC", clcDTO.NoiDungCLC); int iReturn = obj.ExcSql("Insert_Update_Cau_Lua_Chon", _list, CommandType.StoredProcedure); return iReturn; } catch (Exception) { //return ex.Message; return -1111; // Đặt số này làm ngoại lệ ko lường trước được. ở StoredProcedure không được return có số này tránh trường hợp trùng } }
public int InsertUpdate(clsCauLuaChon_DTO clcDTO) { try { ListDictionary _list = new ListDictionary(); _list.Add("old_id", clcDTO.OldID); _list.Add("MaCauLuaChon", clcDTO.MaCauLuaChon); _list.Add("NoiDungCLC", clcDTO.NoiDungCLC); int iReturn = obj.ExcSql("Insert_Update_Cau_Lua_Chon", _list, CommandType.StoredProcedure); return(iReturn); } catch (Exception) { //return ex.Message; return(-1111); // Đặt số này làm ngoại lệ ko lường trước được. ở StoredProcedure không được return có số này tránh trường hợp trùng } }
public DataTable getCauLuaChon(clsCauLuaChon_DTO clcDTO) { ListDictionary _list = new ListDictionary(); _list.Add("MaCauLuaChon", clcDTO.MaCauLuaChon); _list.Add("NoiDungCLC", clcDTO.NoiDungCLC); DataTable dt = new DataTable(); try { dt = obj.GetDataTable("Select_Cau_Lua_Chon", CommandType.StoredProcedure); } catch { dt = null; } return(dt); }
protected void Page_Load(object sender, EventArgs e) { if (Convert.ToString(Session["TenDangNhap"]) == "") { Response.Redirect("~/dangnhap.aspx"); } lchoiDAL = new clsLoaiCauHoi_DAL(); lchoiDTO = new clsLoaiCauHoi_DTO(); choiDAL = new clsCauHoi_DAL(); choiDTO = new clsCauHoi_DTO(); clchonDAL = new clsCauLuaChon_DAL(); clchonDTO = new clsCauLuaChon_DTO(); choi_clchonDAL = new clsCauHoi_CauLuaChon_DAL(); choi_clchonDTO = new clsCauHoi_CauLuaChon_DTO(); ctchoiDAL = new clsChiTietCauHoi_DAL(); cmn = new clsCommon(); loadMasterData(); }
protected void btnLuu_Click(object sender, EventArgs e) { choiDTO = new clsCauHoi_DTO(); clchonDTO = new clsCauLuaChon_DTO(); choi_clchonDTO = new clsCauHoi_CauLuaChon_DTO(); choiDTO.NoiDung = txtNoiDung.Text.ToString(); choiDTO.HinhAnh = uplFile.FileName.ToString(); choiDTO.MaloaiCauHoi = cboLoaiCauHoi.SelectedIndex.ToString(); int iReturn = choiDAL.InsertUpdate(choiDTO); if (iReturn > 0) { uplFile.SaveAs(Server.MapPath(@"~\hinh\") + uplFile.FileName); Response.Write("Lưu dữ liệu thành công"); } else { Response.Write("lưu dữ liệu thất bại"); txtNoiDung.Focus(); } clchonDTO.NoiDungCLC = txtCauLuaChon.Text.ToString(); int iReturn1 = clchonDAL.InsertUpdate(clchonDTO); if (iReturn1 > 0) { // uplFile.SaveAs(Server.MapPath(@"~\hinh\") + uplFile.FileName); Response.Write("Lưu dữ liệu thành công"); } else { Response.Write("lưu dữ liệu thất bại"); // txtNoiDung.Focus(); } clchonDTO.NoiDungCLC = txtCauLuaChon1.Text.ToString(); int iReturn2 = clchonDAL.InsertUpdate(clchonDTO); if (iReturn2 > 0) { // uplFile.SaveAs(Server.MapPath(@"~\hinh\") + uplFile.FileName); Response.Write("Lưu dữ liệu thành công"); } else { Response.Write("lưu dữ liệu thất bại"); // txtNoiDung.Focus(); } clchonDTO.NoiDungCLC = txtCauLuaChon2.Text.ToString(); int iReturn3 = clchonDAL.InsertUpdate(clchonDTO); if (iReturn3 > 0) { // uplFile.SaveAs(Server.MapPath(@"~\hinh\") + uplFile.FileName); Response.Write("Lưu dữ liệu thành công"); } else { Response.Write("lưu dữ liệu thất bại"); // txtNoiDung.Focus(); } clchonDTO.NoiDungCLC = txtCauLuaChon3.Text.ToString(); int iReturn4 = clchonDAL.InsertUpdate(clchonDTO); if (iReturn4 > 0) { // uplFile.SaveAs(Server.MapPath(@"~\hinh\") + uplFile.FileName); Response.Write("Lưu dữ liệu thành công"); } else { Response.Write("lưu dữ liệu thất bại"); // txtNoiDung.Focus(); } choi_clchonDTO.MaCauHoi = iReturn.ToString(); choi_clchonDTO.MaCauLuaChon = iReturn1.ToString(); choi_clchonDTO.DapAn = rbtDapAn.Checked.ToString(); int iReturn5 = choi_clchonDAL.InsertUpdate(choi_clchonDTO); if (iReturn5 >= 0) { // uplFile.SaveAs(Server.MapPath(@"~\hinh\") + uplFile.FileName); Response.Write("Lưu dữ liệu thành công"); } else { Response.Write("lưu dữ liệu thất bại"); // txtNoiDung.Focus(); } choi_clchonDTO.MaCauHoi = iReturn.ToString(); choi_clchonDTO.MaCauLuaChon = iReturn2.ToString(); choi_clchonDTO.DapAn = rbtDapAn1.Checked.ToString(); int iReturn6 = choi_clchonDAL.InsertUpdate(choi_clchonDTO); if (iReturn6 >= 0) { // uplFile.SaveAs(Server.MapPath(@"~\hinh\") + uplFile.FileName); Response.Write("Lưu dữ liệu thành công"); } else { Response.Write("lưu dữ liệu thất bại"); // txtNoiDung.Focus(); } choi_clchonDTO.MaCauHoi = iReturn.ToString(); choi_clchonDTO.MaCauLuaChon = iReturn3.ToString(); choi_clchonDTO.DapAn = rbtDapAn2.Checked.ToString(); int iReturn7 = choi_clchonDAL.InsertUpdate(choi_clchonDTO); if (iReturn7 >= 0) { // uplFile.SaveAs(Server.MapPath(@"~\hinh\") + uplFile.FileName); Response.Write("Lưu dữ liệu thành công"); } else { Response.Write("lưu dữ liệu thất bại"); // txtNoiDung.Focus(); } choi_clchonDTO.MaCauHoi = iReturn.ToString(); choi_clchonDTO.MaCauLuaChon = iReturn4.ToString(); choi_clchonDTO.DapAn = rbtDapAn3.Checked.ToString(); int iReturn8 = choi_clchonDAL.InsertUpdate(choi_clchonDTO); if (iReturn8 >= 0) { // uplFile.SaveAs(Server.MapPath(@"~\hinh\") + uplFile.FileName); Response.Write("Lưu dữ liệu thành công"); } else { Response.Write("lưu dữ liệu thất bại"); // txtNoiDung.Focus(); } }
protected void Page_Load(object sender, EventArgs e) { if (Convert.ToString(Session["TenDangNhap"]) == "") Response.Redirect("~/dangnhap.aspx"); lchoiDAL = new clsLoaiCauHoi_DAL(); lchoiDTO = new clsLoaiCauHoi_DTO(); choiDAL = new clsCauHoi_DAL(); choiDTO = new clsCauHoi_DTO(); clchonDAL = new clsCauLuaChon_DAL(); clchonDTO = new clsCauLuaChon_DTO(); choi_clchonDAL = new clsCauHoi_CauLuaChon_DAL(); choi_clchonDTO = new clsCauHoi_CauLuaChon_DTO(); ctchoiDAL = new clsChiTietCauHoi_DAL(); cmn = new clsCommon(); loadMasterData(); }