private void btExcel_Click(object sender, EventArgs e)
        {
            SaveFileDialog save = new SaveFileDialog();

            save.Filter       = "(*.xlsx)|*.xlsx";
            save.DefaultExt   = ".xlsx";
            save.AddExtension = true;
            if (save.ShowDialog(this) == DialogResult.OK)
            {
                waitForm.ShowWaitForm();
                WorkWithExcel excel = new WorkWithExcel();
                if (State == EnumReportState.RevenueOfMonth)
                {
                    excel.ExportExcelReports(table, 2, "Reprot of Monthly", "Report of Monthly", save.FileName);
                }
                else if (State == EnumReportState.Price)
                {
                    excel.ExportExcelReports(table, 2, "Reprot of Product Price", "Reprot of Product Price", save.FileName);
                }
                else if (State == EnumReportState.Quantiy)
                {
                    excel.ExportExcelReports(table, 2, "Reprot of Product Quantily", "Reprot of Product Quantily", save.FileName);
                }
                else if (State == EnumReportState.ProductTypes)
                {
                    excel.ExportExcelReports(table, 2, "Reprot of Product Types", "Reprot of Product Types", save.FileName);
                }
                else if (State == EnumReportState.RevenueOfDays)
                {
                    excel.ExportExcelReports(table, 2, "Reprot of Days", "Report of Days", save.FileName);
                }
                waitForm.CloseWaitForm();
            }
        }
Beispiel #2
0
        //
        // Export to Excel
        private void btExcel_Click(object sender, EventArgs e)
        {
            SaveFileDialog save = new SaveFileDialog();

            save.Filter       = "(*.xlsx)|*.xlsx";
            save.DefaultExt   = ".xlsx";
            save.AddExtension = true;
            if (save.ShowDialog(this) == DialogResult.OK)
            {
                waitForm.ShowWaitForm();
                WorkWithExcel excel = new WorkWithExcel();
                get_productsTableAdapter.Fill(computerStoreDataSet.get_products);
                excel.ExportExcelReports(computerStoreDataSet.get_products, 2, "Reprot of Products", "Reprot of Products", save.FileName);
                waitForm.CloseWaitForm();
            }
        }
Beispiel #3
0
 //
 // Export Excel
 private void simpleButton2_Click(object sender, EventArgs e)
 {
     if (AcceptText())
     {
         InforDAO       infor  = new InforDAO();
         SaveFileDialog dialog = new SaveFileDialog();
         dialog.Filter       = "Excel Document (*.xlsx) | *.xlsx";
         dialog.AddExtension = true;
         dialog.DefaultExt   = ".xlsx";
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             WorkWithExcel excel = new WorkWithExcel();
             excel.ExportBill(infor.getObject(), MainView, od.getObject(cbBillID.Text), dialog.FileName, 1, 1);
             DevExpress.XtraEditors.XtraMessageBox.Show("Successfully!!");
         }
     }
 }
Beispiel #4
0
        public static DataTable CreateTeacherTimeTable(this Individual individual)
        {
            int clsCount = Data.Instance.Classes.Count;
            Dictionary <int, Dictionary <int, Lesson> > TimeTable = new Dictionary <int, Dictionary <int, Lesson> >(clsCount);

            foreach (int key in Data.Instance.Teachers.Keys)
            {
                TimeTable.Add(key, new Dictionary <int, Lesson>());
            }
            // подготовка таблицы для расписания ^^^
            for (int i = 0; i < Data.Instance.N; i++)
            {
                TimeTable[Data.Instance.Lessons[i].Teacher.Id].Add(individual.Colors[i], Data.Instance.Lessons[i]);
            }


            DataTable dt = new DataTable();

            dt.Columns.Add("уроки\\Учителя");
            string[] tmpList = new string[31];
            for (int i = 1; i < 31; i++)
            {
                dt.Columns.Add(i.ToString());
            }

            Lesson curLes;

            foreach (Dictionary <int, Lesson> teacherTimeTable in TimeTable.Values)
            {
                tmpList[0] = teacherTimeTable.First().Value.Teacher.Name;
                for (int i = 1; i < 31; i++)
                {
                    curLes = null;
                    teacherTimeTable.TryGetValue(i, out curLes);
                    tmpList[i] = curLes?.Info ?? "-----------";
                }
                dt.Rows.Add(tmpList);
            }
            DataTable correctTable = WorkWithExcel.GenerateTransposedTable(dt);

            return(correctTable);
        }