Beispiel #1
0
        public bool Save(int workbookId)
        {
            if (WorksheetRow == null)
            {
                Id           = Worksheet_BLL.Create(Name, workbookId);
                WorksheetRow = WorkSheet_DAL.GetDataRow(Id);
                WorkbookId   = WorksheetRow.WorkbookId;
            }

            foreach (KeyValuePair <int, string> kvp in Cells.Keys.ToList())
            {
                Cell cell = Cells[kvp];

                if (!cell.Save(Id))
                {
                    return(false);
                }

                if (!cell.Included)
                {
                    Cells.Remove(kvp);
                }
            }

            return(Id != Constants.Constants.UNDEFINED_ID);
        }
Beispiel #2
0
        public WorkSheet(int worksheetId)
        {
            WorksheetRow = WorkSheet_DAL.GetDataRow(worksheetId);

            Id         = worksheetId;
            Name       = WorksheetRow.Name;
            WorkbookId = WorksheetRow.WorkbookId;
            Cells      = new Dictionary <KeyValuePair <int, string>, Cell>();

            foreach (int cellId in Cell_BLL.Cells(Id))
            {
                Cell cell = new Cell(cellId);
                Cells.Add(new KeyValuePair <int, string>(cell.Row, cell.Column), cell);
            }
        }
Beispiel #3
0
        public static bool Delete(int id)
        {
            try
            {
                ExcelDataSet.WorksheetsRow row = WorkSheet_DAL.GetDataRow(id);

                if (row == null)
                {
                    return(true);
                }

                row.Delete();
                return(WorkSheet_DAL.Update(Table));
            }
            catch
            {
                throw;
            }
        }
Beispiel #4
0
        public static int Create(string name, int workbookId)
        {
            try
            {
                ExcelDataSet.WorksheetsRow row = Table.NewWorksheetsRow();

                row.Name       = name;
                row.WorkbookId = workbookId;

                Table.AddWorksheetsRow(row);

                if (!WorkSheet_DAL.Update(Table))
                {
                    return(Constants.Constants.UNDEFINED_ID);
                }

                return(row.Id);
            }
            catch
            {
                throw;
            }
        }