// When all types has lost focus included and excluded public void OnUpdateSetTypes(ProcessCode pc, ErrorCode ec) { _filters.Clear(); foreach (string stype in _fileTypes) { char firstChar = stype[0]; /* * eg: (*.*) all files, (*text*.*) any files with text occurence anywhere * (*.pdf) any pdf files (-.txt) no text files allowed (-filename.txt) exclude filename.txt * Note: using * asterisk with nothing before it will cause an exception when matched * */ FilterType ft = new FilterType(); if (firstChar == '-') { ft.isExcluded = true; ft.Content = stype.Substring(1); // get rid of the minus(-) at the beginning } else { ft.Content = stype; } _filters.Add(ft); } }
public ProcessResult(ProcessCode code, string output, string executablePath, string arguments) { Code = code; Output = output; ExecutablePath = executablePath; Arguments = arguments; }
public void CheckResult(ref ProcessCode process, DataTable dTable, ref int serialId, string processId) { switch (process.Code) { case "0": process.Message = commonCulture.ElementValues.getResourceString("Exception", _loginInfo.XeErrors); break; case "1": SetSessions(dTable, _loginInfo.Password); if (IsResetPassword()) { process.Code = "resetPassword"; } //CheckIovation(Convert.ToString(dTable.Rows[0]["lastLoginIP"]), ref serialId, processId); process.Message = string.Empty; break; case "21": process.Message = commonCulture.ElementValues.getResourceXPathString("Login/InvalidUsername", _loginInfo.XeErrors); break; case "22": process.Message = commonCulture.ElementValues.getResourceXPathString("Login/InactiveAccount", _loginInfo.XeErrors); break; case "23": process.Message = commonCulture.ElementValues.getResourceXPathString("Login/InvalidPassword", _loginInfo.XeErrors); break; } }
public MainWindowViewModel() { // Set unity container UnityContainer unityContainer = (UnityContainer)System.Windows.Application.Current.Resources["UContainer"]; unityContainer.RegisterType <OptionsModel>(new ContainerControlledLifetimeManager()); unityContainer.RegisterType <RenameService>(new ContainerControlledLifetimeManager()); // Instantiate objects now _option = unityContainer.Resolve <OptionsModel>(); _statServ = unityContainer.Resolve <StatusService>(); _renServ = unityContainer.Resolve <RenameService>(); _renServ.SetOptions(_option); // only pass this as a copy not a reference; // Set actions for the view and just use lambda expression to return true regardless BrowseFolder = new DelegateCommand(BrowseExecute, () => true); RenameNow = new DelegateCommand(RenExecute, () => true); // Call initialize(ON_INIT) for initialization just incase it was called from context menu // this call for everything status display, call to get folder etc. ProcessCode pc = ProcessCode.ON_INIT; InitializeAll(ref pc); _busy = false; }
// Initialize the interface looks and status messages private void InitializeGUI(ProcessCode pc, ErrorCode enErr) { int error = 0; switch (pc) { case ProcessCode.ON_INIT: switch (enErr) { case ErrorCode.NO_FOLDER_EXIST: _statServ.OnErrorNoFolderExist(_option.FolderPath, value => _option.Status = value, value => _option.Summary = value); error++; break; } break; case ProcessCode.ON_SELECT_BY_FOLDER: break; case ProcessCode.ON_SELECT_BY_MULTIPLE_FILES: break; default: break; } if (error == 0) { _statServ.OnSelectionFiles(_option.FilesSelected, value => _option.Status = value, value => _option.Summary = value); } InitializeUpdateSource(); }
// Initialize All private void InitializeAll(ref ProcessCode pc) { ErrorCode enErr = ErrorCode.NO_ERROR; InitializeFilesSelected(ref enErr); // Pass an enum error if something goes wrong InitializeGUI(pc, enErr); }
// After a rename update the status and summary public void OnRenameNow(ProcessCode pc, ErrorCode ec) { if (pc == ProcessCode.ON_RENAME_SUCCESS && _options != null) { int iFileCount = _options.FilesSelected.Count; _options.Summary = string.Format("{0} files has been renamed, do you want to rename them again?", iFileCount); _options.Status = OnStatusFilesSelected(_options.FilesSelected); } }
public ProcessCode ValidateData() { var msg = new ProcessCode(); if (string.IsNullOrEmpty(_loginInfo.Username)) { msg.Code = "-1"; msg.Message = commonCulture.ElementValues.getResourceXPathString("Login/MissingUsername", _loginInfo.XeErrors); msg.IsAbort = true; } else if (string.IsNullOrEmpty(_loginInfo.Password)) { msg.Code = "-1"; msg.Message = commonCulture.ElementValues.getResourceXPathString("Login/MissingPassword", _loginInfo.XeErrors); msg.IsAbort = true; } else if (commonValidation.isInjection(_loginInfo.Username)) { msg.Code = "-1"; msg.Message = commonCulture.ElementValues.getResourceXPathString("Login/InvalidUsername", _loginInfo.XeErrors); msg.IsAbort = true; } else if (commonValidation.isInjection(_loginInfo.Password)) { msg.Code = "-1"; msg.Message = commonCulture.ElementValues.getResourceXPathString("Login/InvalidPassword", _loginInfo.XeErrors); msg.IsAbort = true; } else if (!string.IsNullOrEmpty(_loginInfo.Captcha) && !string.IsNullOrEmpty(_loginInfo.SessionCaptcha)) { if (string.IsNullOrEmpty(_loginInfo.Captcha)) { msg.Code = "-1"; msg.Message = commonCulture.ElementValues.getResourceString("MissingVCode", _loginInfo.XeErrors); msg.IsAbort = true; } else if (commonValidation.isInjection(_loginInfo.Captcha)) { msg.Code = "-1"; msg.Message = commonCulture.ElementValues.getResourceXPathString("Register/InvalidVCode", _loginInfo.XeErrors); msg.IsAbort = true; } if (_loginInfo.Captcha != commonEncryption.decrypting(_loginInfo.SessionCaptcha)) { msg.Code = "-1"; msg.Message = commonCulture.ElementValues.getResourceXPathString("Register/IncorrectVCode", _loginInfo.XeErrors); msg.IsAbort = true; } } return(msg); }
private string GetReportPath() { if (ProcessCode != null) { return(_baseReportPath + ProcessCode.Replace("_REQ", string.Empty)); } else { if (!string.IsNullOrEmpty(FormName)) { return(_baseReportPath + FormName); } return(_baseReportPath + "CLASSIC"); } }
public ResponseModel(ProcessCode code, string message = null, object content = null) { this.Code = code; this.Message = message; this.Content = content; }