Example #1
0
        public IndustryCode ConvertToIndustryCode()
        {
            string       value  = string.Format("{0}_{1}", this.primary_industry, this.deputy_industry.Replace("|", "_").Replace("/", "_"));
            IndustryCode result = default(IndustryCode);

            if (!Enum.TryParse <IndustryCode>(value, true, out result))
            {
                return(IndustryCode.其它_其它);
            }
            return(result);
        }
Example #2
0
        public IndustryCode ConvertToIndustryCode()
        {
            string       value  = string.Format("{0}_{1}", this.first_class, this.second_class.Replace("|", "_").Replace("/", "_"));
            IndustryCode result = default(IndustryCode);

            if (!Enum.TryParse <IndustryCode>(value, true, out result))
            {
                return(IndustryCode.其它_其它);
            }
            return(result);
        }
Example #3
0
 /// <summary>
 /// 设置所属行业
 /// </summary>
 /// <param name="accessTokenOrAppId">AccessToken或AppId(推荐使用AppId,需要先注册)</param>
 /// <param name="industry_id1">公众号模板消息所属行业编号</param>
 /// <param name="industry_id2">公众号模板消息所属行业编号</param>
 /// <param name="timeOut"></param>
 /// <returns></returns>
 public static WxJsonResult SetIndustry(string accessTokenOrAppId, IndustryCode industry_id1, IndustryCode industry_id2, int timeOut = Config.TIME_OUT)
 {
     return(ApiHandlerWapper.TryCommonApi(accessToken =>
     {
         const string urlFormat = "https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token={0}";
         var msgData = new
         {
             industry_id1 = ((int)industry_id1).ToString(),
             industry_id2 = ((int)industry_id2).ToString()
         };
         return CommonJsonSend.Send <WxJsonResult>(accessToken, urlFormat, msgData, timeOut: timeOut);
     }, accessTokenOrAppId));
 }
Example #4
0
        /// <summary>
        /// 设置所属行业
        /// </summary>
        /// <param name="accessTokenOrAppId"></param>
        /// <param name="industry_id1">公众号模板消息所属行业编号</param>
        /// <param name="industry_id2">公众号模板消息所属行业编号</param>
        /// <param name="timeOut"></param>
        /// <returns></returns>

        public static WxJsonResult SetIndustry(string accessTokenOrAppId, IndustryCode industry_id1, IndustryCode industry_id2, int timeOut = Config.TIME_OUT)
        {
            return ApiHandlerWapper.TryCommonApi(accessToken =>
            {
                const string urlFormat = "https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token={0}";
                var msgData = new
                {
                    industry_id1 = ((int)industry_id1).ToString(),
                    industry_id2 = ((int)industry_id2).ToString()
                };
                return CommonJsonSend.Send<WxJsonResult>(accessToken, urlFormat, msgData, timeOut: timeOut);

            }, accessTokenOrAppId);
        }
Example #5
0
 public static async Task <WxJsonResult> SetIndustryAsync(string accessTokenOrAppId, IndustryCode industry_id1, IndustryCode industry_id2, int timeOut = Config.TIME_OUT)
 {
     return(await ApiHandlerWapper.TryCommonApiAsync(async accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/cgi-bin/template/api_set_industry?access_token={0}";
         var msgData = new
         {
             industry_id1 = ((int)industry_id1).ToString(),
             industry_id2 = ((int)industry_id2).ToString()
         };
         return await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync <WxJsonResult>(accessToken, urlFormat, msgData, timeOut: timeOut).ConfigureAwait(false);
     }, accessTokenOrAppId).ConfigureAwait(false));
 }
Example #6
0
 public void AttachIndustryCode(IndustryCode industryCode)
 {
     _dbContext.IndustryCode.Add(industryCode);
 }
Example #7
0
 /// <summary>
 /// 设置所属行业
 /// </summary>
 /// <param name="token"></param>
 /// <param name="industry">公众号模板消息所属行业</param>
 /// <param name="secondIndustry">公众号模板消息所属行业</param>
 /// <returns></returns>
 public static JsonResult TemplateIndustrySet(this AccessToken token, IndustryCode industry, IndustryCode secondIndustry) =>
 Api.Template.SetIndustry(token.access_token, industry, secondIndustry);
Example #8
0
 public static JsonResult SetIndustry(string access_token, IndustryCode industry_id1, IndustryCode industry_id2) =>
 ApiPost <JsonResult>(JsonCreate.SetIndustry(industry_id1, industry_id2), "/cgi-bin/template/api_set_industry?access_token={0}", access_token);
