Exemple #1
0
        /// <summary>
        /// 逻辑删除
        /// </summary>
        public OPResult DeleteOrder(OrderSearchEntity entity)
        {
            var lp    = VMGlobal.DistributionQuery.LinqOP;
            var order = lp.GetById <BillOrder>(entity.BillID);

            if (order == null)
            {
                return new OPResult {
                           IsSucceed = false, Message = "未找到相应单据."
                }
            }
            ;
            if (order.IsDeleted)
            {
                return new OPResult {
                           IsSucceed = false, Message = "订单已作废."
                }
            }
            ;
            BillOrderChange change = new BillOrderChange
            {
                BillID      = order.ID,
                CreateTime  = DateTime.Now,
                CreatorID   = VMGlobal.CurrentUser.ID,
                Description = "作废订单"
            };

            order.IsDeleted = true;
            OPResult result = null;

            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    lp.Update <BillOrder>(order);
                    lp.Add <BillOrderChange>(change);
                    result = new OPResult {
                        IsSucceed = true, Message = "作废成功!"
                    };
                    scope.Complete();
                }
                catch (Exception ex)
                {
                    result = new OPResult {
                        IsSucceed = false, Message = "作废失败,失败原因:\n" + ex.Message
                    };
                }
            }
            if (result.IsSucceed)
            {
                entity.Changes.Insert(0, change);

                var users = GetIMUsers(order.OrganizationID);
                IMHelper.AsyncSendMessageTo(users, new IMessage
                {
                    Message = string.Format("订单{0}被作废.", order.Code)
                }, IMReceiveAccessEnum.订单变动);
            }
            return(result);
        }
Exemple #2
0
        public override OPResult Save()
        {
            BillRetailBO bo = this.GenerateRetailBO();

            OPResult result = null;

            try
            {
                result = BillWebApiInvoker.Instance.Invoke <OPResult <BillRetail>, BillRetailBO>(bo, "BillRetail/SaveBillRetail");
            }
            catch (Exception ex)
            {
                result = new OPResult {
                    IsSucceed = false, Message = ex.Message
                };
            }

            if (result.IsSucceed)
            {
                this.Master = ((OPResult <BillRetail>)result).Result;

                var users = IMHelper.OnlineUsers.Where(o => o.OrganizationID == OrganizationListVM.CurrentOrganization.ParentID).ToArray();
                IMHelper.AsyncSendMessageTo(users, new IMessage
                {
                    Message = string.Format("{2}销售{0}件,单号{1},金额{3:C}.", Details.Sum(o => o.Quantity), Master.Code, OrganizationListVM.CurrentOrganization.Name, Master.CostMoney)
                }, IMReceiveAccessEnum.零售单);
            }
            return(result);
        }
Exemple #3
0
 public static void UpdateUserWebStub(int userId)
 {
     if (PortalConfig.UseIM)
     {
         IMHelper.UpdateUserWebStub(userId);
     }
 }
Exemple #4
0
 public static void UpdateGroup(int groupId)
 {
     if (PortalConfig.UseIM)
     {
         IMHelper.UpdateGroup(groupId);
     }
 }
Exemple #5
0
 public static void LogOff(int userId)
 {
     if (PortalConfig.UseIM)
     {
         IMHelper.LogOff(userId);
     }
 }
