//funcion que regresa a la escena del menu principal public void ButtonReturn() { PanelConfirmacion.SetActive(true); btnYes.GetComponent <Button>().onClick.AddListener(() => { #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else Application.Quit(); #endif }); btnNo.GetComponent <Button>().onClick.AddListener(() => { PanelConfirmacion.SetActive(false); }); }
void Start() { cont = 1; x = -1; y = -1; RotX = 0; RotY = 0; move = true; ready = true; destroy = false; rotate = false; rnd = true; isWhite = false; buttonColor = false; buttonEdition = false; buttonInfo = false; ModificarXY = true; guardadoTut = false; ButtonVisAct = false; BandEnter = false; BandOnClick = false; //FDDM fieldBSTotalC = GameObject.Find("InputField"); //Input del menu editar para la cantidad de componentes textTC = GameObject.Find("TextTC").GetComponent <Text>(); //Texto que esta en la ventana que solicita la cantidad de elementos del componente. //FDDM btnSave = GameObject.Find("ButtonSaveEdition"); showPanel = GameObject.Find("PanelEdition").GetComponent <CanvasGroup>(); fieldS = GameObject.Find("InputSaveEdition"); panelEdit = GameObject.Find("PanelEdition"); ControllerBoard = GameObject.Find("Tablero").GetComponent <ControllerBoard>(); tablero = GameObject.Find("Tablero"); panelSave = GameObject.Find("PanelGuardar"); panel = GameObject.Find("PanelInfo"); panelLoad = GameObject.Find("PanelCargar"); panelProc = GameObject.Find("PanelProcesos"); panelInfo = GameObject.Find("PanelInfo"); panelColor = GameObject.Find("PanelChangeColor"); textStatus = GameObject.Find("TextStatusEdition").GetComponent <Text>(); panelSociedad = GameObject.Find("sociedad"); inventory = GameObject.Find("Inventory").GetComponent <Inventory>(); Camera = GameObject.Find("Camera").GetComponent <CameraController>(); btnShow = GameObject.Find("ShowCategory"); panelEdit.SetActive(false); panelColor.SetActive(false); BSTotalC = GameObject.Find("ButtonSaveTotalC"); MenuStickers = GameObject.Find("MenuStickers"); MenuFicha = GameObject.Find("PanelFicha"); PanelSupport = GameObject.Find("PanelSoporte"); PanelConfirmacion = GameObject.Find("PanelConfirmacion"); PanelConfirmacion1 = GameObject.Find("PanelConfirmacion1"); btnYes1 = GameObject.Find("Yes1"); btnNo1 = GameObject.Find("No1"); btnYes = GameObject.Find("Yes"); btnNo = GameObject.Find("No"); MenuStickers.SetActive(false); MenuFicha.SetActive(false); PanelSupport.SetActive(false); PanelConfirmacion.SetActive(false); PanelConfirmacion1.SetActive(false); }
protected void btnGuardarDocumento_Click(object sender, EventArgs e) { PanelError.Visible = false; PanelConfirmacion.Visible = false; int idTDoc = int.Parse(ddlTipoDocumento.SelectedValue.ToString()); string NombreTipoDocumento = ddlTipoDocumento.SelectedItem.Text; string Titulo = TxtTitulo.Text; String Descripcion = TxtDescripcion.Text; int idDireccionFNC = int.Parse(dllDireccionFNC.SelectedValue.ToString()); DateTime fecha_actual = DateTime.Now; int idUsuario = int.Parse(Session["idUsuario"].ToString()); GestionDocumental gd = new GestionDocumental(); Boolean fileOK = false; Boolean tamañoOK = false; Boolean tamañoOK2 = false; if (idTDoc == 1) { ViewState["ruta"] = "~/Documentos/PoliticasCorporativas/"; ViewState["NombreArchivo"] = "PoliticaCorporativa"; } else if (idTDoc == 2) { ViewState["ruta"] = "~/Documentos/PoliticasOperativas/"; ViewState["NombreArchivo"] = "PoliticaOperativa"; } else if (idTDoc == 3) { ViewState["ruta"] = "~/Documentos/Manuales/"; ViewState["NombreArchivo"] = "Manual"; } else if (idTDoc == 4) { ViewState["ruta"] = "~/Documentos/Procedimientos-Instructivos/"; ViewState["NombreArchivo"] = "Procedimiento-Instructivo"; } String path = Server.MapPath(ViewState["ruta"].ToString()); if (FileUpload_Documento.HasFile) { String fileExtension = System.IO.Path.GetExtension(FileUpload_Documento.FileName).ToLower(); String[] allowedExtensions = { ".pdf" }; for (int i = 0; i < allowedExtensions.Length; i++) { if (fileExtension == allowedExtensions[i]) { fileOK = true; } } int tamanoarchivo = FileUpload_Documento.PostedFile.ContentLength; if (tamanoarchivo < 2000000) { tamañoOK = true; } int ta_descripcion = Descripcion.Length; if (ta_descripcion < 200) { tamañoOK2 = true; } } else if (!fileOK) { LblFile.Text = "Se requiere un archivo!"; LblFile.Visible = true; } if (fileOK && tamañoOK && tamañoOK2) { try { string result = string.Empty; string nombrearchivo = Titulo.Replace(" ", "_").ToUpper(); string rutaarchivo = path + nombrearchivo; gd.Ruta = rutaarchivo; gd.NombreDocumento = nombrearchivo; FileUpload_Documento.PostedFile.SaveAs(path + nombrearchivo + ".pdf"); gd.Titulo = Titulo; gd.Descripcion = Descripcion; gd.FechaRegistro = fecha_actual; gd.IdUsuario = idUsuario; gd.IdTipoDocumento = idTDoc; gd.TipoDocumento = NombreTipoDocumento; gd.IdDireccion = idDireccionFNC; gd.NoDescargas = 0; ModelBD_GestionDocumentos.GestionDocumental.Add(gd); ModelBD_GestionDocumentos.SaveChanges(); PanelConfirmacion.Visible = true; PanelConfirmacion.Focus(); TxtTitulo.Text = string.Empty; TxtDescripcion.Text = string.Empty; GridView_Documentos.DataSourceID = ""; GridView_Documentos.DataSource = SqlDataSource_Documentos; GridView_Documentos.DataBind(); } catch (Exception ex) { PanelError.Visible = true; PanelError.Focus(); TxtTitulo.Text = string.Empty; TxtDescripcion.Text = string.Empty; LblTipoerror2.Text = ex.ToString(); } } else { if (!fileOK) { LblFile.Text = "Tipo de archivo no aceptado."; LblFile.Visible = true; } else if (!tamañoOK) { Double t2 = FileUpload_Documento.PostedFile.ContentLength / 1048576.0; Double t3 = Math.Truncate(t2); LblFile.Text = "El tamaño del archivo es: " + t3 + "MB, superando los 2MB permitidos."; LblFile.Visible = true; } else if (!tamañoOK2) { LblFile.Text = "El numero de caracteres de la descripción es: " + Descripcion.Length + ", superando los 200 caracteres permitidos."; LblFile.Visible = true; } } }