/// <summary>
 /// Create a new HouseOwner object.
 /// </summary>
 /// <param name="houseOwnerId">Initial value of the HouseOwnerId property.</param>
 /// <param name="isCertificateOwner">Initial value of the IsCertificateOwner property.</param>
 /// <param name="consumerId">Initial value of the ConsumerId property.</param>
 /// <param name="oldHouseId">Initial value of the OldHouseId property.</param>
 public static HouseOwner CreateHouseOwner(global::System.Int32 houseOwnerId, global::System.Boolean isCertificateOwner, global::System.Int32 consumerId, global::System.Int32 oldHouseId)
 {
     HouseOwner houseOwner = new HouseOwner();
     houseOwner.HouseOwnerId = houseOwnerId;
     houseOwner.IsCertificateOwner = isCertificateOwner;
     houseOwner.ConsumerId = consumerId;
     houseOwner.OldHouseId = oldHouseId;
     return houseOwner;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the HouseOwnerSet EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToHouseOwnerSet(HouseOwner houseOwner)
 {
     base.AddObject("HouseOwnerSet", houseOwner);
 }
        public OrderFlow CreateOrderFromPreorder(IEnumerable<PreprocessOrder> preorders)
        {
            OrderFlow order = InnerCreateOrder();

            foreach (PreprocessOrder pre in preorders)
            {
                //------------------------------
                OldHouse house = new OldHouse();

                foreach (PreprocessConsumer cur in pre.PreprocessConsumer)
                {
                    Consumer consumer = null;
                    foreach (Consumer rep in order.Consumer)
                    {
                        //注意,不能改变cur。
                        string sname, sid;
                        sname = cur.Name;
                        sid = cur.IdentityCardNo;
                        if (rep.Name == sname.Trim() &&
                            rep.IdentityType == cur.IdentityType &&
                            rep.IdentityCardNo == sid.Trim())
                        {
                            consumer = rep;
                            break;
                        }
                    }

                    if (consumer == null)
                    {
                        string sname, sid;
                        sname = cur.Name;
                        sid = cur.IdentityCardNo;

                        consumer = new Consumer();
                        consumer.Name = sname.Trim();
                        consumer.IdentityType = cur.IdentityType;
                        consumer.IdentityCardNo = sid.Trim();
                        consumer.Memo = cur.Memo;
                        order.Consumer.Add(consumer);
                    }
                    else if (string.IsNullOrEmpty(consumer.Memo))
                    {
                        consumer.Memo = cur.Memo;
                    }

                    HouseOwner owner = new HouseOwner();

                    owner.IsCertificateOwner = false;
                    owner.Consumer = consumer;

                    house.HouseOwner.Add(owner);
                }
                //------------------------------
                house.RegionType = pre.RegionType;
                house.OwnershipType = pre.OwnershipType;
                house.Organization = pre.Organization;
                house.CertificateType = pre.CertificateType;
                house.CertificateNo = pre.CertificateNo;
                house.Address = pre.Address;
                house.PropertyArea = pre.PropertyArea;
                house.MeasureArea = pre.MeasureArea;
                house.EvaluationTotalPrice = pre.EvaluationTotalPrice;
                house.Memo = pre.Memo;

                order.OldHouse.Add(house);

                //------------------------------
                order.QueueNo = pre.QueueNo;

            }

            this.OrderFlows.Add(order);

            //从服务器更新用户名和时间
            order.UpdateCreator();

            //这样更新,居然解决了!!!因为实际上传递的参数是0
            foreach (PreprocessOrder pre in preorders)
            {
                pre.UpdateAssociatedOrderFlow(order.OrderFlowId);
            }

            OrderFlowLog(order, Operate_Enum.Order_Create_Pre);

            return order;
        }