Exemple #6
0
        /// <summary>
        /// 取消剩余订单
        /// </summary>
        public OPResult CancelLeftOrderQuantity(OrderSearchEntity order)
        {
            var lp     = VMGlobal.DistributionQuery.LinqOP;
            var orders = lp.Search <BillOrderDetails>(o => o.BillID == order.BillID && o.QuaCancel != o.Quantity - o.QuaDelivered).ToList();

            if (orders.Count == 0)
            {
                return(new OPResult {
                    IsSucceed = false, Message = "没有可取消的量."
                });
            }
            int quaCancel = 0;

            orders.ForEach(o =>
            {
                quaCancel  += o.Quantity - o.QuaDelivered - o.QuaCancel;
                o.QuaCancel = o.Quantity - o.QuaDelivered;
            });
            BillOrderChange change = new BillOrderChange
            {
                BillID      = order.BillID,
                CreateTime  = DateTime.Now,
                CreatorID   = VMGlobal.CurrentUser.ID,
                Description = string.Format("取消剩余订单量,取消量{0}件.", quaCancel)
            };
            OPResult result = null;

            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    lp.Update <BillOrderDetails>(orders);
                    lp.Add <BillOrderChange>(change);
                    result = new OPResult {
                        IsSucceed = true, Message = "取消成功!"
                    };
                    scope.Complete();
                }
                catch (Exception ex)
                {
                    result = new OPResult {
                        IsSucceed = false, Message = "取消失败,失败原因:\n" + ex.Message
                    };
                }
            }
            if (result.IsSucceed)
            {
                foreach (var d in order.Details)
                {
                    d.QuaCancel = d.Quantity - d.QuaDelivered;
                }
                order.Changes.Insert(0, change);
                var users = GetIMUsers(order.OrganizationID);
                IMHelper.AsyncSendMessageTo(users, new IMessage
                {
                    Message = string.Format("订单{0}剩余量被取消,取消量{1}件.", order.BillCode, quaCancel)
                }, IMReceiveAccessEnum.订单变动);
            }
            return(result);
        }
        public ActionResult Afinidades()
        {
            CarregaUsuario();

            var dados = new PessoaNegocio().MinhasAfinidades(IMHelper.GetCookie(this, "UID"));

            return(View(dados));
        }
Exemple #8
0
        public void CarregaUsuario()
        {
            var codigo = IMHelper.GetCookie(this, "UID");

            var pessoa = new PessoaNegocio().PegaPessoaPorCodigo(codigo);

            ViewBag.emailmd5 = pessoa.Email.GeraMD5().ToLower();
            ViewBag.Usuario  = pessoa;
        }
 public JsonResult InsereDoacao(Doacao doacao)
 {
     return(Json(new DoacaoNegocio().InsereDoacao(
                     IMHelper.GetCookie(this, "UID"),
                     doacao.CodigoCampanha,
                     doacao.Descricao,
                     doacao.Quantidade
                     )
                 ));
 }
Exemple #10
0
        public override OPResult Save()
        {
            if (!IsDefectiveReturn && !OrganizationListVM.IsSelfRunShop(Master.OrganizationID))
            {
                var result = this.CheckGoodReturnRate(Master.OrganizationID);
                if (!result.IsSucceed)
                {
                    return(result);
                }
            }
            this.Master.TotalPrice = this.GridDataItems.Sum(o => o.Quantity * o.Price * o.Discount) / 100;//本单退货金额
            this.Master.Quantity   = this.GridDataItems.Sum(o => o.Quantity);
            this.Master.Status     = (int)BillGoodReturnStatusEnum.未审核;
            //this.Master.StorageID = (-1) * StorageID;//入库仓库ID以负数形式保存到数据库,用以后续审核入库
            var details = this.Details = new List <BillGoodReturnDetails>();

            TraverseGridDataItems(p =>
            {
                details.Add(new BillGoodReturnDetails {
                    ProductID = p.ProductID, Quantity = p.Quantity, Discount = p.Discount, Price = p.Price
                });
            });
            if (details.Count == 0)
            {
                return(new OPResult {
                    IsSucceed = false, Message = "没有需要保存的数据"
                });
            }
            OPResult opresult = null;

            if (Master.StorageID == default(int))
            {
                opresult = base.Save();
            }
            else
            {
                opresult = BillWebApiInvoker.Instance.SaveBill <BillGoodReturn, BillGoodReturnDetails>(new BillBO <BillGoodReturn, BillGoodReturnDetails>()
                {
                    Bill    = this.Master,
                    Details = this.Details
                });
            }
            if (opresult.IsSucceed)
            {
                var users = IMHelper.OnlineUsers.Where(o => o.OrganizationID == OrganizationListVM.CurrentOrganization.ParentID).ToArray();
                IMHelper.AsyncSendMessageTo(users, new IMessage
                {
                    Message = string.Format("{2}退货{0}件,单号{1},请注意查收.", Details.Sum(o => o.Quantity), Master.Code, OrganizationListVM.CurrentOrganization.Name)
                }, IMReceiveAccessEnum.退货单);
                this.Init();
            }
            return(opresult);
        }
        protected void Logoff()
        {
            try
            {
                FormsAuthentication.SignOut();

                IMHelper.SetaCookie(this, "UID", string.Empty);
            }
            catch
            {
            }
        }
