Beispiel #1
0
        public virtual CustomerPointsAddRequest CreateCustomerAddPointRequset(CustomerPointsAddRequest requset)
        {
            //检查输入的SO单存不存在:
            if (requset.PointType == (int)AdjustPointType.RMAPostageManuToPoints)
            {
                throw new BizException(string.Format(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "AuditRequest_RMASONotFound"), requset.SOSysNo.Value.ToString()));
            }
            else
            {
                if (requset.SOSysNo != null && !ExternalDomainBroker.ExistSO(requset.SOSysNo.Value))
                {
                    throw new BizException(string.Format(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "CreateRequest_SONotFound"), requset.SOSysNo.Value.ToString()));
                }
            }
            using (TransactionScope scope = new TransactionScope())
            {
                ObjectFactory <IPointDA> .Instance.CreateRequest(requset);

                if (0 < requset.SysNo)
                {
                    requset.PointsItemList.ForEach(delegate(CustomerPointsAddRequestItem item)
                    {
                        item.PointsAddRequestSysNo = requset.SysNo.Value;
                        ObjectFactory <IPointDA> .Instance.CreateRequestItem(item);
                    });
                    scope.Complete();
                    return(requset);
                }
                else
                {
                    throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "CreateRequest_CreateFailed"));
                }
            }
        }
Beispiel #2
0
        public virtual void ConfirmRequest(CustomerPointsAddRequest requestInfo)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("ConfirmCustomerPointsAddRequest");

            cmd.SetParameterValue <CustomerPointsAddRequest>(requestInfo);
            cmd.ExecuteNonQuery();
        }
Beispiel #3
0
        public virtual DataTable QueryRequestItemsBySysNo(CustomerPointsAddRequest info)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("SelectCustomerPointAddRequestItem");

            cmd.SetParameterValue("@PointAddRequestSysNo", info.SysNo);
            cmd.SetParameterValue("@Status", "A");
            return(cmd.ExecuteDataTable());
        }
Beispiel #4
0
        public virtual int CreateRequest(CustomerPointsAddRequest info)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("CreateCustomerPointAddRequest");

            cmd.SetParameterValue <CustomerPointsAddRequest>(info);
            cmd.ExecuteNonQuery();
            int result = Convert.ToInt32(cmd.GetParameterValue("@SysNo"));

            info.SysNo = result;
            return(result);
        }
Beispiel #5
0
        public List <CommentEntity> SendCommentPoint(List <CommentEntity> commentList, out List <string> msg)
        {
            msg = new List <string>();
            if (commentList == null || commentList.Count == 0)
            {
                return(new List <CommentEntity>());
            }
            List <CustomerPointsAddRequest> body = new List <CustomerPointsAddRequest>();

            foreach (var item in commentList)
            {
                //新蛋网商品(vendortype=0)评论经验积分从MKT-Topic账户发放。
                //商家商品(vendortype=1)评论相关发放积分从Seller –topic中发放。
                CustomerPointsAddRequest aPR = new CustomerPointsAddRequest
                {
                    CustomerSysNo     = item.CustomerSysNo,
                    Point             = item.CustomerPoint,
                    PointType         = item.VendorType,
                    SOSysNo           = item.SOSysNo,
                    NewEggAccount     = item.VendorType == 0 ? NeweggAccount : SellerAccount,
                    Memo              = item.SysNo.ToString(),
                    Source            = "ECommerceMgmt",
                    PointExpiringDate = DateTime.Now.AddYears(1)
                };
                body.Add(aPR);
                string msgCode = SendCommentPointsDA.Adjust(aPR).ToString();
                if (msgCode == "10001")
                {
                    msg.Add("\r\n 客户:" + item.CustomerSysNo + ";评论编号:" + item.SysNo + ";获得积分:" + item.CustomerPoint + "-----出现异常,异常原因:发积分账户不存在或者积分不足!");
                }
            }

            List <CommentEntity> successList = new List <CommentEntity>();

            if (body == null || body.Count == 0)
            {
                return(new List <CommentEntity>());
            }

            body.ForEach(item =>
            {
                successList.Add(new CommentEntity()
                {
                    //SysNo = int.Parse(item.Message.Memo),
                    SysNo         = Convert.ToInt32(item.SysNo),
                    CustomerPoint = Convert.ToInt32(item.Point),
                    CustomerSysNo = Convert.ToInt32(item.CustomerSysNo)
                });
            });
            return(successList);
        }
