/* Metodo para realizar una insersion */ private void saveAuxiliar() { if (Upn2.Text != "" & ProcessSelector.SelectedItem != null & Product2.SelectedItem != null) { if (ProcessSelector.SelectedItem.Value != "" & Product2.SelectedItem.Value != "") { if (validateRecipeonOperation() & checkEnableRecipeInsert()) { UpnService upnService = new UpnService(); UpnInsertView upn = new UpnInsertView(); upn.ProductLineId = Int32.Parse(Product2.SelectedItem.Value); upn.UpnId = Upn2.Text; upn.UPNStatus = upnEnable2.Items[0].Selected; upn.Multisession = multisessionCheck.Items[0].Selected; upn.UpnTypeId = 0; // cambiar, esta alambrado String user = Context.User.Identity.Name; AuditDataFromWeb audit = new AuditDataFromWeb(); audit.Reason = "N/A"; audit.StationIP = General.getIp(this.Page); audit.UserName = user; CUDView crud = upnService.insertUpn(upn, audit); if (crud.insert == false) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not insert the UPN')", true); } else { foreach (GridViewRow gvrow in GridView2.Rows) { CheckBox operationEnable = (CheckBox)gvrow.FindControl("EnableOperation"); Label lblOperationId = (Label)gvrow.FindControl("OperationId"); Label lblRecipeId = (Label)gvrow.FindControl("recipeOperationId"); Label lblRecipe = (Label)gvrow.FindControl("recipeOperation"); if (lblRecipe.Text != "") { UpnInsertOperationView newOperationUpn = new UpnInsertOperationView(); newOperationUpn.OperationEnable = operationEnable.Checked; newOperationUpn.OperationId = Int32.Parse(lblOperationId.Text); newOperationUpn.ProcessId = Int32.Parse(ProcessSelector.SelectedItem.Value); newOperationUpn.RecipeId = Int32.Parse(lblRecipeId.Text); newOperationUpn.UpnId = upn.UpnId; crud = upnService.insertUpnOperation(newOperationUpn, audit); } } if (crud.insert == false) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not insert the operation')", true); } fillUpnTable(); Upn.Text = ""; Product.Text = ""; clearOperationTable(); clearProcesses(); fillProducts(); clearRecipeUpn(); FirstDIV.Visible = true; SecondDIV.Visible = false; } } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Add at least one enabled recipe to operation table.')", true); } } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true); } } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true); } }
private void saveAuxiliar() { if (Upn2.Text != "" & ProcessSelector.SelectedItem != null & Product2.SelectedItem != null) { if (ProcessSelector.SelectedItem.Value != "" & Product2.SelectedItem.Value != "") { if (validateRecipeonOperation()) { string confirmValue = Request.Form["confirm_value"]; if (confirmValue == "Yes") { UpnService upnService = new UpnService(); UpnInsertView upn = new UpnInsertView(); upn.ProductLineId = Int32.Parse(Product2.SelectedItem.Value); upn.UpnId = Upn2.Text; upn.UPNStatus = upnEnable2.Items[0].Selected; upn.UpnTypeId = 0; // cambiar, esta alambrado CUDView crud = upnService.insertUpn(upn); if (crud.insert == false) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not insert the UPN')", true); } else { foreach (GridViewRow gvrow in GridView2.Rows) { CheckBox operationEnable = (CheckBox)gvrow.FindControl("EnableOperation"); Label lblOperationId = (Label)gvrow.FindControl("OperationId"); Label lblRecipeId = (Label)gvrow.FindControl("recipeOperationId"); Label lblRecipe = (Label)gvrow.FindControl("recipeOperation"); if (lblRecipe.Text != "") { UpnInsertOperationView newOperationUpn = new UpnInsertOperationView(); newOperationUpn.OperationEnable = operationEnable.Checked; newOperationUpn.OperationId = Int32.Parse(lblOperationId.Text); newOperationUpn.ProcessId = Int32.Parse(ProcessSelector.SelectedItem.Value); newOperationUpn.RecipeId = Int32.Parse(lblRecipeId.Text); newOperationUpn.UpnId = upn.UpnId; crud = upnService.insertUpnOperation(newOperationUpn); } } if (crud.insert == false) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not insert the operation')", true); } fillUpnTable(); Upn.Text = ""; Product.Text = ""; clearOperationTable(); clearProcesses(); fillProducts(); clearRecipeUpn(); FirstDIV.Visible = true; SecondDIV.Visible = false; } } } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Add at least one recipe to operation table.')", true); } } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true); } } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true); } }