Exemple #12
0
        public OPResult UpdateDetailsCancelQuantity(int did, int quaNew, string skuCode, OrderSearchEntity order)
        {
            var lp      = VMGlobal.DistributionQuery.LinqOP;
            var details = lp.GetById <BillOrderDetails>(did);

            if (quaNew == details.QuaCancel)
            {
                return(new OPResult {
                    IsSucceed = true
                });
            }
            string des = string.Format("SKU[{2}]取消量从{0}件改动为{1}件", details.QuaCancel, quaNew, skuCode);

            details.QuaCancel = quaNew;
            BillOrderChange change = new BillOrderChange
            {
                BillID      = details.BillID,
                CreateTime  = DateTime.Now,
                CreatorID   = VMGlobal.CurrentUser.ID,
                Description = des
            };
            OPResult result = null;

            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    lp.Update <BillOrderDetails>(details);
                    lp.Add <BillOrderChange>(change);
                    result = new OPResult {
                        IsSucceed = true, Message = "改动成功!"
                    };
                    scope.Complete();
                }
                catch (Exception ex)
                {
                    result = new OPResult {
                        IsSucceed = false, Message = "改动失败,失败原因:\n" + ex.Message
                    };
                }
            }
            if (result.IsSucceed)
            {
                order.Changes.Insert(0, change);
                var users = GetIMUsers(order.OrganizationID);
                IMHelper.AsyncSendMessageTo(users, new IMessage
                {
                    Message = string.Format("订单{0}" + des, order.BillCode)
                }, IMReceiveAccessEnum.订单变动);
            }
            return(result);
        }
        public JsonResult DoLogin(string Email, string Senha, bool manterConectado)
        {
            var usuario   = new PessoaNegocio();
            var resultado = usuario.Autenticacao(Email, Senha);

            if (resultado.Sucesso)
            {
                IMHelper.SetaCookie(this, "UID", ((Pessoa)resultado.New).CodigoPessoa);

                Autentica(Email, manterConectado);
            }

            return(Json(new { situacao = resultado.Sucesso, mensagem = resultado.Mensagem }));
        }
