protected void saveRouter_Click(object sender, ImageClickEventArgs e) { if (getOperation() == "update") { if (HttpContext.Current.Session["idRouter"] != null) { if (OperationStatusText.SelectedItem != null & RouterStatusText != null) { string confirmValue = Request.Form["confirm_value"]; if (confirmValue == "Yes") { RouterService routerService = new RouterService(); RouterUpdateView router = new RouterUpdateView(); int OperationStatusId = Int32.Parse(OperationStatusText.SelectedItem.Value); int RouterStatusId = Int32.Parse(RouterStatusText.SelectedItem.Value); router.RouterId = RouterText.Text; router.OperationStatusId = OperationStatusId; router.RouterStatus = RouterStatusId; CUDView crud = routerService.updateRouter(router); if (crud.update == false) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the Router')", true); } fillRouterTable(); RouterText.Text = ""; UpnText.Text = ""; RecipeText.Text = ""; ProductText.Text = ""; ProcessText.Text = ""; OperationText.Text = ""; OperationStatusText.Items.Clear(); SessionModeText.Text = ""; RouterStatusText.Items.Clear(); OperationStatusText.Enabled = false; RouterStatusText.Enabled = false; HttpContext.Current.Session["idRouter"] = null; clearOperation(); } } } } }
/* Metodo´para actualizar un router */ private void saveRouterAux() { //Se verifica que la operacion sea update if (getOperation() == "update") { if (HttpContext.Current.Session["idRouter"] != null) { if (OperationStatusText.SelectedItem != null & RouterStatusText != null) { //Se crea el servicio RouterService routerService = new RouterService(); RouterUpdateView router = new RouterUpdateView(); int OperationStatusId = Int32.Parse(OperationStatusText.SelectedItem.Value); int RouterStatusId = Int32.Parse(RouterStatusText.SelectedItem.Value); router.RouterId = RouterText.Text; router.OperationStatusId = OperationStatusId; router.RouterStatus = RouterStatusId; router.Multisession = MultiSessionText.SelectedItem.Text; String reason = Session["reason"].ToString(); String user = Context.User.Identity.Name; //Se llenan los datos de la auditoria AuditDataFromWeb audit = new AuditDataFromWeb(); audit.Reason = reason; audit.StationIP = General.getIp(this.Page); audit.UserName = user; //Se realiza la actualizacion CUDView crud = routerService.updateRouter(router, audit); if (crud.update == false) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the Router')", true); } fillRouterTable(); RouterText.Text = ""; UpnText.Text = ""; RecipeText.Text = ""; ProductText.Text = ""; ProcessText.Text = ""; OperationText.Text = ""; OperationStatusText.Items.Clear(); SessionModeText.Text = ""; RouterStatusText.Items.Clear(); OperationStatusText.Enabled = false; RouterStatusText.Enabled = false; MultiSessionText.Enabled = false; HttpContext.Current.Session["idRouter"] = null; clearOperation(); } } } }