Beispiel #6
0
        public virtual int?QueryRequestStatusBySysNo(CustomerPointsAddRequest info)
        {
            int?        status = null;
            DataCommand cmd    = DataCommandManager.GetDataCommand("SelectCustomerPointAddRequestStatus");

            cmd.SetParameterValue("@SysNo", info.SysNo);
            object returnObject = cmd.ExecuteScalar();

            if (null != returnObject)
            {
                status = Convert.ToInt16(returnObject);
            }
            return(status);
        }
Beispiel #7
0
 private CustomerPointsAddRequest BuildAuditRequestMessage(CustomerPointsAddRequestStatus targetStatus)
 {
     this.actionRequest = new BizEntity.Customer.CustomerPointsAddRequest()
     {
         SysNo            = Convert.ToInt32(viewModel["sysno"]),
         Status           = targetStatus,
         ConfirmUserSysNo = CPApplication.Current.LoginUser.UserSysNo.Value,
         CustomerSysNo    = Convert.ToInt32(viewModel["customersysno"]),
         ConfirmNote      = viewModel["confirmnote"].ToString(),
         PointType        = Convert.ToInt32(viewModel["pointlogtype"]),
         SOSysNo          = Convert.ToInt32(viewModel["sosysno"]),
         Point            = Convert.ToInt32(viewModel["point"]),
         CreateUserSysNo  = Convert.ToInt32(viewModel["createusersysno"]),
         NewEggAccount    = viewModel["neweggaccount"].ToString()
     };
     return(this.actionRequest);
 }
        private void Button_Save_Click(object sender, RoutedEventArgs e)
        {
            // 添加顾客加积分申请操作:
            if (!ValidateInput())
            {
                return;
            }
            CustomerPointsAddRequest newRequestInfo = new CustomerPointsAddRequest();

            newRequestInfo.CustomerID      = viewModel.CustomerID;
            newRequestInfo.CustomerSysNo   = viewModel.CustomerSysNo.Value;
            newRequestInfo.PointType       = Convert.ToInt32((Combo_Memo.SelectedItem as CodeNamePair).Code);
            newRequestInfo.NewEggAccount   = (Combo_SysAccount.SelectedItem as CodeNamePair).Name;
            newRequestInfo.Memo            = Combo_Memo.SelectedItem != null ? (Combo_Memo.SelectedItem as CodeNamePair).Name : string.Empty;
            newRequestInfo.OwnByDepartment = Combo_OwnByDepartment.SelectedItem != null ? (Combo_OwnByDepartment.SelectedItem as CodeNamePair).Name : string.Empty;
            if (!string.IsNullOrEmpty(viewModel.SOSysNo))
            {
                newRequestInfo.SOSysNo = Convert.ToInt32(viewModel.SOSysNo);
            }
            newRequestInfo.Point          = Convert.ToInt32(viewModel.Point);
            newRequestInfo.PointsItemList = EntityConverter <CustomerPointsAddItemVM, CustomerPointsAddRequestItem> .Convert(viewModel.PointsItemList);

            newRequestInfo.Note      = viewModel.Note;
            newRequestInfo.ProductID = txtProductID.Text.Length > 0 ? txtProductID.Text : null;

            serviceFacade.CreateCustomerPointsAddRequest(newRequestInfo, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                else
                {
                    if (Dialog != null)
                    {
                        Dialog.ResultArgs.Data         = args;
                        Dialog.ResultArgs.DialogResult = DialogResultType.OK;
                        Dialog.Close();
                    }
                }
            });
        }
        public List <CustomerGuideEntity> SendCommentPoint(List <CustomerGuideEntity> commentList)
        {
            if (commentList == null || commentList.Count == 0)
            {
                return(new List <CustomerGuideEntity>());
            }
            List <CustomerPointsAddRequest> body = new List <CustomerPointsAddRequest>();

            foreach (var item in commentList)
            {
                //新蛋网商品(vendortype=0)评论经验积分从MKT-Topic账户发放。
                //商家商品(vendortype=1)评论相关发放积分从Seller –topic中发放。
                CustomerPointsAddRequest aPR = new CustomerPointsAddRequest
                {
                    CustomerSysNo = item.CustomerSysNo,
                    Point         = item.CustomerPoint,
                    Memo          = item.SysNo.ToString(),
                    Source        = "ECommerceMgmt",
                    SysNo         = item.SysNo
                };
                body.Add(aPR);
            }

            List <CustomerGuideEntity> successList = new List <CustomerGuideEntity>();

            if (body == null || body.Count == 0)
            {
                return(new List <CustomerGuideEntity>());
            }
            foreach (CustomerPointsAddRequest item in body)
            {
                successList.Add(new CustomerGuideEntity()
                {
                    SysNo         = Convert.ToInt32(item.SysNo),
                    CustomerPoint = Convert.ToInt32(item.Point),
                    CustomerSysNo = Convert.ToInt32(item.CustomerSysNo)
                });
            }
            return(successList);
        }