Exemple #14
0
        public override OPResult Save()
        {
            if (string.IsNullOrEmpty(Master.Remark))
            {
                var toOrganizationName = OrganizationListVM.CurrentOrganization.ChildrenOrganizations.Find(o => o.ID == Master.ToOrganizationID).Name;

                Master.Remark = "发往" + toOrganizationName;
            }
            var bo = new BillDeliveryBO
            {
                Bill    = this.Master,
                Details = this.Details
            };

            if (!_isSelfShop)
            {
                var bid        = Master.BrandID;
                var totalMoney = GetTotalMoney();
                bo.FundAccount = new OrganizationFundAccount
                {
                    BrandID          = bid,
                    OrganizationID   = this.Master.ToOrganizationID,
                    NeedIn           = totalMoney,
                    AlreadyIn        = 0.0M,
                    CreatorID        = VMGlobal.CurrentUser.ID,
                    BillKind         = (int)BillTypeEnum.BillDelivery,
                    Remark           = "发货单生成",
                    RefrenceBillCode = this.Master.Code
                };
            }
            var result = BillWebApiInvoker.Instance.SaveBill <BillDelivery, BillDeliveryDetails>(bo);

            if (result.IsSucceed)
            {
                var users  = IMHelper.OnlineUsers.Where(o => o.OrganizationID == Master.ToOrganizationID || o.OrganizationID == VMGlobal.CurrentUser.OrganizationID).ToArray();
                var toName = VMGlobal.SysProcessQuery.LinqOP.GetById <SysOrganization>(Master.ToOrganizationID).Name;
                IMHelper.AsyncSendMessageTo(users, new IMessage
                {
                    Message = string.Format("发往{2}{0}件,单号{1},到货后请及时入库.", Details.Sum(o => o.Quantity), Master.Code, toName),
                    Sender  = IMHelper.CurrentUser
                }, IMReceiveAccessEnum.发货单);
            }

            return(result);
        }
        /// <summary>
        /// Invokes this instance.
        /// </summary>
        public override void Invoke()
        {
            // Remove Expired
            RemoveExpiredMessages();

            //int maxDeliveryAttempts = 100; // TODO: Read From Config

            EntityObject[] elements = BusinessManager.List(OutgoingMessageQueueEntity.ClassName,
                                                           OutgoingMessageUtil.CreateIbnClientMessageDeliveryProviderFilters(),
                                                           new SortingElement[]
            {
                SortingElement.Ascending(OutgoingMessageQueueEntity.FieldCreated)
            });

            foreach (OutgoingMessageQueueEntity element in elements)
            {
                try
                {
                    // Load Ibn Message
                    IbnClientMessageEntity message = (IbnClientMessageEntity)BusinessManager.Load(IbnClientMessageEntity.ClassName, element.IbnClientMessageId.Value);

                    // Send
                    int toOriginalId   = DBUser.GetOriginalId(message.ToId);
                    int fromOriginalId = DBUser.GetOriginalId(message.FromId);

                    IMHelper.SendMessage(toOriginalId, fromOriginalId, message.HtmlBody);

                    element.Error = string.Empty;
                    element.DeliveryAttempts++;
                    element.IsDelivered = true;
                }
                catch (Exception ex)
                {
                    element.Error = ex.Message;
                    element.DeliveryAttempts++;

                    // TODO: Save Complete Error Stack || Complete Delivery Log
                }

                BusinessManager.Update(element);
            }

            //
        }
        public override OPResult Save()
        {
            Master.OrganizationID = VMGlobal.CurrentUser.OrganizationID;
            var details = this.Details = new List <BillCannibalizeDetails>();

            TraverseGridDataItems(p =>
            {
                details.Add(new BillCannibalizeDetails {
                    ProductID = p.ProductID, Quantity = p.Quantity
                });
            });
            if (details.Count == 0)
            {
                return(new OPResult {
                    IsSucceed = false, Message = "没有需要保存的数据"
                });
            }

            var opresult = BillWebApiInvoker.Instance.SaveBill <OPResult <string>, BillCannibalize, BillCannibalizeDetails>(new BillBO <BillCannibalize, BillCannibalizeDetails>()
            {
                Bill    = this.Master,
                Details = this.Details
            });

            if (opresult.IsSucceed)
            {
                this.Master.Code = ((OPResult <string>)opresult).Result;
                var users  = IMHelper.OnlineUsers.Where(o => o.OrganizationID == Master.ToOrganizationID || o.OrganizationID == OrganizationListVM.CurrentOrganization.ParentID).ToArray();
                var toName = VMGlobal.SysProcessQuery.LinqOP.GetById <SysOrganization>(Master.ToOrganizationID).Name;
                IMHelper.AsyncSendMessageTo(users, new IMessage
                {
                    Message = string.Format("从{2}到{3}调拨{0}件,单号{1},到货后请及时入库.", Details.Sum(o => o.Quantity), Master.Code, OrganizationListVM.CurrentOrganization.Name, toName)
                }, IMReceiveAccessEnum.调拨单);
            }
            return(opresult);
        }
