private void btnXoa_Click(object sender, EventArgs e) { try { int k = gridView1.SelectedRowsCount; if (k > 0) { int[] arrSelect = gridView1.GetSelectedRows(); for (int i = 0; i < k; i++) { long MaDT = long.Parse(gridView1.GetRowCellValue(arrSelect[i], colID).ToString()); WebUp temp = WebUp.Get(MaDT); if (temp != null) { if (WebUp.Delete(temp.ID)) { _LoadDSWebLink(); } else { MessageBox.Show("Không thể link đang được sử dụng"); } } } } } catch { } }
private void _SelectUpdateWebLink() { try { int k = gridView1.SelectedRowsCount; if (k > 0) { int RowHandle = gridView1.GetSelectedRows()[k - 1]; if (RowHandle >= 0) { long iDDT = long.Parse(gridView1.GetRowCellValue(RowHandle, colID).ToString()); WebUp temp = WebUp.Get(iDDT); if (temp != null) { frmWebLink frm = new frmWebLink(_Type, _TypePage); frm._cus = temp; if (frm.ShowDialog() == DialogResult.OK) { _LoadDSWebLink(); } } } } } catch { } }
private void gridView2_DoubleClick(object sender, EventArgs e) { try { int k = gridView2.SelectedRowsCount; if (k > 0) { int RowHandle = gridView2.GetSelectedRows()[k - 1]; if (RowHandle >= 0) { long iDDT = long.Parse(gridView2.GetRowCellValue(RowHandle, colID).ToString()); WebUp temp = WebUp.Get(iDDT); if (temp != null) { frmWebLink frm = new frmWebLink(NumCode.UPWEB, NumCode.WEB); frm._cus = temp; if (frm.ShowDialog() == DialogResult.OK) { _LoadDSWebLink(); } } } } } catch { } }
private void btnLuu_Click(object sender, EventArgs e) { WebUp temp = _getFormInfo(); if (temp != null) { if (_cus == null) //thêm mới { _cus = temp; txtID.Text = WebUp.Insert(_cus).ToString(); DialogResult = DialogResult.OK; if (chkCloseAlterSave.Checked) { this.Close(); return; } _setFormStatus(-1); } else //cập nhật { temp.ID = _cus.ID; _cus = temp; WebUp.Update(_cus); DialogResult = DialogResult.OK; if (chkCloseAlterSave.Checked) { this.Close(); return; } _setFormStatus(-1); } } }
private void _ClearForm() { txtID.Text = ""; lookUpEdit_Nhom.EditValue = null; lookUpEditPage.EditValue = null; txtUsername.Text = ""; txtUrlPost.Text = ""; txtPassword.Text = ""; txtNote.Text = ""; txtTopic.Text = ""; txtIDTopic.Text = ""; _cus = null; lookUpEditPage.Focus(); }
private WebUp _getFormInfo() { WebUp temp = null; if (lookUpEditPage.EditValue != null) { if (lookUpEdit_Nhom.EditValue != null) { if (txtUrlPost.Text != "") { temp = new WebUp(); temp.Group = (int)lookUpEdit_Nhom.EditValue; temp.Page = long.Parse(lookUpEditPage.EditValue.ToString()); temp.Type = _Type; temp.UrlPost = txtUrlPost.Text; temp.Note = txtNote.Text; temp.Topic = txtTopic.Text; temp.IDTopic = txtIDTopic.Text; } else { MessageBox.Show("Nhập link topic cần post tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txtUrlPost.Focus(); } } else { MessageBox.Show("Chọn nhóm link", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); lookUpEdit_Nhom.Focus(); } } else { MessageBox.Show("Chọn trang Web", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); lookUpEditPage.Focus(); } return(temp); }
private void btnXoa_Click(object sender, EventArgs e) { if (_cus != null) { if (WebUp.Delete(_cus.ID)) { DialogResult = DialogResult.OK; if (chkCloseAlterSave.Checked) { this.Close(); return; } _ClearForm(); _setFormStatus(-1); } else { MessageBox.Show("Không thể xoá weblink đang được sử dụng"); } } }