// ------------------------------------------------------ static void Chk_VIA(int PrevDate, bool Monthly) { string FileMask; string[] FileList; string DayMask = __.StrD(PrevDate, 10, 10).Replace("/", "").Replace(".", ""); string CfgFileName = ScroogeDir + CAbc.SLASH + "EXE" + CAbc.SLASH + "GLOBAL.FIL"; CCfgFile CfgFile = new CCfgFile(CfgFileName); string ViaDir = CfgFile["IMPORTANTARCHIVE"].ToString().Trim().ToUpper(); // Daily ------------------------------ FileMask = ViaDir + CAbc.SLASH + "DAILY" + CAbc.SLASH + "??????" + DayMask + DayMask + "*.*"; FileList = __.GetFileList(FileMask); __.Print("Архивы особо-важных данных :", ""); if (FileList != null) { if (FileList.Length > 0) { foreach (string FileName in FileList) { __.Print(__.GetFileName(FileName) + "\t" + __.GetFileTime(FileName).ToString()); } } else { __.Print("Ежедневные архивы не найдены !"); } } else { __.Print("Ежедневные архивы не найдены !"); } // Monthly ------------------------------ if (Monthly) { FileMask = ViaDir + CAbc.SLASH + "MONTHLY" + CAbc.SLASH + "??????01" + DayMask.Substring(2, 6) + "*.*"; FileList = __.GetFileList(FileMask); __.Print(""); if (FileList != null) { if (FileList.Length > 0) { foreach (string FileName in FileList) { __.Print(__.GetFileName(FileName) + "\t" + __.GetFileTime(FileName).ToString()); } } else { __.Print("Ежемесячные архивы не найдены !"); } } else { __.Print("Ежемесячные архивы не найдены !"); } } __.Print("", "Нажмите Enter для продолжения..."); __.Input(); }
} //FOLD00 // Спросить у пользователя, надо ли применять данный шаблон void ShowModel() //fold00 { if (!__.FileExists(FileName)) { return; } if (__.FileExists(ModelFileName)) { __.DeleteFile(ModelFileName); } ModelFile = new CCfgFile(FileName); string DebitMoniker = (string)ModelFile["AccountA_Text"]; if (DebitMoniker == null) { DebitMoniker = CAbc.EMPTY; } string DebitName = (string)ModelFile["AName_Text"]; if (DebitName == null) { DebitName = CAbc.EMPTY; } string Purpose = (string)ModelFile["Argument_Text"]; if (Purpose == null) { Purpose = CAbc.EMPTY; } CConsole.Clear(); __.Print(CAbc.EMPTY , " Информация из шаблона :" , " -----------------------" , " Дебет-счет : " + DebitMoniker , " Название дебет-счета : " + DebitName , " Назначение платежа : " + Purpose ); if (CConsole.GetBoxChoice("Использовать теперь этот шаблон ?" , " Да = Enter . Нет = Esc ." ) ) { __.CopyFile(FileName, ModelFileName); } } //FOLD00
public CScrooge2Config() { Is_Valid = false; Scrooge2Root = CCommon.GetEnvStr("Scrooge2Root"); if ((Scrooge2Root == null) || (Scrooge2Root == "")) { Err_Info = "Ошибка : Не определена переменная окружения Scrooge2Root !"; return; } CfgFile = new CCfgFile(Scrooge2Root + "\\EXE\\GLOBAL.CFG"); if ((CfgFile["SERVER"] == null) || (CfgFile["SERVER"] == "")) { Err_Info = "Ошибка чтения параметров из файла " + Scrooge2Root + "\\EXE\\GLOBAL.CFG"; return; } Err_Info = ""; Is_Valid = true; }
} //FOLD00 // Загрузка из шаблона информации о дебетовом счете public void LoadModelInfo() //fold00 { if (!__.FileExists(ModelFileName)) { return; } ModelFile = new CCfgFile(ModelFileName); string DebitMoniker = (string)ModelFile["AccountA_Text"]; if (DebitMoniker != null) { if (!__.IsEmpty(DebitMoniker)) { FieldValues[FLD_DEBITACC] = DebitMoniker; } } string Purpose = (string)ModelFile["Argument_Text"]; if (Purpose != null) { if (!__.IsEmpty(Purpose)) { FieldValues[FLD_PURPOSE] = __.FixUkrI(Purpose); } } string Encoding = (string)ModelFile["Encoding"]; if (Encoding != null) { if (Encoding.ToUpper().Trim() == "1251") { CharSet = CAbc.CHARSET_WINDOWS; } else { CharSet = CAbc.CHARSET_DOS; } } } //FOLD00
}//FOLD01 // ------------------------------------------------------- // Получить информацию о дебетб-счете и назначении платежа static void LoadModel( string FileName ) {//fold01 if ( FileName == null ) { __.Print("Ошибка : не указан файл с шаблоном !"); return; } if ( __.IsEmpty( FileName ) == null ) { __.Print("Ошибка : не указан файл с шаблоном !"); return; } if ( __.FileExists( FileName ) ) { CCfgFile ModelFile = new CCfgFile( FileName ) ; DebitMoniker = (string) ModelFile[ DEBIT_ALIAS ]; if ( DebitMoniker == null ) DebitMoniker = CAbc.EMPTY; Purpose = (string) ModelFile[ PURPOSE_ALIAS ]; if ( Purpose == null ) Purpose = CAbc.EMPTY; } do { __.Write( "Введите номер дебет.счета" ); if ( __.IsEmpty( DebitMoniker ) ) __.Write( " : " ); else __.Write( " ( " + DebitMoniker + " )" + " : " ); NewDebitMoniker = __.Input(); if ( ! __.IsEmpty( NewDebitMoniker ) ) DebitMoniker = NewDebitMoniker ; if ( ! __.IsEmpty( DebitMoniker ) ) DebitName = (string) Command.GetScalar( "exec dbo.pMega_OpenGate_PayRoll @Mode=2 , @Moniker='" + DebitMoniker + "'" ); else DebitName = CAbc.EMPTY; if ( DebitName == null ) DebitName = CAbc.EMPTY; if ( ( __.IsEmpty( DebitName ) ) || ( DebitName.Length < 33 ) ) DebitMoniker = CAbc.EMPTY; else { BankCode = DebitName.Substring(0,16).Trim(); DebitState = DebitName.Substring(16,16).Trim(); DebitName = __.FixUkrI( DebitName.Substring(32).Trim() ); } } while ( __.IsEmpty( DebitMoniker ) ) ; do { __.Write( "Введите назначение платежа" ) ; if ( __.IsEmpty( Purpose ) ) __.Write( " : " ); else __.Write( " ( " + Purpose + " )" + " : " ); NewPurpose = __.Input(); if ( ! __.IsEmpty( NewPurpose ) ) Purpose = NewPurpose; } while ( __.IsEmpty( Purpose ) ) ; if ( ( ! __.IsEmpty( NewPurpose ) ) || ( ! __.IsEmpty( NewDebitMoniker ) ) ) __.SaveText( FileName , DEBIT_ALIAS + CAbc.TAB + CAbc.TAB + DebitMoniker + CAbc.CRLF + PURPOSE_ALIAS + CAbc.TAB + CAbc.TAB + Purpose + CAbc.CRLF , CAbc.CHARSET_WINDOWS ) ; }//FOLD01