Beispiel #10
0
        public CustomerPointsAddRequestDetailInfo(DynamicXml model, string type)
        {
            viewModel     = new DynamicXml();
            serviceFacade = new CustomerPointsAddQueryFacade();
            actionRequest = new CustomerPointsAddRequest();
            queryRequest  = new CustomerPointsAddRequestFilter()
            {
                PageInfo    = new QueryFilter.Common.PagingInfo(),
                CompanyCode = CPApplication.Current.CompanyCode
            };

            if (null != model)
            {
                viewModel = model;
                if (!string.IsNullOrEmpty((string)viewModel["productID"]))
                {
                    (new OtherDomainQueryFacade()).QueryCategoryC1ByProductID((string)viewModel["productID"], (o, args) =>
                    {
                        if (!args.FaultsHandle())
                        {
                            viewModel["Category1Name"] = args.Result.CategoryName.Content;
                        }
                    });
                }
                this.DataContext = viewModel;
            }
            InitializeComponent();
            this.ProductsResultGrid.Bind();

            if (type == "Audit")
            {
                SwitchAuditButtons(true);
            }
            else
            {
                SwitchAuditButtons(false);
            }
        }
 public virtual CustomerPointsAddRequest CreateCustomerPointsAddRequest(CustomerPointsAddRequest newInfo)
 {
     return(ObjectFactory <PointProcessor> .Instance.CreateCustomerAddPointRequset(newInfo));
 }
        public void CreateCustomerPointsAddRequest(CustomerPointsAddRequest request, EventHandler <RestClientEventArgs <CustomerPointsAddRequest> > callback)
        {
            string itemRelativeUrl = "/CustomerService/Point/CreateCustomerPointsAddRequest";

            restClient.Update(itemRelativeUrl, request, callback);
        }
