public static bool Update(BaseVillage model) { if (model == null) { throw new ArgumentNullException("model"); } if (string.IsNullOrWhiteSpace(model.VNo)) { throw new ArgumentNullException("小区编号不能为空"); } IVillage factory = VillageFactory.GetFactory(); BaseVillage dbModel = factory.QueryVillageByVillageNo(model.VNo, model.CPID); if (dbModel != null && dbModel.VID != model.VID) { throw new MyException("小区编号已经存在"); } dbModel = factory.QueryVillageByProxyNo(model.ProxyNo); if (dbModel != null && dbModel.VID != model.VID) { throw new MyException("代理编号已存在"); } bool result = factory.Update(model); if (result) { OperateLogServices.AddOperateLog <BaseVillage>(model, OperateType.Update); } return(result); }
public PatientsController(IPatient patient, IOccupation occupation, IVillage village, IContact contact) { _patient = patient; _occupation = occupation; _village = village; _contact = contact; }
/// <summary> /// Scales down the given rect into a grid and returns its coordinates. /// </summary> /// <param name="village"></param> /// <returns></returns> public static List <Point> ScaledGridCoordinates(IVillage village) { int x = village.X; int y = village.Y; int w = 25; int h = 25; int gridSize = 25; int minX = (int)Math.Floor((decimal)x / gridSize); int minY = (int)Math.Floor((decimal)y / gridSize); int maxX = (int)Math.Ceiling(((decimal)x + w) / gridSize); int maxY = (int)Math.Ceiling(((decimal)y + h) / gridSize); List <Point> gridCoordinates = new List <Point>(); if (w == 1 && h == 1) { gridCoordinates.Add(new Point(minX, minY)); return(gridCoordinates); } for (x = minX; x < maxX; x++) { for (y = minY; y < maxY; y++) { gridCoordinates.Add(new Point(x, y)); } } return(gridCoordinates); }
public static IVillage GetFactory() { if (factory == null) { Type type = Type.GetType("Common." + SystemDefaultConfig.DatabaseProvider + "Repository.VillageDAL,Common." + SystemDefaultConfig.DatabaseProvider + "Repository", true); factory = (IVillage)Activator.CreateInstance(type); } return(factory); }
public static BaseVillage QueryVillageByRecordId(string recordId) { if (string.IsNullOrWhiteSpace(recordId)) { throw new ArgumentNullException("recordId"); } IVillage factory = VillageFactory.GetFactory(); return(factory.QueryVillageByRecordId(recordId)); }
public static List <BaseVillage> QueryVillageByCompanyIds(List <string> companyIds) { if (companyIds == null || companyIds.Count == 0) { throw new ArgumentNullException("companyIds"); } IVillage factory = VillageFactory.GetFactory(); return(factory.QueryVillageByCompanyIds(companyIds)); }
public static List <BaseVillage> QueryVillageByUserId(string userId) { if (string.IsNullOrWhiteSpace(userId)) { throw new ArgumentNullException("userId"); } IVillage factory = VillageFactory.GetFactory(); return(factory.QueryVillageByUserId(userId)); }
public static BaseVillage QueryVillageByProxyNo(string proxyNo) { if (string.IsNullOrWhiteSpace(proxyNo)) { throw new ArgumentNullException("proxyNo"); } IVillage factory = VillageFactory.GetFactory(); return(factory.QueryVillageByProxyNo(proxyNo)); }
void Start () { advisor = GetComponent<Advisor>(); village = new SimpleVillage(100); foreach (var spot in villigerSpots) { spot.OnViligerHovered += advisor.ShowVilligerAdvice; spot.OnViligerSelected += OnViligerClicked; } NextYear(); }
public static List <BaseVillage> QueryVillageByEmployeeMobilePhone(string mobilePhone) { if (string.IsNullOrWhiteSpace(mobilePhone)) { throw new ArgumentNullException("mobilePhone"); } IVillage factory = VillageFactory.GetFactory(); return(factory.QueryVillageByEmployeeMobilePhone(mobilePhone)); }
/// <summary> /// 创建默认小区 /// </summary> /// <param name="model"></param> /// <param name="dbOperator"></param> /// <returns></returns> public static bool AddVillageDefaultUser(BaseVillage model, DbOperator dbOperator) { model.DataStatus = DataStatus.Normal; model.LastUpdateTime = DateTime.Now; model.HaveUpdate = SystemDefaultConfig.DataUpdateFlag; IVillage factory = VillageFactory.GetFactory(); bool result = factory.Add(model, dbOperator); if (result) { OperateLogServices.AddOperateLog <BaseVillage>(model, OperateType.Add); } return(result); }
public static List <CarParkingResult> GetParkGrantByPlateNo(string plateNo) { if (plateNo.IsEmpty()) { throw new ArgumentNullException("plateNo"); } List <CarParkingResult> models = new List <CarParkingResult>(); IParkGrant factory = ParkGrantFactory.GetFactory(); List <ParkGrant> grants = factory.GetParkGrantByPlateNo(plateNo); if (grants.Count > 0) { List <ParkCarType> carTypes = ParkCarTypeServices.QueryParkCarTypeByRecordIds(grants.Select(p => p.CarTypeID).ToList()); List <BaseParkinfo> parkings = ParkingServices.QueryParkingByRecordIds(grants.Select(p => p.PKID).ToList()); List <BaseVillage> villages = new List <BaseVillage>(); if (parkings.Count > 0) { IVillage factoryVillage = VillageFactory.GetFactory(); villages = factoryVillage.QueryVillageByRecordIds(parkings.Select(p => p.VID).ToList()); } foreach (var item in grants) { CarParkingResult model = new CarParkingResult(); model.PlateNo = plateNo; BaseParkinfo parking = parkings.FirstOrDefault(p => p.PKID == item.PKID); if (parking != null) { model.ParkingName = parkings != null ? parking.PKName : string.Empty; BaseVillage village = villages.FirstOrDefault(p => p.VID == parking.VID); model.VillageName = village != null ? village.VName : string.Empty; } ParkCarType carType = carTypes.FirstOrDefault(p => p.CarTypeID == item.CarTypeID); if (carType != null) { model.CarTypeName = carType.CarTypeName; } model.StartTime = item.BeginDate; model.EndTime = item.EndDate; models.Add(model); } } return(models); }
private async Task <bool> SendGetVillageByArea(IVillage village) { const int mapChunkSize = 25; var coordinates = GameFormulas.ScaledGridCoordinates(village); foreach (Point coordinate in coordinates) { object data = new { x = coordinate.X * mapChunkSize, y = coordinate.Y * mapChunkSize, width = mapChunkSize, height = mapChunkSize }; var response = await SendStandardMessage(RouteProvider.MAP_GETVILLAGESBYAREA, data); } return(true); }
public static bool Delete(string recordId) { if (string.IsNullOrWhiteSpace(recordId)) { throw new ArgumentNullException("recordId"); } List <BaseParkinfo> parks = ParkingServices.QueryParkingByVillageId(recordId); if (parks.Count != 0) { throw new MyException("请先删除小区下面所有的车场"); } IVillage factory = VillageFactory.GetFactory(); bool result = factory.Delete(recordId); if (result) { OperateLogServices.AddOperateLog(OperateType.Delete, string.Format("recordId:{0}", recordId)); } return(result); }
private async Task <bool> SendGetCharacterInfo() { var response = await SendStandardMessage(RouteProvider.CHARACTER_GETINFO); var characterData = SocketUtilities.ParseDataFromResponse <CharacterDataDTO>(response.Response); if (characterData != null) { foreach (IVillage village in characterData.Villages) { village.CharacterId = _socketManager.ActiveCharacterId; village.WorldId = _socketManager.ActiveWorldId; } DataEvents.InvokeCharacterDataAvailable(characterData); } // Take the first village as the active village, its unclear how TW2 determines te active village. // This is done somewhere in javascript but not communicated through websockets. // TODO Find out how the active village is determined activeVillage = characterData.Villages[0]; return(characterData != null); }
public EReturnCode SwitchHome(IVillage _village) { throw new NotImplementedException(); }
public VillagesController(IVillage village) { _village = village; }
public VillageController() { repo = new VillageRepo(); }
public static List <BaseVillage> QueryVillageAll() { IVillage factory = VillageFactory.GetFactory(); return(factory.QueryVillageAll()); }
public static List <BaseVillage> QueryPage(List <string> villageIds, string companyId, int pageIndex, int pageSize, out int totalRecord) { IVillage factory = VillageFactory.GetFactory(); return(factory.QueryPage(villageIds, companyId, pageIndex, pageSize, out totalRecord)); }
public static List <BaseVillage> QueryVillageByCompanyId(string companyId) { IVillage factory = VillageFactory.GetFactory(); return(factory.QueryVillageByCompanyId(companyId)); }