Exemple #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DataTableCreateForm dataTableCreateForm = new DataTableCreateForm();
            string temp = dataTableCreateForm.fromDataCreatedFormString();



            //int Colcount = createdDataTable.Columns.Count;
            //SetTableDataStringFormat += "&&=";
            //foreach (DataColumn column in createdDataTable.Columns)
            //{
            //    SetTableDataStringFormat += column.ColumnName.ToString() + "|";
            //}
            //SetTableDataStringFormat += "=+";
            //foreach (DataRow row in createdDataTable.Rows)
            //{

            //    for (int i=0; i < Colcount;i++)
            //    {
            //        SetTableDataStringFormat += row[i].ToString() + " ";
            //    }

            //    SetTableDataStringFormat += "##";
            //}
            //SetTableDataStringFormat += "+&&";

            ModelItem.Properties["TableInfo"].SetValue(new InArgument <string>(temp));
        }
Exemple #2
0
        private void DataTableCreateButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //GetTableDataStringFormat = ModelItem.Properties["TableInfo"].ComputedValue.ToString();
                //abc.ToString(); InArgument<string> abc;
                //GetTableDataStringFormat = ModelItem.Properties["TableInfo"].Value.GetCurrentValue().ToString();
                // DialogResult dialogResult = dataTableCreateWindow.ShowDialog();
                if (ModelItem.Properties["TableInfo"].Value != null)
                {
                    string dtstring = ModelItem.Properties["TableInfo"].Value.Content.ComputedValue.ToString();
                    DataTableCreateForm.GetCreatedDataTable(dtstring);
                }
                else
                {
                    DataTableCreateForm.GetCreatedDataTable(null);
                }

                DataTableCreateForm dataTableCreateForm = new DataTableCreateForm();
                dataTableCreateForm.Show();

                //ModelItem.Properties["TableInfo"].SetValue(new InArgument<string>("Heloo123!!"));
            }
            catch (Exception ex)
            {
                Logger.Log.Logger.LogData("Error in DataTable Create:" + ex.Message, Logger.LogLevel.Error);
            }
        }
        public void Ok_BtnClick(object sender, EventArgs e)
        {
            try
            {
                DataTableCreateForm frm2 = new DataTableCreateForm();
                string columnName        = txtColumnName.Text;
                string defauktvalue      = txtDefaultValue.Text;
                string maxl      = txtMaxLength.Text;
                int    maxlength = 0;



                bool unique        = chkUnique.Checked;
                bool allowNull     = chkAllowNull.Checked;
                bool AutoIncrement = chkAutoIncrement.Checked;


                //Type a = (Type)comboBoxDataType.SelectedItem;
                string dataType = (string)comboBoxDataType.SelectedItem;
                //Type dataType = (Type)comboBoxDataType.SelectedItem;
                System.Data.DataColumn newColumn = null;
                if (defauktvalue.Equals(""))
                {
                    defauktvalue = null;
                }
                else
                {
                    //newColumn.DefaultValue = defauktvalue;   testing...
                }



                if (comboBoxDataType.SelectedIndex == 0)
                {
                    Logger.Log.Logger.LogData("Data Type is not selected", LogLevel.Error);
                }
                else
                {
                    if (dataType.Equals("string"))
                    {
                        if (maxl.Equals(""))
                        {
                            maxlength = 100000000;
                        }
                        else
                        {
                            maxlength = Int32.Parse(maxl);
                        }
                        newColumn.MaxLength    = maxlength;
                        newColumn.DefaultValue = defauktvalue;
                    }
                    lblColumnName.Text      = AddNewColumnForm.SetValueForColumnName;
                    newColumn               = new System.Data.DataColumn(columnName);
                    newColumn.DataType      = System.Type.GetType("System." + dataType);
                    newColumn.DefaultValue  = defauktvalue; //testing..
                    newColumn.Unique        = unique;
                    newColumn.AllowDBNull   = allowNull;
                    newColumn.AutoIncrement = AutoIncrement;
                    //dtable = frm2.fromDataCreatedForm();
                    //DataTableCreateForm.dtable.Columns.
                }

                DataTableCreateForm.dtable.Columns.Add(newColumn);
                DataTableCreateForm.dtable.AcceptChanges();
                dtFromAddNewForm(DataTableCreateForm.dtable);


                frm2.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                Logger.Log.Logger.LogData("Error in Import:" + ex.Message, Logger.LogLevel.Error);
            }
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                DataTableCreateForm dataTableCreateForm = new DataTableCreateForm();
                string editColName = txtColumnName.Text;
                int    index       = Convert.ToInt32(Index.Text);



                string maxl      = txtMaxLength.Text;
                int    maxlength = 0;
                if (maxl.Equals(""))
                {
                    maxlength = 0;
                }
                else
                {
                    maxlength = Int32.Parse(maxl);
                }
                string defauktvalue  = txtDefaultValue.Text;
                bool   unique        = chkUnique.Checked;
                bool   allowNull     = chkAllowNull.Checked;
                bool   AutoIncrement = chkAutoIncrement.Checked;

                if (editColName != "")
                {
                    dataTableCreateForm.Edit(index, editColName);
                }
                if (comboBoxDataType.SelectedIndex != 0)
                {
                    string dataType = (string)comboBoxDataType.SelectedItem;
                    dataTableCreateForm.EditDatatype(index, dataType);
                }
                if (defauktvalue != null)
                {
                    dataTableCreateForm.EditDefaultvalue(index, defauktvalue);
                }
                if (maxlength != 0)
                {
                    dataTableCreateForm.Editmaxlength(index, maxlength);
                }
                if (allowNull != false)
                {
                    dataTableCreateForm.EditallowNull(index, allowNull);
                }
                if (unique != false)
                {
                    dataTableCreateForm.Editunique(index, unique);
                }
                if (AutoIncrement != false)
                {
                    dataTableCreateForm.EditAutoIncrement(index, AutoIncrement);
                }


                this.Close();
            }
            catch (Exception)
            {
                throw;
            }
        }