Esempio n. 1
0
        public override CommandResultCode Execute(IExecutionContext context, CommandArguments args)
        {
            ISettingsHandler handler = Application as ISettingsHandler;
            if (handler == null) {
                Error.WriteLine("The application doesn't support settings.");
                return CommandResultCode.ExecutionFailed;
            }

            if (args.MoveNext())
                return CommandResultCode.SyntaxError;

            VarColumns[0].ResetWidth();
            VarColumns[1].ResetWidth();

            TableRenderer table = new TableRenderer(VarColumns, Out);
            table.EnableHeader = true;
            table.EnableFooter = true;
            foreach(KeyValuePair<string, string> setting in handler.Settings) {
                if (setting.Key == ApplicationSettings.SpecialLastCommand)
                    continue;

                ColumnValue[] row = new ColumnValue[4];
                row[0] = new ColumnValue(setting.Key);
                row[1] = new ColumnValue(setting.Value);
                table.AddRow(row);
            }

            table.CloseTable();
            Error.WriteLine();

            return CommandResultCode.Success;
        }
Esempio n. 2
0
        public override CommandResultCode Execute(IExecutionContext context, CommandArguments args)
        {
            PropertyRegistry properties = Properties;
            if (properties == null) {
                Application.Error.WriteLine("the current context does not support properties.");
                return CommandResultCode.ExecutionFailed;
            }

            if (args.MoveNext()) {
                string name = args.Current;
                PropertyHolder holder = properties.GetProperty(name);
                if (holder == null)
                    return CommandResultCode.ExecutionFailed;

                PrintDescription(name, holder, Application.Error);
                return CommandResultCode.Success;
            }

            ProperiesColumns[0].ResetWidth();
            ProperiesColumns[1].ResetWidth();
            TableRenderer table = new TableRenderer(ProperiesColumns, Application.Out);
            foreach(KeyValuePair<string, PropertyHolder> entry in properties) {
                ColumnValue[] row = new ColumnValue[3];
                PropertyHolder holder = entry.Value;
                row[0] = new ColumnValue(entry.Key);
                row[1] = new ColumnValue(holder.Value);
                row[2] = new ColumnValue(holder.ShortDescription);
                table.AddRow(row);
            }
            table.CloseTable();
            return CommandResultCode.Success;
        }
Esempio n. 3
0
        /// <summary>
        /// Recursive SetColumns method for data pinning. This populates the buffer and
        /// calls the inherited SetColumns method.
        /// </summary>
        /// <param name="sesid">The session to use.</param>
        /// <param name="tableid">
        /// The table to set the columns in. An update should be prepared.
        /// </param>
        /// <param name="columnValues">
        /// Column values to set.
        /// </param>
        /// <param name="nativeColumns">
        /// Structures to put the pinned data in.
        /// </param>
        /// <param name="i">Offset of this object in the array.</param>
        /// <returns>An error code.</returns>
        internal override unsafe int SetColumns(JET_SESID sesid, JET_TABLEID tableid, ColumnValue[] columnValues, NATIVE_SETCOLUMN* nativeColumns, int i)
        {
            if (null != this.Value)
            {
                fixed (void* buffer = this.Value)
                {
                    return this.SetColumns(
                        sesid, tableid, columnValues, nativeColumns, i, buffer, checked(this.Value.Length * sizeof(char)), true);
                }
            }

            return this.SetColumns(sesid, tableid, columnValues, nativeColumns, i, null, 0, false);
        }
Esempio n. 4
0
 public override CommandResultCode Execute(IExecutionContext context, CommandArguments args)
 {
     Columns[0].ResetWidth();
     Columns[1].ResetWidth();
     TableRenderer table = new TableRenderer(Columns, Out);
     foreach(KeyValuePair<string, string> alias in Application.Commands.Aliases) {
         ColumnValue[] row = new ColumnValue[2];
         row[0] = new ColumnValue(alias.Key);
         row[1] = new ColumnValue(alias.Value);
         table.AddRow(row);
     }
     table.CloseTable();
     return CommandResultCode.Success;
 }
 public void Add(GeneralItem generalItem)
 {
     try {
         ColumnValue id = new ColumnValue () { Item1 = "id", Item2 = generalItem.Id.ToString() };
         ColumnValue name = new ColumnValue () { Item1 = "name", Item2 = generalItem.Name };
         ColumnValue iconId = new ColumnValue () { Item1 = "iconId", Item2 = generalItem.IconId.ToString() };
         List<ColumnValue> columns = new List<ColumnValue> ();
         columns.Add (id);
         columns.Add (name);
         columns.Add (iconId);
         this.Insert (columns);
     } catch (MySqlException ex) {
         switch (ex.Number) {
         case 0:
             throw new DatabaseException ("Cannot connect to server.  Contact administrator", ex);
         case 1045:
             throw new DatabaseException ("Invalid username/password, please try again", ex);
         default:
             throw new DatabaseException (ex.Message, ex);
         }
     }
 }
