Пример #1
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            string sErr = "";

            BUS.LIST_QDControl        control    = new BUS.LIST_QDControl();
            BUS.LIST_QD_SCHEMAControl controlADD = new BUS.LIST_QD_SCHEMAControl();
            try
            {
                foreach (DataRow row in dt.Rows)
                {
                    if ((bool)row["tmp_Validated"] == true)
                    {
                        if (_type == "QD")
                        {
                            control.TransferIn(row, ref sErr);
                        }
                        else if (_type == "QDADD")
                        {
                            sErr = controlADD.TransferIn(row);
                        }
                    }
                }
                Close();
            }
            catch { }
        }
Пример #2
0
        private void btnView_Click(object sender, EventArgs e)
        {
            string sErr = "";

            _processStatus = "V";
            frmQDADDView frm = new frmQDADDView(_db, _user);

            //frm.Connect = _db;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (frm.ReturnCode != "")
                {
                    BUS.LIST_QD_SCHEMAControl ctr = new BUS.LIST_QD_SCHEMAControl();
                    DTO.LIST_QD_SCHEMAInfo    inf = ctr.Get(_db, frm.ReturnCode, ref sErr);
                    SetDataToForm(inf);
                }
            }
            if (sErr == "")
            {
                EnableForm(false);
                _processStatus = "V";
            }
            dgvFrom.AutoSizeColumns();
            dgvField.AutoSizeColumns();
        }
Пример #3
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            if (_type == "QD")
            {
                BUS.LIST_QDControl control = new BUS.LIST_QDControl();
                dt = control.ToTransferInStruct();
                foreach (DataColumn col in dt.Columns)
                {
                    col.DataType = typeof(string);
                }
            }
            else if (_type == "QDADD")
            {
                BUS.LIST_QD_SCHEMAControl control = new BUS.LIST_QD_SCHEMAControl();
                dt = control.ToTransferInStruct();
                foreach (DataColumn col in dt.Columns)
                {
                    col.DataType = typeof(string);
                }
            }
            BUS.CommoControl commonCtr = new BUS.CommoControl();

            try
            {
                dt.ReadXml(txtFileName.Text);
                dt = commonCtr.ValidatedDataTransferIn(dt, _type);
                radGridView1.DataSource = dt;
                radGridView1.RetrieveStructure();
                radGridView1.RootTable.Columns["tmp_Validated"].Visible = false;
            }
            catch { }
        }
Пример #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string sErr = "";

            BUS.LIST_QD_SCHEMAControl ctr = new BUS.LIST_QD_SCHEMAControl();
            DTO.LIST_QD_SCHEMAInfo    inf = new DTO.LIST_QD_SCHEMAInfo();

            if (_processStatus == "C")
            {
                if (!ctr.IsExist(_db, 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);
            }
        }
Пример #5
0
 private void FrmTransferOut_Load(object sender, EventArgs e)
 {
     if (_type == "QD")
     {
         BUS.LIST_QDControl control = new BUS.LIST_QDControl();
         dt = control.GetTransferOut_LIST_QD(_db, QD_CODE, ref sErr);
     }
     else if (_type == "QDADD")
     {
         BUS.LIST_QD_SCHEMAControl control = new BUS.LIST_QD_SCHEMAControl();
         if (QD_CODE != "")
         {
             DTO.LIST_QD_SCHEMAInfo inf = control.Get(_db, QD_CODE, ref sErr);
             dt = inf.ToDataTable();
             dt.Rows.Add(inf.ToDataRow(dt));
             dt.TableName = "Table";
         }
         else
         {
             dt = control.GetAll(_db, ref sErr);
         }
     }
     else if (_type == "TASK")
     {
         BUS.LIST_TASKControl control = new BUS.LIST_TASKControl();
         if (QD_CODE != "")
         {
             DTO.LIST_TASKInfo inf = control.Get(_db, QD_CODE, ref sErr);
             dt = DTO.LIST_TASKInfo.ToDataTable();
             dt.Rows.Add(inf.ToDataRow(dt));
             dt.TableName = "Table";
         }
         else
         {
             dt = control.GetAll(_db, ref sErr);
         }
     }
     else if (_type == "POD")
     {
         BUS.PODControl control = new BUS.PODControl();
         if (QD_CODE != "")
         {
             DTO.PODInfo inf = control.Get(QD_CODE, ref sErr);
             dt = DTO.PODInfo.ToDataTable();
             dt.Rows.Add(inf.ToDataRow(dt));
             dt.TableName = "Table";
         }
         else
         {
             dt = control.GetAll(ref sErr);
         }
     }
     dtEnd = dt.Copy();
     radGridView1.DataSource = dtEnd;
     radGridView1.RetrieveStructure();
 }
