Beispiel #1
0
        public WorkBook(int id)
        {
            WorkbookRow = WorkBook_DAL.GetDataRow(id);

            Id         = id;
            Name       = WorkbookRow.Name;
            Size       = 0;
            Created    = WorkbookRow.Created;
            Modified   = WorkbookRow.Modified;
            Imported   = WorkbookRow.Imported;
            WorkSheets = new Dictionary <string, WorkSheet>();

            foreach (int worksheetId in Worksheet_BLL.Worksheets(Id))
            {
                WorkSheet workSheet = new WorkSheet(worksheetId);
                WorkSheets.Add(workSheet.Name, workSheet);
            }
        }
Beispiel #2
0
        public bool Save()
        {
            if (WorkbookRow == null)
            {
                Id          = Workbook_BLL.Create(Name, Created, Modified);
                WorkbookRow = WorkBook_DAL.GetDataRow(Id);
                Imported    = WorkbookRow.Imported;
            }

            foreach (string wsName in WorkSheets.Keys)
            {
                WorkSheet worksheet = WorkSheets[wsName];

                worksheet.Save(Id);

                // Delete all worksheets those are empty
                if (worksheet.Cells.Count == 0)
                {
                    WorkSheets.Remove(wsName);
                }
            }

            return(Id != Constants.Constants.UNDEFINED_ID);
        }