/// <summary> /// Deprecated Method for adding a new object to the ConsumerSet EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToConsumerSet(Consumer consumer) { base.AddObject("ConsumerSet", consumer); }
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; }
/// <summary> /// Create a new Consumer object. /// </summary> /// <param name="consumerId">Initial value of the ConsumerId property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="identityType">Initial value of the IdentityType property.</param> /// <param name="orderFlowId">Initial value of the OrderFlowId property.</param> public static Consumer CreateConsumer(global::System.Int32 consumerId, global::System.String name, global::System.Int32 identityType, global::System.Int32 orderFlowId) { Consumer consumer = new Consumer(); consumer.ConsumerId = consumerId; consumer.Name = name; consumer.IdentityType = identityType; consumer.OrderFlowId = orderFlowId; return consumer; }
public OrderFlow CreateOrderFromError(ErrorFlow error) { OrderFlow order = InnerCreateOrder(); foreach (OrderFlow o in error.OrderFlow) { foreach (Apartment apt in o.Apartment) { apt.SellStateEnum = SellState_Enum.Locked; apt.OrderFlow = order; } foreach (PreprocessOrder pre in o.PreprocessOrder) { pre.IsProcessed = true; pre.OrderFlow = order; } //不检查重复性 foreach (OldHouse house in o.OldHouse) { OldHouse newh = new OldHouse(); newh.RegionType = house.RegionType; newh.OwnershipType = house.OwnershipType; newh.Organization = house.Organization; newh.CertificateType = house.CertificateType; newh.CertificateNo = house.CertificateNo; newh.Address = house.Address; newh.PropertyArea = house.PropertyArea; newh.MeasureArea = house.MeasureArea; newh.EvaluationTotalPrice = house.EvaluationTotalPrice; newh.Memo = house.Memo; order.OldHouse.Add(newh); } //不检查重复性 foreach (Consumer user in o.Consumer) { Consumer con = new Consumer(); con.Name = user.Name; con.IdentityType = user.IdentityType; con.IdentityCardNo = user.IdentityCardNo; con.Memo = user.Memo; order.Consumer.Add(con); } //不添加HouseOwener order.QueueNo = o.QueueNo; } //新单设置成错误状态,以免其他人删除,处理完成后设置成其他状态 order.OrderState = (int)OrderState_Enum.Error; order.ErrorOrderType = (int)ErrorOrderType_Enum.CreateOrder; order.ErrorFlow = error; this.OrderFlows.Add(order); //从服务器更新用户名和时间 order.UpdateCreator(); OrderFlowLog(order, Operate_Enum.Order_Create_Error); return order; }