/* Metodo para realizar una actualizacion */ private void updateAuxiliar() { if (HttpContext.Current.Session["IdUpn"] != null) { if (Upn.Text != "" & ProcessSelector1.SelectedItem != null) { if (validateRecipeonOperationUpdate() & checkEnableRecipeUpdate()) { UpnService upnService = new UpnService(); UpnUpdateView upn = new UpnUpdateView(); upn.UpnId = Upn.Text; upn.UpnStatus = upnEnable.Items[0].Selected; upn.Multisession = multisessionEnable.Items[0].Selected; String reason = Session["reason"].ToString(); String user = Context.User.Identity.Name; AuditDataFromWeb audit = new AuditDataFromWeb(); audit.Reason = reason; audit.StationIP = General.getIp(this.Page); audit.UserName = user; CUDView crud = upnService.updateUpn(upn, audit); String processSelectorId = ProcessSelector1.SelectedItem.Value; String upnId = upn.UpnId; if (crud.update == false) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the UPN')", true); } else { foreach (GridViewRow gvrow in GridView1.Rows) { CheckBox operationEnable = (CheckBox)gvrow.FindControl("EnableOperation1"); Label lblOperationId = (Label)gvrow.FindControl("OperationId1"); Label lblRecipeId = (Label)gvrow.FindControl("recipeOperationId1"); Label lblRecipe = (Label)gvrow.FindControl("recipeOperation1"); if (lblRecipe.Text != "") { UpnOperationView newOperationUpn = new UpnOperationView(); newOperationUpn.Enable = operationEnable.Checked; newOperationUpn.OperationId = Int32.Parse(lblOperationId.Text); newOperationUpn.ProcessId = Int32.Parse(processSelectorId); newOperationUpn.RecipeId = Int32.Parse(lblRecipeId.Text); newOperationUpn.UpnId = upnId; crud = upnService.updateUpnOperation(newOperationUpn, audit); } } if (crud.update == false) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the operation')", true); } } fillUpnTable(); Upn.Text = ""; Product.Text = ""; clearOperationTable1(); clearProcesses1(); clearRecipeUpn1(); RecipeUpn1.Enabled = false; GridView1.Enabled = false; upnEnable.Items[0].Enabled = false; upnEnable.Items[0].Selected = false; multisessionEnable.Items[0].Enabled = false; multisessionEnable.Items[0].Selected = false; } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Add at least one enabled recipe to operation table.')", true); } } } }
private void updateAuxiliar() { if (HttpContext.Current.Session["IdUpn"] != null) { if (Upn.Text != "" & ProcessSelector1.SelectedItem != null) { if (validateRecipeonOperationUpdate()) { string confirmValue = Request.Form["confirm_value"]; if (confirmValue == "Yes") { UpnService upnService = new UpnService(); UpnUpdateView upn = new UpnUpdateView(); upn.UpnId = Upn.Text; upn.UpnStatus = upnEnable.Items[0].Selected; CUDView crud = upnService.updateUpn(upn); String processSelectorId = ProcessSelector1.SelectedItem.Value; String upnId = upn.UpnId; if (crud.update == false) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the UPN')", true); } else { foreach (GridViewRow gvrow in GridView1.Rows) { CheckBox operationEnable = (CheckBox)gvrow.FindControl("EnableOperation1"); Label lblOperationId = (Label)gvrow.FindControl("OperationId1"); Label lblRecipeId = (Label)gvrow.FindControl("recipeOperationId1"); Label lblRecipe = (Label)gvrow.FindControl("recipeOperation1"); if (lblRecipe.Text != "") { UpnOperationView newOperationUpn = new UpnOperationView(); newOperationUpn.Enable = operationEnable.Checked; newOperationUpn.OperationId = Int32.Parse(lblOperationId.Text); newOperationUpn.ProcessId = Int32.Parse(processSelectorId); newOperationUpn.RecipeId = Int32.Parse(lblRecipeId.Text); newOperationUpn.UpnId = upnId; crud = upnService.updateUpnOperation(newOperationUpn); } } if (crud.update == false) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the operation')", true); } } fillUpnTable(); Upn.Text = ""; Product.Text = ""; clearOperationTable1(); clearProcesses1(); clearRecipeUpn1(); RecipeUpn1.Enabled = false; GridView1.Enabled = false; upnEnable.Items[0].Enabled = false; upnEnable.Items[0].Selected = false; } } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Add at least one recipe to operation table.')", true); } } } }