Esempio n. 6
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Events_.GID field.
 /// </summary>
 public void SetGIDFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.GIDColumn);
 }
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Scope_.UOMID field.
 /// </summary>
 public void SetUOMIDFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.UOMIDColumn);
 }
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's VwPropSBondBudgetDetail_.ID field.
 /// </summary>
 public void SetID0FieldValue(long val)
 {
     ColumnValue cv = new ColumnValue(val);
     this.SetValue(cv, TableUtils.ID0Column);
 }
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's VwPropSBondBudgetDetail_.sub_category field.
 /// </summary>
 public void Setsub_categoryFieldValue(string val)
 {
     ColumnValue cv = new ColumnValue(val);
     this.SetValue(cv, TableUtils.sub_categoryColumn);
 }
Esempio n. 10
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Scope_.ScopeGlobal field.
 /// </summary>
 public void SetScopeGlobalFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.ScopeGlobalColumn);
 }
Esempio n. 11
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's VwSite_.SiteZip field.
 /// </summary>
 public void SetSiteZipFieldValue(string val)
 {
     ColumnValue cv = new ColumnValue(val);
     this.SetValue(cv, TableUtils.SiteZipColumn);
 }
Esempio n. 12
0
        public void WriteCellValue(ColumnValue value)
        {
            WriteTag(PlainBufferConsts.TAG_CELL_VALUE);
            if (value.IsInfMin())
            {
                output.WriteRawLittleEndian32(1);
                output.WriteRawByte(PlainBufferConsts.VT_INF_MIN);
                return;
            }

            if (value.IsInfMax())
            {
                output.WriteRawLittleEndian32(1);
                output.WriteRawByte(PlainBufferConsts.VT_INF_MAX);
                return;
            }

            if (value.IsPlaceHolderForAutoIncr())
            {
                output.WriteRawLittleEndian32(1);
                output.WriteRawByte(PlainBufferConsts.VT_AUTO_INCREMENT);
                return;
            }

            byte[] rawData;
            int    prefixLength;

            switch (value.Type)
            {
            case ColumnValueType.String:
                rawData      = value.AsStringInBytes();
                prefixLength = PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE + 1; // length + type + length
                output.WriteRawLittleEndian32(prefixLength + rawData.Length);     // length + type + value
                output.WriteRawByte(PlainBufferConsts.VT_STRING);
                output.WriteRawLittleEndian32(rawData.Length);
                output.WriteBytes(rawData);
                break;

            case ColumnValueType.Integer:
                output.WriteRawLittleEndian32(1 + PlainBufferOutputStream.LITTLE_ENDIAN_64_SIZE);
                output.WriteRawByte(PlainBufferConsts.VT_INTEGER);
                output.WriteRawLittleEndian64(value.IntegerValue);
                break;

            case ColumnValueType.Binary:
                rawData      = value.BinaryValue;
                prefixLength = PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE + 1; // length + type + length
                output.WriteRawLittleEndian32(prefixLength + rawData.Length);     // length + type + value
                output.WriteRawByte(PlainBufferConsts.VT_BLOB);
                output.WriteRawLittleEndian32(rawData.Length);
                output.WriteBytes(rawData);
                break;

            case ColumnValueType.Boolean:
                output.WriteRawLittleEndian32(2);
                output.WriteRawByte(PlainBufferConsts.VT_BOOLEAN);
                output.WriteBool(value.BooleanValue);
                break;

            case ColumnValueType.Double:
                output.WriteRawLittleEndian32(1 + PlainBufferOutputStream.LITTLE_ENDIAN_64_SIZE);
                output.WriteRawByte(PlainBufferConsts.VT_DOUBLE);
                output.WriteDouble(value.DoubleValue);
                break;

            default:
                throw new IOException("Bug: unsupported column type: " + value.Type);
            }
        }
Esempio n. 13
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Scope_.LastEditDate field.
 /// </summary>
 public void SetLastEditDateFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.LastEditDateColumn);
 }
Esempio n. 14
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's Events_.AccountNumber field.
        /// </summary>
        public void SetAccountNumberFieldValue(string val)
        {
            ColumnValue cv = new ColumnValue(val);

            this.SetValue(cv, TableUtils.AccountNumberColumn);
        }
Esempio n. 15
0
 public TermQuery(string fieldName, ColumnValue term)
 {
     this.FieldName = fieldName;
     this.Term      = term;
 }
Esempio n. 16
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Events_.AccountNumber field.
 /// </summary>
 public void SetAccountNumberFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.AccountNumberColumn);
 }
Esempio n. 17
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Events_.ContactEmail field.
 /// </summary>
 public void SetContactEmailFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.ContactEmailColumn);
 }
