Esempio n. 1
0
        private void saveExcelBtn_Click(object sender, EventArgs e)//+
        {
            try
            {
                string infoFileName   = string.Empty;
                string resultFileName = string.Empty;
                Dictionary <string, ExcelProfile> excelProfileMap = null;

                using (SheetsSettigsForm ssf = new SheetsSettigsForm())
                {
                    ssf.Type     = "save";
                    ssf.Format   = "excel";
                    ssf.Document = Document;
                    ssf.ShowDialog();
                    if (ssf.Status)
                    {
                        infoFileName    = ssf.InfoFileName;
                        resultFileName  = ssf.ResultFileName;
                        excelProfileMap = ssf.ExcelProfileMap;
                    }
                    else
                    {
                        return;
                    }
                }
                string filePath = CommonService.SaveFilePath("*.xlsx|*.xlsx", Document.DocumentName);

                DataManipulationService.SaveExcel(infoFileName, resultFileName, excelProfileMap, Document, filePath);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        private void loadDataExcelBtn_Click(object sender, EventArgs e)//+
        {
            try
            {
                string filePath = CommonService.OpenFilePath("*.xlsx|*.xlsx", "физвоспитание анкета");
                if (string.IsNullOrEmpty(filePath))
                {
                    return;
                }
                string fileName = Path.GetFileNameWithoutExtension(filePath);

                string infoFileName   = string.Empty;
                string resultFileName = string.Empty;
                Dictionary <string, string> excelProfileMap = null;

                using (SheetsSettigsForm ssf = new SheetsSettigsForm())
                {
                    ssf.Type     = "load";
                    ssf.FilePath = filePath;
                    ssf.ShowDialog();
                    if (ssf.Status)
                    {
                        infoFileName    = ssf.InfoFileName;
                        resultFileName  = ssf.ResultFileName;
                        excelProfileMap = ssf.ExcelSheetMap;
                    }
                    else
                    {
                        return;
                    }

                    Document = SortDocument(DataManipulationService.LoadMainProfileExcel(filePath, infoFileName, resultFileName, excelProfileMap));
                    if (Document != null)
                    {
                        ShowOnTabControl(Document);
                        InitAutoComplete(questionTB, Document);
                        saveBtn.Enabled         = true;
                        closeProfileBtn.Enabled = true;
                        visDataBtn.Enabled      = true;
                        questionBtn.Enabled     = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }