• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IBusinessObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IBusinessObject的典型用法代码示例。如果您正苦于以下问题:C# IBusinessObject类的具体用法?C# IBusinessObject怎么用?C# IBusinessObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IBusinessObject类属于命名空间,在下文中一共展示了IBusinessObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateMapper

 /// <summary>
 /// Creates the appropriate PropertyMapper based on the BusinessObject and propertyName.
 /// </summary>
 /// <param name="businessObject"></param>
 /// <param name="propertyName"></param>
 /// <returns></returns>
 public static IBOPropertyMapper CreateMapper(IBusinessObject businessObject, string propertyName)
 {
     var originalPropertyName = propertyName;
     if (IsReflectiveProp(propertyName))
     {
         IBusinessObject relatedBo = businessObject;
         while (propertyName.Contains(RELATIONSHIP_SEPARATOR))
         {
             //Get the first property name
             string relationshipName = propertyName.Substring(0, propertyName.IndexOf("."));
             propertyName = propertyName.Remove(0, propertyName.IndexOf(".") + 1);
             var newRelatedBo = relatedBo.Relationships.GetRelatedObject(relationshipName);
             if (newRelatedBo == null)
             {
                 var invalidReason = string.Format("The '{0}' relationship of the '{1}' returned null, therefore the '{2}' property could not be accessed.", relationshipName, relatedBo.GetType().Name, propertyName);
                 return new NullBOPropertyMapper(originalPropertyName, invalidReason) { BusinessObject = businessObject };
             }
             relatedBo = newRelatedBo;
         }
         return new ReflectionPropertyMapper(propertyName) { BusinessObject = relatedBo };
     }
     try
     {
         return new BOPropertyMapper(propertyName) { BusinessObject = businessObject };
     }
     catch (InvalidPropertyException)
     {
         //If the BOProp is not found then try a ReflectiveProperty.
         return new ReflectionPropertyMapper(propertyName) { BusinessObject = businessObject };
     }
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:37,代码来源:BOPropMapperFactory.cs


示例2: TransactionalSingleRelationship

 /// <summary>
 /// Constructor for <see cref="TransactionalSingleRelationship"/>
 /// </summary>
 /// <param name="relationship"></param>
 /// <param name="relatedBO"></param>
 protected TransactionalSingleRelationship(IRelationship relationship, IBusinessObject relatedBO)
 {
     if (relatedBO == null) throw new ArgumentNullException("relatedBO");
     _transactionID = Guid.NewGuid().ToString();
     _relationship = relationship;
     _relatedBO = relatedBO;
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:12,代码来源:TransactionalSingleRelationship.cs


示例3: DeleteBusinessObject

 ///<summary>
 /// Deletes the given business object
 ///</summary>
 ///<param name="businessObject">The business object to delete</param>
 public void DeleteBusinessObject(IBusinessObject businessObject)
 {
     string message;
     if (CustomConfirmationMessageDelegate != null)
     {
         message = CustomConfirmationMessageDelegate(businessObject);
     }
     else
     {
         message = string.Format("Are you certain you want to delete the object '{0}'", businessObject);
     }
     Confirmer.Confirm(message, delegate(bool confirmed)
         {
             if (!confirmed) return;
             var defaultBODeletor = new DefaultBODeletor();
             try
             {
                 defaultBODeletor.DeleteBusinessObject(businessObject);
             }
             catch (Exception ex)
             {
                 GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error Deleting");
             }
         });
 }
开发者ID:Chillisoft,项目名称:habanero.faces,代码行数:29,代码来源:ConfirmingBusinessObjectDeletor.cs


示例4: RelationshipObjectInitialiser

 /// <summary>
 /// Constructor for a new initialiser
 /// </summary>
 /// <param name="parentObject">The parent for the relationship</param>
 /// <param name="relationship">The relationship object</param>
 /// <param name="correspondingRelationshipName">The corresponding
 /// relationship name</param>
 public RelationshipObjectInitialiser(IBusinessObject parentObject, RelationshipDef relationship,
                                      string correspondingRelationshipName)
 {
     _parentObject = parentObject;
     _relationship = relationship;
     _correspondingRelationshipName = correspondingRelationshipName;
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:14,代码来源:RelationshipObjectInitialiser.cs


示例5: CancelEditsToBusinessObject

 public void CancelEditsToBusinessObject(IBusinessObject bo)
 {
     bo.CancelEdits();
     if (bo.Status.IsNew)
     {
         bo.MarkForDelete();
     }
 }
开发者ID:Chillisoft,项目名称:habanero.faces,代码行数:8,代码来源:IDefaultBOEditorForm.cs


示例6: AutorController

 public AutorController(
     IBusinessObject<Autor> bo,
     IMapper<Autor, AutorModel> mapper,
     IMapper<AutorModel, Autor> modelMapper)
 {
     BO = bo;
     Mapper = mapper;
     ModelMapper = modelMapper;
 }
开发者ID:RaphaelChapur,项目名称:UniRitterDemo,代码行数:9,代码来源:AutorController.cs


示例7: GeneroController

 public GeneroController(
     IBusinessObject<Genero> bo,
     IMapper<Genero, GeneroModel> mapper,
     IMapper<GeneroModel, Genero> modelMapper)
 {
     BO = bo;
     Mapper = mapper;
     ModelMapper = modelMapper;
 }
开发者ID:andso,项目名称:UniRitterDemo,代码行数:9,代码来源:GeneroController.cs


示例8: InitialiseObject

        /// <summary>
        /// Initialises the given object
        /// </summary>
        /// <param name="objToInitialise">The object to initialise</param>
        public void InitialiseObject(IBusinessObject objToInitialise)
        {
            BusinessObject newBo = (BusinessObject) objToInitialise;
			foreach (RelPropDef propDef in _relationship.RelKeyDef)
			{
                newBo.SetPropertyValue(propDef.OwnerPropertyName,
                                       _parentObject.GetPropertyValue(propDef.RelatedClassPropName));
            }
            newBo.Relationships.SetRelatedObject(_correspondingRelationshipName, _parentObject);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:14,代码来源:RelationshipObjectInitialiser.cs


示例9: BusinessObjectDTO

 /// <summary>
 /// Constructs a DTO for a Business Object.
 /// </summary>
 /// <param name="businessObject"></param>
 public BusinessObjectDTO(IBusinessObject businessObject) {
     ClassDefName = businessObject.ClassDef.ClassName;
     ClassName = businessObject.ClassDef.ClassNameExcludingTypeParameter;
     AssemblyName = businessObject.ClassDef.AssemblyName;
     foreach (IBOProp boProp in businessObject.Props)
     {
         Props[boProp.PropertyName.ToUpper()] = boProp.Value;
     }
     ID = businessObject.ID.ToString();
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:14,代码来源:BusinessObjectDTO.cs


示例10: TestUpdate

        internal static void TestUpdate(IBusinessObject busObject, object newValue, string columnName)
        {
            ObjectStateEntry stateEntry;
            BsoArchiveEntities.Current.ObjectStateManager.TryGetObjectStateEntry(busObject, out stateEntry);

            var createdProps = stateEntry.CurrentValues.DataRecordInfo.FieldMetadata;

            var prop = createdProps.FirstOrDefault(p => p.FieldType.Name.ToUpper() == columnName.ToUpper());
            stateEntry.CurrentValues.SetValue(prop.Ordinal, newValue);
        }
开发者ID:BostonSymphOrch,项目名称:HENRY-archives,代码行数:10,代码来源:BsoArchiveEntities.cs


示例11: BusObjDeleteException

 /// <summary>
 /// Constructor to initialise the exception with details regarding the
 /// object whose record was deleted
 /// </summary>
 /// <param name="bo">The business object in question</param>
 /// <param name="message">Additional err message</param>
 public BusObjDeleteException(IBusinessObject bo, string message):
     base(String.IsNullOrEmpty(message) ? string.Format(
         "You cannot delete the '{0}', as the IsDeletable is set to false for the object. " +
         "ObjectID: {1}, also identified as {2}",
         bo.ClassDef.ClassName, bo.ID, bo) : message, 
         !String.IsNullOrEmpty(message) ? new Exception(
             string.Format(
                 "You cannot delete the '{0}', as the IsDeletable is set to false for the object. " +
                 "ObjectID: {1}, also identified as {2}",
                 bo.ClassDef.ClassName, bo.ID, bo)) : null)
 {
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:18,代码来源:BusObjDeleteException.cs


示例12: BusinessObjectLastUpdatePropertiesLog

 ///<summary>
 /// This constructor initialises this update log with the BusinessObject to be updated.
 /// This businessobject is then searched for the default UserLastUpdated and DateLastUpdated properties 
 /// that are to be updated when the BusinessObject is updated.
 ///</summary>
 ///<param name="businessObject">The BusinessObject to be updated</param>
 public BusinessObjectLastUpdatePropertiesLog(IBusinessObject businessObject)
 {
     IBOPropCol boPropCol = businessObject.Props;
     string propName = "UserLastUpdated";
     if (boPropCol.Contains(propName))
     {
         _userLastUpdatedBoProp = boPropCol[propName];
     }
     propName = "DateLastUpdated";
     if (boPropCol.Contains(propName))
     {
         _dateLastUpdatedBoProp = boPropCol[propName];
     }
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:20,代码来源:BusinessObjectLastUpdatePropertiesLog.cs


示例13: DeleteBusinessObject

 ///<summary>
 /// Deletes the given business object
 ///</summary>
 ///<param name="businessObject">The business object to delete</param>
 public virtual void DeleteBusinessObject(IBusinessObject businessObject)
 {
     try
     {
         businessObject.MarkForDelete();
         var committer = BORegistry.DataAccessor.CreateTransactionCommitter();
         committer.AddBusinessObject(businessObject);
         committer.CommitTransaction();
     }
     catch (Exception)
     {
         businessObject.CancelEdits();
         throw;
     }
 }
开发者ID:Chillisoft,项目名称:habanero.faces,代码行数:19,代码来源:DefaultBODeletor.cs


示例14: UpdateObject

        internal static void UpdateObject(IBusinessObject busObject, object newValue, string columnName)
        {
            ObjectStateEntry stateEntry;
            BsoArchiveEntities.Current.ObjectStateManager.TryGetObjectStateEntry(busObject, out stateEntry);

            var createdProps = stateEntry.CurrentValues.DataRecordInfo.FieldMetadata;

            var prop = createdProps.FirstOrDefault(p => p.FieldType.Name.ToUpper() == columnName.ToUpper());

            if (prop.FieldType == null)
                return;

            var value = EFUtility.MapType(newValue, prop.FieldType.TypeUsage.EdmType);

            stateEntry.CurrentValues.SetValue(prop.Ordinal, value);
        }
开发者ID:BostonSymphOrch,项目名称:HENRY-archives,代码行数:16,代码来源:BsoArchiveEntities.cs


示例15: AddBusinessObject

 ///<summary>
 /// Add an object of type business object to the transaction.
 /// The DBTransactionCommiter wraps this Business Object in the
 /// appropriate Transactional Business Object
 ///</summary>
 ///<param name="businessObject"></param>
 public void AddBusinessObject(IBusinessObject businessObject)
 {
     if (_myDataAccessor == null)
     {
         _myDataAccessor = GetDataAccessorForType(businessObject.GetType());
         _transactionCommitter = _myDataAccessor.CreateTransactionCommitter();
     } else
     {
         IDataAccessor dataAccessorToUseForType = GetDataAccessorForType(businessObject.GetType());
         if (dataAccessorToUseForType != _myDataAccessor)
         {
             throw new HabaneroDeveloperException("A problem occurred while trying to save, please see log for details", string.Format("A BusinessObject of type {0} was added to a TransactionCommitterMultiSource which has been set up with a different source to this type.", businessObject.GetType().FullName));
         }
     }
     _transactionCommitter.AddBusinessObject(businessObject);
 }
开发者ID:Chillisoft,项目名称:habanero,代码行数:22,代码来源:TransactionCommitterMultiSource.cs


示例16: GetBrokenRulesString

        public static void GetBrokenRulesString(IBusinessObject currentObj,
                List<IBusinessObject> checkEntities,
                List<string> errorMessages,
                System.Data.Objects.DataClasses.EntityObject parent)
        {
            if (checkEntities.Contains(currentObj))
                return;

            checkEntities.Add(currentObj);

            if (parent == null)
                errorMessages.Add(currentObj.GetCurrentBrokenRules());
            else
                errorMessages.Add(currentObj.GetCurrentBrokenRules());

            if (IsNew(currentObj))
                return;

            foreach (Adage.EF.Interfaces.RelatedObject eachObj in currentObj.RelatedObjects)
            {
                IRelatedEnd childColl;
                if (eachObj.RelatedType == RelatedEnum.Many)
                {
                    childColl = eachObj.GetRelatedEnd((EntityObject)currentObj);
                    if (childColl == null || childColl.IsLoaded == false)
                    {
                        continue;
                    }
                }
                else
                {
                    if (eachObj.GetReference((EntityObject)currentObj).IsLoaded == false)
                    {
                        continue;
                    }

                    childColl = eachObj.GetRelatedEnd((EntityObject)currentObj);
                }

                foreach (Adage.EF.Interfaces.IBusinessObject eachChild in childColl)
                {
                    eachChild.FindBrokenRules(checkEntities,
                        errorMessages, (EntityObject)currentObj);
                }
            }
        }
开发者ID:BostonSymphOrch,项目名称:HENRY-archives,代码行数:46,代码来源:BusinessObjectHelper.cs


示例17: BusObjBeginEditConcurrencyControlException

 /// <summary>
 /// Constructor to initialise the exception with a set of details
 /// regarding the editing of the object
 /// </summary>
 /// <param name="className">The class name</param>
 /// <param name="userName">The user name editing the record</param>
 /// <param name="machineName">The machine name editing the record</param>
 /// <param name="dateUpdated">The date that the editing took place</param>
 /// <param name="objectID">The object's ID</param>
 /// <param name="obj">The object in question</param>
 public BusObjBeginEditConcurrencyControlException(string className,
     string userName,
     string machineName,
     DateTime dateUpdated,
     string objectID,
     IBusinessObject obj)
     :
         base("You cannot Edit '" + className +
              "', as another user has edited this record. \n" +
              "UserName: " +
              (userName.Length > 0 ? userName : "[Unknown]") +
              " \nMachineName: " +
              (machineName.Length > 0 ? machineName : "[Unknown]") +
              " \nDateUpdated: " +
              dateUpdated.ToString("dd MMM yyyy HH:mm:ss:fff") +
              " \nObjectID: " + objectID, obj)
 {
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:28,代码来源:BusObjBeginEditConcurrencyControlException.cs


示例18: ShowDialog

        public CloseBOEditorDialogResult ShowDialog(IBusinessObject businessObject)
        {
            if (businessObject == null)
            {
                BOEditorDialogResult = CloseBOEditorDialogResult.CloseWithoutSaving;
                this.Close();
                return BOEditorDialogResult;
            }


            var isInValidState = businessObject.Status.IsValid();
            var isDirty = businessObject.Status.IsDirty;
            SaveAndCloseBtn.Enabled = isInValidState;
            this.BOEditorDialogResult = CloseBOEditorDialogResult.CancelClose;


            if (!isDirty)
            {
                this.BOEditorDialogResult = CloseBOEditorDialogResult.CloseWithoutSaving;
                this.Close();
                return this.BOEditorDialogResult;
            }
            string isValidString;
            if (isInValidState)
            {
                isValidString = " and is in a valid state to be saved";
            }

            else
            {
                string isValidMessage = businessObject.Status.IsValidMessage;

                isValidString = " and is not in a valid state to be saved: " + Environment.NewLine +
                                isValidMessage + Environment.NewLine;
            }
            var fullDisplayName = businessObject.ClassDef.DisplayName
                    + " '" + businessObject.ToString() + "'";
            _label.Text = "The " + fullDisplayName + " is has been edited" + isValidString +
                          ". Please choose the appropriate action";
            this.SaveAndCloseBtn.Enabled = isInValidState;
            ShowForm();
            return this.BOEditorDialogResult;
        }
开发者ID:Chillisoft,项目名称:habanero.faces,代码行数:43,代码来源:CloseBOEditorDialogWin.cs


示例19: BusObjOptimisticConcurrencyControlException

 /// <summary>
 /// Constructor to initialise the exception with a set of concurrency
 /// details
 /// </summary>
 /// <param name="className">The class name</param>
 /// <param name="userName">The user name that edited the record</param>
 /// <param name="machineName">The machine name that edited the record</param>
 /// <param name="dateUpdated">The date that the record was edited</param>
 /// <param name="objectID">The object ID</param>
 /// <param name="obj">The object whose record was edited</param>
 public BusObjOptimisticConcurrencyControlException(string className,
     string userName,
     string machineName,
     DateTime dateUpdated,
     string objectID,
     IBusinessObject obj) :
         base("You cannot save the changes to '" + className +
              "', as another user has edited this record. \n" +
              "UserName: " +
              (userName.Length > 0 ? userName : "[Unknown]") +
              " \nMachineName: " +
              (machineName.Length > 0 ? machineName : "[Unknown]") +
              " \nDateUpdated: " +
              dateUpdated.ToString("dd MMM yyyy HH:mm:ss:fff") +
              " \nObjectID: " + objectID, obj)
 {
     _userNameEdited = (userName.Length > 0 ? userName : "[Unknown]");
     _machineNameEdited = (machineName.Length > 0 ? machineName : "[Unknown]");
     _dateUpdated = dateUpdated;
     _objectID = objectID;
     _obj = obj;
     _className = className;
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:33,代码来源:BusObjOptimisticConcurrencyControlException.cs


示例20: CheckIsValid

        public static bool CheckIsValid(IBusinessObject currentObj,
                List<IBusinessObject> checkEntities)
        {
            if (checkEntities.Contains(currentObj))
                return true;

            checkEntities.Add(currentObj);
            foreach (Adage.EF.Interfaces.RelatedObject eachObj in currentObj.RelatedObjects)
            {
                IRelatedEnd childColl;
                if (eachObj.RelatedType == RelatedEnum.Many)
                {
                    childColl = eachObj.GetRelatedEnd((EntityObject)currentObj);
                    if (childColl == null || childColl.IsLoaded == false)
                    {
                        continue;
                    }
                }
                else
                {
                    if (eachObj.GetReference((EntityObject)currentObj).IsLoaded == false)
                    {
                        continue;
                    }

                    childColl = eachObj.GetRelatedEnd((EntityObject)currentObj);
                }

                foreach (IBusinessObject eachChild in childColl)
                {
                    if (eachChild.CheckIsValid(checkEntities) == false)
                        return false;
                }
            }

            return true;
        }
开发者ID:BostonSymphOrch,项目名称:HENRY-archives,代码行数:37,代码来源:BusinessObjectHelper.cs



注:本文中的IBusinessObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IButton类代码示例发布时间:2022-05-24
下一篇:
C# IBus类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap