/// <summary>
        /// 通过一个实体给另外一个实体赋值
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="targetEntity"></param>
        private static void SetTargetEntityValue(InformationBrokerEntity originalEntity, ref InformationBrokerEntity targetEntity)
        {
            targetEntity.CanUsable                  = originalEntity.CanUsable;
            targetEntity.ContactPerson              = originalEntity.ContactPerson;
            targetEntity.InformationBrokerName      = originalEntity.InformationBrokerName;
            targetEntity.InformationBrokerNameShort = originalEntity.InformationBrokerNameShort;
            targetEntity.PrincipleAddress           = originalEntity.PrincipleAddress;
            targetEntity.InformationBrokerWWW       = originalEntity.InformationBrokerWWW;
            targetEntity.InformationBrokerType      = originalEntity.InformationBrokerType;
            targetEntity.Email = originalEntity.Email;
            targetEntity.InformationBrokerLevel       = originalEntity.InformationBrokerLevel;
            targetEntity.InformationBrokerMemo        = originalEntity.InformationBrokerMemo;
            targetEntity.InformationBrokerDescription = originalEntity.InformationBrokerDescription;
            targetEntity.Fax                   = originalEntity.Fax;
            targetEntity.IndustryKey           = originalEntity.IndustryKey;
            targetEntity.PostCode              = originalEntity.PostCode;
            targetEntity.InformationBrokerKind = originalEntity.InformationBrokerKind;
            targetEntity.Telephone             = originalEntity.Telephone;
            targetEntity.AreaCode              = originalEntity.AreaCode;
            targetEntity.HigherOrganization    = originalEntity.HigherOrganization;

            targetEntity.FinanceUserName   = RequestHelper.GetValue("FinanceUser");
            targetEntity.FinanceUserGuid   = RequestHelper.GetValue <Guid>("FinanceUser_Value");
            targetEntity.ProviderUserName  = RequestHelper.GetValue("ProviderUser");
            targetEntity.ProviderUserGuid  = RequestHelper.GetValue <Guid>("ProviderUser_Value");
            targetEntity.RecommendUserName = RequestHelper.GetValue("RecommendUser");
            targetEntity.RecommendUserGuid = RequestHelper.GetValue <Guid>("RecommendUser_Value");
            targetEntity.ServiceUserName   = RequestHelper.GetValue("ServiceUser");
            targetEntity.ServiceUserGuid   = RequestHelper.GetValue <Guid>("ServiceUser_Value");
            targetEntity.BusinessUserName  = RequestHelper.GetValue("BusinessUser");
            targetEntity.BusinessUserGuid  = RequestHelper.GetValue <Guid>("BusinessUser_Value");
            targetEntity.SettleUserName    = RequestHelper.GetValue("SettleUser");
            targetEntity.SettleUserGuid    = RequestHelper.GetValue <Guid>("SettleUser_Value");
        }
        public ActionResult Item(string itemKey)
        {
            InformationBrokerEntity department = InformationBrokerEntity.Empty;

            if (string.IsNullOrWhiteSpace(itemKey) == false)
            {
                department = InformationBrokerBLL.Instance.Get(itemKey);
            }

            return(View(department));
        }
        public override bool Update(InformationBrokerEntity entity)
        {
            string commandText = string.Format(@"Update [XQYCInformationBroker] Set   
				    [InformationBrokerGuid] = {0}InformationBrokerGuid,
				    [InformationBrokerName] = {0}InformationBrokerName,
				    [InformationBrokerNameShort] = {0}InformationBrokerNameShort,
                    [HigherOrganization] = {0}HigherOrganization,
				    [CanUsable] = {0}CanUsable,
				    [AreaCode] = {0}AreaCode,
				    [IndustryKey] = {0}IndustryKey,
				    [IndustryType] = {0}IndustryType,
				    [InformationBrokerType] = {0}InformationBrokerType,
				    [InformationBrokerKind] = {0}InformationBrokerKind,
				    [PrincipleAddress] = {0}PrincipleAddress,
				    [ContactPerson] = {0}ContactPerson,
				    [PostCode] = {0}PostCode,
				    [Telephone] = {0}Telephone,
				    [Fax] = {0}Fax,
				    [Email] = {0}Email,
				    [InformationBrokerWWW] = {0}InformationBrokerWWW,
				    [InformationBrokerLevel] = {0}InformationBrokerLevel,
				    [InformationBrokerRank] = {0}InformationBrokerRank,
				    [InformationBrokerDescription] = {0}InformationBrokerDescription,
				    [InformationBrokerMemo] = {0}InformationBrokerMemo,
				    [ProviderUserGuid] = {0}ProviderUserGuid,
				    [ProviderUserName] = {0}ProviderUserName,
				    [RecommendUserGuid] = {0}RecommendUserGuid,
				    [RecommendUserName] = {0}RecommendUserName,
				    [ServiceUserGuid] = {0}ServiceUserGuid,
				    [ServiceUserName] = {0}ServiceUserName,
				    [FinanceUserGuid] = {0}FinanceUserGuid,
				    [FinanceUserName] = {0}FinanceUserName,
                    [BusinessUserGuid] = {0}BusinessUserGuid,
				    [BusinessUserName] = {0}BusinessUserName,
                    [SettleUserGuid] = {0}SettleUserGuid,
				    [SettleUserName] = {0}SettleUserName,
				    [CreateUserKey] = {0}CreateUserKey,
				    [CreateUserName] = {0}CreateUserName,
				    [CreateDate] = {0}CreateDate,
				    [LastUpdateUserKey] = {0}LastUpdateUserKey,
				    [LastUpdateUserName] = {0}LastUpdateUserName,
				    [LastUpdateDate] = {0}LastUpdateDate,
				    [IsProtectedByOwner] = {0}IsProtectedByOwner,
				    [CooperateStatus] = {0}CooperateStatus,
				    [PropertyNames] = {0}PropertyNames,
				    [PropertyValues] = {0}PropertyValues
            Where [InformationBrokerID] = {0}InformationBrokerID", ParameterNamePrefix);

            TParameter[] sqlParas = PrepareParasAll(entity);

            bool isSuccessful = HelperExInstance.ExecuteSingleRowNonQuery(commandText, sqlParas);

            return(isSuccessful);
        }
        protected override TParameter[] PrepareParasAll(InformationBrokerEntity entity)
        {
            List <TParameter> list = new List <TParameter>()
            {
                GenerateParameter("InformationBrokerID", entity.InformationBrokerID),
                GenerateParameter("InformationBrokerGuid", entity.InformationBrokerGuid),
                GenerateParameter("InformationBrokerName", entity.InformationBrokerName ?? String.Empty),
                GenerateParameter("InformationBrokerNameShort", entity.InformationBrokerNameShort ?? String.Empty),
                GenerateParameter("HigherOrganization", entity.HigherOrganization ?? String.Empty),
                GenerateParameter("CanUsable", entity.CanUsable),
                GenerateParameter("AreaCode", entity.AreaCode ?? String.Empty),
                GenerateParameter("IndustryKey", entity.IndustryKey ?? String.Empty),
                GenerateParameter("IndustryType", entity.IndustryType),
                GenerateParameter("InformationBrokerType", entity.InformationBrokerType),
                GenerateParameter("InformationBrokerKind", entity.InformationBrokerKind ?? String.Empty),
                GenerateParameter("PrincipleAddress", entity.PrincipleAddress ?? String.Empty),
                GenerateParameter("ContactPerson", entity.ContactPerson ?? String.Empty),
                GenerateParameter("PostCode", entity.PostCode ?? String.Empty),
                GenerateParameter("Telephone", entity.Telephone ?? String.Empty),
                GenerateParameter("Fax", entity.Fax ?? String.Empty),
                GenerateParameter("Email", entity.Email ?? String.Empty),
                GenerateParameter("InformationBrokerWWW", entity.InformationBrokerWWW ?? String.Empty),
                GenerateParameter("InformationBrokerLevel", entity.InformationBrokerLevel),
                GenerateParameter("InformationBrokerRank", entity.InformationBrokerRank ?? String.Empty),
                GenerateParameter("InformationBrokerDescription", entity.InformationBrokerDescription ?? String.Empty),
                GenerateParameter("InformationBrokerMemo", entity.InformationBrokerMemo ?? String.Empty),
                GenerateParameter("ProviderUserGuid", entity.ProviderUserGuid),
                GenerateParameter("ProviderUserName", entity.ProviderUserName ?? String.Empty),
                GenerateParameter("RecommendUserGuid", entity.RecommendUserGuid),
                GenerateParameter("RecommendUserName", entity.RecommendUserName ?? String.Empty),
                GenerateParameter("ServiceUserGuid", entity.ServiceUserGuid),
                GenerateParameter("ServiceUserName", entity.ServiceUserName ?? String.Empty),
                GenerateParameter("FinanceUserGuid", entity.FinanceUserGuid),
                GenerateParameter("FinanceUserName", entity.FinanceUserName ?? String.Empty),
                GenerateParameter("BusinessUserGuid", entity.BusinessUserGuid),
                GenerateParameter("BusinessUserName", entity.BusinessUserName ?? String.Empty),
                GenerateParameter("SettleUserGuid", entity.SettleUserGuid),
                GenerateParameter("SettleUserName", entity.SettleUserName ?? String.Empty),
                GenerateParameter("CreateUserKey", entity.CreateUserKey ?? String.Empty),
                GenerateParameter("CreateUserName", entity.CreateUserName ?? String.Empty),
                GenerateParameter("CreateDate", entity.CreateDate),
                GenerateParameter("LastUpdateUserKey", entity.LastUpdateUserKey ?? String.Empty),
                GenerateParameter("LastUpdateUserName", entity.LastUpdateUserName ?? String.Empty),
                GenerateParameter("LastUpdateDate", entity.LastUpdateDate),
                GenerateParameter("IsProtectedByOwner", entity.IsProtectedByOwner),
                GenerateParameter("CooperateStatus", entity.CooperateStatus),
                GenerateParameter("PropertyNames", entity.PropertyNames ?? String.Empty),
                GenerateParameter("PropertyValues", entity.PropertyValues ?? String.Empty)
            };

            return(list.ToArray());
        }
        public ActionResult Item(string itemKey, InformationBrokerEntity entity, bool isOnlyPlaceHolder = true)
        {
            bool   isSuccessful   = false;
            string displayMessage = string.Empty;
            string returnUrl      = RequestHelper.GetValue("returnUrl");

            if (string.IsNullOrWhiteSpace(returnUrl))
            {
                returnUrl = Url.Action("Index");
            }

            InformationBrokerEntity targetEntity = null;

            if (GuidHelper.IsInvalidOrEmpty(itemKey))
            {
                targetEntity = new InformationBrokerEntity();
                SetTargetEntityValue(entity, ref targetEntity);
                targetEntity.CreateUserKey = BusinessUserBLL.CurrentUserGuid.ToString();
                targetEntity.CreateDate    = DateTime.Now;
                isSuccessful = InformationBrokerBLL.Instance.Create(targetEntity);
            }
            else
            {
                targetEntity = InformationBrokerBLL.Instance.Get(itemKey);
                SetTargetEntityValue(entity, ref targetEntity);

                isSuccessful = InformationBrokerBLL.Instance.Update(targetEntity);
            }


            if (isSuccessful == true)
            {
                displayMessage = "数据保存成功";
            }
            else
            {
                displayMessage = "数据保存失败";
            }

            return(Redirect(returnUrl));
        }
        public override bool Create(InformationBrokerEntity entity)
        {
            if (entity.InformationBrokerGuid == Guid.Empty)
            {
                entity.InformationBrokerGuid = GuidHelper.NewGuid();
            }

            string commandText = string.Format(@"Insert Into [XQYCInformationBroker] (
			    [InformationBrokerGuid],
			    [InformationBrokerName],
			    [InformationBrokerNameShort],
                [HigherOrganization],
			    [CanUsable],
			    [AreaCode],
			    [IndustryKey],
			    [IndustryType],
			    [InformationBrokerType],
			    [InformationBrokerKind],
			    [PrincipleAddress],
			    [ContactPerson],
			    [PostCode],
			    [Telephone],
			    [Fax],
			    [Email],
			    [InformationBrokerWWW],
			    [InformationBrokerLevel],
			    [InformationBrokerRank],
			    [InformationBrokerDescription],
			    [InformationBrokerMemo],
			    [ProviderUserGuid],
			    [ProviderUserName],
			    [RecommendUserGuid],
			    [RecommendUserName],
			    [ServiceUserGuid],
			    [ServiceUserName],
			    [FinanceUserGuid],
			    [FinanceUserName],
			    [BusinessUserGuid],
			    [BusinessUserName],
			    [SettleUserGuid],
			    [SettleUserName],
			    [CreateUserKey],
			    [CreateUserName],
			    [CreateDate],
			    [LastUpdateUserKey],
			    [LastUpdateUserName],
			    [LastUpdateDate],
			    [IsProtectedByOwner],
			    [CooperateStatus],
			    [PropertyNames],
			    [PropertyValues]
            ) 
            Values (
			    {0}InformationBrokerGuid,
			    {0}InformationBrokerName,
			    {0}InformationBrokerNameShort,
                {0}HigherOrganization,
			    {0}CanUsable,
			    {0}AreaCode,
			    {0}IndustryKey,
			    {0}IndustryType,
			    {0}InformationBrokerType,
			    {0}InformationBrokerKind,
			    {0}PrincipleAddress,
			    {0}ContactPerson,
			    {0}PostCode,
			    {0}Telephone,
			    {0}Fax,
			    {0}Email,
			    {0}InformationBrokerWWW,
			    {0}InformationBrokerLevel,
			    {0}InformationBrokerRank,
			    {0}InformationBrokerDescription,
			    {0}InformationBrokerMemo,
			    {0}ProviderUserGuid,
			    {0}ProviderUserName,
			    {0}RecommendUserGuid,
			    {0}RecommendUserName,
			    {0}ServiceUserGuid,
			    {0}ServiceUserName,
			    {0}FinanceUserGuid,
			    {0}FinanceUserName,
			    {0}BusinessUserGuid,
			    {0}BusinessUserName,
			    {0}SettleUserGuid,
			    {0}SettleUserName,
			    {0}CreateUserKey,
			    {0}CreateUserName,
			    {0}CreateDate,
			    {0}LastUpdateUserKey,
			    {0}LastUpdateUserName,
			    {0}LastUpdateDate,
			    {0}IsProtectedByOwner,
			    {0}CooperateStatus,
			    {0}PropertyNames,
			    {0}PropertyValues
            )", ParameterNamePrefix);

            TParameter[] sqlParas = PrepareParasAll(entity);

            bool isSuccessful = HelperExInstance.ExecuteSingleRowNonQuery(commandText, sqlParas);

            return(isSuccessful);
        }
        protected override InformationBrokerEntity Load(IDataReader reader)
        {
            InformationBrokerEntity entity = new InformationBrokerEntity();

            if (reader != null && reader.IsClosed == false)
            {
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "InformationBrokerID"))
                {
                    entity.InformationBrokerID = reader.GetInt32(reader.GetOrdinal("InformationBrokerID"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "InformationBrokerGuid"))
                {
                    entity.InformationBrokerGuid = reader.GetGuid(reader.GetOrdinal("InformationBrokerGuid"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "InformationBrokerName"))
                {
                    entity.InformationBrokerName = reader.GetString(reader.GetOrdinal("InformationBrokerName"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "InformationBrokerNameShort"))
                {
                    entity.InformationBrokerNameShort = reader.GetString(reader.GetOrdinal("InformationBrokerNameShort"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "HigherOrganization"))
                {
                    entity.HigherOrganization = reader.GetString(reader.GetOrdinal("HigherOrganization"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "CanUsable"))
                {
                    entity.CanUsable = (Logics)reader.GetInt32(reader.GetOrdinal("CanUsable"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "AreaCode"))
                {
                    entity.AreaCode = reader.GetString(reader.GetOrdinal("AreaCode"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "IndustryKey"))
                {
                    entity.IndustryKey = reader.GetString(reader.GetOrdinal("IndustryKey"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "IndustryType"))
                {
                    entity.IndustryType = (IndustryTypes)reader.GetInt32(reader.GetOrdinal("IndustryType"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "InformationBrokerType"))
                {
                    entity.InformationBrokerType = (InformationBrokerTypes)reader.GetInt32(reader.GetOrdinal("InformationBrokerType"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "InformationBrokerKind"))
                {
                    entity.InformationBrokerKind = reader.GetString(reader.GetOrdinal("InformationBrokerKind"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "PrincipleAddress"))
                {
                    entity.PrincipleAddress = reader.GetString(reader.GetOrdinal("PrincipleAddress"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "ContactPerson"))
                {
                    entity.ContactPerson = reader.GetString(reader.GetOrdinal("ContactPerson"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "PostCode"))
                {
                    entity.PostCode = reader.GetString(reader.GetOrdinal("PostCode"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "Telephone"))
                {
                    entity.Telephone = reader.GetString(reader.GetOrdinal("Telephone"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "Fax"))
                {
                    entity.Fax = reader.GetString(reader.GetOrdinal("Fax"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "Email"))
                {
                    entity.Email = reader.GetString(reader.GetOrdinal("Email"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "InformationBrokerWWW"))
                {
                    entity.InformationBrokerWWW = reader.GetString(reader.GetOrdinal("InformationBrokerWWW"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "InformationBrokerLevel"))
                {
                    entity.InformationBrokerLevel = reader.GetInt32(reader.GetOrdinal("InformationBrokerLevel"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "InformationBrokerRank"))
                {
                    entity.InformationBrokerRank = reader.GetString(reader.GetOrdinal("InformationBrokerRank"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "InformationBrokerDescription"))
                {
                    entity.InformationBrokerDescription = reader.GetString(reader.GetOrdinal("InformationBrokerDescription"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "InformationBrokerMemo"))
                {
                    entity.InformationBrokerMemo = reader.GetString(reader.GetOrdinal("InformationBrokerMemo"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "ProviderUserGuid"))
                {
                    entity.ProviderUserGuid = reader.GetGuid(reader.GetOrdinal("ProviderUserGuid"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "ProviderUserName"))
                {
                    entity.ProviderUserName = reader.GetString(reader.GetOrdinal("ProviderUserName"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "RecommendUserGuid"))
                {
                    entity.RecommendUserGuid = reader.GetGuid(reader.GetOrdinal("RecommendUserGuid"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "RecommendUserName"))
                {
                    entity.RecommendUserName = reader.GetString(reader.GetOrdinal("RecommendUserName"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "ServiceUserGuid"))
                {
                    entity.ServiceUserGuid = reader.GetGuid(reader.GetOrdinal("ServiceUserGuid"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "ServiceUserName"))
                {
                    entity.ServiceUserName = reader.GetString(reader.GetOrdinal("ServiceUserName"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "FinanceUserGuid"))
                {
                    entity.FinanceUserGuid = reader.GetGuid(reader.GetOrdinal("FinanceUserGuid"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "FinanceUserName"))
                {
                    entity.FinanceUserName = reader.GetString(reader.GetOrdinal("FinanceUserName"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "BusinessUserGuid"))
                {
                    entity.BusinessUserGuid = reader.GetGuid(reader.GetOrdinal("BusinessUserGuid"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "BusinessUserName"))
                {
                    entity.BusinessUserName = reader.GetString(reader.GetOrdinal("BusinessUserName"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "SettleUserGuid"))
                {
                    entity.SettleUserGuid = reader.GetGuid(reader.GetOrdinal("SettleUserGuid"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "SettleUserName"))
                {
                    entity.SettleUserName = reader.GetString(reader.GetOrdinal("SettleUserName"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "CreateUserKey"))
                {
                    entity.CreateUserKey = reader.GetString(reader.GetOrdinal("CreateUserKey"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "CreateUserName"))
                {
                    entity.CreateUserName = reader.GetString(reader.GetOrdinal("CreateUserName"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "CreateDate"))
                {
                    entity.CreateDate = reader.GetDateTime(reader.GetOrdinal("CreateDate"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LastUpdateUserKey"))
                {
                    entity.LastUpdateUserKey = reader.GetString(reader.GetOrdinal("LastUpdateUserKey"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LastUpdateUserName"))
                {
                    entity.LastUpdateUserName = reader.GetString(reader.GetOrdinal("LastUpdateUserName"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LastUpdateDate"))
                {
                    entity.LastUpdateDate = reader.GetDateTime(reader.GetOrdinal("LastUpdateDate"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "IsProtectedByOwner"))
                {
                    entity.IsProtectedByOwner = (Logics)reader.GetInt32(reader.GetOrdinal("IsProtectedByOwner"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "CooperateStatus"))
                {
                    entity.CooperateStatus = reader.GetInt32(reader.GetOrdinal("CooperateStatus"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "PropertyNames"))
                {
                    entity.PropertyNames = reader.GetString(reader.GetOrdinal("PropertyNames"));
                }
                if (DataReaderHelper.IsExistFieldAndNotNull(reader, "PropertyValues"))
                {
                    entity.PropertyValues = reader.GetString(reader.GetOrdinal("PropertyValues"));
                }
            }

            return(entity);
        }
        /// <summary>
        /// 通过一个实体给另外一个实体赋值
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="targetEntity"></param>
        private static void SetTargetEntityValue(InformationBrokerEntity originalEntity, ref InformationBrokerEntity targetEntity)
        {
            targetEntity.CanUsable = originalEntity.CanUsable;
            targetEntity.ContactPerson = originalEntity.ContactPerson;
            targetEntity.InformationBrokerName = originalEntity.InformationBrokerName;
            targetEntity.InformationBrokerNameShort = originalEntity.InformationBrokerNameShort;
            targetEntity.PrincipleAddress = originalEntity.PrincipleAddress;
            targetEntity.InformationBrokerWWW = originalEntity.InformationBrokerWWW;
            targetEntity.InformationBrokerType = originalEntity.InformationBrokerType;
            targetEntity.Email = originalEntity.Email;
            targetEntity.InformationBrokerLevel = originalEntity.InformationBrokerLevel;
            targetEntity.InformationBrokerMemo = originalEntity.InformationBrokerMemo;
            targetEntity.InformationBrokerDescription = originalEntity.InformationBrokerDescription;
            targetEntity.Fax = originalEntity.Fax;
            targetEntity.IndustryKey = originalEntity.IndustryKey;
            targetEntity.PostCode = originalEntity.PostCode;
            targetEntity.InformationBrokerKind = originalEntity.InformationBrokerKind;
            targetEntity.Telephone = originalEntity.Telephone;
            targetEntity.AreaCode = originalEntity.AreaCode;
            targetEntity.HigherOrganization = originalEntity.HigherOrganization;

            targetEntity.FinanceUserName = RequestHelper.GetValue("FinanceUser");
            targetEntity.FinanceUserGuid = RequestHelper.GetValue<Guid>("FinanceUser_Value");
            targetEntity.ProviderUserName = RequestHelper.GetValue("ProviderUser");
            targetEntity.ProviderUserGuid = RequestHelper.GetValue<Guid>("ProviderUser_Value");
            targetEntity.RecommendUserName = RequestHelper.GetValue("RecommendUser");
            targetEntity.RecommendUserGuid = RequestHelper.GetValue<Guid>("RecommendUser_Value");
            targetEntity.ServiceUserName = RequestHelper.GetValue("ServiceUser");
            targetEntity.ServiceUserGuid = RequestHelper.GetValue<Guid>("ServiceUser_Value");
            targetEntity.BusinessUserName = RequestHelper.GetValue("BusinessUser");
            targetEntity.BusinessUserGuid = RequestHelper.GetValue<Guid>("BusinessUser_Value");
            targetEntity.SettleUserName = RequestHelper.GetValue("SettleUser");
            targetEntity.SettleUserGuid = RequestHelper.GetValue<Guid>("SettleUser_Value");
        }
        public ActionResult Item(string itemKey, InformationBrokerEntity entity, bool isOnlyPlaceHolder = true)
        {
            bool isSuccessful = false;
            string displayMessage = string.Empty;
            string returnUrl = RequestHelper.GetValue("returnUrl");
            if (string.IsNullOrWhiteSpace(returnUrl))
            {
                returnUrl = Url.Action("Index");
            }

            InformationBrokerEntity targetEntity = null;
            if (GuidHelper.IsInvalidOrEmpty(itemKey))
            {
                targetEntity = new InformationBrokerEntity();
                SetTargetEntityValue(entity, ref targetEntity);
                targetEntity.CreateUserKey = BusinessUserBLL.CurrentUserGuid.ToString();
                targetEntity.CreateDate = DateTime.Now;
                isSuccessful = InformationBrokerBLL.Instance.Create(targetEntity);
            }
            else
            {
                targetEntity = InformationBrokerBLL.Instance.Get(itemKey);
                SetTargetEntityValue(entity, ref targetEntity);

                isSuccessful = InformationBrokerBLL.Instance.Update(targetEntity);
            }

            if (isSuccessful == true)
            {
                displayMessage = "数据保存成功";
            }
            else
            {
                displayMessage = "数据保存失败";
            }

            return Redirect(returnUrl);
        }