Пример #1
0
        public static async Task <List <CountyInfo> > GetCountyInfo()
        {
            var countyResponse = await client.GetAsync("http://api.scb.se/OV0104/v1/doris/sv/ssd/START/ME/ME0104/ME0104D/ME0104T4");

            var countyInfo = new List <CountyInfo>();


            string countyResponseBody = countyResponse.Content.ReadAsStringAsync().Result;

            CountyData countyData = JsonConvert.DeserializeObject <CountyData>(countyResponseBody);


            foreach (var item in countyData.Variables)
            {
                if (item.Code == "Region")
                {
                    for (int i = 0; i < item.Values.Count; i++)
                    {
                        var county = new CountyInfo();
                        county.Id   = item.Values[i];
                        county.Name = item.ValueTexts[i];

                        countyInfo.Add(county);
                    }
                }
            }
            return(countyInfo);
        }
Пример #2
0
    public string DisplayProductAddress(string stateCode, string cityCode, string countyCode)
    {
        StateInfo  stateEntity  = null;
        CityInfo   cityEntity   = null;
        CountyInfo countyEntity = null;

        try
        {
            stateEntity  = MyBLL.GetStateInfoByCode(stateCode);
            cityEntity   = MyBLL.GetCityInfoByCode(cityCode);
            countyEntity = MyBLL.GetCountyInfoByCode(countyCode);
        }
        catch (Exception ex) { throw ex; }

        string strHTML = string.Empty;

        if (stateEntity != null)
        {
            strHTML = stateEntity.State_CN + " ";
        }
        if (cityEntity != null)
        {
            strHTML += cityEntity.City_CN + " ";
        }
        if (countyEntity != null)
        {
            strHTML += countyEntity.County_CN;
        }

        return(strHTML.ToString());
    }
Пример #3
0
        public virtual IList <CountyInfo> GetCountysByCity(string cityCode)
        {
            IList <CountyInfo> entitys = null;
            CountyInfo         entity  = null;
            string             SqlList = "SELECT Sys_County_CityCode, Sys_County_Code, Sys_County_CN FROM Sys_County WHERE Sys_County_CityCode = '" + cityCode + "'";
            DataTable          DtList  = new DataTable();

            try {
                DtList = DBHelper.Query(SqlList);

                if (DtList.Rows.Count > 0)
                {
                    entitys = new List <CountyInfo>();
                }

                foreach (DataRow DrList in DtList.Rows)
                {
                    entity = new CountyInfo();
                    entity.County_CityCode = Tools.NullStr(DrList["Sys_County_CityCode"]);
                    entity.County_Code     = Tools.NullStr(DrList["Sys_County_Code"]);
                    entity.County_CN       = Tools.NullStr(DrList["Sys_County_CN"]);
                    entitys.Add(entity);
                    entity = null;
                }

                return(entitys);
            }
            catch (Exception ex) { throw ex; }
            finally { DtList = null; }
        }
Пример #4
0
    /// <summary>
    /// 根据县区编码获取县区名称
    /// </summary>
    /// <param name="City_Code">城市编码</param>
    /// <returns>城市名称</returns>
    public string Get_County_Name(string County_Code)
    {
        string     County_Name = "";
        CountyInfo entity      = MyBLL.GetCountyInfoByCode(County_Code);

        if (entity != null)
        {
            County_Name = entity.County_CN;
        }
        return(County_Name);
    }
Пример #5
0
        public virtual CountyInfo GetCountyInfoByCode(string countyCode)
        {
            CountyInfo entity  = null;
            string     SqlList = "SELECT Sys_County_CityCode, Sys_County_Code, Sys_County_CN FROM Sys_County WHERE Sys_County_Code = '" + countyCode + "'";
            DataTable  DtList  = DBHelper.Query(SqlList);

            if (DtList.Rows.Count > 0)
            {
                entity = new CountyInfo();
                entity.County_CityCode = Tools.NullStr(DtList.Rows[0]["Sys_County_CityCode"]);
                entity.County_Code     = Tools.NullStr(DtList.Rows[0]["Sys_County_Code"]);
                entity.County_CN       = Tools.NullStr(DtList.Rows[0]["Sys_County_CN"]);
            }
            return(entity);
        }