Example #9
0
 public static string SetIndustry(IndustryCode industry_id1, IndustryCode industry_id2) =>
 "{\"industry_id1\":\"" + ((int)industry_id1).ToString() + "\",\"industry_id2\":\"" + ((int)industry_id2).ToString() + "\"}";
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (LastUpdateTime != null)
         {
             hashCode = hashCode * 59 + LastUpdateTime.GetHashCode();
         }
         if (AgentFirstName != null)
         {
             hashCode = hashCode * 59 + AgentFirstName.GetHashCode();
         }
         if (AgentLastName != null)
         {
             hashCode = hashCode * 59 + AgentLastName.GetHashCode();
         }
         if (AgentRole != null)
         {
             hashCode = hashCode * 59 + AgentRole.GetHashCode();
         }
         if (BusinessName != null)
         {
             hashCode = hashCode * 59 + BusinessName.GetHashCode();
         }
         if (LegalName != null)
         {
             hashCode = hashCode * 59 + LegalName.GetHashCode();
         }
         if (ShortName != null)
         {
             hashCode = hashCode * 59 + ShortName.GetHashCode();
         }
         if (Abn != null)
         {
             hashCode = hashCode * 59 + Abn.GetHashCode();
         }
         if (Acn != null)
         {
             hashCode = hashCode * 59 + Acn.GetHashCode();
         }
         if (IsACNCRegistered != null)
         {
             hashCode = hashCode * 59 + IsACNCRegistered.GetHashCode();
         }
         if (IndustryCode != null)
         {
             hashCode = hashCode * 59 + IndustryCode.GetHashCode();
         }
         if (OrganisationType != null)
         {
             hashCode = hashCode * 59 + OrganisationType.GetHashCode();
         }
         if (RegisteredCountry != null)
         {
             hashCode = hashCode * 59 + RegisteredCountry.GetHashCode();
         }
         if (EstablishmentDate != null)
         {
             hashCode = hashCode * 59 + EstablishmentDate.GetHashCode();
         }
         return(hashCode);
     }
 }
        /// <summary>
        /// Returns true if CommonOrganisation instances are equal
        /// </summary>
        /// <param name="other">Instance of CommonOrganisation to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CommonOrganisation other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     LastUpdateTime == other.LastUpdateTime ||
                     LastUpdateTime != null &&
                     LastUpdateTime.Equals(other.LastUpdateTime)
                     ) &&
                 (
                     AgentFirstName == other.AgentFirstName ||
                     AgentFirstName != null &&
                     AgentFirstName.Equals(other.AgentFirstName)
                 ) &&
                 (
                     AgentLastName == other.AgentLastName ||
                     AgentLastName != null &&
                     AgentLastName.Equals(other.AgentLastName)
                 ) &&
                 (
                     AgentRole == other.AgentRole ||
                     AgentRole != null &&
                     AgentRole.Equals(other.AgentRole)
                 ) &&
                 (
                     BusinessName == other.BusinessName ||
                     BusinessName != null &&
                     BusinessName.Equals(other.BusinessName)
                 ) &&
                 (
                     LegalName == other.LegalName ||
                     LegalName != null &&
                     LegalName.Equals(other.LegalName)
                 ) &&
                 (
                     ShortName == other.ShortName ||
                     ShortName != null &&
                     ShortName.Equals(other.ShortName)
                 ) &&
                 (
                     Abn == other.Abn ||
                     Abn != null &&
                     Abn.Equals(other.Abn)
                 ) &&
                 (
                     Acn == other.Acn ||
                     Acn != null &&
                     Acn.Equals(other.Acn)
                 ) &&
                 (
                     IsACNCRegistered == other.IsACNCRegistered ||
                     IsACNCRegistered != null &&
                     IsACNCRegistered.Equals(other.IsACNCRegistered)
                 ) &&
                 (
                     IndustryCode == other.IndustryCode ||
                     IndustryCode != null &&
                     IndustryCode.Equals(other.IndustryCode)
                 ) &&
                 (
                     OrganisationType == other.OrganisationType ||
                     OrganisationType != null &&
                     OrganisationType.Equals(other.OrganisationType)
                 ) &&
                 (
                     RegisteredCountry == other.RegisteredCountry ||
                     RegisteredCountry != null &&
                     RegisteredCountry.Equals(other.RegisteredCountry)
                 ) &&
                 (
                     EstablishmentDate == other.EstablishmentDate ||
                     EstablishmentDate != null &&
                     EstablishmentDate.Equals(other.EstablishmentDate)
                 ));
        }