Exemple #1
0
        private void Editar()
        {
            ITiempoEntrega tiempoEntrega = TiempoEntregaFactory.GetTiempoEntrega();

            tiempoEntrega.TiempoEntregaID = Convert.ToInt32(this.txtTiempoEntregaID.Text);
            tiempoEntrega.Consultar();

            this.txtTiempoEntregaDescrip.Text = tiempoEntrega.TiempoEntregaDescrip;
            this.txtTiempoMaximoEntrega.Text  = Convert.ToString(tiempoEntrega.TiempoMaximoEntrega);
        }
Exemple #2
0
        private void butGuardarTiempoEntrega_Click(object sender, System.EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            ITiempoEntrega tiempoEntrega = TiempoEntregaFactory.GetTiempoEntrega();

            tiempoEntrega.TiempoEntregaID      = Convert.ToInt32(this.txtTiempoEntregaID.Text);
            tiempoEntrega.TiempoEntregaDescrip = this.txtTiempoEntregaDescrip.Text;
            tiempoEntrega.TiempoMaximoEntrega  = Convert.ToInt32(this.txtTiempoMaximoEntrega.Text);
            tiempoEntrega.UnidadNegocioID      = this.UnidadNegocioID;
            if (this.txtTiempoEntregaID.Text != "0")
            {
                for (int i = 0; i < lstTiempoEntrega.Items.Count; i++)
                {
                    if (this.txtTiempoEntregaID.Text == lstTiempoEntrega.Items[i].Value)
                    {
                        tiempoEntrega.Prioridad = i + 1;
                    }
                }
            }

            try
            {
                if (tiempoEntrega.Guardar())
                {
                    string script = "<script language='javascript'>\n";
                    script += "alert('Los datos se guardaron correctamente.');";
                    //script += "window.location.href = 'TiempoEntregaConsul.aspx';\n";
                    script += "</script>";

                    this.txtTiempoEntregaID.Text = tiempoEntrega.TiempoEntregaID.ToString();
                    Page.RegisterStartupScript("scriptOk", script);
                    tiempoEntrega.Consultar();
                    int priori = tiempoEntrega.Prioridad;
                    this.CargarPrioridades();
                }
                else
                {
                    string script = "<script language='javascript'>\n";
                    script += "alert('Los datos no se guardaron debido a errores.');\n";
                    script += "</script>";

                    Page.RegisterStartupScript("scriptError", script);
                }
            }
            catch (Exception ex)
            {
                string mensaje = ex.Message;
                try
                {
                    mensaje = this.TraducirTexto(ex.Message);
                    if (mensaje == "" || mensaje == null)
                    {
                        mensaje = ex.Message;
                    }
                }
                catch (Exception)
                {
                    mensaje = ex.Message;
                }
                ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(mensaje);
            }
        }