Esempio n. 1
0
        public static void AddCounty(CountyView countyView, string account)
        {
            var county = County.GetCounty(countyView);

            if (QueryCounty(county.Code) != null)
            {
                throw new ChinaPay.Core.Exception.KeyRepeatedException("代码[" + county.Code + "]已存在");
            }
            var sameNameCounty = QueryCountyByName(county.Name);

            if (sameNameCounty != null && sameNameCounty.CityCode == county.CityCode)
            {
                throw new ChinaPay.Core.Exception.KeyRepeatedException("名称[" + county.Name + "]已存在");
            }
            CountyCollection.Instance.Add(county.Code, county);
            saveAddLog("县", county.ToString(), county.Code, account);
        }
Esempio n. 2
0
        public static void UpdateCounty(CountyView countyView, string account)
        {
            var county         = County.GetCounty(countyView);
            var originalCounty = QueryCounty(county.Code);

            if (null == originalCounty)
            {
                throw new ChinaPay.Core.CustomException("原县不存在");
            }
            var sameNameCounty = QueryCountyByName(county.Name);

            if (sameNameCounty != null && sameNameCounty.Code != county.Code && sameNameCounty.CityCode == county.CityCode)
            {
                throw new ChinaPay.Core.Exception.KeyRepeatedException("名称[" + county.Name + "]已存在");
            }
            var originalContent = originalCounty.ToString();

            CountyCollection.Instance.Update(county.Code, county);
            saveUpdateLog("县", originalContent, county.ToString(), county.Code, account);
        }
Esempio n. 3
0
    public RespCounty GetCounty(string dd, string cc, string key)
    {
        try
        {
            RespCounty r = Auth.GetRespCountyAuth4Key(key);

            if (r.EqualsEStatus(r.GetStatus(), Response.EStatus.ERROR))
            {
                return(r);
            }

            List <County> ld = County.GetCounty(dd, cc, 1, 0);

            if (ld.Count == 0)
            {
                County c = new County();
                c.dd       = "";
                c.district = "";
                c.cc       = "";
                c.county   = "";
                r.County   = c;
                r.SetStatus(Response.EStatus.ERROR);
                r.error = string.Format("Record not found, county cc = {0}", cc);
            }
            else
            {
                r.County = ld[0];
            }
            return(r);
        }
        catch (Exception e)
        {
            RespCounty r = new RespCounty();
            r.SetStatus(Response.EStatus.ERROR);
            r.error = e.Message;
            return(r);
        }
    }