private void BtnThem_Click(object sender, EventArgs e) { ServiceReference1.Option obj = new ServiceReference1.Option(); //CmbAns.Items.Add(TxtAns.Text); obj.idopt = CmbOption.Text; obj.deadlinetime = dateTimePicker1.Value; //obj.contents = TxtCt.Text; obj.contents = TxtAns.Text; if (obj.contents == TxtCt.Text) { } if (TxtAns.Text == "") { MessageBox.Show("Nhập thiếu thông tin", "Thông Báo", MessageBoxButtons.OK); return; } if (client.ThemOption(obj) == true) { MessageBox.Show("Đã Thêm", "Thông Báo", MessageBoxButtons.OK); } else { MessageBox.Show("Id bị trùng", "Thông Báo", MessageBoxButtons.OK); } }
private void BtnSua_Click(object sender, EventArgs e) { if (TxtAns.Text == "") { MessageBox.Show("Thiếu thông tin", "Thông báo"); return; } if (MessageBox.Show("Bạn có chắc là sửa ?", "NOTE", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { ServiceReference1.Option obj = new ServiceReference1.Option(); obj.code = CmbAns.SelectedValue.ToString(); obj.contents = TxtAns.Text; client.SuaOption(obj); } }
private void BtnXoa_Click(object sender, EventArgs e) { //int id = CmbAns.SelectedIndex; //CmbAns.Items.RemoveAt(id); if (TxtAns.Text == "") { MessageBox.Show("Thiếu điều kiện", "Thông báo"); return; } if (MessageBox.Show("Bạn có chắc là xóa ?", "NOTE", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { ServiceReference1.Option obj = new ServiceReference1.Option(); obj.code = CmbAns.SelectedValue.ToString(); obj.contents = TxtAns.Text; client.XoaOption(obj); MessageBox.Show("Đã Xóa", "Thông báo"); //BtnLoad_Click(sender, e); } FrmLoadOption_Load(sender, e); }
private void FrmLoadOption_Load(object sender, EventArgs e) { DataSet da = new DataSet(); da = client.DistinctOpt(); CmbOption.DataSource = da.Tables[0]; CmbOption.DisplayMember = "idopt"; CmbOption.ValueMember = "idopt"; ServiceReference1.Option obj = new ServiceReference1.Option(); DataSet ds = new DataSet(); ds = client.DsAns(); CmbAns.DataSource = ds.Tables[0]; CmbAns.DisplayMember = "Contents"; CmbAns.ValueMember = "Code"; //TxtContent.Text = DataSet dr = new DataSet(); dr = client.DsQuestion(); //TxtContent.Text = dr.Tables[0].Rows[0][0].ToString(); }
private void TxtNext_Click(object sender, EventArgs e) { ServiceReference1.Option obj = new ServiceReference1.Option(); obj.contents = TxtAns.Text; if (obj.contents == TxtContent.Text) { } obj.deadlinetime = dateTimePicker1.Value; obj.idopt = CmbOption.Text; if (TxtAns.Text == "") { MessageBox.Show("Nhap Thieu Thong Tin", "Thong bao", MessageBoxButtons.OK); return; } if (client.ThemContents(obj) == true) { MessageBox.Show("Da Them", "Thong Bao", MessageBoxButtons.OK); } else { MessageBox.Show("Id bị trùng", "Thong Bao", MessageBoxButtons.OK); } FrmLoadOption_Load(sender, e); }