public PageLeavingEventArgs OnPageLeaving(PageLeavingEventArgs e)
 {
     /*
      * GlobalVariables.SourceColumns.Add(new Database.MyDbColumn { ColumnName = "ID" });
      * GlobalVariables.SourceColumns.Add(new Database.MyDbColumn { ColumnName = "S_NAME" });
      * GlobalVariables.SourceColumns.Add(new Database.MyDbColumn { ColumnName = "I_AGE" });
      * GlobalVariables.SourceColumns.Add(new Database.MyDbColumn { ColumnName = "S_ADDRESS" });
      * GlobalVariables.SourceColumns.Add(new Database.MyDbColumn { ColumnName = "D_CREATED" });
      * GlobalVariables.SourceColumns.Add(new Database.MyDbColumn { ColumnName = "D_MODIFIED" });
      *
      * GlobalVariables.TargetColumns.Add(new Database.MyDbColumn { ColumnName = "EmployeeID" });
      * GlobalVariables.TargetColumns.Add(new Database.MyDbColumn { ColumnName = "Name" });
      * GlobalVariables.TargetColumns.Add(new Database.MyDbColumn { ColumnName = "Age_Current" });
      * GlobalVariables.TargetColumns.Add(new Database.MyDbColumn { ColumnName = "Age_Original" });
      * GlobalVariables.TargetColumns.Add(new Database.MyDbColumn { ColumnName = "Age_Previous" });
      * GlobalVariables.TargetColumns.Add(new Database.MyDbColumn { ColumnName = "Age_Effective_From" });
      * GlobalVariables.TargetColumns.Add(new Database.MyDbColumn { ColumnName = "Address" });
      * GlobalVariables.TargetColumns.Add(new Database.MyDbColumn { ColumnName = "StartDate" });
      * GlobalVariables.TargetColumns.Add(new Database.MyDbColumn { ColumnName = "EndDate" });
      * GlobalVariables.TargetColumns.Add(new Database.MyDbColumn { ColumnName = "IsActiveRecord" });
      *
      * GlobalVariables.UserColumns.Add(new Database.MyDbColumn { ColumnName = "@CurrentDateTime" });
      */
     return(e);
 }
Beispiel #2
0
        public PageLeavingEventArgs OnPageLeaving(PageLeavingEventArgs e)
        {
            if (dataGridView1.Rows.Count > 0)
            {
                e.Cancel = true;
                e.PageErrors.Add(new PageError {
                    Control = dataGridView1, ErrorMessage = "Duplicate Business Keys found!"
                });
            }

            return(e);
        }
        public PageLeavingEventArgs OnPageLeaving(PageLeavingEventArgs e)
        {
            if (!GlobalVariables.ColumnMappings.Any(cm => cm.TransformationCode == ETransformationCode.DELETED_DATE || cm.TransformationCode == ETransformationCode.IS_DELETED) && GlobalVariables.Options.RecordsOnTargetNotFoundOnSourceMode == ERecordsOnTargetNotFoundOnSourceMode.UpdateTargetField)
            {
                e.Cancel = true;
                e.PageErrors.Add(new PageError {
                    Control = propertyGrid1, ErrorMessage = "Cannot select UpdateTargetField option when there are no 'Deleted Date' and/or 'Is Deleted' transformations defined"
                });
            }

            return(e);
        }
        public PageLeavingEventArgs OnPageLeaving(PageLeavingEventArgs e)
        {
            var result = transformationGridView1.GetMappingResults();

            if (result.Messages.Any(m => m.MessageType == Components.EMappingMessageType.ERROR))
            {
                e.Cancel = true;
                e.PageErrors.Add(new PageError {
                    Control = panel2, ErrorMessage = result.Messages.First(m => m.MessageType == Components.EMappingMessageType.ERROR).MessageText
                });
            }
            return(e);
        }