Exemple #17
0
        /// <summary>
        /// 添加机器人到诊室
        /// </summary>
        /// <param name="channelID"></param>
        /// <param name="identifier"></param>
        /// <param name="name"></param>
        /// <param name="photoUrl"></param>
        /// <returns></returns>
        public bool AddRobotToChannel(int channelID, int identifier = 0, string name = "医生助理", string photoUrl = "")
        {
            IMHelper imService = new IMHelper();
            ConversationRoomService roomService = new ConversationRoomService();

            if (!imService.AddGroupMember(channelID, new List <int>()
            {
                identifier
            }))
            {
                return(false);
            }

            //新增群组成员
            if (!roomService.GetChannelUsersInfo(channelID).Exists(x => x.identifier == identifier))
            {
                if (!roomService.InsertChannelMembers(channelID, new List <RequestChannelMemberDTO>()
                {
                    new RequestChannelMemberDTO()
                    {
                        Identifier = identifier,
                        UserID = "",
                        UserMemberID = "",
                        UserType = EnumUserType.SysRobot,
                        PhotoUrl = photoUrl,
                        UserENName = name,
                        UserCNName = name
                    }
                }))
                {
                    return(false);
                }
            }

            return(true);
        }
        public override OPResult Save()
        {
            if (!OrganizationListVM.IsSelfRunShop(VMGlobal.CurrentUser.OrganizationID))
            {
#if UniqueCode
                List <string> uniqueCodes = new List <string>();
                TraverseGridDataItems(
                    item =>
                {
                    if (item.UniqueCodes.Count > 0)
                    {
                        uniqueCodes.AddRange(item.UniqueCodes);
                    }
                }
                    );
                var ucarray = uniqueCodes.ToArray();
                var result  = this.CheckDataAvaliable(ucarray);
                if (!result.IsSucceed)
                {
                    return(result);
                }
                result =
#else
                var result =
#endif
                    this.CheckGoodReturnRate(VMGlobal.CurrentUser.OrganizationID);
                if (!result.IsSucceed)
                {
                    return(result);
                }
            }
            this.Master.TotalPrice = this.GridDataItems.Sum(o => o.Quantity * o.Price * o.Discount) / 100;//本单退货金额
            this.Master.Quantity   = this.GridDataItems.Sum(o => o.Quantity);
            var details = this.Details = new List <BillGoodReturnDetails>();
            TraverseGridDataItems(p =>
            {
                details.Add(new BillGoodReturnDetails {
                    ProductID = p.ProductID, Quantity = p.Quantity, Discount = p.Discount, Price = p.Price
                });
            });
            if (details.Count == 0)
            {
                return(new OPResult {
                    IsSucceed = false, Message = "没有需要保存的数据"
                });
            }
            var opresult = BillWebApiInvoker.Instance.SaveBill <BillGoodReturn, BillGoodReturnDetails>(new BillBO <BillGoodReturn, BillGoodReturnDetails>()
            {
                Bill    = this.Master,
                Details = this.Details
            });
            if (opresult.IsSucceed)
            {
                var users = IMHelper.OnlineUsers.Where(o => o.OrganizationID == OrganizationListVM.CurrentOrganization.ParentID).ToArray();
                IMHelper.AsyncSendMessageTo(users, new IMessage
                {
                    Message = string.Format("{2}退货{0}件,单号{1},请注意查收.", Details.Sum(o => o.Quantity), Master.Code, OrganizationListVM.CurrentOrganization.Name)
                }, IMReceiveAccessEnum.退货单);
                this.Init();
            }
            return(opresult);
        }
        public JsonResult AtualizaAfinidade(string afinidade, string selecionado)
        {
            new PessoaNegocio().AtualizaAfinidade(IMHelper.GetCookie(this, "UID"), afinidade, selecionado.Equals("S"));

            return(Json(new { ok = true }));
        }
