Esempio n. 1
0
        static void Main(string[] args)
        {
            try
            {
                SendCommentPointsBP.jobContext = new JobContext();
                SendCommentPointsBP.BizLogFile = ConfigurationManager.AppSettings["BizLogFile"];
                new SendCommentPointsBP().Process();
                Log.WriteLog("最有用评论处理完成", "Log\\ServiceInfo.txt");
            }
            catch (Exception ex)
            {
                //MailHelper.SendMail(ex.ToString(), "最有用评论Job出现异常,请联系管理员!");

                string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["CommonRestFulBaseUrl"];
                string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"];
                string companyCode  = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];

                ECCentral.BizEntity.Common.MailInfo mInfo = new ECCentral.BizEntity.Common.MailInfo();
                mInfo.Subject  = "最有用评论Job出现异常,请联系管理员!";
                mInfo.Body     = ex.ToString();
                mInfo.FromName = ConfigurationManager.AppSettings["EmailFrom"];
                mInfo.ToName   = ConfigurationManager.AppSettings["EmailTo"];
                mInfo.CCName   = ConfigurationManager.AppSettings["EmailCC"];
                mInfo.Priority = 1;

                ECCentral.Job.Utility.RestClient       client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode);
                ECCentral.Job.Utility.RestServiceError error;
                var ar = client.Create("/Message/SendMail", mInfo, out error);

                Log.WriteLog(ex.ToString(), "Log\\ServiceInfo.txt");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 团购开始,结束 后都需要验证销售规则内差价是否小于0
        /// </summary>
        /// <param name="item"></param>
        private static void CheckSaleRule(int productSysNo)
        {
            //IMaintainSaleRuleV31 service = ServiceBroker.FindService<IMaintainSaleRuleV31>();
            try
            {
                //SaleRuleV31 saleRule = new SaleRuleV31();
                //saleRule.Body = new SaleRuleMsg();
                //saleRule.Body.ProductSysNo = productSysNo;
                //saleRule.Header = new Newegg.Oversea.Framework.Contract.MessageHeader();
                //saleRule.Header.CompanyCode = AppConfig.CompanyCode;
                //saleRule.Header.OperationUser = AppConfig.GetOperationUser();
                //service.CheckSaleRulePrice(saleRule);


                string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["MKTRestFulBaseUrl"];
                string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"];
                string companyCode  = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];
                ECCentral.Job.Utility.RestClient       client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode);
                ECCentral.Job.Utility.RestServiceError error;
                var ar = client.Create("/Combo/CheckComboPriceAndSetStatus", productSysNo, out error);
            }
            catch (Exception ex)
            {
                throw new BusinessException(ex.Message);
            }
            finally
            {
                //ServiceBroker.DisposeService(service);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 赠送客户积分校验
        /// </summary>
        /// <param name="pointRequest"></param>
        public static void PresentedCustomerPointPrecheck(AdjustPointRequestInfo pointRequest)
        {
            if (pointRequest == null)
            {
                return;
            }

            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["InvoiceMgmtRestFulBaseUrl"];
            string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"];
            string companyCode  = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];

            ECCentral.Job.Utility.RestClient       client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode);
            ECCentral.Job.Utility.RestServiceError error;
            string relativeUrl = "/InvoiceService/Job/AdjustPointPreCheck";

            var ar             = client.Create(relativeUrl, pointRequest, out error);
            var messageBuilder = new StringBuilder();

            if (error != null && error.Faults != null && error.Faults.Count > 0)
            {
                foreach (var errorItem in error.Faults)
                {
                    messageBuilder.AppendFormat(" {0} <br/>", errorItem.ErrorDescription);
                }

                throw new Exception(messageBuilder.ToString());
            }
        }
Esempio n. 4
0
        public static void SendEmail(MailEntity mailEntity)
        {
            try
            {
                string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["CommonRestFulBaseUrl"];
                string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"];
                string companyCode  = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];

                MailInfo mInfo = new MailInfo();
                mInfo.Subject  = mailEntity.Subject;
                mInfo.Body     = mailEntity.Body;
                mInfo.FromName = mailEntity.From;
                mInfo.ToName   = mailEntity.To;
                mInfo.CCName   = mailEntity.CC;
                mInfo.Priority = 1;

                ECCentral.Job.Utility.RestClient       client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode);
                ECCentral.Job.Utility.RestServiceError error;
                var ar = client.Create("/Message/SendMail", mInfo, out error);

                if (error != null && error.Faults != null && error.Faults.Count > 0)
                {
                    throw new Exception(error.Faults[0].ErrorDescription);
                }
            }
            catch (Exception ex)
            {
                string errorLog = ConfigurationManager.AppSettings["ErrorLog"];
                Log.WriteLog("邮件发送失败!\r\n" + ex.ToString(), errorLog);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 发送内部邮件
        /// </summary>
        /// <param name="mailList">内部邮件实体列表</param>
        public static void SendMail(List <MailInfo> mailList)
        {
            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["CommonRestFulBaseUrl"];
            string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"];
            string companyCode  = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];

            ECCentral.Job.Utility.RestClient       client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode);
            ECCentral.Job.Utility.RestServiceError error;

            foreach (MailInfo mailInfo in mailList)
            {
                mailInfo.FromName = JobConfig.SendMailAddress;

                if (string.IsNullOrEmpty(mailInfo.ToName))
                {
                    throw new Exception("收件人为空");
                }
                else
                {
                    mailInfo.ToName = mailInfo.ToName.Trim();
                }

                mailInfo.IsHtmlType = false;
                mailInfo.IsAsync    = true;
                mailInfo.IsInternal = true;

                var ar = client.Create("/Message/SendMail", mailInfo, out error);
                if (error != null && error.Faults != null && error.Faults.Count > 0)
                {
                    string errorMsg = "";
                    foreach (var errorItem in error.Faults)
                    {
                        errorMsg += errorItem.ErrorDescription;
                    }

                    throw new Exception("发送邮件异常:" + errorMsg);
                }
            }
        }
