private void BtnOK_OnClick(object sender, RoutedEventArgs e)
        {
            int i = 0;

            foreach (var VARIABLE in MainPanel.Children)
            {
                Type mType = VARIABLE.GetType();

                switch (mType.Name)
                {
                case "TextBox":
                    obj.GetType().GetProperties()[i].SetValue(obj, ((TextBox)VARIABLE).Text);
                    i++;
                    break;

                case "ComboBox":
                    var             value           = ((DataRowView)((ComboBox)VARIABLE).SelectedItem).Row.ItemArray[0].ToString();
                    ForeignKeyModel foreignKeyModel = new ForeignKeyModel()
                    {
                        name = value,
                        nameForeignColumn = ((ForeignKeyModel)obj.GetType().GetProperties()[i].GetValue(obj)).nameForeignColumn,
                        nameForeignTable  = ((ForeignKeyModel)obj.GetType().GetProperties()[i].GetValue(obj)).nameForeignTable
                    };
                    obj.GetType().GetProperties()[i].SetValue(obj, foreignKeyModel);
                    break;
                }
            }
            WriterData writerData = new WriterData();

            writerData.WriteInDb(obj, WriteMode.INSERTMODE, null);
            this.DialogResult = true;
        }
Exemple #2
0
 public void Dispose()
 {
     writerData = null;
 }
Exemple #3
0
 public Writer(SaveSetting saveSetting)
 {
     saveData   = saveSetting;
     writerData = new WriterData(saveData);
 }