Exemple #20
0
        public JsonResult ComboCampanha()
        {
            var lista = new CampanhaNegocio().PegaMinhasCampanhas(IMHelper.GetCookie(this, "UID"));

            return(Json(lista));
        }
Exemple #21
0
        public OPResult Send(DeliverySearchEntity entity)
        {
            if (entity.Status != (int)BillDeliveryStatusEnum.已装箱未配送)
            {
                return(new OPResult {
                    IsSucceed = false, Message = "该单已配送"
                });
            }
            var bill = VMGlobal.DistributionQuery.LinqOP.GetById <BillDelivery>(entity.ID);

            if (bill.Status != (int)BillDeliveryStatusEnum.已装箱未配送)
            {
                return(new OPResult {
                    IsSucceed = false, Message = "该单已由他人配送"
                });
            }
            OrganizationFundAccount fundAccount = null;
            bool isSelfShop = OrganizationListVM.IsSelfRunShop(entity.ToOrganizationID);//是否自营店

            if (!isSelfShop)
            {
                var result = this.CheckFundSatisfyDelivery(entity);
                if (!result.IsSucceed)
                {
                    return(result);
                }
                var totalMoney = GetTotalMoney(entity);
                fundAccount = new OrganizationFundAccount
                {
                    BrandID          = entity.BrandID,
                    OrganizationID   = entity.ToOrganizationID,
                    NeedIn           = totalMoney,
                    AlreadyIn        = 0.0M,
                    CreatorID        = VMGlobal.CurrentUser.ID,
                    BillKind         = (int)BillTypeEnum.BillDelivery,
                    Remark           = "发货单生成",
                    RefrenceBillCode = entity.Code
                };
            }
            //生成出库单
            var storeout = this.GenerateStoreOut(entity);

            entity.Status = (int)BillDeliveryStatusEnum.在途中;
            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    if (fundAccount != null)
                    {
                        VMGlobal.DistributionQuery.LinqOP.Add <OrganizationFundAccount>(fundAccount);
                    }
                    VMGlobal.DistributionQuery.LinqOP.Update <BillDelivery>(entity);
                    storeout.SaveWithNoTran();
                    scope.Complete();
                }
                catch (Exception e)
                {
                    return(new OPResult {
                        IsSucceed = false, Message = "配送失败\n失败原因:" + e.Message
                    });
                }
            }
            ((ObservableCollection <DeliverySearchEntity>) this.Entities).Remove(entity);

            var users  = IMHelper.OnlineUsers.Where(o => o.OrganizationID == entity.ToOrganizationID || o.OrganizationID == VMGlobal.CurrentUser.OrganizationID).ToArray();
            var toName = VMGlobal.SysProcessQuery.LinqOP.GetById <SysOrganization>(entity.ToOrganizationID).Name;

            IMHelper.AsyncSendMessageTo(users, new IMessage
            {
                Message = string.Format("发往{2}{0}件,单号{1},到货后请及时入库.", entity.Quantity, entity.Code, toName),
                Sender  = IMHelper.CurrentUser
            }, IMReceiveAccessEnum.发货单);

            return(new OPResult {
                IsSucceed = true, Message = "配送成功."
            });
        }