Esempio n. 6
0
        private static List <ErpOrder> CallCreateSOIncomeService(List <ErpOrder> orderList)
        {
            //获取配置参数
            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["RestFulBaseUrl"];
            string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"];
            string companyCode  = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];
            int?   UserSysNo    = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["UserSysNo"]);

            ECCentral.Job.Utility.RestClient       client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode);
            ECCentral.Job.Utility.RestServiceError error;
            foreach (var item in orderList)
            {
                SOIncomeInfo so = new SOIncomeInfo
                {
                    OrderType   = SOIncomeOrderType.SO,
                    OrderSysNo  = Convert.ToInt32(item.RefOrderNo),
                    OrderAmt    = item.OrderAmt,
                    IncomeStyle = SOIncomeOrderStyle.Normal,
                    IncomeAmt   = item.OrderAmt,
                    PrepayAmt   = 0,
                    Status      = SOIncomeStatus.Origin,
                    PayAmount   = item.OrderAmt,
                    CompanyCode = "8601"
                };
                var ar = client.Create("/InvoiceService/SOIncome/CreatSOIncome", so, out error);
                if (error != null && error.Faults != null && error.Faults.Count > 0)
                {
                    string errorMsg = string.Empty;
                    foreach (var errorItem in error.Faults)
                    {
                        errorMsg += errorItem.ErrorDescription;
                    }
                    OnShowInfo(errorMsg);
                }
            }
            return(orderList);
        }
Esempio n. 7
0
        private static List <ERPShippingInfo> CallSystemCreateService(List <ERPShippingInfo> orderList)
        {
            //获取配置参数
            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["RestFulBaseUrl"];
            string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"];
            string companyCode  = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];
            int?   UserSysNo    = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["UserSysNo"]);


            ECCentral.Job.Utility.RestClient       client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode);
            ECCentral.Job.Utility.RestServiceError error;
            var ar = client.Create <List <ERPShippingInfo> >("/ExternalSYSService/ERP/GetERPShippingInfoByRefOrder", orderList, out orderList, out error);

            if (error != null && error.Faults != null && error.Faults.Count > 0)
            {
                string errorMsg = string.Empty;
                foreach (var errorItem in error.Faults)
                {
                    errorMsg += errorItem.ErrorDescription;
                }
                OnShowInfo(errorMsg);
            }
            return(orderList);
        }