Beispiel #5
0
        public PageLeavingEventArgs OnPageLeaving(PageLeavingEventArgs e)
        {
            List <string> variableValues = new List <string>();

            GlobalVariables.UserColumns.Clear();
            GlobalVariables.UserColumnsDefinitions.Clear();

            Exception ex = testSQL();

            if (ex != null)
            {
                e.Cancel = true;
                e.PageErrors.Add(new PageError {
                    Control = dgvUserFields, ErrorMessage = string.Format("System Fields are not defined properly! Use TSQL standards.{0}{0}Error:{0}{1}", Environment.NewLine, ex.Message)
                });
                return(e);
            }

            DbCommand cmd = GlobalVariables.SourceConnection.GetConn().CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = getSQL(true);

            DbDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                variableValues.Add(rdr[1].ToString());
            }
            rdr.Close();

            for (int i = 0; i < dgvUserFields.Rows.Count - 1; i++)
            {
                if (!dgvUserFields.Rows[i].IsNewRow)
                {
                    GlobalVariables.UserColumns.Add(new MyDbColumn {
                        ColumnName = "@" + dgvUserFields.Rows[i].Cells["colName"].Value
                    });
                    GlobalVariables.UserColumnsDefinitions.Add(new MyUserVariable {
                        Name = dgvUserFields.Rows[i].Cells["colName"].Value.ToString(), ColumnName = "@" + dgvUserFields.Rows[i].Cells["colName"].Value, DataType = dgvUserFields.Rows[i].Cells["colDataType"].Value.ToString(), Definition = dgvUserFields.Rows[i].Cells["colDefinition"].Value.ToString(), Value = variableValues[i].ToUpper()
                    });
                }
            }

            GlobalVariables.UserColumnsDefsQuery = getSQL(false);

            return(e);
        }
        public PageLeavingEventArgs OnPageLeaving(PageLeavingEventArgs e)
        {
            if (GlobalVariables.TargetConnection == null)
            {
                GlobalVariables.TargetConnection = DbHelper.CreateConnection(rtbTgtConnStr.Text);
            }

            if (GlobalVariables.TargetConnection == null)
            {
                e.Cancel = true;
                e.PageErrors.Add(new PageError {
                    Control = rtbTgtConnStr, ErrorMessage = "Target connection cannot be established."
                });
            }

            if (GlobalVariables.TargetConnection != null && !GlobalVariables.TargetConnection.IsConnectionOpened())
            {
                e.Cancel = true;
                e.PageErrors.Add(new PageError {
                    Control = rtbTgtConnStr, ErrorMessage = "Target connection cannot be opened."
                });
            }

            if (string.IsNullOrEmpty(cbxTgtTableOrViewName.Text))
            {
                e.Cancel = true;
                e.PageErrors.Add(new PageError {
                    Control = cbxTgtTableOrViewName, ErrorMessage = "You must select source table or view"
                });
            }


            if (!e.Cancel)
            {
                string commandText = "SELECT * FROM " + cbxTgtTableOrViewName.Text;
                var    tc          = DbHelper.GetColumns(GlobalVariables.TargetConnection, commandText);
                if (tc != null)
                {
                    GlobalVariables.TargetColumns = tc.ToList();
                }

                GlobalVariables.TargetObjectName = cbxTgtTableOrViewName.Text;
            }

            return(e);
        }
        private void buttonNext_Click(object sender, EventArgs e)
        {
            var plea = new PageLeavingEventArgs();

            errorProvider1.Clear();

            var res = _pages[CurrentPageIndex].OnPageLeaving(plea);

            if (!res.Cancel)
            {
                CurrentPageIndex = getNextShowablePageIndex();
                _pages[CurrentPageIndex].OnPageEntering();
                showPage((TheMasterPage)_pages[CurrentPageIndex]);
            }
            else
            {
                for (int i = res.PageErrors.Count - 1; i >= 0; i--)
                //foreach (PageError pe in res.PageErrors)
                {
                    errorProvider1.SetIconAlignment(res.PageErrors[i].Control, ErrorIconAlignment.MiddleLeft);
                    errorProvider1.SetError(res.PageErrors[i].Control, !string.IsNullOrEmpty(res.PageErrors[i].ErrorMessage) ? res.PageErrors[i].ErrorMessage : "Error");
                }
            }
        }
Beispiel #8
0
        public PageLeavingEventArgs OnPageLeaving(PageLeavingEventArgs e)
        {
            if (GlobalVariables.SourceConnection == null)
            {
                GlobalVariables.SourceConnection = DbHelper.CreateConnection(rtbSrcConnStr.Text);
            }

            if (GlobalVariables.SourceConnection == null)
            {
                e.Cancel = true;
                e.PageErrors.Add(new PageError {
                    Control = rtbSrcConnStr, ErrorMessage = "Source connection cannot be established"
                });
            }
            if (GlobalVariables.SourceConnection != null && !GlobalVariables.SourceConnection.IsConnectionOpened())
            {
                e.Cancel = true;
                e.PageErrors.Add(new PageError {
                    Control = rtbSrcConnStr, ErrorMessage = "Source connection cannot be opened"
                });
            }

            if (rbIsTableOrView.Checked && cbxSrcTableOrViewName.SelectedIndex < 0)
            {
                e.Cancel = true;
                e.PageErrors.Add(new PageError {
                    Control = cbxSrcTableOrViewName, ErrorMessage = "Select source table or view"
                });
            }
            if (rbIsCommandText.Checked && string.IsNullOrEmpty(rtbCommandText.Text))
            {
                e.Cancel = true;
                e.PageErrors.Add(new PageError {
                    Control = rtbCommandText, ErrorMessage = "Enter source command text"
                });
            }

            if (!e.Cancel)
            {
                string commandText;
                if (rbIsTableOrView.Checked)
                {
                    commandText = "SELECT * FROM " + cbxSrcTableOrViewName.Text;
                }
                else
                {
                    commandText = rtbCommandText.Text;
                }


                var sc = DbHelper.GetColumns(GlobalVariables.SourceConnection, commandText);
                if (sc != null)
                {
                    GlobalVariables.SourceColumns = sc.ToList();
                }

                GlobalVariables.SourceObjectName        = cbxSrcTableOrViewName.Text;
                GlobalVariables.SourceIsTableOrViewMode = rbIsTableOrView.Checked;
                GlobalVariables.SourceCommandText       = rtbCommandText.Text;
            }
            return(e);
        }
 public PageLeavingEventArgs OnPageLeaving(PageLeavingEventArgs e)
 {
     return(e);
 }