Exemplo n.º 1
0
 public DictionaryField(DictionaryFieldModel dictionaryField_, bool primaryKey_, DictionaryFieldModel dictionaryFieldModelForeignKey_ = null)
     : base()
 {
     this.columnName = dictionaryField_.columnName;
     this.dictionaryID = dictionaryField_.dictionaryID;
     this.domainValueTypeID = dictionaryField_.domainValueTypeID;
     this.ID = dictionaryField_.ID;
     this.name = dictionaryField_.name;
     this.primaryKey = primaryKey_;
     this.foreignKey = dictionaryFieldModelForeignKey_;
     this.foreignKeyColumnName = this.foreignKey == null ? null : this.foreignKey.name;
 }
 private void DropColumnForDictionaryField(DictionaryFieldModel obj, DictionaryModel dictionary, IDbConnection connectionID, IDbTransaction transactionID)
 {
     string sql = null;
     bool isEdit = obj.ID > 0;
     if (!isEdit)
     {
         sql = string.Format(
             "alter table {0} drop {1};",
             dictionary.tableName,
             obj.columnName
         );
         DBUtils.ExecuteSQL(sql, connectionID, false, transactionID).ThrowExceptionIfError();
     }
 }
 private void CreateColumnForDictionaryField(DictionaryFieldModel obj, DictionaryModel dictionary, IDbConnection connectionID, IDbTransaction transactionID)
 {
     string sql = null;
     bool isEdit = obj.ID > 0;
     if (!isEdit)
     {
         sql = string.Format(
             "alter table {0} add {1} {2};",
             dictionary.tableName,
             obj.columnName,
             GetDBTypeByID(obj.domainValueTypeID)
         );
         DBUtils.ExecuteSQL(sql, connectionID, false, transactionID).ThrowExceptionIfError();
     }
 }
        public ResponsePackage SaveDictionaryField(DictionaryFieldModel field)
        {
            RequestObjectPackage<DictionaryFieldModel> fieldRequest = new RequestObjectPackage<DictionaryFieldModel>()
            {
                requestData = field
            };

            ResponsePackage response = new DBUtils().RunSqlAction(new DictionaryTypesAdministrator().SaveDictionaryField, fieldRequest);
            response.ThrowExceptionIfError();
            return response;
        }
 public JsonResult SaveDictionaryField(DictionaryFieldModel field)
 {
     try
     {
         ResponsePackage result = new DictionaryTypeAdministratorLogic().SaveDictionaryField(field);
         return Json(result);
     }
     catch (Exception ex)
     {
         return this.HandleException(ex);
     }
 }