private string DataImport(ImportPrepareInfo importPrepareInfo, string importDirectory, string fileImportFormatDirectory) { string result = string.Empty; if (importPrepareInfo.FileInfoType != FileInfoType.NoMasterBase && importPrepareInfo.FileInfoType != FileInfoType.BillBase) { importDirectory = Path.Combine(importDirectory, importPrepareInfo.BusinessDate); } string className = string.Format("{0}.File{1}", "NMB.BLL", importPrepareInfo.FileInfoId); FileBase fileBase = (FileBase)Activator.CreateInstance(Type.GetType(className)); result = fileBase.FileExtract(importPrepareInfo.UploadFileName, importPrepareInfo.FileInfoType, importPrepareInfo.BusinessDate, importPrepareInfo.TableName, fileImportFormatDirectory); return result; }
private ImportPrepareInfo GetImportPrepareInfoById(string importStatusId) { ImportPrepareInfo importPrepareInfo = new ImportPrepareInfo(); try { DbCommand cmd = _dataBaseAccess.CreateCommand(); cmd.CommandText = "Proc_GetImportPrepareInfo_byId"; DbParameter param = _dataBaseAccess.CreateParameter(); param.ParameterName = "@ImportStatusId"; param.DbType = DbType.String; param.Value = importStatusId; cmd.Parameters.Add(param); DataTable dt = _dataBaseAccess.GetDataTable(cmd); importPrepareInfo.FileInfoId= dt.Rows[0]["FileInfoId"].ToString(); importPrepareInfo.BusinessDate = dt.Rows[0]["BusinessDate"].ToString(); importPrepareInfo.UploadFileName = dt.Rows[0]["UploadFileName"].ToString(); importPrepareInfo.FileName = dt.Rows[0]["FileName"].ToString(); importPrepareInfo.TableName = dt.Rows[0]["TableName"].ToString(); importPrepareInfo.KeyName = dt.Rows[0]["KeyName"].ToString(); int type = Convert.ToByte(dt.Rows[0]["Type"]); importPrepareInfo.FileInfoType = (FileInfoType)type; } catch (Exception ex) { Tools.LogWrite(ex.ToString()); throw; } return importPrepareInfo; }
private void BusinessTableRepeatDelete(ImportPrepareInfo importPrepareInfo) { DbCommand cmd = _dataBaseAccess.CreateCommand(); cmd.CommandText = "Proc_BusinessTable_RepeatDelete"; DbParameter param = _dataBaseAccess.CreateParameter(); param.ParameterName = "@TableName"; param.DbType = DbType.String; param.Value = importPrepareInfo.TableName; cmd.Parameters.Add(param); param = _dataBaseAccess.CreateParameter(); param.ParameterName = "@BusinessDate"; param.DbType = DbType.Int32; param.Value = importPrepareInfo.BusinessDate; cmd.Parameters.Add(param); _dataBaseAccess.ExecuteCommand(cmd); }