Exemple #1
0
 private void SetDataToForm(DTO.DBAInfo inf)
 {
     RefreshForm("");
     txtDescription.Text = inf.DESCRIPTION;
     txtCode.Text        = inf.DB;
     txtTMP.Text         = inf.REPORT_TEMPLATE_DRIVER;
 }
Exemple #2
0
 private void frmChangeDB_Load(object sender, EventArgs e)
 {
     txtdatabase.Text = _dtb;
     BUS.DBAControl dbaCtr = new DBAControl();
     DTO.DBAInfo    dbaInf = dbaCtr.Get(txtdatabase.Text, ref sErr);
     txt_database.Text = dbaInf.DESCRIPTION;
 }
Exemple #3
0
 private void txtdatabase_Validated(object sender, EventArgs e)
 {
     BUS.DBAControl dbaCtr = new DBAControl();
     DTO.DBAInfo    dbaInf = dbaCtr.Get(txtdatabase.Text, ref sErr);
     txt_database.Text = dbaInf.DESCRIPTION;
     //ResetForm();
 }
Exemple #4
0
        private DTO.DBAInfo GetDataFromForm(DTO.DBAInfo inf)
        {
            inf.DB                     = inf.DB1 = inf.DB2 = txtCode.Text;
            inf.DESCRIPTION            = txtDescription.Text;
            inf.REPORT_TEMPLATE_DRIVER = txtTMP.Text;

            return(inf);
        }
Exemple #5
0
        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);
            }
        }
Exemple #6
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            Form_QD.DB = txtdatabase.Text;
            if (_user != "TVC" && checkBox1.Checked)
            {
                BUS.PODControl podCtr = new PODControl();
                DTO.PODInfo    podInf = podCtr.Get(_user, ref sErr);
                podInf.DB_DEFAULT = txtdatabase.Text;
                podCtr.Update(podInf);
            }
            BUS.DBAControl dbaCtr = new DBAControl();
            DTO.DBAInfo    dbaInf = dbaCtr.Get(txtdatabase.Text, ref sErr);
            reportDir = dbaInf.REPORT_TEMPLATE_DRIVER;

            DialogResult = DialogResult.OK;
            Close();
        }
Exemple #7
0
        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";
            }
        }