Beispiel #13
0
        private static int DoProcess(DateTime currentDate, int pointType)
        {
            List <SOMasterEntity> list = SendAmbassadorPointsDA.GetSO(pointType, currentDate, startNumber);

            if (list == null || list.Count == 0)
            {
                return(0);
            }
            Dictionary <string, int>        customerPointDictionary = new Dictionary <string, int>();
            List <CustomerPointsAddRequest> pointRequestList        = new List <CustomerPointsAddRequest>();

            foreach (SOMasterEntity so in list)
            {
                if (pointRequestList.Exists(delegate(CustomerPointsAddRequest item)
                                            { return(item.SOSysNo.Value == so.SysNo); }
                                            ))
                {
                    continue;
                }
                #region Get Refund
                List <RmaRefundEntity> refundList = SendAmbassadorPointsDA.GetRefundBySO(so.SysNo);
                //退款单为待审核状态Job不加积分
                if (refundList.Exists(delegate(RmaRefundEntity item)
                {
                    return(item.Status == 3);
                }))
                {
                    startNumber++;
                    continue;
                }

                decimal refundAmount = Convert.ToInt32(refundList.Sum(delegate(RmaRefundEntity item)
                {
                    if (item.Status == 0 || item.Status == 2)
                    {
                        return(item.PointAmt * 0.1m + item.CashAmt);
                    }
                    return(0);
                }));
                #endregion

                decimal soAmount = so.CashPay + so.DiscountAmt + so.PointPay * 0.1m;

                //团购订单
                if (so.SOType == 7)
                {
                    SOMasterEntity groupBuyingSo       = SendAmbassadorPointsDA.GetGroupBuyingSO(so.SysNo);
                    decimal        soGroupBuyingAmount = groupBuyingSo.CashPay + groupBuyingSo.DiscountAmt + groupBuyingSo.PointPay * 0.1m;
                    soAmount = soAmount - soGroupBuyingAmount;
                }
                //拆单的情况
                if (so.Status == -6)
                {
                    //所有子单金额
                    List <SOMasterEntity> allSOList = SendAmbassadorPointsDA.GetAllSubSO(so.SysNo);
                    soAmount = 0.0m;
                    foreach (SOMasterEntity soEntity in allSOList)
                    {
                        soAmount += soEntity.CashPay + soEntity.DiscountAmt + soEntity.PointPay * 0.1m;
                    }

                    //作废子单金额
                    List <SOMasterEntity> invalidList = SendAmbassadorPointsDA.GetInValidSubSO(so.SysNo);
                    decimal invalidAmount             = 0.0m;
                    foreach (SOMasterEntity invalidSO in invalidList)
                    {
                        invalidAmount += invalidSO.CashPay + invalidSO.DiscountAmt + invalidSO.PointPay * 0.1m;
                    }

                    //作废团购订单金额
                    SOMasterEntity groupbuyingSO     = SendAmbassadorPointsDA.GetGroupBuyingSubSO(so.SysNo);
                    decimal        groupbuyingAmount = groupbuyingSO.CashPay + groupbuyingSO.DiscountAmt + groupbuyingSO.PointPay * 0.1m;

                    soAmount = soAmount - invalidAmount - groupbuyingAmount;
                }

                int pointAmount = (int)(rate * (soAmount - refundAmount) * 10);

                if (pointAmount <= 0)
                {
                    startNumber++;
                    continue;
                }

                #region add AdjustPointRequest
                CustomerPointsAddRequest pointRequest = new CustomerPointsAddRequest();
                //pointRequest.CompanyCode = AppConfigHelper.CompanyCode;
                pointRequest.CustomerSysNo = so.AgentSysNo;
                pointRequest.Memo          = so.SysNo.ToString();
                pointRequest.NewEggAccount = SysAccount;
                pointRequest.Note          = "新蛋大使订单加积分";
                pointRequest.Point         = pointAmount;
                pointRequest.PointType     = pointType;
                pointRequest.SOSysNo       = so.SysNo;
                pointRequest.Source        = "IPP.MKT.SendAmbassadorPoints";
                pointRequestList.Add(pointRequest);
                #endregion
            }
            BatchAdjustPointService(pointRequestList);
            return(pointRequestList.Count);
        }
Beispiel #14
0
 public CustomerPointsAddRequest CreateCustomerPointsAddRequest(CustomerPointsAddRequest request)
 {
     return(ObjectFactory <CustomerPointsAppService> .Instance.CreateCustomerPointsAddRequest(request));
 }
