private void btnSelectTrafficArea_Click(object sender, EventArgs e) { btnSelectTrafficArea.DisableServerSideValidation(); if (Page.IsValid) { // Add this traffic area to this control area. int trafficAreaId = Convert.ToInt32(cboAddTrafficArea.SelectedValue); bool success = false; using (Facade.ITrafficArea facTrafficArea = new Facade.Traffic()) { Entities.TrafficArea trafficArea = facTrafficArea.GetForTrafficAreaId(trafficAreaId); trafficArea.ControlAreaId = m_controlArea.ControlAreaId; success = facTrafficArea.Update(trafficArea, ((Entities.CustomPrincipal)Page.User).UserName); } if (success) { lblConfirmation.Text = "The traffic area has been added."; ConfigureControlAreaManipulation(eControlAreaManipulation.ConfigureTrafficAreas); } else { lblConfirmation.Text = "The traffic area has not been added."; } lblConfirmation.Visible = true; } }
private void btnActionTrafficArea_Click(object sender, EventArgs e) { btnActionTrafficArea.DisableServerSideValidation(); if (Page.IsValid) { if (m_trafficArea == null) { m_trafficArea = new Entities.TrafficArea(); } m_trafficArea.TrafficAreaName = txtTrafficAreaDescription.Text; m_trafficArea.ControlAreaId = Convert.ToInt32(cboControlAreaForNewTrafficArea.SelectedValue); bool success = false; using (Facade.ITrafficArea facTrafficArea = new Facade.Traffic()) { if (m_trafficArea.TrafficAreaId == 0) { m_trafficArea.TrafficAreaId = facTrafficArea.Create(m_trafficArea, ((Entities.CustomPrincipal)Page.User).UserName); success = m_trafficArea.TrafficAreaId > 0; } else { success = facTrafficArea.Update(m_trafficArea, ((Entities.CustomPrincipal)Page.User).UserName); } } if (success) { lblConfirmation.Text = "The traffic area has been stored."; ConfigureTrafficAreaManupulation(eTrafficAreaManipulation.SelectTrafficArea); } else { lblConfirmation.Text = "The traffic area has not been stored."; } lblConfirmation.Visible = true; } }