public ActionResult Edit(FieldID model) { // if (ModelState.IsValid) // { using (Entity db = new Entity()) { if (model._FieldID.Length == 0) { throw new ArgumentException("FieldID not provided"); } t_fieldid rec = db.t_fieldid.Find(model._FieldID); if (rec == null) { throw new ArgumentException("Invalid FieldID: " + model._FieldID); } // Set and save user fields. SetCoreFields(ref rec, model); rec.updatedby_userid = CurrentUser.Id; rec.updated_date = DateTime.Now; db.SaveChanges(); return(RedirectToAction("Manage", new { id = rec.parent_fieldid })); } //} //else //{ // return View(model); //} }
public ActionResult Add(string id) { FieldID addRec = new FieldID(); addRec.ParentFieldID = id; return(View(addRec)); }
protected override string GetQuery(CodeActivityContext context) { long id = TableRecordID.Get(context); string fieldId = FieldID.Get(context); object fieldValue = Value.Get(context); return(string.Format(SetTableRecordFieldValueQuery, id, fieldId, fieldValue.ToQueryValue())); }
protected Field <T> GetField <T, TTypeSerializer>(FieldID fieldID) where TTypeSerializer : struct, ITypeSerializer <T> { T item = default(T); var reader = new ByteReader(); default(TTypeSerializer).Decode(reader, ref item); throw new NotImplementedException(); }
public ArchetypeField(string _name_, FieldType _type_) { if (_name_ == null) { Error.BadArg("Got null archetype parse_field name"); } if (!Token.is_bare_multi_word(_name_)) { Error.BadArg("Got invalid parse_field name '{0}'", _name_); } if (_type_ == null) { Error.BadArg("Got null FieldType"); } name = _name_; type = _type_; // Initialize default_value with a suitable IObjField instance // // Yes, doing an switch on types in an OO system is often a code smell. // Does anyone have an aesthetically better means of implementing Duck-Typing in C# prior to C# 4.0 ? // switch (_type_.semantic_type) { case SemanticTypes.INT: default_value = new FieldInt(); break; case SemanticTypes.STRING: default_value = new FieldString(); break; case SemanticTypes.DECIMAL: default_value = new FieldDecimal(); break; case SemanticTypes.ID: default_value = new FieldID(); break; case SemanticTypes.LIST_INT: default_value = new FieldListInt(); break; case SemanticTypes.LIST_STRING: default_value = new FieldListString(); break; case SemanticTypes.LIST_DECIMAL: default_value = new FieldListDecimal(); break; case SemanticTypes.LIST_ID: default_value = new FieldListID(); break; default: Error.BadArg("Got unknown field type '{0}'", _type_); break; } // This method sets up an IObjField with the default C# value for the storage type // (0, "", 0.0M, or an empty list of one of these). // The additional constructors below (with additional args) are called // when a default field value (or a non-empty default list) is specified, // which is possibly the more common case. }
public override int GetHashCode() { unchecked { int hashCode = Index; hashCode = ( hashCode * 397 ) ^ FieldID.GetHashCode(); hashCode = ( hashCode * 397 ) ^ ( Name != null ? Name.GetHashCode(StringComparison.Ordinal) : 0 ); hashCode = ( hashCode * 397 ) ^ ( Properties != null ? Properties.GetHashCode() : 0 ); hashCode = ( hashCode * 397 ) ^ ( StructureDescription != null ? StructureDescription.GetHashCode() : 0 ); hashCode = ( hashCode * 397 ) ^ ( EnumDescription != null ? EnumDescription.GetHashCode() : 0 ); hashCode = ( hashCode * 397 ) ^ ( NodeID != null ? NodeID.GetHashCode() : 0 ); return hashCode; } }
public bool Equals( DataPointValue other ) { if ( ReferenceEquals( null, other ) ) { return false; } if ( ReferenceEquals( this, other ) ) { return true; } bool areEqual = Index == other.Index && FieldID.Equals( other.FieldID ) && Name == other.Name && Properties.NullableSequenceEquals( other.Properties ) && Equals( StructureDescription, other.StructureDescription ) && Equals( EnumDescription, other.EnumDescription ) && Equals( NodeID, other.NodeID ); return areEqual; }
public ActionResult Add(FieldID model) { if (CurrentUser.IsInRole(Role.SystemAdministrator) && model.Value.Length > 0 && model.ParentFieldID.Length > 0) { using (Entity db = new Entity()) { // Set and save user fields. t_fieldid rec = new t_fieldid(); db.t_fieldid.Add(rec); rec.fieldid = GetNextKey(model.ParentFieldID); rec.value = model.Value; rec.parent_fieldid = model.ParentFieldID; rec.createdby_userid = CurrentUser.Id; rec.created_date = DateTime.Now; rec.active = true; db.SaveChanges(); } } return(RedirectToAction("Manage", new { id = model.ParentFieldID })); }
public static FieldInfo getField(Type type, FieldID id) { TypeMembers tmember = getMembers(type); var arr = tmember.fields; if (arr != null) { for (var i = -1; i < arr.Length; i++) { FieldInfo curr; if (i == -1) { if (id.index >= 0 && arr.Length > id.index) { curr = arr[id.index]; } else { continue; } } else { curr = arr[i]; } if (curr.Name == id.name) { if (i != -1) { id.index = i; } return(curr); } } } Debug.LogError(new StringBuilder().AppendFormat("GenericTypeCache.getField({0}, {1}) fail", type.Name, id.name)); return(null); }
public void Encode(Stream outputStream, bool withHeader = true) { if (outputStream == null || !outputStream.CanWrite) { return; } // 1. Name Name.Encode(outputStream); // 2. Description Description.Encode(outputStream); // 3. Field Flags Flags.Encode(outputStream); // 4. Built-in Type outputStream.WriteByte((byte)Type); // 5. DataType DataType.Encode(outputStream); // 6. Value Rank BaseType.WriteToStream(outputStream, BitConverter.GetBytes(ValueRank)); // 7. Array Dimension SimpleArray <uint> .Encode(outputStream, ArrayDimension); // 8. MaxStringLength BaseType.WriteToStream(outputStream, BitConverter.GetBytes(MaxStringLength)); // 9. FieldID BaseType.WriteToStream(outputStream, FieldID.ToByteArray()); // 10. Properties EncodeProperties(outputStream); }
public ThreadCateModelField(DataReaderWrap readerWrap) { FieldID = readerWrap.Get <int>("FieldID"); ModelID = readerWrap.Get <int>("ModelID"); FieldKey = readerWrap.Get <Guid>("FieldKey"); FieldName = readerWrap.Get <string>("FieldName"); Enable = readerWrap.Get <bool>("Enable"); SortOrder = readerWrap.Get <int>("SortOrder"); FieldType = readerWrap.Get <string>("FieldType"); FieldTypeSetting = readerWrap.Get <string>("FieldTypeSetting"); Search = readerWrap.Get <bool>("Search"); AdvancedSearch = readerWrap.Get <bool>("AdvancedSearch"); DisplayInList = readerWrap.Get <bool>("DisplayInList"); MustFilled = readerWrap.Get <bool>("MustFilled"); Description = readerWrap.Get <string>("Description"); ExtendedField field = new ExtendedField(); field.Settings = StringTable.Parse(FieldTypeSetting); field.FieldTypeName = FieldType; field.Key = "fieldKey_" + FieldID.ToString();//FieldKey.ToString(); ExtendedField = field; }
private void AddBook(object sender, EventArgs e) { Book book = new Book(); FileStream FS = new FileStream("Book.txt", FileMode.Append, FileAccess.Write); byte[] p; string Temp; //Write Field ID. book.set_FieldID(FieldID.Text); Temp = book.get_FieldID(); FS.WriteByte((byte)book.get_FieldID().Length); p = new byte[book.get_FieldID().Length]; for (int i = 0; i < book.get_FieldID().Length; i++) { p[i] = (byte)Temp[i]; } FS.Write(p, 0, book.get_FieldID().Length); //Write Book ID. if (book.set_BookID(BookID.Text)) { p = new byte[book.get_BookID().Length]; Temp = book.get_BookID(); for (int i = 0; i < book.get_BookID().Length; i++) { p[i] = (byte)Temp[i]; } FS.Write(p, 0, book.get_BookID().Length); } else { MessageBox.Show("Error !! Book_ID Length Very Large ."); } //Write Book Name. if (book.set_BookName(NameBook.Text)) { p = new byte[book.get_BookName().Length]; Temp = book.get_BookName(); for (int i = 0; i < book.get_BookName().Length; i++) { p[i] = (byte)Temp[i]; } FS.Write(p, 0, book.get_BookName().Length); } else { MessageBox.Show("Error !! Book_Name Length Very Large ."); } //Write Book Author. book.set_BookAuthor(BookAuthor.Text); Temp = book.get_BookAuthor(); FS.WriteByte((byte)book.get_BookAuthor().Length); p = new byte[book.get_BookAuthor().Length]; for (int i = 0; i < book.get_BookAuthor().Length; i++) { p[i] = (byte)Temp[i]; } FS.Write(p, 0, book.get_BookAuthor().Length); BookID.Clear(); NameBook.Clear(); FieldID.Clear(); BookAuthor.Clear(); FS.Close(); }
public static FieldInfo getField(Type type, FieldID id) { TypeMembers tmember = getMembers(type); var arr = tmember.fields; if (arr != null) { for (var i = -1; i < arr.Length; i++) { FieldInfo curr; if (i == -1) { if (id.index >= 0 && arr.Length > id.index) curr = arr[id.index]; else continue; } else { curr = arr[i]; } if (curr.Name == id.name) { if (i != -1) id.index = i; return curr; } } } Debug.LogError(new StringBuilder().AppendFormat("GenericTypeCache.getField({0}, {1}) fail", type.Name, id.name)); return null; }
private void SetCoreFields(ref t_fieldid rec, FieldID model) { rec.value = model.Value; rec.active = model.Active; }
public void add_field(string field_name, FieldType type) { IObjField field = null; // or perhaps: new FieldTempNull(this, field_name); switch (type.semantic_type) { case SemanticTypes.INT: field = new FieldInt(); break; case SemanticTypes.STRING: field = new FieldString(); break; case SemanticTypes.DECIMAL: field = new FieldDecimal(); break; case SemanticTypes.ID: field = new FieldID(); break; case SemanticTypes.LIST_INT: field = new FieldListInt(); break; case SemanticTypes.LIST_STRING: field = new FieldListString(); break; case SemanticTypes.LIST_DECIMAL: field = new FieldListDecimal(); break; case SemanticTypes.LIST_ID: field = new FieldListID(); break; default: Error.BadArg("Got unknown field type '{0}'", type); break; } fields[field_name] = field; }