protected void gvStationGroup_SelectedIndexChanged(object sender, System.EventArgs e) { AdminController aCont = new AdminController(); txtSelectedStationGroup.Value = (gvStationGroup.SelectedRow.FindControl("hdngvStationGroupId") as HiddenField).Value; StationGroupInfo StationGroup = aCont.Get_StationGroupById(Convert.ToInt32(txtSelectedStationGroup.Value)); if (StationGroup.Id != -1) { btnDeleteStationGroup.Enabled = true; btnSaveStationGroupAs.Enabled = true; txtStationGroupCreatedBy.Value = StationGroup.CreatedById.ToString(); txtStationGroupCreatedDate.Value = StationGroup.DateCreated.Ticks.ToString(); txtStationGroupName.Text = StationGroup.StationGroupName; txtStationGroupDescription.Text = StationGroup.Description; //ddlStationGroupAgency.SelectedValue = StationGroup.AgencyId.ToString(); lblStationGroupMessage.Text = ""; btnManageStationsInGroup.Enabled = true; lbxStationGroupStations.Items.Clear(); lbxStationsInGroupModal.Items.Clear(); foreach (StationInfo station in StationGroup.stations) { lbxStationGroupStations.Items.Add(new ListItem(station.StationName, station.Id.ToString())); lbxStationsInGroupModal.Items.Add(new ListItem(station.StationName, station.Id.ToString())); } } else { btnDeleteStationGroup.Enabled = false; btnSaveStationGroupAs.Enabled = false; clearStationGroup(); lblStationGroupMessage.Text = "There was an error loading this Station Group."; } //clearAll("StationGroup"); }
protected void btnSaveStationGroupAs_Click(object sender, System.EventArgs e) { AdminController aCont = new AdminController(); StationGroupInfo StationGroup = new StationGroupInfo(); StationGroup.PortalId = PortalId; StationGroup.StationGroupName = txtStationGroupName.Text; StationGroup.Description = txtStationGroupDescription.Text; //StationGroup.AgencyId = Convert.ToInt32(ddlStationGroupAgency.SelectedValue); StationGroup.LastModifiedById = UserId; StationGroup.LastModifiedDate = DateTime.Now; //save new StationGroup StationGroup.CreatedById = UserId; StationGroup.DateCreated = DateTime.Now; int StationGroupId = aCont.Add_StationGroup(StationGroup); txtSelectedStationGroup.Value = StationGroupId.ToString(); txtStationGroupCreatedBy.Value = UserId.ToString(); txtStationGroupCreatedDate.Value = DateTime.Now.Ticks.ToString(); lblStationGroupMessage.Text = "Station Group Saved."; btnManageStationsInGroup.Enabled = true; FillStationGroups(); FillStationGroupList(); //fillDropDowns(""); }
protected void btnDeleteStationGroup_Click(object sender, System.EventArgs e) { AdminController aCont = new AdminController(); int StationGroupId = Convert.ToInt32(txtSelectedStationGroup.Value); StationGroupInfo StationGroup = new StationGroupInfo(); StationGroup.Id = StationGroupId; aCont.Delete_StationGroup(StationGroup); lblStationGroupMessage.Text = "Station Group Deleted."; FillStationGroups(); FillStationGroupList(); clearStationGroup(); //fillDropDowns(""); }
/// <summary> /// 6.5.1 ~ 6.5.2 /// </summary> /// <param name="includedChildInfos"></param> /// <returns></returns> public HttpStatusCode StationGroupGetAll(out IEnumerable <StationGroupInfo> stationGroupInfos, SenslinkInfoTypes includedChildInfos) { string resposeString = string.Empty; StringBuilder sb = new StringBuilder("StationGroup/Get/All"); if (includedChildInfos != SenslinkInfoTypes.None) { bool isFirstChild = true; sb.Append("/{"); if (includedChildInfos.HasFlag(SenslinkInfoTypes.PhysicalQuantity)) { sb.Append("PhysicalQuantity"); isFirstChild = false; } if (includedChildInfos.HasFlag(SenslinkInfoTypes.Category)) { if (!isFirstChild) { sb.Append("|"); } sb.Append("Category"); isFirstChild = false; } sb.Append("}"); } HttpStatusCode resultCode = HttpGet(sb.ToString(), out resposeString); stationGroupInfos = null; if (resultCode == HttpStatusCode.OK) { JArray stationGroupJArray = JArray.Parse(resposeString); JToken[] stationGroupTokens = stationGroupJArray.ToArray(); List <StationGroupInfo> parsedStationGroupInfos = new List <StationGroupInfo>(); foreach (JToken stationGroupToken in stationGroupTokens) { StationGroupInfo cunInfo = stationGroupToken.ToObject <StationGroupInfo>(); parsedStationGroupInfos.Add(cunInfo); } stationGroupInfos = parsedStationGroupInfos.ToList(); } return(resultCode); }
protected void btnRemoveStationFromGroup_Click(object sender, System.EventArgs e) { if (lbxStationsInGroupModal.SelectedItem == null) { lblStationGroupStationsModalMessage.Text = "Please select a station to remove."; } else { AdminController aCont = new AdminController(); aCont.Delete_StationsInGroup(Convert.ToInt32(lbxStationsInGroupModal.SelectedValue), Convert.ToInt32(txtSelectedStationGroup.Value)); StationGroupInfo StationGroup = aCont.Get_StationGroupById(Convert.ToInt32(txtSelectedStationGroup.Value)); lblStationGroupStationsModalMessage.Text = "Station Removed from Group."; lbxStationGroupStations.Items.Clear(); lbxStationsInGroupModal.Items.Clear(); foreach (StationInfo station in StationGroup.stations) { lbxStationGroupStations.Items.Add(new ListItem(station.StationName, station.Id.ToString())); lbxStationsInGroupModal.Items.Add(new ListItem(station.StationName, station.Id.ToString())); } } }
public HttpStatusCode StationGroupGet(out StationGroupInfo stationGroupInfo, Guid id, SenslinkInfoTypes includedChildInfos) { string resposeString = string.Empty; StringBuilder sb = new StringBuilder($"StationGroup/Get/{id.ToString()}"); if (includedChildInfos != SenslinkInfoTypes.None) { bool isFirstChild = true; sb.Append("/{"); if (includedChildInfos.HasFlag(SenslinkInfoTypes.PhysicalQuantity)) { sb.Append("PhysicalQuantity"); isFirstChild = false; } if (includedChildInfos.HasFlag(SenslinkInfoTypes.Category)) { if (!isFirstChild) { sb.Append("|"); } sb.Append("Category"); isFirstChild = false; } sb.Append("}"); } HttpStatusCode resultCode = HttpGet(sb.ToString(), out resposeString); stationGroupInfo = null; if (resultCode == HttpStatusCode.OK) { JToken stationGroupToken = JToken.Parse(resposeString); stationGroupInfo = stationGroupToken.ToObject <StationGroupInfo>(); } return(resultCode); }
public abstract void Delete_StationGroup(StationGroupInfo StationGroup);
public abstract void Update_StationGroup(StationGroupInfo StationGroup);
public abstract int Add_StationGroup(StationGroupInfo StationGroup);