Пример #6
0
 private Image GetImageFromCounty(CountyInfo countyInfo)
 {
     try
     {
         if (countyInfo.Logo != null && countyInfo.Logo != string.Empty)
         {
             string logoBase64DataOnly = countyInfo.Logo.Remove(
                 countyInfo.Logo.IndexOf("data:image/"),
                 ("data:image:" + "xxx" + ";base64,").Length);
             return(Image.FromStream(
                        new MemoryStream(
                            Convert.FromBase64String(
                                logoBase64DataOnly))));
         }
         else
         {
             return(null);
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Пример #7
0
 /// <summary>
 /// Event method for when the selection within a listbox changes
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void lstDataIndex_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.lstDataIndex.SelectedItem != null)
     {
         string title      = this.lstDataIndex.SelectedItem.ToString();
         object cachedData = this._currentData[title];
         this.flpDataContents.Visible = false;
         this.flpDataContents.Controls.Clear();
         Type selectedType = cachedData.GetType();
         if (selectedType == typeof(IndexOptionDetail))
         {
             IndexOptionDetail indexOptionDetail = ((IndexOptionDetail)cachedData);
             this.flpDataContents.Controls.AddRange(new Control[]
             {
                 new IndexOptionDetailControl()
                 {
                     IndexOptionDetail = indexOptionDetail
                 }
             });
         }
         else if (selectedType == typeof(CountyInfo))
         {
             CountyInfo countyInfo = ((CountyInfo)cachedData);
             this.flpDataContents.Controls.AddRange(new Control[]
             {
                 new CountyInfoControl()
                 {
                     CountyInfo = countyInfo
                 },
                 new PictureBox()
                 {
                     Image    = this.GetImageFromCounty(countyInfo),
                     SizeMode = PictureBoxSizeMode.AutoSize
                 }
             });
         }
         else if (selectedType == typeof(CityDetail))
         {
             CityDetail cityDetail = ((CityDetail)cachedData);
             this.flpDataContents.Controls.AddRange(new Control[]
             {
                 new CityDetailControl()
                 {
                     CityDetail = cityDetail
                 }
             });
         }
         else if (selectedType == typeof(ProcessQueueDetail))
         {
             ProcessQueueDetail pqDetail = ((ProcessQueueDetail)cachedData);
             this.flpDataContents.Controls.AddRange(new Control[]
             {
                 new ProcessQueueDetailControl()
                 {
                     ProcessQueueDetail = pqDetail
                 }
             });
         }
         else if (selectedType == typeof(TitleDetail))
         {
             TitleDetail titleDetail = ((TitleDetail)cachedData);
             this.flpDataContents.Controls.AddRange(new Control[]
             {
                 new TitleDetailControl()
                 {
                     TitleDetail = titleDetail
                 }
             });
         }
         else if (selectedType == typeof(RequestingPartyInfo))
         {
             RequestingPartyInfo rpInfo = ((RequestingPartyInfo)cachedData);
             this.flpDataContents.Controls.AddRange(new Control[]
             {
                 new RequestingPartyInfoControl()
                 {
                     RequestingPartyInfo = rpInfo
                 }
             });
         }
         else if (selectedType == typeof(SubmittingPartyInfo))
         {
             SubmittingPartyInfo spInfo = ((SubmittingPartyInfo)cachedData);
             this.flpDataContents.Controls.AddRange(new Control[]
             {
                 new SubmittingPartyInfoControl()
                 {
                     SubmittingPartyInfo = spInfo
                 }
             });
         }
         foreach (Control control in this.flpDataContents.Controls)
         {
             control.Width = this.flpDataContents.Width - 10;
             this.RecursiveReadOnlySet(control);
         }
         this.flpDataContents.Visible = true;
     }
 }
Пример #8
0
 private Image GetImageFromCounty(CountyInfo countyInfo)
 {
     try
     {
         if (countyInfo.Logo != null && countyInfo.Logo != string.Empty)
         {
             string logoBase64DataOnly = countyInfo.Logo.Remove(
                 countyInfo.Logo.IndexOf("data:image/"),
                 ("data:image:" + "xxx" + ";base64,").Length);
             return Image.FromStream(
                 new MemoryStream(
                     Convert.FromBase64String(
                     logoBase64DataOnly)));
         }
         else
         {
             return null;
         }
     }
     catch(Exception)
     {
         return null;
     }
 }
Пример #9
0
    public string GetDeliveryWayDistricts()
    {
        int Delivery_Way_ID = tools.CheckInt(Request.QueryString["Delivery_Way_ID"]);
        IList <DeliveryWayDistrictInfo> entitys = MyBLL.GetDeliveryWayDistrictsByDWID(Delivery_Way_ID, Public.GetUserPrivilege());

        if (entitys != null)
        {
            DeliveryWayInfo wayinfo = MyBLL.GetDeliveryWayByID(Delivery_Way_ID, Public.GetUserPrivilege());

            StateInfo  stateEntity  = null;
            CityInfo   cityEntity   = null;
            CountyInfo countyEntity = null;

            StringBuilder jsonBuilder = new StringBuilder();
            jsonBuilder.Append("{\"page\":1,\"total\":1,\"records\":" + entitys.Count + ",\"rows\"");
            jsonBuilder.Append(":[");
            foreach (DeliveryWayDistrictInfo entity in entitys)
            {
                stateEntity  = addrBLL.GetStateInfoByCode(entity.District_State);
                cityEntity   = addrBLL.GetCityInfoByCode(entity.District_City);
                countyEntity = addrBLL.GetCountyInfoByCode(entity.District_County);

                jsonBuilder.Append("{\"DeliveryWayDistrictInfo.District_ID\":" + entity.District_ID + ",\"cell\":[");
                //各字段
                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.District_ID);
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                if (wayinfo == null)
                {
                    jsonBuilder.Append(Delivery_Way_ID);
                }
                else
                {
                    jsonBuilder.Append(wayinfo.Delivery_Way_Name);
                }
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");

                if (entity.District_State == "0" || entity.District_State.Length == 0)
                {
                    jsonBuilder.Append("全部");
                }
                else
                {
                    if (stateEntity == null)
                    {
                        jsonBuilder.Append(entity.District_State);
                    }
                    else
                    {
                        jsonBuilder.Append(stateEntity.State_CN);
                    }
                }
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                if (entity.District_City == "0" || entity.District_City.Length == 0)
                {
                    jsonBuilder.Append("全部");
                }
                else
                {
                    if (cityEntity == null)
                    {
                        jsonBuilder.Append(entity.District_City);
                    }
                    else
                    {
                        jsonBuilder.Append(cityEntity.City_CN);
                    }
                }
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                if (entity.District_County == "0" || entity.District_County.Length == 0)
                {
                    jsonBuilder.Append("全部");
                }
                else
                {
                    if (countyEntity == null)
                    {
                        jsonBuilder.Append(entity.District_County);
                    }
                    else
                    {
                        jsonBuilder.Append(countyEntity.County_CN);
                    }
                }
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append("<img src=\\\"/images/icon_edit.gif\\\" alt=\\\"修改\\\"> <a href=\\\"district_list.aspx?action=renew&delivery_way_id=" + Delivery_Way_ID + "&district_id=" + entity.District_ID + "\\\" title=\\\"修改\\\">修改</a> <img src=\\\"/images/icon_del.gif\\\"  alt=\\\"删除\\\"> <a href=\\\"javascript:void(0);\\\" onclick=\\\"confirmdelete('district_do.aspx?action=move&delivery_way_id=" + Delivery_Way_ID + "&district_id=" + entity.District_ID + "')\\\" title=\\\"删除\\\">删除</a>");
                jsonBuilder.Append("\",");

                jsonBuilder.Remove(jsonBuilder.Length - 1, 1);
                jsonBuilder.Append("]},");
            }
            jsonBuilder.Remove(jsonBuilder.Length - 1, 1);
            jsonBuilder.Append("]");
            jsonBuilder.Append("}");
            return(jsonBuilder.ToString());
        }
        else
        {
            return(null);
        }
    }
Пример #10
0
 public long Update(CountyInfo info)
 {
     return(base.Update <CountyInfo>(info));
 }
Пример #11
0
 public int Add(CountyInfo info)
 {
     return(base.Add <CountyInfo>(info));
 }