Exemplo n.º 1
0
	}//FOLD01

	//  -----------------------------------
	//  Проверка всех строк входного файла
	static	string	CheckPfuFile( string FileName , int UniqNum ) {//fold01
		if	( Command == null )
			return	"Ошибка подключения к серверу !";
		if	( FileName == null )
			return	"Ошибка определения имени файла !";
		string	Result		=	CAbc.EMPTY
		,	CmdText		=	CAbc.EMPTY
		,	AboutError	=	CAbc.EMPTY	;
		bool	HaveError	=	false		;
		string	ShortFileName		=	__.GetFileName( FileName ).Trim() + "-" + UniqNum.ToString().Trim();
		CPfuReader	PfuReader	= new	CPfuReader();
		int	LineNum		=	0;
		TotalCents		=	0;
		if	( PfuReader.Open( FileName  ) )
			while	( PfuReader.Read() ) {
				LineNum		++	;
				TotalCents	+=	PfuReader.Cents() ;
				CConsole.ShowBox(CAbc.EMPTY," Проверяется строка" + __.StrI( LineNum , 5 ) + " " ,CAbc.EMPTY)	;
				CmdText		=	"exec  dbo.pMega_OpenGate_CheckPalvis "
						+	"   @Code         = '" + ( LineNum + UniqNum ).ToString().Trim() + "'"
						+	" , @Ctrls        = ''"
						+	" , @SourceCode   = '" + BankCode	+ "'"
						+	" , @DebitMoniker = '" + DebitMoniker + "'"
						+	" , @DebitState   = '" + DebitState  + "'"
						+	" , @TargetCode   = '" + BankCode	+ "'"
						+	" , @CreditMoniker= '" + PfuReader.AccountNum() + "'"
						+	" , @CreditState  = '" + PfuReader.IdentCode()  + "'"
						+	" , @CrncyAmount  =  " + PfuReader.Cents().ToString()
						+	" , @CurrencyId   =  980 "
						+	" , @UserName     = '******'"
						;
           			AboutError	=	(string) __.IsNull( Command.GetScalar( CmdText ) , CAbc.EMPTY ) ;
				if	( __.IsEmpty( Purpose ) )
					AboutError	+=	" Не заполнено назначение платежа ;" ;
				if	( __.IsEmpty( DebitName ) )
					AboutError	+=	" Не заполнено название дб. счета ;" ;
				if	( __.IsEmpty( PfuReader.ClientName() ) )
					AboutError	+=	" Не заполнено название кт. счета ;" ;
				if	( AboutError != null )
					if	( ( AboutError.Trim() != "" ) ) {
							HaveError	=	true;
							Result		+=	" Ошибка в строке " + LineNum.ToString() +" : " + AboutError.Trim()  + CAbc.CRLF  ;
					}
			}
		else	{
			PfuReader.Close();
			return	"ошибка открытия файла " + ShortFileName ;
		}
		TotalLines	=	LineNum;
		CConsole.Clear();
		byte	SavedColor		=	CConsole.BoxColor;
		if	( ( ( int ) CCommon.IsNull( Command.GetScalar( "exec dbo.pMega_OpenGate_CheckPalvis;2 @TaskCode='OpenGate',@FileName='" + ShortFileName + "'" ) , (int) 0 ) ) > 0 ) {
			CConsole.BoxColor	=	CConsole.RED*16 + CConsole.WHITE	;
			CConsole.GetBoxChoice( "Файл " + ShortFileName + " сегодня уже загружался !" , "" ,"Нажмите ESC для выхода.") ;
			CConsole.BoxColor	=	SavedColor	;
			CConsole.Clear();
			return	"Файл " + ShortFileName + " сегодня уже загружался !" ;
		}
		return	Result;
	}//FOLD01
Exemplo n.º 2
0
	}//FOLD01

	//  ----------------------------------
	// Загрузка всех строк входного файла
	static	bool	LoadPfuFile( string  FileName , int UniqNum ) {//fold01
		if	( Command == null )
			return	false;
		if	( FileName == null )
			return	false;
		bool		Result		=	true;
		string		CmdText		=	CAbc.EMPTY;
		string		ShortFileName		=	__.GetFileName( FileName ).Trim() + "-" + UniqNum.ToString().Trim();
		CPfuReader	PfuReader	= new	CPfuReader();
		int		LineNum		=	0 ;
		if	( PfuReader.Open( FileName  ) )
			while	( PfuReader.Read() ) {
				LineNum		++	;
				CConsole.ShowBox(""," Загружается строка" + CCommon.StrI( LineNum , 5 ) + " " ,"") ;
				CmdText		=	"exec  dbo.pMega_OpenGate_AddPalvis "
						+	" @TaskCode     = 'OpenGate'"
						+	",@BranchCode   = ''"
						+	",@USerName		= '******'"
						+	",@FileName     = '"	+	ShortFileName + "'"
						+	",@LineNum      =  "	+	LineNum.ToString()
						+	",@Code         = '"	+	( LineNum + UniqNum ).ToString().Trim()+ "'"
						+	",@Ctrls        = ''"
						+	",@SourceCode   = '"	+	BankCode	+	"'"
						+	",@DebitMoniker = '"	+	DebitMoniker	+	"'"
						+	",@DebitName    = '"	+	DebitName.Replace("'","`")	+	"'"
						+	",@DebitState   = '"	+	DebitState	+	"'"
						+	",@TargetCode   = '"	+	BankCode	+	"'"
						+	",@CreditMoniker= '"	+	PfuReader.AccountNum() + "'"
						+	",@CreditName   = '"	+	PfuReader.ClientName().Replace("'","`") + "'"
						+	",@CreditState  = '"	+	PfuReader.IdentCode() + "'"
						+	",@CrncyAmount  =  "	+	PfuReader.Cents().ToString()
						+	",@CurrencyId   =  980 "
						+	",@DayDate	=  "	+	__.Today().ToString()
						+	",@OrgDate	=  "	+	__.Today().ToString()
						+	",@Purpose      = '"	+	Purpose.Replace("'","`") + "'"
						;
				if	( ! Command.Execute( CmdText ) )
					Result	=	false;
			}
		else
			Result	=	false;
		CConsole.Clear();
		PfuReader.Close();
		return	Result;
	}//FOLD01