Esempio n. 18
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's Events_.GID field.
        /// </summary>
        public void SetGIDFieldValue(System.Guid val)
        {
            ColumnValue cv = new ColumnValue(val, System.TypeCode.Object);

            this.SetValue(cv, TableUtils.GIDColumn);
        }
Esempio n. 19
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Scope_.CreatedDate field.
 /// </summary>
 public void SetCreatedDateFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.CreatedDateColumn);
 }
Esempio n. 20
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Users_.UserName field.
 /// </summary>
 public void SetUserName0FieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.UserName0Column);
 }
Esempio n. 21
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Scope_.LastEditBy field.
 /// </summary>
 public void SetLastEditByFieldValue(string val)
 {
     ColumnValue cv = new ColumnValue(val);
     this.SetValue(cv, TableUtils.LastEditByColumn);
 }
Esempio n. 22
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's Users_.UserName field.
        /// </summary>
        public void SetUserName0FieldValue(string val)
        {
            ColumnValue cv = new ColumnValue(val);

            this.SetValue(cv, TableUtils.UserName0Column);
        }
Esempio n. 23
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Scope_.ScopeDescription field.
 /// </summary>
 public void SetScopeDescriptionFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.ScopeDescriptionColumn);
 }
Esempio n. 24
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Users_.Password field.
 /// </summary>
 public void SetPasswordFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.PasswordColumn);
 }
Esempio n. 25
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's VwSite_.SiteID field.
 /// </summary>
 public void SetSiteIDFieldValue(decimal val)
 {
     ColumnValue cv = new ColumnValue(val);
     this.SetValue(cv, TableUtils.SiteIDColumn);
 }
Esempio n. 26
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's Users_.Password field.
        /// </summary>
        public void SetPasswordFieldValue(string val)
        {
            ColumnValue cv = new ColumnValue(val);

            this.SetValue(cv, TableUtils.PasswordColumn);
        }
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's VwPropSBondBudgetDetail_.DeptID field.
 /// </summary>
 public void SetDeptIDFieldValue(string val)
 {
     ColumnValue cv = new ColumnValue(val);
     this.SetValue(cv, TableUtils.DeptIDColumn);
 }
Esempio n. 28
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Users_.eMail field.
 /// </summary>
 public void SeteMailFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.eMailColumn);
 }
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's VwPropSBondBudgetDetail_.ParentID field.
 /// </summary>
 public void SetParentIDFieldValue(long val)
 {
     ColumnValue cv = new ColumnValue(val);
     this.SetValue(cv, TableUtils.ParentIDColumn);
 }
Esempio n. 30
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's Users_.eMail field.
        /// </summary>
        public void SeteMailFieldValue(string val)
        {
            ColumnValue cv = new ColumnValue(val);

            this.SetValue(cv, TableUtils.eMailColumn);
        }
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's VwPropSBondBudgetDetail_.Total field.
 /// </summary>
 public void SetTotalFieldValue(long val)
 {
     ColumnValue cv = new ColumnValue(val);
     this.SetValue(cv, TableUtils.TotalColumn);
 }
Esempio n. 32
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Users_.Active field.
 /// </summary>
 public void SetActiveFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.ActiveColumn);
 }
Esempio n. 33
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Scope_.Status field.
 /// </summary>
 public void SetStatusFieldValue(bool val)
 {
     ColumnValue cv = new ColumnValue(val);
     this.SetValue(cv, TableUtils.StatusColumn);
 }
Esempio n. 34
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's Users_.Active field.
        /// </summary>
        public void SetActiveFieldValue(bool val)
        {
            ColumnValue cv = new ColumnValue(val);

            this.SetValue(cv, TableUtils.ActiveColumn);
        }
Esempio n. 35
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Scope_.CreatedBy field.
 /// </summary>
 public void SetCreatedByFieldValue(string val)
 {
     ColumnValue cv = new ColumnValue(val);
     this.SetValue(cv, TableUtils.CreatedByColumn);
 }
Esempio n. 36
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Users_.LastLoginDate field.
 /// </summary>
 public void SetLastLoginDateFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.LastLoginDateColumn);
 }
Esempio n. 37
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Scope_.CreatedDate field.
 /// </summary>
 public void SetCreatedDateFieldValue(DateTime val)
 {
     ColumnValue cv = new ColumnValue(val);
     this.SetValue(cv, TableUtils.CreatedDateColumn);
 }
Esempio n. 38
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's Users_.LastLoginDate field.
        /// </summary>
        public void SetLastLoginDateFieldValue(DateTime val)
        {
            ColumnValue cv = new ColumnValue(val);

            this.SetValue(cv, TableUtils.LastLoginDateColumn);
        }
