コード例 #1
0
        public void Notify(params object[] args)
        {
            if (args != null && args.Length != 0 && args[0] is EntityEvent)
            {
                BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey;
                if (!(key == null))
                {
                    Customer customer = key.GetEntity() as Customer;
                    if (PubHelper.IsOrg_Customer2DMS(customer))
                    {
                        bool flag = PubHelper.IsUsedDMSAPI();
                        if (flag)
                        {
                            //if ((customer.CustomerCategoryKey != null && (customer.CustomerCategory.Code == "101007" || customer.CustomerCategory.Code == "101006"))
                            //    || (customer.CustomerCategory != null
                            //        && customer.CustomerCategory.DescFlexField != null
                            //        && customer.CustomerCategory.DescFlexField.PrivateDescSeg1.GetBool()
                            //        )
                            //    )
                            if(
                                PubHelper.IsUpdateDMS(customer)
                                )
                            {
                                try
                                {
                                    SI08ImplService service = new SI08ImplService();
                                    // service.Url = PubHelper.GetAddress(service.Url);
                                    System.Collections.Generic.List<dealerInfoDto> list = new System.Collections.Generic.List<dealerInfoDto>();
                                    dealerInfoDto dto = new dealerInfoDto();
                                    dto.dealerCode = customer.Code;
                                    dto.dealerName = customer.Name;
                                    dto.dealerShortName = customer.ShortName;
                                    dto.companyCode = customer.Code;
                                    dto.companyName = customer.Name;
                                    dto.companyShortName = customer.ShortName;
                                    if (customer.CustomerCategoryKey != null)
                                    {
                                        dto.dealerType = int.Parse(customer.CustomerCategory.Code);
                                    }
                                    dto.actionType = 3;
                                    // status  100201 有效 100202 无效
                                    dto.status = (customer.Effective != null && customer.Effective.IsEffective) ? "100201" : "100202";

                                    list.Add(dto);
                                    dealerInfoDto d = service.Do(list.ToArray());
                                    if (d != null && d.flag == 0)
                                    {
                                        throw new System.ApplicationException(d.errMsg);
                                    }
                                }
                                catch (System.Exception e)
                                {
                                    throw new System.ApplicationException("调用DMS接口错误:" + e.Message);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
 public static dealerInfoDto GetUpdateDMSDTO(Customer customer)
 {
     dealerInfoDto dto = new dealerInfoDto();
     dto.dealerCode = customer.Code;
     dto.dealerName = customer.Name;
     dto.dealerShortName = customer.ShortName;
     dto.companyCode = customer.Code;
     dto.companyName = customer.Name;
     dto.companyShortName = customer.ShortName;
     if (customer.CustomerCategoryKey != null)
     {
         dto.dealerType = int.Parse(customer.CustomerCategory.Code);
     }
     dto.actionType = 2;
     // status  100201 有效 100202 无效
     dto.status = (customer.Effective != null && customer.Effective.IsEffective) ? "100201" : "100202";
     return dto;
 }
コード例 #3
0
ファイル: PubExtend.cs プロジェクト: HaiBoHan/HBHDaYunsy
        // 经销商主数据接口
        /// <summary>
        /// 经销商主数据接口
        /// </summary>
        /// <param name="service"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        public static dealerInfoDto Do(this SI08ImplService service, dealerInfoDto[] param)
        {
            service.Url = PubHelper.GetAddress(service.Url);

            string entityName = "经销商主数据接口";
            long svID = -1;
            if (IsLog)
            {
                svID = ProxyLogger.CreateTransferSV(entityName
                    //, EntitySerialization.EntitySerial(bpObj)
                    , Newtonsoft.Json.JsonConvert.SerializeObject(param)
                    , service.GetType().FullName,Newtonsoft.Json.JsonConvert.SerializeObject(service));
            }

            try
            {
                var result = service.receive(param);

                if (svID > 0)
                {
                    if (result != null
                        )
                    {
                        //string resultXml = EntitySerialization.EntitySerial(result);
                        string resultXml = Newtonsoft.Json.JsonConvert.SerializeObject(result);

                        ProxyLogger.UpdateTransferSV(svID, resultXml, result.flag == 1, result.errMsg, string.Empty, string.Empty);
                    }
                    else
                    {
                        ProxyLogger.UpdateTransferSV(svID, string.Empty, false, Const_ResultNullMessage, string.Empty, string.Empty);
                    }
                }
                return result;
            }
            catch (Exception ex)
            {
                if (svID > 0)
                {
                    ProxyLogger.UpdateTransferSV(svID, string.Empty, false, ex.Message, string.Empty, ex.StackTrace);
                }

                throw ex;
            }

            return null;
        }
コード例 #4
0
ファイル: Reference.cs プロジェクト: HaiBoHan/HBHDaYunsy
 /// <remarks/>
 public void receiveAsync(dealerInfoDto[] arg0, object userState) {
     if ((this.receiveOperationCompleted == null)) {
         this.receiveOperationCompleted = new System.Threading.SendOrPostCallback(this.OnreceiveOperationCompleted);
     }
     this.InvokeAsync("receive", new object[] {
                 arg0}, this.receiveOperationCompleted, userState);
 }
コード例 #5
0
ファイル: Reference.cs プロジェクト: HaiBoHan/HBHDaYunsy
 /// <remarks/>
 public void receiveAsync(dealerInfoDto[] arg0) {
     this.receiveAsync(arg0, null);
 }