Exemple #22
0
        public ActionResult Index(string ReturnUrl)
        {
            if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated && !string.IsNullOrEmpty(IMHelper.GetCookie(this, "UID")))
            {
                return(RedirectToAction("Index", "Home"));
            }

            ViewBag.ReturnUrl = ReturnUrl;

            return(View());
        }
        public override OPResult Save()
        {
            var lp = VMGlobal.DistributionQuery.LinqOP;

            var brandIDs = GridDataItems.Select(o => o.BrandID).Distinct().ToList();
            List <BillStoreOutVM> storeouts = new List <BillStoreOutVM>();
            List <BillStoringVM>  storings  = new List <BillStoringVM>();

            foreach (var bid in brandIDs)
            {
                var storeout = this.GenerateStoreOut(bid);
                if (storeout.Details.Count > 0)
                {
                    storeouts.Add(storeout);
                }
                var storing = this.GenerateStoring(bid);
                if (storing.Details.Count > 0)
                {
                    storings.Add(storing);
                }
            }
            Action storeAction = () =>
            {
                foreach (var storeout in storeouts)
                {
                    storeout.Master.RefrenceBillCode = Master.Code;
                    storeout.SaveWithNoTran();
                }
                foreach (var storing in storings)
                {
                    storing.Master.RefrenceBillCode = Master.Code;
                    storing.SaveWithNoTran();
                }
            };

            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    base.SaveWithNoTran();
                    storeAction();
                    if (this._vipInfo != null)
                    {
                        //添加VIP积分记录
                        VIPPointTrack pointTrack = new VIPPointTrack
                        {
                            CreateTime = DateTime.Now,
                            Point      = _vipInfo.PointTimes * ((int)Master.CostMoney),
                            VIPID      = _vipInfo.ID,
                            Remark     = "零售单产生,小票号" + Master.Code
                        };
                        lp.Add <VIPPointTrack>(pointTrack);
                        if (_vipUpgradeInfo != null)
                        {
                            var tactics = _vipUpgradeInfo.UpTactics.Where(o => o.IsChecked);
                            if (tactics != null && tactics.Count() > 0)
                            {
                                IEnumerable <int> kindIDs = tactics.Select(o => o.FormerKindID).ToList();
                                IEnumerable <VIPCardKindMapping> mappings = lp.Search <VIPCardKindMapping>(o => o.CardID == _vipInfo.ID && kindIDs.Contains(o.KindID)).ToList();
                                foreach (var mapping in mappings)
                                {
                                    var t = tactics.First(o => o.FormerKindID == mapping.KindID);
                                    mapping.KindID = t.AfterKindID;
                                    if (t.CutPoint != 0)
                                    {
                                        pointTrack = new VIPPointTrack
                                        {
                                            CreateTime = DateTime.Now,
                                            Point      = (-1 * t.CutPoint),
                                            VIPID      = _vipInfo.ID,
                                            Remark     = "VIP升级产生," + t.Description
                                        };
                                        lp.Add <VIPPointTrack>(pointTrack);
                                    }
                                }
                                lp.Update <VIPCardKindMapping>(mappings);
                            }
                        }
                        if (_vipInfo.IsBirthday && this._vipInfo.CostMoney != 0 && this._vipInfo.Quantity != 0)
                        {
                            lp.Delete <VIPBirthdayConsumption>(o => o.VIPID == _vipInfo.ID && o.ConsumeDay == DateTime.Now.Date);
                            lp.Add <VIPBirthdayConsumption>(new VIPBirthdayConsumption
                            {
                                VIPID      = _vipInfo.ID,
                                Quantity   = _vipInfo.Quantity,
                                CostMoney  = _vipInfo.CostMoney,
                                ConsumeDay = DateTime.Now.Date
                            });
                        }
                    }
                    scope.Complete();
                }
                catch (Exception e)
                {
                    return(new OPResult {
                        IsSucceed = false, Message = e.Message
                    });
                }
            }
            var users = IMHelper.OnlineUsers.Where(o => o.OrganizationID == OrganizationListVM.CurrentOrganization.ParentID).ToArray();

            IMHelper.AsyncSendMessageTo(users, new IMessage
            {
                Message = string.Format("{2}销售{0}件,单号{1},金额{3:C}.", Details.Sum(o => o.Quantity), Master.Code, OrganizationListVM.CurrentOrganization.Name, Master.CostMoney)
            }, IMReceiveAccessEnum.零售单);
            return(new OPResult {
                IsSucceed = true
            });
        }