Beispiel #15
0
        public virtual void VerifyCustomerAddPointRequset(CustomerPointsAddRequest requset)
        {
            if (requset.SysNo <= 0)
            {
                throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "AuditRequest_SONotFound"));
            }
            //审核人和申请人不能相同
            //if (requset.ConfirmUserSysNo == requset.CreateUserSysNo)
            //{
            //    throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "AuditRequest_ComfirmEqualCreate"));
            //}
            if (requset.Status == CustomerPointsAddRequestStatus.AuditDenied)
            {
                string            to    = ExternalDomainBroker.GetUserInfoBySysNo(requset.CreateUserSysNo).EmailAddress;
                KeyValueVariables param = new KeyValueVariables();
                param.Add("RequestSysNo", requset.SysNo);
                param.Add("Reasion", requset.ConfirmNote);
                using (TransactionScope scope = new TransactionScope())
                {
                    ObjectFactory <IPointDA> .Instance.ConfirmRequest(requset);

                    ECCentral.Service.Utility.EmailHelper.SendEmailByTemplate(to, "CustomerPointAddRequest_AuditDenied", param, true);
                    scope.Complete();
                }
                return;
            }
            else if (requset.Status == CustomerPointsAddRequestStatus.AuditPassed)
            {
                if (requset.PointsItemList != null && requset.PointsItemList.Count > 0)
                {
                    SOBaseInfo soInfo = ExternalDomainBroker.GetSOBaseInfo(requset.SOSysNo.Value);
                    if (soInfo == null)
                    {
                        throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SOStatusNotFound"));
                    }

                    if (ExternalDomainBroker.GetAutoRMARefundCountBySOSysNo(requset.SOSysNo.Value) > 0)//出库后被物流拒收也视为未出库
                    {
                        throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SOStatusNotOutStock"));
                    }
                    SOIncomeInfo soincomeinfo = ExternalDomainBroker.GetConfirmedSOIncomeInfo(requset.SOSysNo.Value, SOIncomeOrderType.SO);
                    if (soincomeinfo == null)
                    {
                        throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SOIncomeNotComfirmed"));
                    }
                    if (soInfo.Status != SOStatus.OutStock && SOIncomeStatus.Confirmed != soincomeinfo.Status)
                    {
                        throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SOStatusNotOutStockAndSOIncomeNotComfirmed"));
                    }
                    else if (soInfo.Status != SOStatus.OutStock)
                    {
                        throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SOStatusNotOutStock"));
                    }
                    else if (soincomeinfo.Status != SOIncomeStatus.Confirmed)
                    {
                        throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SOIncomeNotComfirmed"));
                    }
                }
                using (TransactionScope scope = new TransactionScope())
                {
                    //1.为顾客加积分
                    AdjustPointRequest pointAdjust = new AdjustPointRequest();
                    pointAdjust.CustomerSysNo = requset.CustomerSysNo;
                    pointAdjust.Memo          = ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "PointAddMemo_ManulAdjust");
                    pointAdjust.OperationType = AdjustPointOperationType.AddOrReduce;
                    pointAdjust.Point         = requset.Point;
                    pointAdjust.PointType     = requset.PointType;
                    pointAdjust.SOSysNo       = requset.SOSysNo;
                    pointAdjust.Source        = "CustomerMgmt";
                    Adjust(pointAdjust);
                    //1.将申请单审核通过
                    ObjectFactory <IPointDA> .Instance.ConfirmRequest(requset);

                    scope.Complete();
                }
            }
        }
Beispiel #16
0
 public void ConfirmCustomerPointsAddRequest(CustomerPointsAddRequest request)
 {
     ObjectFactory <CustomerPointsAppService> .Instance.ConfirmCustomerPointsAddReques(request);
 }
 public virtual void ConfirmCustomerPointsAddReques(CustomerPointsAddRequest info)
 {
     ObjectFactory <PointProcessor> .Instance.VerifyCustomerAddPointRequset(info);
 }