예제 #1
0
 public DBProcessResult DeleteCustomer(string tenantCode)
 {
     DBProcessResult result = new DBProcessResult() { IsSuccess = false, Message = "删除失败!" };
     try
     {
         EMTenantService tenantServ = new EMTenantService();
         UserService userService = new UserService();
         EMVehicleService vehicleServ = new EMVehicleService();
         IList<EMVehicle> ltEMVehicle = vehicleServ.SelectAll(tenantCode);
         if (ltEMVehicle != null && ltEMVehicle.Count > 0)
         {
             result.Message = "对不起,客户下还存在车辆,不能删除!";
             result.IsSuccess = false;
         }
         else
         {
             EMTenant emTenant = tenantServ.Select(tenantCode);
             if (emTenant != null)
             {
                 //EMUser emUser = userService.GetUser(emTenant.RegisterUserCode);
                 userService.Delete(emTenant.RegisterUserCode);//删除注册账号
                 tenantServ.Delete(emTenant);//删除运营商信息
                 result.Message = "删除成功!";
                 result.IsSuccess = true;
             }
             
             //tenantServ.Delete(tenantCode);
             //result.Message = "删除成功!";
             //result.IsSuccess = true;
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex.Message);
     }
     return result;
 }
예제 #2
0
 public DBProcessResult DeleteOperate(string tenantCode)
 {
     DBProcessResult result = new DBProcessResult() { IsSuccess = false, Message = "删除失败!" };
     try
     {
         IEMTenantService tenantServ = new EMTenantService();
         IUserService userService = new UserService();
         IList<EMTenant> ltTenantAll = tenantServ.GetGrandChildren(tenantCode);
         if (ltTenantAll != null && ltTenantAll.Count > 0)
         {
             result.Message = "对不起,运营商下还存在子运营商或客户,不能删除!";
             result.IsSuccess = false;
         }
         else
         {
             EMTenant  emTenant = tenantServ.Select(tenantCode);
             if(emTenant != null)
             {
                 //EMUser emUser = userService.GetUser(emTenant.RegisterUserCode);
                 userService.Delete(emTenant.RegisterUserCode);//删除注册账号
                 tenantServ.Delete(emTenant);//删除运营商信息
                 result.Message = "删除成功!";
                 result.IsSuccess = true;
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex.Message);
     }
     return result;
 }