예제 #1
0
        private void ImportAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            var paramObj = (ImportApInvoicesDueParam)View.CurrentObject;
            var conn     = (SqlConnection)((XPObjectSpace)ObjectSpace).Connection;
            var loader   = new SqlServerLoader(conn);

            loader.CreateSql  = @"CREATE TABLE {TempTable}
(
    Supplier nvarchar(255),
    InvoiceNumber nvarchar(255),
    InvoiceDueDate date
)";
            loader.PersistSql = @"DELETE FROM VHAFinance.dbo.ApInvoicesDueInput
INSERT INTO VHAFinance.dbo.ApInvoicesDueInput
SELECT
Supplier,
InvoiceNumber,
InvoiceDueDate
FROM {TempTable}";
            var sourceTable = DataObjectFactory.CreateTableFromExcelXml(paramObj.FilePath, "ApInvoicesDueInput");

            var messagesText = loader.Execute(sourceTable);

            new Xafology.ExpressApp.SystemModule.GenericMessageBox(
                messagesText,
                "Import Successful"
                );
        }
        private void ImportAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            var paramObj = (ImportArCustomersParam)View.CurrentObject;
            var conn     = (SqlConnection)((XPObjectSpace)ObjectSpace).Connection;
            var loader   = new SqlServerLoader(conn);

            loader.CreateSql  = @"CREATE TABLE {TempTable}
(
    CustomerNumber nvarchar(255),
    CustomerName nvarchar(255),
    Collector nvarchar(255),
    Activity nvarchar(255)
)";
            loader.PersistSql = @"DELETE FROM VHAFinance.dbo.ArCustomers
INSERT INTO VHAFinance.dbo.ArCustomers
SELECT
CustomerNumber,
CustomerName,
Collector,
Activity
FROM {TempTable}";
            var sourceTable = DataObjectFactory.CreateTableFromExcelXml(paramObj.FilePath, "ArCustomers");

            var messagesText = loader.Execute(sourceTable);

            new Xafology.ExpressApp.SystemModule.GenericMessageBox(
                messagesText,
                "Import Successful"
                );
        }
        private string ImportDates()
        {
            var paramObj = (ImportApPoReceiptMatchInputParam)View.CurrentObject;

            var conn   = (SqlConnection)((XPObjectSpace)ObjectSpace).Connection;
            var loader = new SqlServerLoader(conn);

            loader.CreateSql  = @"CREATE TABLE {TempTable}
(
    PoNum nvarchar(255),
    ForecastMatchDate date
)";
            loader.PersistSql = @"DELETE FROM VHAFinance.dbo.ApPoMatchDateInput
INSERT INTO VHAFinance.dbo.ApPoMatchDateInput (PoNum, ForecastMatchDate)
SELECT PoNum, ForecastMatchDate FROM {TempTable}";

            var sourceTable = DataObjectFactory.CreateTableFromExcelXml(paramObj.FilePath, "ManualMatchDate");

            return(loader.Execute(sourceTable));
        }