private void InitializeInfo() { DataTable _currencies = Cache.GetCachedTable("currencies"); if (_currencies != null) { DataRow[] _rows = _currencies.Select("[Currency] LIKE '" + _currency.ToSqlValidString(true) + "'"); if (_rows.Length > 0) { DataRow _row = _rows[0]; if (!Materia.IsNullOrNothing(_row["Currency"])) { txtCurrency.Text = _row["Currency"].ToString(); } if (!Materia.IsNullOrNothing(_row["Description"])) { txtDescription.Text = _row["Description"].ToString(); } if (VisualBasic.IsNumeric(_row["AccountCode"])) { cboAccount.SelectedValue = _row["AccountCode"]; } if (VisualBasic.IsNumeric(_row["ExchangeRateAccountCode"])) { cboExchangeRateDiff.SelectedValue = _row["ExchangeRateAccountCode"]; } } } }
private void InitializeInfo() { DataTable _denominations = Cache.GetCachedTable("currencydenominations"); if (_denominations != null) { DataRow[] _rows = _denominations.Select("[DetailId] = " + _id.ToString()); if (_rows.Length > 0) { DataRow _row = _rows[0]; if (VisualBasic.IsNumeric(_row["Denomination"])) { txtValue.Value = VisualBasic.CDbl(_row["Denomination"]); } if (!Materia.IsNullOrNothing(_row["Currency"])) { cboCurrency.SelectedValue = _row["Currency"]; } if (VisualBasic.IsNumeric(_row["Active"])) { chkActive.Checked = VisualBasic.CBool(_row["Active"]); } } } }
private void txt_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == VisualBasic.Chr(13)) { btnSignIn_Click(btnSignIn, new EventArgs()); } }
/// <summary> /// The add imports. /// </summary> /// <param name="activity"> /// The activity. /// </param> /// <returns> /// </returns> internal static Activity AddImports(Activity activity) { var settings = new VisualBasicSettings(); settings.ImportReferences.Add( new VisualBasicImportReference { Assembly = "Microsoft.ApplicationServer.Http", Import = "Microsoft.ApplicationServer.Http" }); settings.ImportReferences.Add( new VisualBasicImportReference { Assembly = "Microsoft.ApplicationServer.Http", Import = "Microsoft.ApplicationServer.Http.Dispatcher" }); settings.ImportReferences.Add( new VisualBasicImportReference { Assembly = "System", Import = "System.Net" }); settings.ImportReferences.Add( new VisualBasicImportReference { Assembly = "Microsoft.Net.Http", Import = "System.Net.Http" }); VisualBasic.SetSettings(activity, settings); return(activity); }
private void InitializeInfo() { DataTable _bankmisc = Cache.GetCachedTable("bankmiscellaneous"); if (_bankmisc != null) { DataRow[] _rows = _bankmisc.Select("[BankMiscellaneous] LIKE '" + _bankmiscellaneous.ToSqlValidString(true) + "'"); if (_rows.Length > 0) { DataRow _row = _rows[0]; if (!Materia.IsNullOrNothing(_row["BankMiscellaneous"])) { txtDescription.Text = _row["BankMiscellaneous"].ToString(); } if (VisualBasic.IsNumeric(_row["AccountCode"])) { cboAccount.SelectedValue = _row["AccountCode"]; } if (VisualBasic.IsNumeric(_row["Type"])) { cboType.SelectedIndex = VisualBasic.CInt(_row["Type"]); } } } }
private void ListViewGrid_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == VisualBasic.Chr(13)) { int _row = RowSel; int _col = ColSel; try { if (_row >= Rows.Fixed && _row <= (Rows.Count - 1)) { if (_col >= Cols.Fixed && _col <= (Cols.Count - 1)) { object _userdata = GetUserData(_row, _col); if (!Materia.IsNullOrNothing(_userdata)) { if (_userdata is ListViewGridItem) { ListViewGridItem _item = (ListViewGridItem)_userdata; ListViewGridSelectionEventArgs _args = new ListViewGridSelectionEventArgs(_item); OnListViewItemEnterKeyPressed(_args); } } } } } catch { } } }
/// <summary> /// Creates a new instance of RestorePointInfo. /// </summary> /// <param name="restorepointid"></param> public RestorePointInfo(long restorepointid) { _id = restorepointid; string _path = Application.StartupPath + "\\Xml\\restorepoints.xml"; DataTable _table = SCMS.XmlToTable(_path); if (_table != null) { DataRow[] _rows = _table.Select("[DetailId] = " + _id.ToString()); if (_rows.Length > 0) { DataRow _row = _rows[0]; if (VisualBasic.IsDate(_row["DateAndTime"])) { _asof = VisualBasic.CDate(_row["DateAndTime"]); } if (!Materia.IsNullOrNothing(_row["Filename"])) { _filename = _row["Filename"].ToString(); } if (!Materia.IsNullOrNothing(_row["Server"])) { _server = _row["Server"].ToString(); } if (!Materia.IsNullOrNothing(_row["Database"])) { _database = _row["Database"].ToString(); } } _table.Dispose(); _table = null; Materia.RefreshAndManageCurrentProcess(); } }
private void MainWindow_FormClosing(object sender, FormClosingEventArgs e) { if (SCMS.CurrentSystemUser != null) { if (SCMS.CurrentSystemUser.IsSignedIn) { e.Cancel = VisualBasic.CBool(MsgBoxEx.Ask("Quit from the application?", "Exit") != System.Windows.Forms.DialogResult.Yes); if (!e.Cancel) { SCMS.CleanUp(); SCMS.CurrentSystemUser.LogOut(); SCMS.CurrentSystemUser = null; SCMS.Connection = null; Application.Exit(); } else { _isclosing = false; } } else { Program.StartUpForm.Show(); } } else { if (!e.Cancel) { SCMS.CleanUp(); SCMS.Connection = null; Application.Exit(); } } }
private void InitializeInfo() { DataTable _paymentterms = Cache.GetCachedTable("paymentterms"); if (_paymentterms != null) { DataRow[] _rows = _paymentterms.Select("[PaymentTerm] LIKE '" + _paymentterm.ToSqlValidString(true) + "'"); if (_rows.Length > 0) { DataRow _row = _rows[0]; if (!Materia.IsNullOrNothing(_row["PaymentTerm"])) { txtPaymentTerm.Text = _row["PaymentTerm"].ToString(); } if (!Materia.IsNullOrNothing(_row["Description"])) { txtDescription.Text = _row["Description"].ToString(); } if (!Materia.IsNullOrNothing(_row["Term"])) { cboTerms.SelectedValue = _row["Term"].ToString(); } if (VisualBasic.IsNumeric(_row["Days"])) { txtDays.Value = VisualBasic.CInt(_row["Days"]); } if (VisualBasic.IsNumeric(_row["Months"])) { txtMonths.Value = VisualBasic.CInt(_row["Months"]); } } } }
private void InitializeInfo() { DataTable _additionalcharges = Cache.GetCachedTable("additionalcharges"); if (_additionalcharges != null) { DataRow[] _rows = _additionalcharges.Select("[AdditionalCharge] LIKE '" + _additionalcharge.ToSqlValidString(true) + "'"); if (_rows.Length > 0) { DataRow _row = _rows[0]; if (!Materia.IsNullOrNothing(_row["AdditionalCharge"])) { txtDescription.Text = _row["AdditionalCharge"].ToString(); } if (VisualBasic.IsNumeric(_row["ChargeGroup"])) { cboGroup.SelectedValue = _row["ChargeGroup"]; } if (VisualBasic.IsNumeric(_row["AccountCode"])) { cboAccount.SelectedValue = _row["AccountCode"]; } } } }
private static LanguageDispatcher GetLanguageDispatcher(Document document) { if (document == null) { return(null); } var project = document.Project; if (project == null) { return(null); } var language = project.Language; if (language == LanguageNames.CSharp) { return(CSharp.GetDispatcher()); } else if (language == LanguageNames.VisualBasic) { return(VisualBasic.GetDispatcher()); } else { return(null); } }
private static bool TryGetLanguageParam(string[] args, out ILanguage result, ref bool isInvalidLanguage) { string languageAsString; if (TryGetParam(args, "/lang", out languageAsString)) { if (languageAsString == CommandLineManager.CSharpLanguage) { result = CSharp.GetLanguage(CSharpVersion.V4); return(true); } else if (languageAsString == CommandLineManager.VisualBasicLanguage) { result = VisualBasic.GetLanguage(VisualBasicVersion.V4); return(true); } else { isInvalidLanguage = true; } } result = null; return(false); }
private void ClearInfo() { _author = ""; _datecreated = VisualBasic.CDate("1/1/900"); _description = ""; _requiresapprestartafterexecution = false; _requiresbackupbeforeexecution = false; _requirespcrestartafterexecution = false; _sqlstatement = ""; _title = ""; }
private void LogActivityViewerDialog_Load(object sender, EventArgs e) { CheckForIllegalCrossThreadCalls = false; this.ManageOnDispose(); SCMS.Validators.Add(this); exppnlActions.Expanded = false; exppnlUsers.Expanded = false; exppnlDateRanges.Expanded = true; grdUsers.InitializeAppearance(); grdActions.InitializeAppearance(); grdLogs.InitializeAppearance(); pctLoad.Hide(); grdActions.Styles.Normal.Border.Style = BorderStyleEnum.None; grdLogs.Styles.Normal.Border.Style = BorderStyleEnum.None; grdUsers.Styles.Normal.Border.Style = BorderStyleEnum.None; grdUsers.AttachMouseHoverPointer(); grdActions.AttachMouseHoverPointer(); dtpDateFrom.CustomFormat = "dd-MMM-yyyy hh:mm tt"; dtpDateFrom.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; dtpDateFrom.ShowCheckBox = true; dtpDateFrom.ButtonDropDown.Visible = false; dtpDateFrom.ShowUpDown = true; dtpDateFrom.AllowEmptyState = false; dtpDateFrom.Value = VisualBasic.CDate(DateTime.Now.ToShortDateString() + " 12:00:00 AM"); dtpDateFrom.MaxDate = DateTime.Now.AddDays(1); dtpDateFrom.LockUpdateChecked = false; dtpDateTo.CustomFormat = "dd-MMM-yyyy hh:mm tt"; dtpDateTo.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; dtpDateTo.ShowCheckBox = true; dtpDateTo.ButtonDropDown.Visible = false; dtpDateTo.ShowUpDown = true; dtpDateTo.AllowEmptyState = false; dtpDateTo.Value = DateTime.Now; dtpDateTo.MaxDate = DateTime.Now.AddDays(1); dtpDateTo.LockUpdateChecked = false; InitializeActions(); InitializeUsers(); }
/// <summary> /// Loads a bank account information in this dialog thru the given bank account code. /// </summary> /// <param name="code"></param> public void LoadBankAccountInformation(string code) { DataTable _bankaccounts = Cache.GetCachedTable("bankaccounts"); _bankaccountcode = code; _isnew = false; _withupdates = false; _updated = false; _isshown = false; _isinbackground = false; Text = Text.Replace(" *", "").Replace("*", ""); if (_bankaccounts != null) { DataRow[] _rows = _bankaccounts.Select("[BankAccountCode] LIKE '" + _bankaccountcode.ToSqlValidString(true) + "'"); if (_rows.Length > 0) { DataRow _row = _rows[0]; if (!Materia.IsNullOrNothing(_row["AccountNo"])) { txtAccountNo.Text = _row["AccountNo"].ToString(); } if (!Materia.IsNullOrNothing(_row["AccountName"])) { txtAccountName.Text = _row["AccountName"].ToString(); } if (!Materia.IsNullOrNothing(_row["Currency"])) { cboCurrency.SelectedValue = _row["Currency"].ToString(); } if (VisualBasic.IsNumeric(_row["AccountCode"])) { cboAccountCode.SelectedValue = _row["AccountCode"]; } if (!Materia.IsNullOrNothing(_row["Swift"])) { txtSwift.Text = _row["Swift"].ToString(); } if (!Materia.IsNullOrNothing(_row["IBAN"])) { txtIban.Text = _row["IBAN"].ToString(); } if (!Materia.IsNullOrNothing(_row["Bank"])) { cboBankingCompany.SelectedValue = _row["Bank"].ToString(); } if (!Materia.IsNullOrNothing(_row["Branch"])) { txtBranch.Text = _row["Branch"].ToString(); } if (!Materia.IsNullOrNothing(_row["Notes"])) { txtNotes.Text = _row["Notes"].ToString(); } } } if (!_isshown) { _isshown = true; } }
private void InitializeTimeAndKeyboardInfo() { btnDate.Text = " " + VisualBasic.Format(DateTime.Now, "dd-MMM-yyyy"); btnTime.Text = " " + VisualBasic.Format(DateTime.Now, "hh:mm:ss tt"); btnCaps.Enabled = Control.IsKeyLocked(Keys.CapsLock); btnNum.Enabled = Control.IsKeyLocked(Keys.NumLock); btnScrl.Enabled = Control.IsKeyLocked(Keys.Scroll); }
/// <summary> /// Creates a new instance of DatabaseScriptInfo. /// </summary> /// <param name="table"></param> public DatabaseScriptInfo(DataTable table) { ClearInfo(); if (table != null) { if (table.TableName != "scripts") { return; } if (table.Rows.Count > 0) { DataRow _row = table.Rows[0]; if (!Materia.IsNullOrNothing(_row["Author"])) { _author = _row["Author"].ToString(); } if (VisualBasic.IsDate(_row["DateCreated"])) { _datecreated = VisualBasic.CDate(_row["DateCreated"]); } if (!Materia.IsNullOrNothing(_row["Description"])) { _description = _row["Description"].ToString(); } if (!Materia.IsNullOrNothing(_row["ReferenceNo"])) { _referenceno = _row["ReferenceNo"].ToString(); } if (VisualBasic.IsNumeric(_row["RequireAppRestart"])) { _requiresapprestartafterexecution = VisualBasic.CBool(_row["RequireAppRestart"]); } if (VisualBasic.IsNumeric(_row["RequireBackup"])) { _requiresbackupbeforeexecution = VisualBasic.CBool(_row["RequireBackup"]); } if (VisualBasic.IsNumeric(_row["RequirePcRestart"])) { _requirespcrestartafterexecution = VisualBasic.CBool(_row["RequirePcRestart"]); } if (!Materia.IsNullOrNothing(_row["Script"])) { _sqlstatement = _row["Script"].ToString(); } if (!Materia.IsNullOrNothing(_row["SystemVersion"])) { _systemversion = _row["SystemVersion"].ToString(); } if (!Materia.IsNullOrNothing(_row["Title"])) { _title = _row["Title"].ToString(); } } } }
private static void ConvertNamespaces(object root, EditingContext context) { VisualBasicSettings settings = VisualBasic.GetSettings(root); IList <AssemblyReference> references; IList <string> importedNamespaces = NamespaceHelper.GetTextExpressionNamespaces(root, out references); FrameworkName targetFramework = WorkflowDesigner.GetTargetFramework(context); if (targetFramework.IsLessThan45()) { if (settings == null) { if ((importedNamespaces != null) && (importedNamespaces.Count > 0)) { NamespaceHelper.ConvertToVBSettings( importedNamespaces, references, context, out settings); } else { settings = new VisualBasicSettings(); } NamespaceHelper.SetVisualBasicSettings(root, settings); NamespaceHelper.SetTextExpressionNamespaces(root, null, null); } IDebuggableWorkflowTree debuggableWorkflowTree = root as IDebuggableWorkflowTree; if (debuggableWorkflowTree != null) { Activity rootActivity = debuggableWorkflowTree.GetWorkflowRoot(); if (rootActivity != null) { NamespaceHelper.SetVisualBasicSettings(rootActivity, settings); NamespaceHelper.SetTextExpressionNamespaces(rootActivity, null, null); } } } else { if ((importedNamespaces == null) || (importedNamespaces.Count == 0)) { if (settings != null) { NamespaceHelper.ConvertToTextExpressionImports(settings, out importedNamespaces, out references); NamespaceHelper.SetTextExpressionNamespaces(root, importedNamespaces, references); NamespaceHelper.SetVisualBasicSettings(root, null); } else { NamespaceHelper.SetTextExpressionNamespaces(root, new Collection <string>(), new Collection <AssemblyReference>()); } } } }
public ExpressionEvaluator(string predicate) { VisualBasic.SetSettingsForImplementation(this, VbSettings); Implementation = () => new Assign <TOut> { Value = new InArgument <TOut>(new VisualBasicValue <TOut>(predicate)), To = new ArgumentReference <TOut>("Result") }; }
private void InitializeCheckBoxes() { if (_multiselect && grdSearch.DataSource != null) { string _fieldname = _multiselectmember; if (string.IsNullOrEmpty(_fieldname.RLTrim())) { for (int i = grdSearch.Cols.Fixed; i <= (grdSearch.Cols.Count - 1); i++) { if (grdSearch.Cols[i].Visible) { _fieldname = grdSearch.Cols[i].Name; break; } } } if (!string.IsNullOrEmpty(_fieldname.RLTrim())) { grdSearch.AllowEditing = true; for (int i = grdSearch.Cols.Fixed; i <= (grdSearch.Cols.Count - 1); i++) { grdSearch.Cols[i].AllowEditing = (grdSearch.Cols[i].Name == _fieldname); } bool _selectall = true; for (int i = grdSearch.Rows.Fixed; i <= (grdSearch.Rows.Count - 1); i++) { bool _selected = VisualBasic.CBool(grdSearch[i, "Select"]); if (_selected) { grdSearch.SetCellCheck(i, grdSearch.Cols[_fieldname].Index, CheckEnum.Checked); } else { grdSearch.SetCellCheck(i, grdSearch.Cols[_fieldname].Index, CheckEnum.Unchecked); } _selectall = _selectall && _selected; } if (_selectall) { grdSearch.SetCellCheck(0, grdSearch.Cols[_fieldname].Index, CheckEnum.Checked); } else { grdSearch.SetCellCheck(0, grdSearch.Cols[_fieldname].Index, CheckEnum.Unchecked); } } } }
internal static void SetVisualBasicSettings(object root, VisualBasicSettings settings) { if (NamespaceHelper.ShouldUsePropertiesForImplementation(root)) { VisualBasic.SetSettingsForImplementation(root, settings); } else { VisualBasic.SetSettings(root, settings); } }
private void InitializeSearches() { DataTable _bankaccounts = Cache.GetCachedTable("bankaccounts"); if (_bankaccounts != null) { if (txtSearch.AutoCompleteCustomSource == null) { txtSearch.AutoCompleteCustomSource = new AutoCompleteStringCollection(); } txtSearch.AutoCompleteCustomSource.Clear(); for (int i = 0; i <= (_bankaccounts.Rows.Count - 1); i++) { DataRow _row = _bankaccounts.Rows[i]; if (!Materia.IsNullOrNothing(_row["AccountNo"])) { if (!txtSearch.AutoCompleteCustomSource.Contains(_row["AccountNo"].ToString())) { txtSearch.AutoCompleteCustomSource.Add(_row["AccountNo"].ToString()); } } if (!Materia.IsNullOrNothing(_row["AccountName"])) { if (!txtSearch.AutoCompleteCustomSource.Contains(_row["AccountName"].ToString())) { txtSearch.AutoCompleteCustomSource.Add(_row["AccountName"].ToString()); } } if (VisualBasic.IsNumeric(_row["AccountCode"])) { if (!txtSearch.AutoCompleteCustomSource.Contains(_row["AccountCode"].ToString())) { txtSearch.AutoCompleteCustomSource.Add(_row["AccountCode"].ToString()); } } if (!Materia.IsNullOrNothing(_row["Bank"])) { if (!txtSearch.AutoCompleteCustomSource.Contains(_row["Bank"].ToString())) { txtSearch.AutoCompleteCustomSource.Add(_row["Bank"].ToString()); } } } txtSearch.AutoCompleteMode = AutoCompleteMode.SuggestAppend; txtSearch.AutoCompleteSource = AutoCompleteSource.CustomSource; } }
/// <summary> /// Creates a new instance of DatabaseScriptInfo. /// </summary> /// <param name="refno"></param> public DatabaseScriptInfo(string refno) { _referenceno = refno; ClearInfo(); DataTable _scripts = Cache.GetCachedTable("scripts"); if (_scripts != null) { DataRow[] _rows = _scripts.Select("[ReferenceNo] LIKE '" + refno.ToSqlValidString(true) + "'"); if (_rows.Length > 0) { DataRow _row = _rows[0]; if (!Materia.IsNullOrNothing(_row["Author"])) { _author = _row["Author"].ToString(); } if (VisualBasic.IsDate(_row["DateCreated"])) { _datecreated = VisualBasic.CDate(_row["DateCreated"]); } if (!Materia.IsNullOrNothing(_row["Description"])) { _description = _row["Description"].ToString(); } if (VisualBasic.IsNumeric(_row["RequireAppRestart"])) { _requiresapprestartafterexecution = VisualBasic.CBool(_row["RequireAppRestart"]); } if (VisualBasic.IsNumeric(_row["RequireBackup"])) { _requiresbackupbeforeexecution = VisualBasic.CBool(_row["RequireBackup"]); } if (VisualBasic.IsNumeric(_row["RequirePcRestart"])) { _requirespcrestartafterexecution = VisualBasic.CBool(_row["RequirePcRestart"]); } if (!Materia.IsNullOrNothing(_row["Script"])) { _sqlstatement = _row["Script"].ToString(); } if (!Materia.IsNullOrNothing(_row["SystemVersion"])) { _systemversion = _row["SystemVersion"].ToString(); } if (!Materia.IsNullOrNothing(_row["Title"])) { _title = _row["Title"].ToString(); } } } }
private bool IsRevalidated(string value) { bool _isvalid = true; if (!String.IsNullOrEmpty(value.RLTrim())) { int _startindex = 0; char[] _chars = value.ToCharArray(); for (int i = 0; i <= (_chars.Length - 1); i++) { if (_chars[i].ToString().ToUpper().In("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")) { _startindex = i; break; } } if (_startindex >= 0) { List <string> _patterns = GetSqlPatternList(); string _reparsedvalue = value.Substring(_startindex, value.Length - _startindex); foreach (string pattern in _patterns) { _isvalid = Regex.IsMatch(_reparsedvalue, pattern); if (_isvalid) { string _incompletestringblock = "'[\\n\\r\\t a-zA-Z0-9~`!@#$\\%\\^&\\*\\(\\)-_\\+=\\{\\}\\[\\]\\\\/\\|:;\"<>,\\.\\?']+;"; MatchCollection _matches = Regex.Matches(_reparsedvalue, _incompletestringblock); if (_matches.Count > 0) { _isvalid = !_reparsedvalue.EndsWith(_matches[0].Value); if (!_isvalid) { MatchCollection _clips = Regex.Matches(_reparsedvalue, "'"); _isvalid = VisualBasic.CBool(_clips.Count % 2 == 0); } } break; } } } } return(_isvalid); }
private void trvwModules_AfterNodeSelect(object sender, DevComponents.AdvTree.AdvTreeNodeEventArgs e) { if (_nodesloading) { return; } if (e.Node == null) { return; } _selectedsubmodule = SubModule.None; if (e.Node.Nodes.Count > 0) { DisableButtons(); grdRecords.Hide(); if (lstvwRecords.Redraw) { lstvwRecords.BeginUpdate(); } lstvwRecords.ImageList = _images32; lstvwRecords.Show(); lstvwRecords.ListItems.Clear(); for (int i = 0; i <= (e.Node.Nodes.Count - 1); i++) { ListViewGridItem _item = new ListViewGridItem(e.Node.Nodes[i].Name, e.Node.Nodes[i].Text.Replace(" ", "\n"), e.Node.Nodes[i].Name); _item.Tag = e.Node.Nodes[i].Tag; lstvwRecords.ListItems.Add(_item); } while (!lstvwRecords.Redraw) { lstvwRecords.EndUpdate(); } } else { if (VisualBasic.IsNumeric(e.Node.Tag)) { if (VisualBasic.CInt(e.Node.Tag) > 0) { try { _selectedsubmodule = (SubModule)e.Node.Tag; } catch { _selectedsubmodule = SubModule.None; } grdRecords.Show(); lstvwRecords.Hide(); InitializeDataSource(); } } } }
private void CurrencyInfoDialog_Load(object sender, EventArgs e) { CheckForIllegalCrossThreadCalls = false; this.ManageOnDispose(); SCMS.Validators.Add(this); AttachEditorHandler(); cboAccount.LoadAccounts(); cboExchangeRateDiff.LoadAccounts(); txtCurrency.ReadOnly = (_currency.ToUpper() == "USD"); string _path = Application.StartupPath + "\\Xml\\defaultaccounts.xml"; DataTable _defaultaccounts = SCMS.XmlToTable(_path); if (_defaultaccounts != null) { if (cboAccount.DataSource != null) { long _cashathand = 54005; DataRow[] _rows = _defaultaccounts.Select("[AccountName] LIKE 'Cash at hand'"); if (_rows.Length > 0) { _cashathand = VisualBasic.CLng(_rows[0]["AccountCode"]); } try { cboAccount.SelectedValue = _cashathand; } catch { } } if (cboExchangeRateDiff.DataSource != null) { long _exratediff = 34625; DataRow[] _rows = _defaultaccounts.Select("[AccountName] LIKE 'Exchange rate differences'"); if (_rows.Length > 0) { _exratediff = VisualBasic.CLng(_rows[0]["AccountCode"]); } try { cboExchangeRateDiff.SelectedValue = _exratediff; } catch { } } _defaultaccounts.Dispose(); _defaultaccounts = null; Materia.RefreshAndManageCurrentProcess(); } txtCurrency.SetAsRequired(); cboAccount.SetAsRequired(); cboExchangeRateDiff.SetAsRequired(); if (!_isnew) { InitializeInfo(); } }
/// <summary> /// Creates a DSN connection using the specified database information. /// </summary> /// <param name="connectionstring">Database connection string</param> /// <returns></returns> public static IDbConnection CreateDSN(string connectionstring) { string _server = connectionstring.ConnectionStringValue(ConnectionStringSection.Server); string _database = connectionstring.ConnectionStringValue(ConnectionStringSection.Database); string _uid = connectionstring.ConnectionStringValue(ConnectionStringSection.UID); string _pwd = connectionstring.ConnectionStringValue(ConnectionStringSection.PWD); string _port = connectionstring.ConnectionStringValue(ConnectionStringSection.Port); if (String.IsNullOrEmpty(_port)) { _port = "3306"; } return(CreateDSN(_server, _database, _uid, _pwd, VisualBasic.CInt(_port))); }
public ExpressionEvaluator(string predicate) { VisualBasic.SetSettingsForImplementation(this, new VisualBasicSettings { ImportReferences = { new VisualBasicImportReference { Assembly = typeof(TIn).Assembly.GetName().Name, Import = typeof(TIn).Namespace } } }); Implementation = () => new Assign <TOut> { Value = new InArgument <TOut>(new VisualBasicValue <TOut>(predicate)), To = new ArgumentReference <TOut>("Result") }; }
/// <summary> /// Adds a setting to the activity provided which ensures visual basic-style declarations are interpreted correctly /// </summary> internal static void AddVbSetting(Activity activity) { var settings = new VisualBasicSettings { ImportReferences = { new VisualBasicImportReference { Assembly = typeof(Person).Assembly.GetName().Name, Import = typeof(Person).Namespace } } }; VisualBasic.SetSettings(activity, settings); }
public override object GetValue(object component) { VisualBasicSettings settings = VisualBasic.GetSettings(component); IList <AssemblyReference> references; IList <string> namespaces = NamespaceHelper.GetTextExpressionNamespaces(component, out references); if ((namespaces != null) && ((namespaces.Count > 0) || ((namespaces.Count == 0) && (settings == null)))) { return(new TextExpressionNamespaceList(namespaces, references)); } else { Fx.Assert(settings != null, "Either VB settings or new TextExpression attached properties should be set"); return(new VisualBasicNamespaceList(settings.ImportReferences)); } }
protected VisualBasic.VisualBasicCompilation CreateVisualBasicCompilation( string assemblyName, string code, VisualBasic.VisualBasicParseOptions parseOptions = null, VisualBasic.VisualBasicCompilationOptions compilationOptions = null, IEnumerable<MetadataReference> referencedAssemblies = null, IEnumerable<Compilation> referencedCompilations = null) { if (assemblyName == null) { assemblyName = GetUniqueName(); } if (parseOptions == null) { parseOptions = VisualBasic.VisualBasicParseOptions.Default; } if (compilationOptions == null) { compilationOptions = new VisualBasic.VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary); } var references = new List<MetadataReference>(); if (referencedAssemblies == null) { references.Add(MscorlibRef); references.Add(SystemRef); references.Add(SystemCoreRef); references.Add(MsvbRef); references.Add(SystemXmlRef); references.Add(SystemXmlLinqRef); } else { references.AddRange(referencedAssemblies); } AddReferencedCompilations(referencedCompilations, references); var tree = VisualBasic.VisualBasicSyntaxTree.ParseText(code, options: parseOptions); return VisualBasic.VisualBasicCompilation.Create(assemblyName, new[] { tree }, references, compilationOptions); }
protected VisualBasic.VisualBasicCompilation CreateVisualBasicCompilation( string code, VisualBasic.VisualBasicParseOptions parseOptions = null, VisualBasic.VisualBasicCompilationOptions compilationOptions = null, string assemblyName = null, IEnumerable<MetadataReference> referencedAssemblies = null) { return CreateVisualBasicCompilation(assemblyName, code, parseOptions, compilationOptions, referencedAssemblies, referencedCompilations: null); }