Kayıt düzeyi güvenliği
Kayıt düzeyi güvenliğine excel ile kayıtları ekleyebilirsiniz. Aşağıdaki formdaki gibi kayıtlar eklenmiş olacak.
void MAA_SysRecordLevelSecurity_Excel()
{
#Excel
#AviFiles
Dialog dialog = new Dialog("Veri Aktarma");
DialogField dialogPath;
FilenameFilter filter = ['Excel files 2010','*.xlsx','Excel files 2003', '*.xls' ];
FilenameOpen filePath;
SysExcelApplication application;
SysExcelWorkBooks workBooks;
SysExcelWorkBook workBook;
SysExcelWorkSheets workSheets;
SysExcelWorkSheet workSheet;
SysExcelCells cells;
SysOperationProgress progress;
Int NoofSheet,i,lastRow,sn;
SysRecordLevelSecurity SysRecordLevelSecurity;
SysExcelRange range;
void findLastRow(SysExcelWorkSheet _workSheet)
{
#define.Star('*')
#define.Space(' ')
;
range = _workSheet.cells().range(#ExcelTotalRange);
try
{
range = range.find(#Star, null, #xlFormulas, #xlWhole, #xlByRows, #xlPrevious);
}
catch (Exception::Error)
{
error("@SYS59926");
}
if (range)
{
lastRow = range.row();
}
else
{
lastRow = 0;
}
}
;
dialog.filenameLookupFilter(filter);
dialogPath = dialog.addField(typeid(FilenameOpen));
if (dialog.run())
{
if(dialog.closedOk())
{
filePath = dialogPath.value();
application = SysExcelApplication::construct();
application.visible(false);
workBooks = application.workbooks();
workBooks.open(filePath,0,true);
workSheets = workBooks.item(1).worksheets();
noOfSheet = worksheets.count();
progress = new SysOperationProgress();
progress.setCaption("Vendor Importing");
progress.setTotal(lastRow);
progress.setAnimation(#AviTransfer);
setprefix("Vendor Import");
try
{
For( i = 1; i <= noOfSheet; i++)
{
workSheet = workSheets.itemFromNum(i);
if(workSheet)
{
findLastRow(workSheet);
for(sn = 2;sn <= lastrow;sn++)
{
ttsbegin;
cells = workSheet.cells();
// SoftwareTable.clear();
cells = workSheet.cells();
SysRecordLevelSecurity.tabId = cells.item(sn,1).value().double();
SysRecordLevelSecurity.groupId = cells.item(sn,2).value().bStr();
SysRecordLevelSecurity.companyId = cells.item(sn,3).value().bStr();
info("Aktarma tamamlandı");
SysRecordLevelSecurity.insert();
ttscommit;
}
}
}
}
catch
{
ttsabort;
application.quit();
}
}
}
}