Ejemplo n.º 1
0
        /// <summary>
        /// This function provides option for save as single file and also as one file per object.
        /// </summary>
        /// <param name="selectedbtntype"></param>
        public void SaveFileForTabsWithOptions(string selectedbtntype)
        {
            var isSaved = false;
            _scriptWriter.GetLanguageType(out _isVb, out _isJava, out _isCSharp, out _isRuby);
            var saveFile = new SaveFileDialog();
            if (_isCSharp)
                saveFile.Filter = "csharp Files (*.cs)|*.cs|All Files (*.*)|*.*";
            else if (_isVb)
                saveFile.Filter = "vb Files (*.vb)|*.vb|All Files (*.*)|*.*";
            else if (_isJava)
                saveFile.Filter = "java Files (*.class)|*.class|All Files (*.*)|*.*";
            else if (_isRuby)
                saveFile.Filter = "Ruby Files (*.rb)|*.rb|All Files (*.*)|*.*";

            if (selectedbtntype == "Save As Single File")
            {
                if (saveFile.ShowDialog() == true)
                {
                    isSaved = _scriptWriter.WriteScriptAsPerSelectedLanguage(_exportPocoList, null, _namespaceName, saveFile.FileName);
                }
            }

            if (selectedbtntype == "One File Per Object")
            {
                foreach (var parentItem in _exportPocoList)
                {
                   if (saveFile.ShowDialog() == true)
                    {
                        isSaved = _scriptWriter.WriteScriptAsPerSelectedLanguage(null, parentItem, _namespaceName, saveFile.FileName);
                    }
                }
            }
            if (!isSaved) return;
            Visibility = Visibility.Hidden;
            var saveSummary = new Summary();
            saveSummary.ShowSummary(_exportPocoList);
            var win = Window.GetWindow(this);
            var homePage = (HomePage)(win);
            if (homePage != null) homePage.Savelbl.FontWeight = FontWeights.Normal;
            var page = (HomePage)(win);
            if (page != null) page.Saveoptionlbl.FontWeight = FontWeights.Normal;
            var homePage1 = (HomePage)(win);
            if (homePage1 != null) homePage1.Summarylbl.FontWeight = FontWeights.Bold;
            var page1 = (HomePage)(win);
            if (page1 != null) page1.ContentArea.Content = saveSummary;
        }
 private void savebtn_Click(object sender, RoutedEventArgs e)
 {
     var isKeyspaceExists = false;
     var dbOperator = new DatabaseOperationsReader();
     var isAvailable = dbOperator.SaveDataToDb(_exportMetadataList, ref isKeyspaceExists);
     if (isAvailable)
     {
         Visibility = Visibility.Hidden;
         var saveSummary = new Summary();
         saveSummary.ShowSummary(_exportMetadataList);
         var win = Window.GetWindow(this);
         var homePage = (HomePage)(win);
         if (homePage != null) homePage.ContentArea.Content = saveSummary;
     }
     else
     {
         MessageBox.Show(!isKeyspaceExists
             ? "This Keyspace doesnot Exists."
             : "This ColumnFamily already exists.");
     }
 }