예제 #1
0
 void client_AreaCityCheckCompleted(object sender, AreaCityCheckCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERROR"),
                                        Utility.GetResourceStr("CONFIRM"), MessageIcon.Error);
         //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(e.Error.Message));
     }
     else
     {
         if (e.Result.Count > 0)
         {
             string resultStr = string.Empty;
             Dictionary <string, string> tmp = e.Result;
             string[] arr = null;//实体的城市
             if (ExistCity != "")
             {
                 arr = ExistCity.Split(',');
             }
             //遍历已经在使用的城市集合
             foreach (var a in tmp.Keys)
             {
                 //如果实体的城市中没有的就加提示
                 if (!arr.Contains(a))
                 {
                     resultStr += tmp[a].ToString() + Utility.GetResourceStr("MIDDLETYPES") + "[" + GetCityName(a) + "]\n";
                 }
             }
             //如果存在已选的城市就提示
             if (resultStr != "")
             {
                 resultStr += Utility.GetResourceStr("ALREADYEXISTNOTADD");
                 ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(resultStr), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
             }
             else
             {
                 //citycode = citys;
                 if (e.UserState.ToString() != "Add")
                 {
                     client.AreaCityByCategoryDeleteAsync(area.AREADIFFERENCEID);
                 }
                 else
                 {
                     client.AreaCityLotsofAddAsync(citys, "Add");
                 }
             }
         }
         else
         {
             if (e.UserState.ToString() != "Add")
             {
                 client.AreaCityByCategoryDeleteAsync(area.AREADIFFERENCEID);
             }
             else
             {
                 client.AreaCityLotsofAddAsync(citys, "Add");
             }
         }
     }
 }