Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string sErr = "";

            BUS.IMPORT_SCHEMAControl ctr = new BUS.IMPORT_SCHEMAControl();
            DTO.IMPORT_SCHEMAInfo    inf = new DTO.IMPORT_SCHEMAInfo();

            if (_processStatus == "C")
            {
                if (!ctr.IsExist(ddlQD.Text, txtCode.Text))
                {
                    ctr.Add(GetDataFromForm(inf), ref sErr);
                }
                else
                {
                    sErr = txtCode.Text.Trim() + " is exist!";
                }
            }
            else if (_processStatus == "A")
            {
                sErr = ctr.InsertUpdate(GetDataFromForm(inf));
            }
            if (sErr == "")
            {
                _processStatus = "V";
                EnableForm(false);
            }
            else
            {
                MessageBox.Show(sErr);
            }
        }
Ejemplo n.º 2
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     BUS.IMPORT_SCHEMAControl ctr = new BUS.IMPORT_SCHEMAControl();
     if (ctr.IsExist(ddlQD.Text, txtCode.Text))
     {
         EnableForm(true);
         //ddlQD.Enabled = false;
         txtCode.Enabled = false;
         _processStatus  = "A";
     }
 }
Ejemplo n.º 3
0
 private BUS.IMPORT_SCHEMAControl AddValidatedList(BUS.IMPORT_SCHEMAControl _importCtr, string db, string xml)
 {
     _importCtr.ListV.Clear();
     _importCtr.LKey.Clear();
     _importCtr.DtStruct = BUS.IMPORT_SCHEMAControl.GetStruct(xml);
     foreach (DataRow row in _importCtr.DtStruct.Rows)
     {
         if ((row["Tag"] != DBNull.Value && row["Tag"].ToString() != "") || (row["IsNull"] == DBNull.Value || row["IsNull"].ToString() == "False"))
         {
             if (row["Tag"] != DBNull.Value && row["Tag"].ToString() != "")
             {
                 objValidatedList objVal   = new objValidatedList(row["Tag"]);
                 ValueList        validate = new ValueList();
                 if (row["IsNull"] != DBNull.Value && row["IsNull"].ToString() == "True")
                 {
                     validate.IsNull = true;
                 }
                 else
                 {
                     validate.IsNull = false;
                 }
                 validate.Key     = row["Key"].ToString();
                 validate.Message = objVal.Message;
                 BUS.LIST_QDControl      ctr  = new BUS.LIST_QDControl();
                 DTO.LIST_QDInfo         inf  = ctr.Get_LIST_QD(db, objVal.QD, ref _sErr);
                 QueryBuilder.SQLBuilder sqlB = QueryBuilder.SQLBuilder.LoadSQLBuilderFromDataBase(inf.QD_ID, inf.DTB, inf.ANAL_Q0);
                 sqlB.StrConnectDes = Form_QD._strConnectDes;
                 DataTable dt = sqlB.BuildDataTable(inf.SQL_TEXT);
                 foreach (DataRow aRow in dt.Rows)
                 {
                     if (!validate.Content.Contains(aRow[objVal.Field].ToString().Trim()))
                     {
                         validate.Content.Add(aRow[objVal.Field].ToString().Trim());
                     }
                 }
                 _importCtr.ListV.Add(validate);
             }
             else
             {
                 ValueList validate = new ValueList();
                 //if (row["IsNull"] == DBNull._Value || row["IsNull"].ToString() == "False")
                 validate.IsNull = false;
                 validate.Key    = row["Key"].ToString();
                 _importCtr.ListV.Add(validate);
             }
         }
         if (row["PrimaryKey"].ToString() == "True")
         {
             _importCtr.LKey.Add(row["Key"].ToString());
         }
     }
     return(_importCtr);
 }
Ejemplo n.º 4
0
 private void btnCopy_Click(object sender, EventArgs e)
 {
     BUS.IMPORT_SCHEMAControl ctr = new BUS.IMPORT_SCHEMAControl();
     if (ctr.IsExist(ddlQD.Text, txtCode.Text))
     {
         EnableForm(true);
         txtCode.Focus();
         txtCode.SelectAll();
         //txtCode.Text = "";
         //_code = "";
         _processStatus = "C";
     }
 }
Ejemplo n.º 5
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     BUS.IMPORT_SCHEMAControl ctr = new BUS.IMPORT_SCHEMAControl();
     if (ctr.IsExist(ddlQD.Text, txtCode.Text))
     {
         if (MessageBox.Show("Do you want to delete " + txtCode.Text + " schema?", "Message", MessageBoxButtons.OKCancel) == DialogResult.OK)
         {
             string sErr = ctr.Delete(ddlQD.Text, txtCode.Text);
             RefreshForm("");
             EnableForm(false);
         }
     }
 }
Ejemplo n.º 6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            BUS.IMPORT_SCHEMAControl ctr = new BUS.IMPORT_SCHEMAControl();
            string    sErr = "";
            DataTable dt   = ctr.GetAll(_dtb, ref sErr);

            BUS.LIST_DAControl daCtr       = new LIST_DAControl();
            DataTable          dtPermision = daCtr.GetPermission(Form_QD._user, ref sErr);

            for (int i = dt.Rows.Count - 1; i >= 0; i--)
            {
                DTO.IMPORT_SCHEMAInfo impInf = new DTO.IMPORT_SCHEMAInfo(dt.Rows[i]);
                string flag = "";
                bool   ie   = true;
                foreach (DataRow row in dtPermision.Rows)
                {
                    if (impInf.DAG.Trim() != "")
                    {
                        if (row["DAG_ID"].ToString() == impInf.DAG)
                        {
                            flag = row["EI"].ToString();
                        }
                        else if (row["EI"].ToString() == "I")
                        {
                            ie = false;
                        }
                    }
                }
                if ((flag == "" && ie) || flag == "I")
                {
                }
                else
                {
                    dt.Rows.Remove(dt.Rows[i]);
                }
            }
            ddlImport.DataSource       = dt;
            ddlImport.ValueMember      = "SCHEMA_ID";
            ddlImport.DisplayMember    = "DESCRIPTN";
            cboConvertor.SelectedIndex = 0;
            //_importCtr.StrConn = Form_QD._strConnectDes;
        }
Ejemplo n.º 7
0
        private void btnView_Click(object sender, EventArgs e)
        {
            string sErr = "";

            _processStatus = "V";
            frmImportDefView frm = new frmImportDefView();

            frm.Connect = _dtb;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (frm.ReturnCode != "")
                {
                    BUS.IMPORT_SCHEMAControl ctr = new BUS.IMPORT_SCHEMAControl();
                    DTO.IMPORT_SCHEMAInfo    inf = ctr.Get(_dtb, frm.ReturnCode, ref sErr);
                    SetDataToForm(inf);
                }
            }
            if (sErr == "")
            {
                EnableForm(false);
                _processStatus = "V";
            }
            dgvField.AutoSizeColumns();
        }