Пример #6
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     BUS.LIST_QD_SCHEMAControl ctr = new BUS.LIST_QD_SCHEMAControl();
     if (ctr.IsExist(_db, txtCode.Text))
     {
         EnableForm(true);
         //ddlQD.Enabled = false;
         txtCode.Enabled = false;
         _processStatus  = "A";
     }
 }
Пример #7
0
 private void btnCopy_Click(object sender, EventArgs e)
 {
     BUS.LIST_QD_SCHEMAControl ctr = new BUS.LIST_QD_SCHEMAControl();
     if (ctr.IsExist(_db, txtCode.Text))
     {
         EnableForm(true);
         txtCode.Focus();
         txtCode.SelectAll();
         //txtCode.Text = "";
         //_code = "";
         _processStatus = "C";
     }
 }
Пример #8
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     BUS.LIST_QD_SCHEMAControl ctr = new BUS.LIST_QD_SCHEMAControl();
     if (ctr.IsExist(_db, txtCode.Text))
     {
         if (MessageBox.Show("Do you want to delete " + txtCode.Text + " schema?", "Message", MessageBoxButtons.OKCancel) == DialogResult.OK)
         {
             string sErr = ctr.Delete(_db, txtCode.Text);
             RefreshForm("");
             EnableForm(false);
         }
     }
 }
Пример #9
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            string sErr = "";

            BUS.LIST_QD_SCHEMAControl ctr = new BUS.LIST_QD_SCHEMAControl();
            DataTable dt = ctr.GetAll(_conn_ID, ref sErr);

            dt.Columns["SCHEMA_ID"].ColumnName = "Code";
            //dgvQDADDView.AutoGenerateColumns = false;
            dgvQDADDView.DataSource = dt;
            //dgvQDADDView.AutoSizeColumns();
            SaveLayout(dgvQDADDView);
        }
Пример #10
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            string sErr = "";

            BUS.LIST_QD_SCHEMAControl ctr = new BUS.LIST_QD_SCHEMAControl();
            DataTable dt = ctr.GetAll(_db, ref sErr);

            foreach (DataRow row in dt.Rows)
            {
                DTO.LIST_QD_SCHEMAInfo inf = new DTO.LIST_QD_SCHEMAInfo(row);
                try
                {
                    if (inf.FROM_TEXT[0] == '<')
                    {
                    }
                    _data.Tables["_TableName"].Rows.Clear();
                    _data.Tables["fromcode"].Rows.Clear();
                    _data = ReadScheme(inf);
                    DataTable dtfield = _data.Tables["_TableName"];
                    string    field   = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><SUN_SCHEMA>{0}</SUN_SCHEMA>";
                    string    tmp     = "";
                    string    from    = "";
                    foreach (DataRow jrow in dtfield.Rows)
                    {
                        tmp += string.Format("<row table=\"{0}\" node=\"{1}\" name=\"{2}\" nodeDesc=\"{3}\" type=\"{4}\" conn_id=\"{5}\"/>", jrow["table"], jrow["node"], jrow["name"], jrow["nodeDesc"], jrow["type"], inf.DEFAULT_CONN);
                    }
                    DataTable dtfrom = _data.Tables["fromcode"];
                    field = string.Format(field, tmp);
                    tmp   = "";
                    foreach (DataRow jrow in dtfrom.Rows)
                    {
                        tmp += string.Format("<row fromcode=\"{0}\" lookup=\"{1}\"/> ", jrow["fromcode"], frmQDADD.XmlEncode(jrow["lookup"].ToString()));
                    }
                    from = tmp;

                    //result = doc.InnerXml;
                    inf.FIELD_TEXT = field;
                    inf.FROM_TEXT  = Form_QD.StringToBase64(from);
                    ctr.Update(inf);
                }
                catch (Exception ex)
                { }
            }
        }
Пример #11
0
        private void frmLookup_Load(object sender, EventArgs e)
        {
            string sErr = "";

            BUS.LIST_QD_SCHEMAControl ctr = new BUS.LIST_QD_SCHEMAControl();
            DataTable dt = ctr.GetAll(_db, ref sErr);

            if (_conn_ID != "")
            {
                dt.DefaultView.RowFilter = "DEFAULT_CONN='" + _conn_ID + "'";
            }
            dt.Columns["SCHEMA_ID"].ColumnName = "Code";
            //dgvQDADDView.AutoGenerateColumns = false;
            string DAField = "DAG";

            if (_user != "TVC")
            {
                sErr = BUS.LIST_DAControl.SetDataAccessGroup(DAField, dt, _user);
            }
            LoadDataGrid(dgvQDADDView, dt);
        }
