private void btnEdit_Click(object sender, EventArgs e) { BUS.DBAControl ctr = new BUS.DBAControl(); if (ctr.IsExist(txtCode.Text)) { EnableForm(true); //ddlQD.Enabled = false; txtCode.Enabled = false; _processStatus = "A"; } }
private void btnCopy_Click(object sender, EventArgs e) { BUS.DBAControl ctr = new BUS.DBAControl(); if (ctr.IsExist(txtCode.Text)) { EnableForm(true); txtCode.Focus(); txtCode.SelectAll(); //txtCode.Text = ""; //_code = ""; _processStatus = "C"; } }
private void btnDelete_Click(object sender, EventArgs e) { BUS.DBAControl ctr = new BUS.DBAControl(); if (ctr.IsExist(txtCode.Text)) { if (MessageBox.Show("Do you want to delete " + txtCode.Text + " schema?", "Message", MessageBoxButtons.OKCancel) == DialogResult.OK) { string sErr = ctr.Delete(txtCode.Text); RefreshForm(""); EnableForm(false); } } }
private void btnSave_Click(object sender, EventArgs e) { string sErr = ""; BUS.DBAControl ctr = new BUS.DBAControl(); DTO.DBAInfo inf = new DTO.DBAInfo(); if (_processStatus == "C") { if (!ctr.IsExist(txtCode.Text)) { ctr.Add(GetDataFromForm(inf), ref sErr); } else { sErr = txtCode.Text.Trim() + " is exist!"; } } else if (_processStatus == "A") { sErr = ctr.Update(GetDataFromForm(inf)); _config.DIR[0].TMP = inf.REPORT_TEMPLATE_DRIVER; } if (sErr == "") { if (inf.REPORT_TEMPLATE_DRIVER != "") { if (!File.Exists(inf.REPORT_TEMPLATE_DRIVER + "\\-.template.xls")) { File.Copy(Application.StartupPath + "\\-.template.xls", inf.REPORT_TEMPLATE_DRIVER + "\\-.template.xls"); } if (!File.Exists(inf.REPORT_TEMPLATE_DRIVER + "\\-.template.xlsx")) { File.Copy(Application.StartupPath + "\\-.template.xlsx", inf.REPORT_TEMPLATE_DRIVER + "\\-.template.xlsx"); } if (!File.Exists(inf.REPORT_TEMPLATE_DRIVER + "\\NODATA.xls")) { File.Copy(Application.StartupPath + "\\NODATA.xls", inf.REPORT_TEMPLATE_DRIVER + "\\NODATA.xls"); } } _processStatus = "V"; EnableForm(false); } else { MessageBox.Show(sErr); } }
private void btnView_Click(object sender, EventArgs e) { string sErr = ""; _processStatus = "V"; Form_DTBView frm = new Form_DTBView(); //frm.Connect = _dtb; if (frm.ShowDialog() == DialogResult.OK) { if (frm.Code_DTB != "") { BUS.DBAControl ctr = new BUS.DBAControl(); DTO.DBAInfo inf = ctr.Get(frm.Code_DTB, ref sErr); SetDataToForm(inf); } } if (sErr == "") { EnableForm(false); _processStatus = "V"; } }