}//FOLD01 // --------------------------------------------------------------- // Получить имя файла с помощью графической панели открытия файла static string SelectFileNameGUI( string SettingsPath ) {//fold01 string Result = CAbc.EMPTY; string SettingsFileName= null; if ( SettingsPath != null ) if ( SettingsPath.Trim().Length > 0 ) { SettingsFileName = SettingsPath.Trim() + "\\" + CCommon.GetUserName() + ".ldr"; if ( CCommon.FileExists( SettingsFileName ) ) Result = CCommon.LoadText( SettingsFileName , CAbc.CHARSET_WINDOWS ); if ( Result == null ) Result = CAbc.EMPTY; } Result = Result.Trim(); Result = __.OpenFileBox( "Выберите файл для обработки" , Result , "ведомости пенс.фонда|0*.0*" ); if ( Result == null ) return CAbc.EMPTY; Result = Result.Trim(); if ( __.IsEmpty( Result ) ) return Result; if ( SettingsFileName != null ) CCommon.SaveText( SettingsFileName , __.GetDirName( Result ) , CAbc.CHARSET_WINDOWS ) ; return Result; }//FOLD01
bool IFileOfColumnsReader.Open(string FileName, int CharSet, params int[] MetaData) { TotalLines = 0; Sizes = new int[1]; Sizes[0] = 1; if (MetaData != null) { if (MetaData.Length > 0) { Sizes = new int[MetaData.Length]; CCommon.CopyArray(MetaData, Sizes); } } if (base.Open(FileName, CharSet)) { while (base.Read()) { TotalLines++; } base.Close(); if (base.Open(FileName, CharSet)) { return(TotalLines > 0); } else { return(false); } } else { return(false); } }
public CParam() { if (CCommon.ParamCount() > 2) { for (int Ptr = 1; Ptr < CCommon.ParamCount(); Ptr++) { if (ParamName != CAbc.EMPTY) { base.Add(ParamName, CAbc.ParamStr[Ptr]); ParamName = ""; } else { ParamName = CAbc.ParamStr[Ptr].Trim(); if (ParamName.Length > 1) { if (ParamName.Substring(0, 1) == "-") { ParamName = ParamName.Substring(1); } else { ParamName = CAbc.EMPTY; } } else { ParamName = CAbc.EMPTY; } } } } }
public override string TodayDir() { string TmpS = CCommon.DtoC(Erc_Date); TmpS = TmpS.Substring(6, 2) + TmpS.Substring(4, 2) + TmpS.Substring(2, 2); return(CfgFile["SalaryDir"] + "\\" + TmpS + "\\"); }
public bool Load(CCommand Command, string FileName, string BranchCode, string TaskCode) { int LineNum; bool Result = true; string DebitAcc, CreditAcc, DebitIBAN, CreditIBAN; if (AFileReader == null) { return(false); } if (AFileReader.Open(FileName, CAbc.CHARSET_DOS)) { string ShortFileName = CCommon.GetFileName(FileName); LineNum = 1; while (AFileReader.Read()) { DebitAcc = AFileReader[CSepAFileInfo.L_DEBITACC].Replace("'", "`").Trim(); DebitAcc = CCommon.IsDigit(DebitAcc) ? DebitAcc : AFileReader[CSepAFileInfo.L_DEBITACC_EXT].Replace("'", "`").Trim(); DebitAcc = CCommon.IsDigit(DebitAcc) ? DebitAcc : ""; CreditAcc = AFileReader[CSepAFileInfo.L_CREDITACC].Replace("'", "`").Trim(); CreditAcc = CCommon.IsDigit(CreditAcc) ? CreditAcc : AFileReader[CSepAFileInfo.L_CREDITACC_EXT].Replace("'", "`").Trim(); CreditAcc = CCommon.IsDigit(CreditAcc) ? CreditAcc : ""; DebitIBAN = AFileReader[CSepAFileInfo.L_DEBITIBAN].Replace("'", "`").Trim(); DebitIBAN = CCommon.IsLetter(DebitIBAN) ? DebitIBAN : CAbc.EMPTY; CreditIBAN = AFileReader[CSepAFileInfo.L_CREDITIBAN].Replace("'", "`").Trim(); CreditIBAN = CCommon.IsLetter(CreditIBAN) ? CreditIBAN : CAbc.EMPTY; CmdText = "exec dbo.pMega_OpenGate_AddPalvis " + " @TaskCode = '" + TaskCode.Trim() + "'" + ",@BranchCode = '" + BranchCode.Trim() + "'" + ",@FileName = '" + ShortFileName + "'" + ",@LineNum = " + LineNum.ToString() + ",@Code = '" + AFileReader[CSepAFileInfo.L_NDOC].Replace("'", "`").Trim() + "'" + ",@Ctrls = '" + AFileReader[CSepAFileInfo.L_SYMBOL].Replace("'", "`").Trim() + "'" + ",@SourceCode = '" + AFileReader[CSepAFileInfo.L_DEBITMFO].Replace("'", "`").Trim() + "'" + ",@DebitMoniker = '" + DebitAcc + "'" + ",@DebitName = '" + AFileReader[CSepAFileInfo.L_DEBITNAME].Replace("'", "`").Trim() + "'" + ",@DebitState = '" + AFileReader[CSepAFileInfo.L_OKPO1].Replace("'", "`").Trim() + "'" + ",@DebitIBAN = '" + DebitIBAN + "'" + ",@TargetCode = '" + AFileReader[CSepAFileInfo.L_CREDITMFO].Replace("'", "`").Trim() + "'" + ",@CreditMoniker= '" + CreditAcc + "'" + ",@CreditName = '" + AFileReader[CSepAFileInfo.L_CREDITNAME].Replace("'", "`").Trim() + "'" + ",@CreditState = '" + AFileReader[CSepAFileInfo.L_OKPO2].Replace("'", "`").Trim() + "'" + ",@CreditIBAN = '" + CreditIBAN + "'" + ",@CrncyAmount = " + AFileReader[CSepAFileInfo.L_SUMA].Replace("'", "`").Trim() + ",@CurrencyId = " + AFileReader[CSepAFileInfo.L_CURRENCY].Replace("'", "`").Trim() + ",@Purpose = '" + AFileReader[CSepAFileInfo.L_PURPOSE].Replace("'", "`").Trim() + "'" + ",@OrgDate = " + CCommon.StrDate_To_IntDate("20" + AFileReader[CSepAFileInfo.L_DATE2].Trim()) + ",@UserName = '******'" ; if (Command.Execute(CmdText) != true) { Result = false; } LineNum = LineNum + 1; CConsole.ShowBox("", " Загружается строка" + CCommon.StrI(LineNum, 5) + " ", ""); } } AFileReader.Close(); return(Result); }
public virtual string TodayDir() { string TmpS = CCommon.DtoC(Erc_Date); TmpS = TmpS.Substring(6, 2) + TmpS.Substring(4, 2) + TmpS.Substring(2, 2); return(CfgFile["DaysDir"] + "\\" + TmpS + "\\"); }
//---------------------------------------------------------- // получить значение колонки для записи в А-файл static string GetColValue(int ColNumber) { if (ColNumber < 0) { return(""); } string Result; if (AModel.ColOfCsv(ColNumber) < 0) { Result = AModel[ColNumber]; } else { Result = TsvFile[AModel.ColOfCsv(ColNumber)]; } if ((ColNumber == CSepAFileInfo.L_PURPOSE) || (ColNumber == CSepAFileInfo.L_DEBITNAME) || (ColNumber == CSepAFileInfo.L_CREDITNAME) ) { Result = Result.Trim().Replace(CAbc.BIG_UKR_I, "I").Replace(CAbc.SMALL_UKR_I, "i"); } if (ColNumber == CSepAFileInfo.L_SUMA) { Result = Result.Trim().Replace(",", "."); money Crncy = CCommon.CCur(Result) * 100; long Val = ( long )Crncy; Result = CCommon.Right(Val.ToString(), CSepAFileInfo.Record_Field_Size[CSepAFileInfo.L_SUMA]); } return(Result); }
private void ShowAnItem(int i) { int idx = start + i; string itemLine = prepareItemLine(idx); bool isSelect = (idx) == current; bool isDir = CCommon.IsDir(directoryItems[idx]); bool isFile = CCommon.IsFile(directoryItems[idx]); ConsoleColor tmp = Console.ForegroundColor; if (isDir) { Console.ForegroundColor = ConsoleColor.White; } if (isFile) { Console.ForegroundColor = ConsoleColor.Green; } ShowLineInPosition(left + 1, top + 4 + i, itemLine, isSelect); if (isSelect) { ShowItemInfo(idx); } Console.ForegroundColor = tmp; }
public bool Add(params string[] MetaData) { if (HFile == null) { return(false); } if (MetaData == null) { return(true); } if (!HasHeaderWritten) { base.Add(HEADER); base.Add(CAbc.CRLF); HasHeaderWritten = true; } for (int CurrentField = 0; CurrentField < MetaData.Length; CurrentField++) { if (MetaData[CurrentField] == CAbc.CRLF) { FieldCounter = 1; LineCounter++; return(base.Add(CAbc.CRLF)); } else if (CCommon.IsDigit(MetaData[CurrentField])) { if (!base.Add("C;X" , (FieldCounter++).ToString() , ";Y" , LineCounter.ToString() , ";K" , MetaData[CurrentField].Replace(",", ".") , CAbc.CRLF ) ) { return(false); } } else { if (!base.Add("C;X" , (FieldCounter++).ToString() , ";Y" , LineCounter.ToString() , ";K" , CAbc.QUOTE , MetaData[CurrentField].Replace(";", ";;") , CAbc.QUOTE , CAbc.CRLF ) ) { return(false); } } } return(true); }
private void ShowItemInfo(int itemIdx) { string item = directoryItems[itemIdx]; if (item == "...") { CCommon.ShowLineInPosition(left + 1, top + height - 3, new string(' ', width - 2), ConsoleColor.DarkBlue, ConsoleColor.White); return; } string itemInfoLine = ""; if (CCommon.IsDir(item)) { long dirSize = CCommon.GetFolderSizeInBytes(item); long numberOfFiles = CCommon.GetNumberOfFilesInFolder(item); itemInfoLine = $"size: {dirSize} num of files: {numberOfFiles}"; } if (CCommon.IsFile(item)) { FileInfo fileInfo = new FileInfo(item); long fileSize = fileInfo.Length; itemInfoLine = $"size: {fileSize}"; } itemInfoLine = itemInfoLine.PadRight(width - 2, ' '); CCommon.ShowLineInPosition(left + 1, top + height - 3, itemInfoLine, ConsoleColor.DarkBlue, ConsoleColor.White); }
// - - - - - - - - - - - - - - - - - - - - - - - - - // Запуск команды на Sql-сервере static bool StartSqlCmd(string CmdText) { if (CmdText == null) { return(false); } if (CmdText.Trim() == "") { return(false); } CConsole.ShowBox("", "Выполнение команды на сервере", ""); Connection = new CConnection(ConnectionString); Command = new CCommand(Connection); Command.Timeout = 599; bool Result = Command.Execute(CmdText); Command.Close(); Connection.Close(); CConsole.Clear(); CCommon.Print(CAbc.EMPTY, "Для продолжения нажмите Enter."); CConsole.ClearKeyboard(); CConsole.Flash(); CConsole.ReadChar(); return(Result); }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Запуск EXE-файла в том же каталоге, что и данная программа static bool StartExeCopy(string SrcExeName, string Params) { if ((SrcExeName == null) || (Params == null)) { return(false); } SrcExeName = SrcExeName.Trim(); Params = Params.Trim(); if (SrcExeName == "") { return(false); } string Path = CCommon.GetTaskDir() + "\\"; string Mask = SrcExeName.Substring(0, SrcExeName.Length - 3) + "*"; string ExeName = Path + CCommon.GetFileName(SrcExeName); if (!CCommon.FileExists(ExeName)) { foreach (string FileName in CCommon.GetFileList(Mask)) { if (!CCommon.CopyFile(FileName, Path + CCommon.GetFileName(FileName))) { return(false); } } } if (!CCommon.FileExists(ExeName)) { return(false); } return(CCommon.Run(ExeName, Params)); }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Подстановка дат ( [DayDate] и [NextDate] ) static string DateSubstitution(string SrcStr) { if (SrcStr == null) { return(CAbc.EMPTY); } if (SrcStr.Trim() == "") { return(SrcStr); } string Result = SrcStr.Trim().ToUpper(); if ((Result.IndexOf("[NEXTDATE]") >= 0) && (NextDate == 0)) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Запрос пользователю на ввод даты дня, который закрывается while (NextDate == 0) { CCommon.Write("Какой следующий рабочий день ? ( " + NEXT_STR.Replace("/", ".") + " ) "); Answer = CCommon.Input().Trim(); if (Answer == "") { NextDate = DefaultNextDate; } else { NextDate = CCommon.GetDate(Answer); } } } Result = Result.Replace("[DAYDATE]", DayDate.ToString()); Result = Result.Replace("[NEXTDATE]", NextDate.ToString()); return(Result); }
}//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
public bool LoadFromFile(string FileName) { CTextReader TextReader = new CTextReader(); string Tmps = ""; string[] SubTmps; if (FileName == null) { return(false); } if (FileName.Trim() == "") { return(false); } if (!TextReader.Open(FileName, CAbc.CHARSET_WINDOWS)) { return(false); } while (TextReader.Read()) { Tmps = TextReader.Value.Trim(); if (Tmps == null) { continue; } if (Tmps == "") { continue; } if (Tmps.Substring(0, 1) == ";") { continue; } if (Tmps.IndexOf("=") < 1) { continue; } SubTmps = Tmps.Split(CCommon.Chr(61)); if (SubTmps.Length < 2) { continue; } Tmps = SubTmps[0].Trim().ToUpper(); for (int CurrentField = 0; CurrentField < TotalFields; CurrentField++) { if ((Aliases[CurrentField].Trim().ToUpper() == Tmps ) && ((CurrentField == CSepAFileInfo.L_PURPOSE) || (SubTmps[1].IndexOf("/") < 0) ) ) { Values[CurrentField] = SubTmps[1].Trim(); } } } TextReader.Close(); return(true); }
public static int GetMenuChoice(params string[] StringList) { if (StringList == null) { return(0); } if (StringList.Length == 0) { return(0); } CurrentLine = 0; bool SavedCursor = System.Console.CursorVisible; byte SavedColor = Color; System.ConsoleKeyInfo KeyInfo; ShowBox(StringList); CurrentLine = 0; FirstLine = 0; System.Console.CursorVisible = false; int I = Lines.Length; while (I > 0) { I = I - 1; Lines[I] = Lines[I] + CCommon.Replicate(" ", Width - Lines[I].Length); } do { DrawLines(); KeyInfo = ReadKeyInfo(); if ((KeyInfo.Key == KEY_DOWN) & (CurrentLine < (Lines.Length - 1))) { CurrentLine = CurrentLine + 1; if ((CurrentLine - FirstLine) > (Height - 1)) { FirstLine = FirstLine + 1; } } if ((KeyInfo.Key == KEY_UP) & (CurrentLine > 0)) { CurrentLine = CurrentLine - 1; if ((CurrentLine < FirstLine)) { FirstLine = FirstLine - 1; } } } while (!((IsEscPressed() | IsEnterPressed()))); Color = SavedColor; Clear(); System.Console.CursorVisible = SavedCursor; if (IsEnterPressed()) { return(CurrentLine + 1); } else { return(0); } }
public long Cents() { if (!Is_DataLine_Valid()) { return(0); } return(CCommon.CLng(Buffer_of_the_record.Substring(27, 19).Trim())); }
//---------------------------------------------------------- // формирование имени результирующего файла static string GetAFileName() { return(ConstPartOfName + "." + CCommon.StrY(CCommon.Minute(CCommon.Now()) & 31, 1) + CCommon.Right((BatchNum + AFileExtName).ToString("000"), 2) ); }
/// <summary> /// 附件增加 /// </summary> private void AddAttached(FileInfo file) { DataRow dr = _currentDt.NewRow(); dr["NAME"] = file.Name; dr["SIZE"] = file.Length; dr["TYPE"] = CCommon.GetFileType(file.FullName); _currentDt.Rows.Add(dr); }
/// <summary> /// 附件增加 /// </summary> private void AddAttached(string file) { DataRow dr = _currentDt.NewRow(); dr["NAME"] = file.ToString().Substring(0, file.Length - 1); dr["SIZE"] = file.Length; dr["TYPE"] = CCommon.GetFileType(file.ToString().Substring(0, file.Length - 1)); _currentDt.Rows.Add(dr); }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Получить имя файла с помощью графической панели открытия файла static string SelectFileNameGUI(string SettingsPath, string DestPath) { string TmpS = CAbc.EMPTY; string Result = CAbc.EMPTY; string SettingsFileName = null; if (SettingsPath != null) { if (SettingsPath.Trim().Length > 0) { SettingsFileName = SettingsPath.Trim() + "\\" + CCommon.GetUserName() + ".ldr"; if (CCommon.FileExists(SettingsFileName)) { TmpS = CCommon.LoadText(SettingsFileName, CAbc.CHARSET_WINDOWS); } if (TmpS == null) { TmpS = CAbc.EMPTY; } } } TmpS = TmpS.Trim(); TmpS = CCommon.OpenFileBox( "Укажите А-файл для загрузки" , TmpS , "А-файлы (?A*.*)|?a*.*" ); if (TmpS == null) { return(Result); } TmpS = TmpS.Trim(); if (TmpS.Length == 0) { return(Result); } if (SettingsFileName != null) { CCommon.SaveText(SettingsFileName, CCommon.GetDirName(TmpS), CAbc.CHARSET_WINDOWS); } Result = DestPath.Trim() + "\\" + CCommon.GetFileName(TmpS); if (CCommon.FileExists(Result)) { CCommon.Print("", "Выбранный файл уже существует в целевом каталоге : ", Result, "", "Нажмите ENTER для выхода..."); CCommon.Input(); Result = CAbc.EMPTY; } else if (!CCommon.CopyFile(TmpS, Result)) { CCommon.Print("Ошибка копирования файла в целевой каталог : ", Result, "", "Нажмите ENTER для выхода..."); CCommon.Input(); Result = CAbc.EMPTY; } return(Result); }
public CPanel(int left, int top, int width, int height) { this.top = top; this.left = left; this.width = width; this.height = height; N = height - 8; path = CCommon.GetFirstAvaibleDrivePath(); RefreshPathFiles(); }
/// <summary> /// 附件增加 /// </summary> private void AddAttached(FileInfo file) { DataRow dr = _currentDt.NewRow(); dr["NAME"] = file.Name; dr["SIZE"] = file.Length; dr["TYPE"] = CCommon.GetFileType(file.FullName); dr["LAST_UPDATE_TIME"] = file.LastWriteTime.ToString("yyyy/MM/dd"); _currentDt.Rows.Add(dr); }
bool IFileOfColumnsWriter.Create(string FileName, int CharSet, params int[] MetaData) { if (MetaData != null) { if (MetaData.Length > 0) { Delimiter = CCommon.Chr(MetaData[0]).ToString(); } } return(base.Create(FileName, CharSet)); }
/// <summary> /// 页面初始化 /// </summary> private void FrmAttached_Load(object sender, EventArgs e) { _currentDt.Columns.Add("NAME", Type.GetType("System.String")); _currentDt.Columns.Add("SIZE", Type.GetType("System.String")); _currentDt.Columns.Add("TYPE", Type.GetType("System.String")); _currentDt.Columns.Add("LAST_UPDATE_TIME", Type.GetType("System.String")); if (CConstant.ORDER_MODIFY.Equals(CTag)) { try { Czzd.Common.Library.FTPOperate myftp = new Czzd.Common.Library.FTPOperate("112.82.245.2", "YS_ERP\\order\\" + _slipNumber, "FTP_user", "czzd", 21); string[] files = myftp.Dir("\\YS_ERP\\order\\" + _slipNumber); for (int i = 0; i < files.Length - 1; i++) { string NAME = files[i].ToString().Substring(0, files[i].Length - 1); long size = myftp.GetFileSize(files[i].Substring(0, files[i].Length - 1)); int currentRowIndex = dgvData.Rows.Add(1); DataGridViewRow row = dgvData.Rows[currentRowIndex]; row.Cells["NAME"].Value = NAME; row.Cells["SIZE"].Value = size; row.Cells["TYPE"].Value = CCommon.GetFileType(NAME); } } catch (Exception ex) { } } else { try { if (Directory.Exists(_fullPath)) { DirectoryInfo di = new DirectoryInfo(_fullPath); FileInfo[] files = di.GetFiles(); foreach (FileInfo file in files) { AddAttached(file); } } } catch (IOException ex) { } dgvData.DataSource = _currentDt; } if (_isSearch) { this.btnUpLoad.Enabled = false; this.btnDelete.Enabled = false; } }
}//FOLD01 // ------------------------------------------------------------- // Получить уникальное число на основе содержимого пути к файлу public static int GetUniqNum( string FileName ) {//fold01 int Result = 0 , Mask = 0xFFFF ; string DirName = CCommon.GetCurDir(); if ( FileName != null ) if ( CCommon.GetDirName( FileName ).Length > 1 ) DirName = CCommon.GetDirName( FileName ); for ( int I = 0 ; I < DirName.Length ; I++ ) Result = ( Result * 5 + CCommon.Ord( DirName[ I ] ) ) & Mask; return Result; }//FOLD01
public void AskFixedValues() { //---------------------------------------------------------- // если из файла читается кредитовый IBAN, то кредитовый счет запрашивать у пользователя уже не будем if (Kinds[CSepAFileInfo.L_CREDITIBAN] > 0 && Kinds[CSepAFileInfo.L_CREDITACC] == -1) { Kinds[CSepAFileInfo.L_CREDITACC] = -4; } string Answer = ""; for (int CurrentField = 0; CurrentField < TotalFields; CurrentField++) { if (Kinds[CurrentField] == -1) /* -1 = постоянное+редактир. */ { do { CCommon.Write(Infos[CurrentField]); if ((Values[CurrentField] != "") && (Values[CurrentField] != null)) { CCommon.Write(" ( " + Values[CurrentField] + " )"); } CCommon.Write(" : "); Answer = CCommon.Input().Trim(); if ((Answer != "") && (Answer != null)) { Values[CurrentField] = Answer; } } while (Values[CurrentField] == ""); } } CCommon.Write("Записать шаблон в файл ( пусто = не записывать ) : "); Answer = CCommon.Input(); if (Answer != null) { if (Answer.Trim() != "") { if (!SaveToFile(Answer.Trim() + ((CCommon.GetExtension(Answer.Trim()) != "") ? "" : ".mod"))) { CCommon.Print(" Ошибка записи шаблона в файл " + Answer); } } } CCommon.Write("Нумеровать документы начиная с ( " + NumberDoc.ToString() + " ) : "); Answer = CCommon.Input(); if ((Answer != "") && (Answer != null)) { try{ NumberDoc = CCommon.CLng(Answer.Trim()); } catch (System.Exception Excpt) { NumberDoc = 1; } } }
public void ProcessCurrentItem() { string selectedItem = directoryItems[current]; if (CCommon.IsDir(selectedItem)) { changeDir(); } else { Process.Start(selectedItem); } }
private void CCustomToolbar_Load(object sender, System.EventArgs e) { cCustomComboBox.ImageList = imlCurrent; String[] addresses = CCommon.GetNetworkAdapterAddresses(); foreach (string addr in addresses) { cCustomComboBox.cboCustom.Items.Add(new CCustomComboItem(addr, 2)); } cCustomComboBox.OnChangeNetworkAddress += new Sniffer.Common.CShare.SelectAddressHandler(cCustomComboBox_OnChangeNetworkAddress); }
public bool Load() { if (Connection == null) { return(false); } CRecordSet RecordSet = new CRecordSet(Connection); if (RecordSet.Open("declare @OwnerCode as VarChar(32) select @OwnerCode=user_name() exec dbo.Mega_Common_Registry;1 @OwnerCode=@OwnerCode , @TaskCode='loader' , @TaskName='TAL\\FILIAL\\LOADER.EXC' ")) { while (RecordSet.Read()) { if (CCommon.IsDigit("0" + RecordSet["FlagCode"].Trim())) { Current = CCommon.CInt32("0" + RecordSet["FlagCode"].Trim()); if (Current < TOTAL_GROUP) { Topics[Current] = RecordSet["Name"].Trim(); Purposes[Current] = RecordSet["Info"].Trim(); } } } } RecordSet.Close(); Print(); Current = CConsole.GetMenuChoice("Принять такие назначения платежей", "Изменить назначения платежей"); while (Current == 2) { Print(); Current = CConsole.GetMenuChoice(TopicMenus); while (Current != 0) { CCommon.Write(" Введите номер балансового счета или список через запятую : "); Topics[Current - 1] = CCommon.Input().Trim(); CCommon.Write(CAbc.CRLF + " Назначение платежа : "); Purposes[Current - 1] = CCommon.Input().Trim(); Print(); Current = CConsole.GetMenuChoice(TopicMenus); } Print(); Current = CConsole.GetMenuChoice("Принять такие назначения платежей", "Изменить назначения платежей"); } if (Current == 1) { return(true); } else { return(false); } }
/// <summary> /// Handle receiving custom data from server /// </summary> void ChatClient_OnCustomData(CCommon.CustomData customData, string Data) { switch (customData) { case CCommon.CustomData.RequestUdpPort: try { int port = Int32.Parse(Data); UdpServer = new IPEndPoint(Server.Address, port); } catch { } break; // Add new cases of CustomData } }
/// <summary> /// Some user change his state /// </summary> void ChatClient_OnUser(CCommon.UserState State, string Username) { InvokeIt(listBoxUsers, () => { switch (State) { case CCommon.UserState.UserLogIn: if (!listBoxUsers.Items.Contains(Username)) listBoxUsers.Items.Add(Username); break; case CCommon.UserState.UserLogOut: if (listBoxUsers.Items.Contains(Username)) listBoxUsers.Items.Remove(Username); if (Username == callPanel1.TalkWith) callPanel1.OuterReject(); break; } }); }