Esempio n. 8
0
        public static void AddShowCommentPointForCustomersFromMKT(List <CustomerInfo> customersPoint, BBSTopicMaster comment)
        {
            if (customersPoint == null || customersPoint.Count == 0)
            {
                return;
            }
            List <ECCentral.BizEntity.Customer.CustomerPointsAddRequest> request = new List <ECCentral.BizEntity.Customer.CustomerPointsAddRequest>();

            customersPoint.ForEach(c =>
            {
                request.Add(new ECCentral.BizEntity.Customer.CustomerPointsAddRequest()
                {
                    CustomerSysNo = c.CustomerSystemNumber,
                    Point         = c.CustomerGotPoint,
                    PointType     = 16,
                    NewEggAccount = "MKT-topic",
                    Memo          = comment.CommentSysNo.ToString(),
                    Note          = "后台设置屏蔽的评论为展示"
                });
            });

            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["CustomerRestFulBaseUrl"];
            string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"];
            string companyCode  = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];

            ECCentral.Job.Utility.RestClient       client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode);
            ECCentral.Job.Utility.RestServiceError error;
            var ar = client.Create("/Point/BatchAdjustPoint", request, out error);

            if (error != null && error.Faults != null && error.Faults.Count > 0)
            {
                string errorMsg = "";
                foreach (var errorItem in error.Faults)
                {
                    errorMsg += errorItem.ErrorDescription;
                }
                ECCentral.Job.Utility.Logger.WriteLog(errorMsg, "IPP.MKT.AutoNewsReplyIsShow");
            }


            //IBatchAdjustPointV31 service = ServiceBroker.FindService<IBatchAdjustPointV31>();

            //BatchMessageV31<AdjustPointRequestMsg> actionPara = new BatchMessageV31<AdjustPointRequestMsg>()
            //{
            //    Messages = (from item in customersPoint
            //                select new AdjustPointRequestMsg()
            //                {
            //                    CustomerSysNo = item.CustomerSystemNumber,
            //                    Point = item.CustomerGotPoint,
            //                    PointLogType = 16,
            //                    NewEggAccount = "MKT-topic",
            //                    Memo = comment.CommentSysNo.ToString(),
            //                    Note = "后台设置屏蔽的评论为展示"
            //                }).ToList()
            //};
            //actionPara.Header = new MessageHeader();
            //actionPara.Header.CompanyCode = CompanyCode;
            //actionPara.Header.Language = "zh-CN";
            //actionPara.Header.OperationUser = new OperationUser();
            //actionPara.Header.OperationUser.CompanyCode = CompanyCode;
            //actionPara.Header.OperationUser.LogUserName = "******";
            //actionPara.Header.OperationUser.UniqueUserName = "******";
            //actionPara.Header.OperationUser.SourceUserName = "******";
            //actionPara.Header.OperationUser.FullName = "IPPSystemAdmin";
            //actionPara.Header.OperationUser.SourceDirectoryKey = "bitkoo";
            //DefaultDataContract result = service.BatchAdjustPoint(actionPara);
            //ServiceAdapterHelper.DealServiceFault(result);
        }
Esempio n. 9
0
        public static void BatchAdjustPointService(List <CustomerPointsAddRequest> body)
        {
            if (body == null || body.Count == 0)
            {
                return;
            }
            string pointLog = string.Empty;

            //IAdjustPointV31 service = ServiceBroker.FindService<IAdjustPointV31>();
            //BatchActionRequest<AdjustPointRequestMsg> actionPara = new BatchActionRequest<AdjustPointRequestMsg>();
            //actionPara.Body = new List<CustomerPointsAddRequest>();
            //foreach (var item in body)
            //{
            //    AdjustPointRequestMsg msg = new AdjustPointRequestMsg()
            //      {
            //          CustomerSysNo = item.CustomerSysNo,
            //          Point = item.Point,
            //          PointType = (AdjustPointType)item.PointLogType,
            //          NewEggAccount = item.NewEggAccount,
            //          Memo = item.Memo + "," + item.Note,
            //          OrderSysNo = item.SOSysNo,
            //          Source = "ECommerceMgmt",
            //          OperationType = 0
            //      };

            //    pointLog += "CustomerSysNo=" + item.CustomerSysNo + ", Point=" + item.Point + " ,PointType=" + item.PointLogType + ",SOSysNo=" + item.SOSysNo + ";\r\n";
            //    actionPara.Body.Add(msg);
            //}
            //actionPara.Header = new Newegg.Oversea.Framework.Contract.MessageHeader();
            //actionPara.Header.CompanyCode = AppConfigHelper.CompanyCode;
            //actionPara.Header.Language = "zh-CN";
            //actionPara.Header.OperationUser = new Newegg.Oversea.Framework.Contract.OperationUser();
            //actionPara.Header.OperationUser.CompanyCode = AppConfigHelper.CompanyCode;
            //actionPara.Header.OperationUser.LogUserName = "******";
            //actionPara.Header.OperationUser.UniqueUserName = "******";
            //actionPara.Header.OperationUser.SourceUserName = "******";
            //actionPara.Header.OperationUser.FullName = "IPPSystemAdmin";
            //actionPara.Header.OperationUser.SourceDirectoryKey = "bitkoo";
            //BatchActionResponse<AdjustPointRequestMsg> result = service.BatchAdjustPoint(actionPara);
            //MessageFaultCollection faults = GetMessageFaults(result);
            //ServiceAdapterHelper.DealServiceFault(faults);

            body.ForEach(e => {
                pointLog += "CustomerSysNo=" + e.CustomerSysNo + ", Point=" + e.Point + " ,SOSysNo=" + e.SOSysNo + ";\r\n";
            });

            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["CustomerRestFulBaseUrl"];
            string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"];
            string companyCode  = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];

            ECCentral.Job.Utility.RestClient       client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode);
            ECCentral.Job.Utility.RestServiceError error;
            var ar = client.Create("/Point/BatchAdjustPoint", body, out error);

            if (error == null && error.Faults == null && error.Faults.Count == 0)
            {
                WriteLog("新蛋大使发订单积分成功,发放记录:\r\n" + pointLog);
            }
            else
            {
                WriteLog("Error:\r\n" + error.Faults[0].ErrorDescription);
            }
        }