/// <summary> /// 查询分站 /// </summary> /// <param name="totalCount">总数量</param> /// <param name="recentCount">最近数量</param> /// <param name="recentDate">最近数量计算时间起</param> /// <param name="groupdArea">分组区域</param> public void QuerySubstation(out int totalCount, out int recentCount, out DateTime recentDate, out Dictionary <string, List <string> > groupdArea) { string subStationRole = "SubStation"; IQueryable <UserBackendDbModel> query = ReadOnlyRepository.Query(e => e.Roles.Contains(subStationRole)); var dbResult = query.Select(e => new { Areas = e.Areas, CreateDate = e.CreateDate, }); HashSet <string> areas = new HashSet <string>(); foreach (var area in dbResult) { foreach (var item in area.Areas.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { areas.Add(item); } } //City = AreaService.GetCityModelFromAreaCode(e).Name var substationModel = areas.OrderBy(e => e).Select(e => new { Code = e, /* * Povince = AreaService.GetAreaName(e.Substring(0, 2) + "0000"), * City = AreaService.GetAreaName(e), */ Povince = AreaService.GetProvinceModelFromCode(e).Name, City = AreaService.GetCityModelFromAreaCode(e).Name + (e.EndsWith("00") ? "" : AreaService.GetAreaViewByCode(e).Name), }); totalCount = substationModel.Count(); var recentD = DateTime.Now.AddDays(-7); recentCount = dbResult.Where(e => e.CreateDate > recentD).Count(); groupdArea = substationModel.GroupBy(e => e.Povince).ToDictionary(g => g.Key, g => g.ToList().Select(e => e.City).ToList()); recentDate = dbResult.OrderByDescending(e => e.CreateDate).Select(e => e.CreateDate).FirstOrDefault(); }
public async Task <ActionResult> Ver(string msgExito) { LimpiarSession(); TableroViewModel model = new TableroViewModel(); model.Titulo = "Tablero de comando "; if (Session["IdAnioTablero"] != null) { model.AnioTableroViewModel = await AnioTableroService.GetById(Int32.Parse((string)Session["IdAnioTablero"])); } string idAreaTablero = (string)Session["IdAreaTablero"]; if (idAreaTablero != null && !idAreaTablero.Equals("0")) { model.AreaTableroViewModel = await AreaService.GetById(Int32.Parse(idAreaTablero)); } else { model.AreaTableroViewModel = new AreaViewModel { Id = 0, Nombre = "Todas las áreas" }; } ViewBag.Titulo = model.Titulo; ViewBag.MensageExito = msgExito; await TableroService.AuditarVisualizacionTablero((PersonaViewModel)Session["Persona"]); return(View(model)); }
public static void ServerStart(string str) { Console.WriteLine("Loading Data Access Objects.\n" + "-------------------------------------------"); DAOManager.Initialize(str); Console.WriteLine("Loading Data Files.\n" + "-------------------------------------------"); Data.Data.LoadAll(); Data.Cache.LoadData(); StatsService.Init(); GeoService.Init(); MapService.Init(); QuestEngine.Init(); SkillEngine.Init(); ActionEngine.Init(); SkillsLearnService.Init(); AreaService.Init(); GuildService.Init(); InitMainLoop(); }
//create service method private AreaService CreateAreaService() { Guid userId = Guid.Parse(User.Identity.GetUserId()); AreaService service = new AreaService(userId); return(service); }
public IHttpActionResult GetByPark(int parkId) { AreaService areaService = CreateAreaService(); var parks = areaService.GetAreasByPark(parkId); return(Ok(parks)); }
void queryAreaRelateList(Pagination pagination) { try { var areaRelate = from item in AreaService.Query(getCondition(), pagination) select new { ProvinceName = item.ProvinceName, AreaName = item.AreaName, ProvinceCode = item.ProvinceCode }; this.dataList.DataSource = areaRelate; this.dataList.DataBind(); if (areaRelate.Any()) { this.dataSource.Visible = true; this.emptyDataInfo.Visible = false; this.pager.Visible = true; if (pagination.GetRowCount) { this.pager.RowCount = pagination.RowCount; } } else { this.pager.Visible = false; this.dataSource.Visible = false; this.emptyDataInfo.Visible = true; } } catch (Exception ex) { ShowExceptionMessage(ex, "查询"); } }
protected void btnDetele_Click(object sender, EventArgs e) { List <Guid> ids = new List <Guid>(); foreach (GridViewRow gv in this.dataSource.Rows) { CheckBox chk = (CheckBox)gv.FindControl("chkBox"); Label lbl = gv.FindControl("lblId") as Label; if (chk.Checked) { Guid id = Guid.Parse(lbl.Text); ids.Add(id); } } if (ids.Count > 0) { try { AreaService.DeleteArea(ids, this.CurrentUser.Name); ClientScript.RegisterStartupScript(this.GetType(), this.UniqueID, "alert('删除成功! ')", true); btnQuery_Click(sender, e); } catch (Exception ex) { ShowExceptionMessage(ex, "删除"); } } }
private void FillDropDown() { ddlFindBranch.DataSource = BranchService.GetActiveBranches(User.Identity.Name); ddlFindBranch.DataTextField = "Name"; ddlFindBranch.DataValueField = "ID"; ddlFindBranch.DataBind(); ddlArea.DataSource = AreaService.GetAll(); ddlArea.DataTextField = "Description"; ddlArea.DataValueField = "ID"; ddlArea.DataBind(); ddlArea.Items.Insert(0, new DropDownListItem(String.Empty)); ddlCreditCardType.DataSource = CreditCardTypeService.GetAll(); ddlCreditCardType.DataTextField = "Description"; ddlCreditCardType.DataValueField = "ID"; ddlCreditCardType.DataBind(); ddlOccupation.DataSource = OccupationService.GetAll(); ddlOccupation.DataTextField = "Description"; ddlOccupation.DataValueField = "ID"; ddlOccupation.DataBind(); ddlOccupation.Items.Insert(0, new DropDownListItem(String.Empty)); ddlBank.DataSource = BankService.GetActiveBanks(); ddlBank.DataTextField = "Name"; ddlBank.DataValueField = "ID"; ddlBank.DataBind(); ddlBank.Items.Insert(0, String.Empty); DataBindingHelper.PopulateBillingTypes(BillingTypeService, ddlBillingType, false); }
public override void DoAction(NWPlayer player, string pageName, int responseID) { var model = GetDialogCustomData <Model>(); NWLocation location; if (responseID == 1) // Create new instance { var instance = AreaService.CreateAreaInstance(player, model.AreaResref, string.Empty, model.DestinationTag); location = instance.GetLocalLocation("INSTANCE_ENTRANCE"); } else { var response = GetResponseByID("MainPage", responseID); NWObject member = (NWObject)response.CustomData; if (!member.IsValid) { player.SendMessage("Unable to locate party member."); return; } var area = member.Area; location = area.GetLocalLocation("INSTANCE_ENTRANCE"); } PlayerService.SaveLocation(player); player.AssignCommand(() => { _.ActionJumpToLocation(location); }); EndConversation(); }
public string this[string columnName] { get { string result = null; if (columnName == "AREA_CODE") { if (string.IsNullOrEmpty(AREA_CODE)) { result = "Area Code cannot be empty"; } } if (columnName == "AREA_NAME") { if (String.IsNullOrWhiteSpace(AREA_NAME)) { result = "Area Name cannot be empty"; } if (AreaService.IsAreaNameExist(AREA_NAME)) { result = "Area Name Exist hence use Different Name"; } } if (columnName == "ID") { if (string.IsNullOrWhiteSpace(ID)) { result = "Area Cannot be Empty"; } } return(result); } }
private void UpdateArea() { int id = 1; IAreaService cs = new AreaService(); var data = cs.GetAreaById(id); var result = cs.UpdateSingleArea(data); }
public AreaStatistics GetAreaStatistics(int id) { List <int?> lst = new List <int?>(); List <int?> lstRecv; var areaList = db.Areas.ToList(); var a1 = areaList.Find(p => p.Id == id); if (a1 == null) { return(new AreaStatistics()); } lst.Add(a1.Id); lstRecv = GetAreaStatisticsInner(a1.Id, areaList); if (lstRecv != null || lstRecv.Count > 0) { lst.AddRange(lstRecv); } AreaService asr = new AreaService(); AreaStatistics ast = asr.GetAreaStatisticsCount(lst); return(ast); }
/// <summary> /// 加载State City District的方法 /// </summary> public void LoadLocation(ComboBoxEdit parentComboBoxEdit, ComboBoxEdit comboBoxEdit) { if (parentComboBoxEdit == null)//加载Location_State的信息 { /*当不存在数据时才进行加载*/ if (comboBoxEdit.Properties.Items == null || comboBoxEdit.Properties.Items.Count == 0) { List <Alading.Entity.Area> areaList = AreaService.GetArea(c => c.parent_id == "1"); foreach (Alading.Entity.Area area in areaList) { cBoxState.Tag += area.id + ";"; cBoxState.Properties.Items.Add(area.name); } } } else//加载Location_City 或者 Location_District的信息 { int index = parentComboBoxEdit.SelectedIndex; if (index == -1 || parentComboBoxEdit.Tag == null) { return; } string[] parentIDStr = parentComboBoxEdit.Tag.ToString().Split(';'); string parentID = parentIDStr[index]; List <Alading.Entity.Area> areaList = AreaService.GetArea(c => c.parent_id == parentID); foreach (Alading.Entity.Area area in areaList) { comboBoxEdit.Tag += area.id + ";"; comboBoxEdit.Properties.Items.Add(area.name); } } }
protected void Page_Load(object sender, EventArgs e) { SectionService sectionService = new SectionService(); HousetypeService hyService = new HousetypeService(); AreaService areaSevice = new AreaService(); sectionList = sectionService.GetModelList(""); hyList = hyService.GetModelList(""); areaList = areaSevice.GetModelList(""); hid = Int32.Parse(Request["hid"]); house = houseService.GetModel(hid); hmode = (int)house.hmode; sid = house.sid; htype = (int)house.htype; areaid = (int)house.harea; if (IsPostBack) { this.update(); } }
public AreaStatistics GetAreaStatistics(int id) { ShowLog(">>>>> GetAreaStatistics id=" + id); Stopwatch watch = new Stopwatch(); watch.Start(); List <int?> lst = new List <int?>(); List <int?> lstRecv; var areaList = db.Areas.ToList(); var a1 = areaList.Find(p => p.Id == id); if (a1 == null) { return(new AreaStatistics()); } lst.Add(a1.Id); lstRecv = GetAreaStatisticsInner(a1.Id, areaList); if (lstRecv != null || lstRecv.Count > 0) { lst.AddRange(lstRecv); } AreaService asr = new AreaService(); AreaStatistics ast = asr.GetAreaStatisticsCount(lst); watch.Stop(); TimeSpan time = watch.Elapsed; ShowLog("time:" + time); ShowLog("<<<<<< GetAreaStatistics id=" + id); return(ast); }
static void PrimerEjemplo() { var areaService = new AreaService(); var pisoService = new PisoService(); var edificioService = new EdificioService(); var piso = new Piso { Id = "1", Nombre = "Piso 1", Edificio = new Edificio { Id = "1", Ubicacion = "Plaza Mayor" } }; pisoService.Add(piso); areaService.Add(new Area { Id = "4", Nombre = "Oficina de Direccion", Ubicacion = "Plaza Mayor 01", PisoId = piso.Id }); }
public void setAreaCodeToComboBox() { AreaCodeList = (List <area>)AreaService.getAreaCodes(); AreaCodeComboBox.ItemsSource = AreaCodeList; AreaCodeComboBox.DisplayMemberPath = "AREA_NAME"; AreaCodeComboBox.DataContext = this; }
public static MvcHtmlString SelectArea(this HtmlHelper html, int idArea = 0, string ctrlName = "Areas") { var areas = new AreaService().Listar() .Where(x => x.Ativo == true) .OrderBy(x => x.Descricao) .ToList(); TagBuilder tag = new TagBuilder("select"); tag.MergeAttribute("id", ctrlName); tag.MergeAttribute("name", ctrlName); foreach (var item in areas) { TagBuilder itemTag = new TagBuilder("option"); itemTag.MergeAttribute("value", item.Id.ToString()); if (item.Id == idArea) { itemTag.MergeAttribute("selected", "selected"); } itemTag.SetInnerText(item.Descricao); tag.InnerHtml += itemTag.ToString(); } return(new MvcHtmlString(tag.ToString())); }
public AreaController( AreaService areaService, AccountService accountService) { _areaService = areaService; _accountService = accountService; }
/// <summary> /// 获取areaUid对应的流量计信息 /// </summary> /// <param name="areaUid"></param> /// <returns></returns> public List <FlowMeterStatusAndArea> GetFlowMeterStatusByArea(Guid areaUid) { IFlowMeterStatusService fms_service = new FlowMeterStatusService(); IAreaService area_service = new AreaService(); IAreaDeviceService areadevice_service = new AreaDeviceService(); List <FlowMeterStatusAndArea> fmsalist = new List <FlowMeterStatusAndArea>(); List <FlowMeter_t> fmlist = FindAll().Where(p => p.FM_Enable == 1).ToList(); List <AreaDevice_t> adlist = areadevice_service.GetAreaDeviceByAreaUid(areaUid); foreach (var aditem in adlist) { if (fmlist.Where(p => p.FM_UId == aditem.AD_DeviceUid).Count() > 0) { FlowMeterStatusAndArea item = new FlowMeterStatusAndArea() { flowmeter = FindAll().Where(p => p.FM_UId == aditem.AD_DeviceUid).FirstOrDefault(), status = fms_service.GetFlowMeterStatusByUid(aditem.AD_DeviceUid).FirstOrDefault(), area = area_service.GetAreaByDeviceUid(aditem.AD_DeviceUid) }; fmsalist.Add(item); } } return(fmsalist); }
public bool Run(params object[] args) { NWObject door = NWGameObject.OBJECT_SELF; if (!door.Area.IsInstance) { return(false); } NWObject target = _.GetTransitionTarget(door); NWPlayer player = _.GetClickingObject(); _.DelayCommand(6.0f, () => { int playerCount = NWModule.Get().Players.Count(x => !Equals(x, player) && Equals(x.Area, door.Area)); if (playerCount <= 0) { AreaService.DestroyAreaInstance(door.Area); } }); player.AssignCommand(() => { _.ActionJumpToLocation(target.Location); }); return(true); }
private void Window_Loaded(object sender, RoutedEventArgs e) { bll = AppContext.GetLocationBll(); areaService = new AreaService(bll); aarService = new AreaAuthorizationRecordService(bll); ITagRoleService service = new TagRoleService(); _roles = service.GetList(); var tree = areaService.GetTree(); TopoTreeView1.LoadData(tree, false, true); TopoTreeView1.ExpandLevel(2); DataGrid1.ItemsSource = _roles; CardRole selectedRole = _roles.Find(i => i.Id == roleId); if (selectedRole != null) { selectedRole.IsChecked = true; DataGrid1.SelectedItem = selectedRole; //CheckRoleAreas(selectedRole.Id); } }
void loadData() { AreaService areaService = new AreaService(new CoffeShopContext()); gridControl1.DataSource = areaService.GetAllArea(); btnDelete.Enabled = false; }
private AreaService CreateAreaService() { //var userId = Guid.Parse(User.Identity.GetUserId()); //We took out the user id from the creation of the AreaService var areaService = new AreaService(); //took out userId parameter return(areaService); }
void BindArea() { IList <Area> list = new List <Area>(); if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Area_All)) { list = new AreaService().FindAll(); AspNetCache.SetCache(Constants.Cache_ReportFuel_Area_All, list); } else { list = (IList <Area>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Area_All); } if (list != null && list.Count > 0) { var listSearch = from o in list where o.ParentId == 0 || o.ParentId == null orderby o.SortOrder ascending select o; ddlArea.DataSource = listSearch; ddlArea.DataTextField = "AreaName"; ddlArea.DataValueField = "Id"; ddlArea.DataBind(); ddlArea.Items.Insert(0, new ListItem("---Tất cả---", "")); } else { ddlArea.DataSource = null; ddlArea.DataTextField = "AreaName"; ddlArea.DataValueField = "Id"; ddlArea.DataBind(); ddlArea.Items.Insert(0, new ListItem("---Tất cả---", "")); } }
public IHttpActionResult Get() { AreaService areaService = CreateAreaService(); var areas = areaService.GetAreas(); return(Ok(areas)); }
void BindSubArea() { ddlSubArea.Items.Clear(); IList <Area> list = new List <Area>(); if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Area_All)) { list = new AreaService().FindAll(); AspNetCache.SetCache(Constants.Cache_ReportFuel_Area_All, list); } else { list = (IList <Area>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Area_All); } if (list != null && list.Count > 0 && ddlArea.SelectedIndex > 0) { int ParentId = Convert.ToInt32(ddlArea.SelectedValue); //var listSearch = from o in list where o.ParentId == ParentId orderby o.AreaName ascending, o.SortOrder ascending select o; var listSearch = from o in list where o.ParentId == ParentId orderby o.AreaName ascending select o; ddlSubArea.DataSource = listSearch; ddlSubArea.DataTextField = "AreaName"; ddlSubArea.DataValueField = "Id"; ddlSubArea.DataBind(); ddlSubArea.Items.Insert(0, new ListItem("---Chọn---", "")); } else { ddlSubArea.DataSource = null; ddlSubArea.DataTextField = "AreaName"; ddlSubArea.DataValueField = "Id"; ddlSubArea.DataBind(); ddlSubArea.Items.Insert(0, new ListItem("---Chọn---", "")); } }
public IHttpActionResult Get(int id) { AreaService areaService = CreateAreaService(); var area = areaService.GetAreaById(id); return(Ok(area)); }
void queryArea() { try { var areas = from item in AreaService.Query(getCondition()) select new { Id = item.Id, Name = item.Name, Remark = item.Remark }; this.dataSource.DataSource = areas; this.dataSource.DataBind(); if (!areas.Any()) { this.emptyDataInfo.Visible = true; // ShowMessage("没有任何符合条件的查询结果"); } else { dataSource.HeaderRow.TableSection = TableRowSection.TableHeader; this.emptyDataInfo.Visible = false; } } catch (Exception ex) { ShowExceptionMessage(ex, "查询"); } }
public List <QualityMeterStatusAndArea> GetQualityMeterStatusByArea(Guid areaUid) { IQualityMeterStatusService qms_service = new QualityMeterStatusService(); IAreaService area_service = new AreaService(); IAreaDeviceService areadevice_service = new AreaDeviceService(); List <QualityMeterStatusAndArea> qmsalist = new List <QualityMeterStatusAndArea>(); List <QualityMeter_t> qmlist = FindAll().Where(p => !p.QM_Description.Contains("可不用")).ToList(); List <AreaDevice_t> adlist = areadevice_service.GetAreaDeviceByAreaUid(areaUid); foreach (var aditem in adlist) { if (qmlist.Where(p => p.QM_UId == aditem.AD_DeviceUid).Count() > 0) { QualityMeterStatusAndArea item = new QualityMeterStatusAndArea() { qualitymeter = FindAll().FirstOrDefault(p => p.QM_UId == aditem.AD_DeviceUid), status = qms_service.GetQualityMeterStatusByUid(aditem.AD_DeviceUid).FirstOrDefault(), area = area_service.GetAreaByDeviceUid(aditem.AD_DeviceUid) }; qmsalist.Add(item); } } return(qmsalist); }
public SearchController(ProjectService projectService, ProjectTypeService projectTypeService, AreaService areaService, PriceService priceService) { _ProjectService = projectService; _ProjectTypeService = projectTypeService; _AreaService = areaService; _PriceService = priceService; }
public void FindArea() { // Arrange var service = new AreaService(); // Act var area = service.Find(1); // Assert Assert.AreEqual("THEORY", area.Descricao); }
public void ListarArea() { // Arrange var service = new AreaService(); // Act var areas = service.Listar(); // Assert Assert.AreEqual(1, areas.Count()); }
public HomeController(ProjectService projectService, ProjectTypeService projectTypeService, AreaService areaService, PriceService priceService, NewsService newsService, AdsService adsService, ContractorServices contractorServices) { _ProjectService = projectService; _ProjectTypeService = projectTypeService; _AreaService = areaService; _PriceService = priceService; _NewsService = newsService; _AdsService = adsService; _ContractorServices = contractorServices; }
public void IncluirArea() { // Arrange var area = new Area { AlteradoPor = 1, Descricao = "Theory", }; var service = new AreaService(); // Act var id = service.Gravar(area); // Assert Assert.AreEqual(1, id); }
public DepartmentController(DepartmentService departmentService, AreaService areaService, SelectValueService selectValueService) { _departmentService = departmentService; _areaService = areaService; _selectValueService = selectValueService; }
public AreaController(AreaService areaService) { _areaService = areaService; }