Esempio n. 1
0
        public static int[] ImportMembers(string table, string filePath)
        {
            int[] successFail = new int[2];
            //Read form file
            try
            {   // Open the text file using a stream reader.
                using (StreamReader sr = new StreamReader(filePath, Encoding.UTF8))
                {
                    // Read the stream to a string, and write the string to the console.
                    String   line        = sr.ReadLine();
                    string[] columns     = line.Split('\t');
                    int      columnCount = columns.Length;

                    string[] rows;
                    while ((line = sr.ReadToEnd()) != null)
                    {
                        rows = line.Split('\t');

                        try
                        {
                            SQLInsertCommandModel insert = new SQLInsertCommandModel()
                            {
                                Table   = table,
                                Columns = columns,
                                Data    = rows
                            };
                            SQLCommandController.InsertInto(insert);

                            successFail[0]++;
                        }
                        catch (Exception)
                        {
                            successFail[1]++;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

            return(successFail);
        }
Esempio n. 2
0
        private void applyButton_Click(object sender, EventArgs e)
        {
            dataSet.Tables.Clear();
            SQLSelectCommandModel command = new SQLSelectCommandModel();

            command.Columns = "*";
            command.Table   = "Member";

            setFilterDataCommnadText(ref command);
            setSortDataCommandText(ref command);

            dataSet.Tables.Add(SQLCommandController.SelectFrom(command, "Member"));
            dataSet.Tables.Add(SuretyController.GetSureties());

            report.SetDataSource(dataSet);
            crystalReportViewer.ReportSource = report;

            filterSortSlidePanel.IsOpen = false;
        }
Esempio n. 3
0
        public BookReportViewerForm()
        {
            InitializeComponent();
            filterSortSlidePanel.IsOpen = false;

            SQLSelectCommandModel command = new SQLSelectCommandModel();

            command.Table   = "Book";
            command.Columns = "*";

            DataSet   dataSet = new DataSet();
            DataTable table   = SQLCommandController.SelectFrom(command, "Book");

            dataSet.Tables.Add(table);

            BookReport report = new BookReport();

            report.SetDataSource(dataSet);
            crystalReportViewer.ReportSource = report;
        }