private void btnAdd_Click(object sender, EventArgs e)
        {
            List<string> lstSrcColumn = new List<string>();
            List<string> lstDesColumn = new List<string>();

            InfoTransactionTransFieldsAddDialog ittfad = new InfoTransactionTransFieldsAddDialog();

            if (strSrcTable != string.Empty && _conn != null)
            {

                if (uctran != null && uctran.SelectCmd != null)
                {
                    ittfad.cmbSrcField.Items.AddRange(uctran.SelectCmd.GetFields());
                }
            }

            if (strDesTable != string.Empty && _conn != null)
            {
                try
                {
                    lstDesColumn = AddColumn(strDesTable);
                }
                catch(Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error",  MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                foreach (string strColumn in lstDesColumn)
                {
                    ittfad.cmbDesField.Items.Add(strColumn);
                }
            }

            ittfad.cbxUpdateMode.Items.Add("Dec");
            ittfad.cbxUpdateMode.Items.Add("Disable");
            ittfad.cbxUpdateMode.Items.Add("Inc");
            ittfad.cbxUpdateMode.Items.Add("Replace");
            ittfad.cbxUpdateMode.Items.Add("WriteBack");
            ittfad.cbxUpdateMode.SelectedIndex = 3;

            if (ittfad.ShowDialog() == DialogResult.OK)
            {
                TransField tf = new TransField();
                tf.DesField = ittfad.cmbDesField.Text;
                tf.SrcField = ittfad.cmbSrcField.Text;
                tf.SrcGetValue = ittfad.txtSrcGetValue.Text;

                switch (ittfad.cbxUpdateMode.SelectedIndex)
                {
                    case 0:
                        tf.UpdateMode = UpdateMode.Dec;
                        break;
                    case 1:
                        tf.UpdateMode = UpdateMode.Disable;
                        break;
                    case 2:
                        tf.UpdateMode = UpdateMode.Inc;
                        break;
                    case 3:
                        tf.UpdateMode = UpdateMode.Replace;
                        break;
                    case 4:
                        tf.UpdateMode = UpdateMode.WriteBack;
                        break;
                }
                this.transPrivateCopy.TransFields.Add(tf);

                this.lbDesField.Items.Add(tf.DesField);
                this.lbScrField.Items.Add(tf.SrcField);

                switch (tf.UpdateMode)
                {
                    case UpdateMode.Dec:
                        this.lbRelation.Items.Add(tf.DesField + " - " + tf.SrcField);
                        break;
                    case UpdateMode.Disable:
                        this.lbRelation.Items.Add(tf.DesField + " X " + tf.SrcField);
                        break;
                    case UpdateMode.Inc:
                        this.lbRelation.Items.Add(tf.DesField + " + " + tf.SrcField);
                        break;
                    case UpdateMode.Replace:
                        this.lbRelation.Items.Add(tf.DesField + " = " + tf.SrcField);
                        break;
                    case UpdateMode.WriteBack:
                        this.lbRelation.Items.Add(tf.DesField + " <- " + tf.SrcField);
                        break;
                }
            }
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int selindex = this.lbRelation.SelectedIndex;

            List<string> lstSrcColumn = new List<string>();
            List<string> lstDesColumn = new List<string>();

            if (selindex != -1)
            {
                InfoTransactionTransFieldsAddDialog ittfad = new InfoTransactionTransFieldsAddDialog();

                if (strSrcTable != string.Empty && _conn != null)
                {
                    if (uctran != null && uctran.SelectCmd != null)
                    {
                        ittfad.cmbSrcField.Items.AddRange(uctran.SelectCmd.GetFields());
                    }
                }

                if (strDesTable != string.Empty && _conn != null)
                {
                    try
                    {
                        lstDesColumn = AddColumn(strDesTable);
                    }
                    catch
                    {
                        MessageBox.Show(string.Format("Transtable :{0} \ndoesn't exist", strDesTable));
                        return;
                    }
                    foreach (string strColumn in lstDesColumn)
                    {
                        ittfad.cmbDesField.Items.Add(strColumn);
                    }
                }

                ittfad.cbxUpdateMode.Items.Add("Dec");
                ittfad.cbxUpdateMode.Items.Add("Disable");
                ittfad.cbxUpdateMode.Items.Add("Inc");
                ittfad.cbxUpdateMode.Items.Add("Replace");
                ittfad.cbxUpdateMode.Items.Add("WriteBack");

                ittfad.cmbDesField.Text = this.lbDesField.Items[selindex].ToString();
                ittfad.cmbSrcField.Text = this.lbScrField.Items[selindex].ToString();
                ittfad.txtSrcGetValue.Text = this.txtSrcGetValue.Text;

                switch (((TransField)this.transPrivateCopy.TransFields[selindex]).UpdateMode)
                {
                    case UpdateMode.Dec:
                        ittfad.cbxUpdateMode.SelectedIndex = 0;
                        break;
                    case UpdateMode.Disable:
                        ittfad.cbxUpdateMode.SelectedIndex = 1;
                        break;
                    case UpdateMode.Inc:
                        ittfad.cbxUpdateMode.SelectedIndex = 2;
                        break;
                    case UpdateMode.Replace:
                        ittfad.cbxUpdateMode.SelectedIndex = 3;
                        break;
                    case UpdateMode.WriteBack:
                        ittfad.cbxUpdateMode.SelectedIndex = 4;
                        break;
                }

                if (ittfad.ShowDialog() == DialogResult.OK)
                {
                    TransField tf = new TransField();
                    tf.DesField = ittfad.cmbDesField.Text;
                    tf.SrcField = ittfad.cmbSrcField.Text;
                    tf.SrcGetValue = ittfad.txtSrcGetValue.Text;

                    switch (ittfad.cbxUpdateMode.SelectedIndex)
                    {
                        case 0:
                            tf.UpdateMode = UpdateMode.Dec;
                            break;
                        case 1:
                            tf.UpdateMode = UpdateMode.Disable;
                            break;
                        case 2:
                            tf.UpdateMode = UpdateMode.Inc;
                            break;
                        case 3:
                            tf.UpdateMode = UpdateMode.Replace;
                            break;
                        case 4:
                            tf.UpdateMode = UpdateMode.WriteBack;
                            break;
                    }

                    this.transPrivateCopy.TransFields[selindex] = tf;
                    this.lbDesField.Items[selindex] = tf.DesField;
                    this.lbScrField.Items[selindex] = tf.SrcField;

                    switch (tf.UpdateMode)
                    {
                        case UpdateMode.Dec:
                            this.lbRelation.Items[selindex] = tf.DesField + " - " + tf.SrcField;
                            break;
                        case UpdateMode.Disable:
                            this.lbRelation.Items[selindex] = tf.DesField + " X " + tf.SrcField;
                            break;
                        case UpdateMode.Inc:
                            this.lbRelation.Items[selindex] = tf.DesField + " + " + tf.SrcField;
                            break;
                        case UpdateMode.Replace:
                            this.lbRelation.Items[selindex] = tf.DesField + " = " + tf.SrcField;
                            break;
                        case UpdateMode.WriteBack:
                            this.lbRelation.Items[selindex] = tf.DesField + " <- " + tf.SrcField;
                            break;
                    }

                }

            }
        }