Пример #12
0
        private void btnRelation_Click(object sender, EventArgs e)
        {
            string       sErr    = "";
            frmQDADDView frmview = new frmQDADDView(_db, _user);

            frmview.Conn_ID = ddlQD.Text;

            if (frmview.ShowDialog() == DialogResult.OK && frmview.ReturnCode != "")
            {
                frmRelation frm = new frmRelation();
                frm.DTOriginal = _data.Tables["_TableName"];
                BUS.LIST_QD_SCHEMAControl ctr = new BUS.LIST_QD_SCHEMAControl();
                DTO.LIST_QD_SCHEMAInfo    inf = ctr.Get(_db, frmview.ReturnCode, ref sErr);
                if (inf.SCHEMA_ID != "")
                {
                    try
                    {
                        ////string result = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><SUN_SCHEMA></SUN_SCHEMA>";
                        //XmlDocument doc = new XmlDocument();
                        //doc.LoadXml(inf.FIELD_TEXT);
                        //XmlElement docele = doc.DocumentElement;

                        ////<row table="M5" node="Lookup" name="Lookup" type=""/>
                        //string schema = inf.FROM_TEXT;
                        DataSet dset = ReadScheme(inf);
                        //dset = ReadScheme(inf);
                        //DataTable dtfrom = new DataTable("fromcode");
                        //DataColumn[] colfrom = new DataColumn[] { new DataColumn("fromcode"), new DataColumn("lookup") };
                        //dtfrom.Columns.AddRange(colfrom);

                        //    DataTable dtfield = new DataTable("_TableName");
                        //    DataColumn[] colfield = new DataColumn[] { new DataColumn("node")
                        //, new DataColumn("table")
                        //, new DataColumn("name")
                        //, new DataColumn("nodeDesc")
                        //, new DataColumn("type")};
                        //    dtfield.Columns.AddRange(colfield);

                        //    //dset.Tables.Add(dtfrom);
                        //    dset.Tables.Add(dtfield);
                        //    //DataRelation relation = new DataRelation("R_field", dtfrom.Columns["fromcode"], dtfield.Columns["table"], true);
                        //    //dset.Relations.Add(relation);
                        //    StringReader strR = new StringReader(schema);
                        //    dset.ReadXml(strR);
                        frm.DTLooup = dset.Tables["_TableName"];
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            DataTable dtR      = frm.Relation;
                            DataRow   fromRow  = _data.Tables["fromcode"].NewRow();
                            DataRow   fieldRow = _data.Tables["_TableName"].NewRow();
                            fieldRow["node"]    = frmview.ReturnCode;
                            fieldRow["name"]    = frmview.ReturnCode + "Record";
                            fieldRow["type"]    = "S";
                            fieldRow["table"]   = txtCode.Text.Trim();
                            fromRow["fromcode"] = String.Format("{0}\\{1}", txtCode.Text.Trim(), frmview.ReturnCode);
                            string lookup = "";
                            foreach (DataRow row in dtR.Rows)
                            {
                                if (row["Original"].ToString().Contains(" "))
                                {
                                    row["Original"] = String.Format("[{0}]", row["Original"]);
                                }
                                if (row["lookup"].ToString().Contains(" "))
                                {
                                    row["lookup"] = String.Format("[{0}]", row["lookup"]);
                                }
                                lookup += String.Format(" and {0}.{1} = {2}.{3}", txtCode.Text.Trim(), row["Original"], frmview.ReturnCode, row["lookup"]);
                            }
                            fromRow["lookup"] = lookup.Substring(5);
                            _data.Tables["fromcode"].Rows.Add(fromRow);
                            if (dgvField.CurrentRow != null && dgvField.CurrentRow.RowIndex >= 0)
                            {
                                _data.Tables["_TableName"].Rows.InsertAt(fieldRow, dgvField.CurrentRow.RowIndex);
                            }
                            else
                            {
                                _data.Tables["_TableName"].Rows.Add(fieldRow);
                            }
                        }
                    }
                    catch (Exception ex) { lbErr.Text = ex.Message; }
                }
            }
        }