protected void Page_Load(object sender, System.EventArgs e) { Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.AddEditResource); m_keyId = GetVehicleKeyId(); m_resourceId = Convert.ToInt32(Request.QueryString["resourceId"]); if (m_keyId > 0) { m_isUpdate = true; } if (!IsPostBack) { PopulateStaticControls(); ConfigureReturnLink(); if (m_isUpdate) { LoadVehicleKey(); } } else { // Retrieve the key from viewstate m_key = (Entities.VehicleKey)ViewState[C_KEY]; } }
private void PopulateKey() { if (m_key == null) { m_key = new Orchestrator.Entities.VehicleKey(); m_key.ResourceId = m_resourceId; } m_key.VehicleKeyType = (eVehicleKeyType)Enum.Parse(typeof(eVehicleKeyType), ddlKeyTypes.SelectedValue.Replace(" ", ""), true); m_key.Serial = txtSerial.Text; }
private void LoadVehicleKey() { Facade.IVehicleKey facVehicleKey = new Facade.Resource(); m_key = facVehicleKey.GetForVehicleKeyId(m_keyId); ViewState[C_KEY] = m_key; ddlKeyTypes.SelectedValue = Utilities.UnCamelCase(m_key.VehicleKeyType.ToString()); txtSerial.Text = m_key.Serial; btnAdd.Text = "Update Vehicle Key"; }