Esempio n. 39
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Scope_.LastEditByID field.
 /// </summary>
 public void SetLastEditByIDFieldValue(System.Guid val)
 {
     ColumnValue cv = new ColumnValue(val, System.TypeCode.Object);
     this.SetValue(cv, TableUtils.LastEditByIDColumn);
 }
Esempio n. 40
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Users_.RoleId field.
 /// </summary>
 public void SetRoleIdFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.RoleIdColumn);
 }
Esempio n. 41
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Scope_.LastEditDate field.
 /// </summary>
 public void SetLastEditDateFieldValue(DateTime val)
 {
     ColumnValue cv = new ColumnValue(val);
     this.SetValue(cv, TableUtils.LastEditDateColumn);
 }
Esempio n. 42
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's Users_.RoleId field.
        /// </summary>
        public void SetRoleIdFieldValue(long val)
        {
            ColumnValue cv = new ColumnValue(val);

            this.SetValue(cv, TableUtils.RoleIdColumn);
        }
Esempio n. 43
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Scope_.ScopeDescription field.
 /// </summary>
 public void SetScopeDescriptionFieldValue(string val)
 {
     ColumnValue cv = new ColumnValue(val);
     this.SetValue(cv, TableUtils.ScopeDescriptionColumn);
 }
Esempio n. 44
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Users_.CreatedBy field.
 /// </summary>
 public void SetCreatedByFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.CreatedByColumn);
 }
Esempio n. 45
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's FieldTrips_.DisplaySequence field.
        /// </summary>
        public void SetDisplaySequenceFieldValue(long val)
        {
            ColumnValue cv = new ColumnValue(val);

            this.SetValue(cv, TableUtils.DisplaySequenceColumn);
        }
Esempio n. 46
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's Users_.CreatedBy field.
        /// </summary>
        public void SetCreatedByFieldValue(decimal val)
        {
            ColumnValue cv = new ColumnValue(val);

            this.SetValue(cv, TableUtils.CreatedByColumn);
        }
Esempio n. 47
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's VwSite_.SiteZip field.
 /// </summary>
 public void SetSiteZipFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.SiteZipColumn);
 }
Esempio n. 48
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's Users_.UpdatedBy field.
        /// </summary>
        public void SetUpdatedByFieldValue(long val)
        {
            ColumnValue cv = new ColumnValue(val);

            this.SetValue(cv, TableUtils.UpdatedByColumn);
        }
Esempio n. 49
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's FieldTrips_.DisplaySequence field.
 /// </summary>
 public void SetDisplaySequenceFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.DisplaySequenceColumn);
 }
Esempio n. 50
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's Users_.CreatedOn field.
        /// </summary>
        public void SetCreatedOnFieldValue(DateTime val)
        {
            ColumnValue cv = new ColumnValue(val);

            this.SetValue(cv, TableUtils.CreatedOnColumn);
        }
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's VwPropSBondBudgetDetail_.ID field.
 /// </summary>
 public void SetID0FieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.ID0Column);
 }
Esempio n. 52
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Users_.UpdatedOn field.
 /// </summary>
 public void SetUpdatedOnFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.UpdatedOnColumn);
 }
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's VwPropSBondBudgetDetail_.ParentID field.
 /// </summary>
 public void SetParentIDFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.ParentIDColumn);
 }
Esempio n. 54
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's FieldTrips_.EventId field.
        /// </summary>
        public void SetEventIdFieldValue(decimal val)
        {
            ColumnValue cv = new ColumnValue(val);

            this.SetValue(cv, TableUtils.EventIdColumn);
        }
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's VwPropSBondBudgetDetail_.sub_category field.
 /// </summary>
 public void Setsub_categoryFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.sub_categoryColumn);
 }
Esempio n. 56
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Events_.EventName field.
 /// </summary>
 public void SetEventNameFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.EventNameColumn);
 }
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's VwPropSBondBudgetDetail_.Total field.
 /// </summary>
 public void SetTotalFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.TotalColumn);
 }
Esempio n. 58
0
 /// <summary>
 /// This is a convenience method that allows direct modification of the value of the record's Scope_.Status field.
 /// </summary>
 public void SetStatusFieldValue(ColumnValue val)
 {
     this.SetValue(val, TableUtils.StatusColumn);
 }
Esempio n. 59
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's FieldTrips_.Time field.
        /// </summary>
        public void SetTimeFieldValue(DateTime val)
        {
            ColumnValue cv = new ColumnValue(val);

            this.SetValue(cv, TableUtils.TimeColumn);
        }
Esempio n. 60
0
        /// <summary>
        /// This is a convenience method that allows direct modification of the value of the record's Events_.EventName field.
        /// </summary>
        public void SetEventNameFieldValue(string val)
        {
            ColumnValue cv = new ColumnValue(val);

            this.SetValue(cv, TableUtils.EventNameColumn);
        }