/// ----------------------------------------------------------------------------- /// <summary> /// Obtiene un registro de la tabla T708_LINEA, /// y devuelve una instancia u objeto del tipo LINEA /// </summary> /// <returns></returns> /// <history> /// Creado por [sqladmin] 11/04/2011 17:54:57 /// </history> /// ----------------------------------------------------------------------------- public static LINEA Select(SqlTransaction tr, int t708_idlinea) { LINEA o = new LINEA(); SqlParameter[] aParam = new SqlParameter[1]; aParam[0] = new SqlParameter("@t708_idlinea", SqlDbType.Int, 4); aParam[0].Value = t708_idlinea; SqlDataReader dr; if (tr == null) { dr = SqlHelper.ExecuteSqlDataReader("GEM_LINEA_S", aParam); } else { dr = SqlHelper.ExecuteSqlDataReaderTransaccion(tr, "GEM_LINEA_S", aParam); } if (dr.Read()) { if (dr["t708_idlinea"] != DBNull.Value) { o.t708_idlinea = int.Parse(dr["t708_idlinea"].ToString()); } if (dr["t708_prefintern"] != DBNull.Value) { o.t708_prefintern = short.Parse(dr["t708_prefintern"].ToString()); } if (dr["t708_numlinea"] != DBNull.Value) { o.t708_numlinea = long.Parse(dr["t708_numlinea"].ToString()); } if (dr["t708_numext"] != DBNull.Value) { o.t708_numext = int.Parse(dr["t708_numext"].ToString()); } if (dr["t313_idempresa"] != DBNull.Value) { o.t313_idempresa = int.Parse(dr["t313_idempresa"].ToString()); } if (dr["empresa"] != DBNull.Value) { o.empresa = (string)dr["empresa"]; } if (dr["t712_idtarjeta"] != DBNull.Value) { o.t712_idtarjeta = byte.Parse(dr["t712_idtarjeta"].ToString()); } if (dr["t063_idproveedor"] != DBNull.Value) { o.t063_idproveedor = byte.Parse(dr["t063_idproveedor"].ToString()); } if (dr["t134_idmedio"] != DBNull.Value) { o.t134_idmedio = (short)dr["t134_idmedio"]; } if (dr["t708_modelo"] != DBNull.Value) { o.t708_modelo = (string)dr["t708_modelo"]; } if (dr["t708_IMEI"] != DBNull.Value) { o.t708_IMEI = (string)dr["t708_IMEI"]; } if (dr["t708_ICC"] != DBNull.Value) { o.t708_ICC = (string)dr["t708_ICC"]; } if (dr["t708_observa"] != DBNull.Value) { o.t708_observa = (string)dr["t708_observa"]; } if (dr["t710_idestado"] != DBNull.Value) { o.t710_idestado = (string)dr["t710_idestado"]; } if (dr["t711_idtarifa"] != DBNull.Value) { o.t711_idtarifa = (short)dr["t711_idtarifa"]; } if (dr["t001_responsable"] != DBNull.Value) { o.t001_responsable = int.Parse(dr["t001_responsable"].ToString()); } if (dr["responsable"] != DBNull.Value) { o.responsable = (string)dr["responsable"]; } if (dr["t708_tipouso"] != DBNull.Value) { o.t708_tipouso = (string)dr["t708_tipouso"]; } if (dr["t001_beneficiario"] != DBNull.Value) { o.t001_beneficiario = int.Parse(dr["t001_beneficiario"].ToString()); } if (dr["beneficiario"] != DBNull.Value) { o.beneficiario = (string)dr["beneficiario"]; } if (dr["t708_departamento"] != DBNull.Value) { o.t708_departamento = (string)dr["t708_departamento"]; } if (dr["t708_QEQ"] != DBNull.Value) { o.t708_QEQ = (bool)dr["t708_QEQ"]; } } else { throw (new NullReferenceException("No se ha obtenido ningun dato de LINEA")); } dr.Close(); dr.Dispose(); return(o); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsCallback) { try { obtenerProveedores(); obtenerMedios(); obtenerTarifaDatos(); obtenerTiposTarjeta(); //obtenerEstados(); if (Request.QueryString["sLectura"] != null) { sLectura = Request.QueryString["sLectura"].ToString(); } if (Request.QueryString["sOrigen"] != null) { sOrigen = Request.QueryString["sOrigen"].ToString(); } //string[] aFiguras = Regex.Split(Session["FIGURAS"].ToString(), ","); //for (int i = 0; i < aFiguras.Length; i++) //{ // if (aFiguras[i] == "C") // { // sLectura = "false"; // break; // } //} if (User.IsInRole("C")) { sLectura = "false"; } // Leer Línea if (Request.QueryString["bNueva"] != "true") { hdnId.Text = Request.QueryString["ID"].ToString(); GEMO.DAL.LINEA oLINEA = GEMO.DAL.LINEA.Select(null, int.Parse(hdnId.Text)); //if (oLINEA.t708_prefintern.ToString() == "") txtPrefijo.Text = ""; //else txtPrefijo.Text = short.Parse(oLINEA.t708_prefintern.ToString()).ToString("000"); txtPrefijo.Text = oLINEA.t708_prefintern.ToString(); txtNumlinea.Text = long.Parse(oLINEA.t708_numlinea.ToString()).ToString("###########"); txtNumext.Text = int.Parse(oLINEA.t708_numext.ToString()).ToString("#########"); if (oLINEA.t313_idempresa == null) { hdnIdEmpresa.Text = "0"; //txtIDEmpresa.Text = ""; txtEmpresa.Text = ""; } else { hdnIdEmpresa.Text = oLINEA.t313_idempresa.ToString(); //txtIDEmpresa.Text = int.Parse(oLINEA.t313_idempresa.ToString()).ToString("##,###,###"); txtEmpresa.Text = oLINEA.empresa; } if (oLINEA.t712_idtarjeta != null) { cboTipoTarjeta.SelectedValue = oLINEA.t712_idtarjeta.ToString(); } if (oLINEA.t063_idproveedor != null) { cboProveedor.SelectedValue = oLINEA.t063_idproveedor.ToString(); } if (oLINEA.t134_idmedio != null) { cboMedio.SelectedValue = oLINEA.t134_idmedio.ToString(); } cboTarifa.SelectedValue = oLINEA.t711_idtarifa.ToString(); if (sLectura == "false" || sOrigen == "2") { switch (oLINEA.t710_idestado.ToString()) { case ("X"): { cboEstado.Items.Add(new ListItem("Preactiva", "X")); cboEstado.Items.Add(new ListItem("Activa", "A")); cboEstado.Items.Add(new ListItem("Inactiva", "I")); break; } case ("A"): case ("B"): { cboEstado.Items.Add(new ListItem("Bloqueada", "B")); cboEstado.Items.Add(new ListItem("Activa", "A")); cboEstado.Items.Add(new ListItem("Inactiva", "I")); break; } case ("Y"): { cboEstado.Items.Add(new ListItem("Preinactiva", "Y")); cboEstado.Items.Add(new ListItem("Activa", "A")); cboEstado.Items.Add(new ListItem("Inactiva", "I")); break; } case ("I"): { cboEstado.Items.Add(new ListItem("Inactiva", "I")); cboEstado.Items.Add(new ListItem("Activa", "A")); break; } } } else { switch (oLINEA.t710_idestado.ToString()) { case ("X"): case ("A"): case ("Y"): { cboEstado.Items.Add(new ListItem("Activa", "A")); break; } case ("B"): { cboEstado.Items.Add(new ListItem("Bloqueada", "B")); break; } case ("I"): { cboEstado.Items.Add(new ListItem("Inactiva", "I")); break; } } } cboEstado.SelectedValue = oLINEA.t710_idestado.ToString(); hdnEstado.Text = cboEstado.SelectedValue; txtModelo.Text = oLINEA.t708_modelo; txtIMEI.Text = oLINEA.t708_IMEI; txtICC.Text = oLINEA.t708_ICC; txtObserva.Text = oLINEA.t708_observa; if (oLINEA.t001_responsable == null) { hdnIdResponsable.Text = "0"; //txtIDResponsable.Text = ""; txtResponsable.Text = ""; } else { hdnIdResponsable.Text = oLINEA.t001_responsable.ToString(); //txtIDResponsable.Text = int.Parse(oLINEA.t001_responsable.ToString()).ToString("##,###,###"); txtResponsable.Text = oLINEA.responsable; } if (oLINEA.t708_tipouso != null) { rdlTipoUso.SelectedValue = oLINEA.t708_tipouso; } if (oLINEA.t001_beneficiario == null) { hdnIdBeneficiario.Text = "0"; //txtIDBeneficiario.Text = ""; txtBeneficiario.Text = ""; } else { hdnIdBeneficiario.Text = oLINEA.t001_beneficiario.ToString(); //txtIDBeneficiario.Text = int.Parse(oLINEA.t001_beneficiario.ToString()).ToString("##,###,###"); txtBeneficiario.Text = oLINEA.beneficiario; } txtDepartamento.Text = oLINEA.t708_departamento; if ((bool)oLINEA.t708_QEQ) { chkQEQ.Checked = true; } else { chkQEQ.Checked = false; } } else { //cboEstado.Items.Add(new ListItem("", "0")); cboEstado.Items.Add(new ListItem("Activa", "A")); //cboProveedor.SelectedValue = "1"; //cboEstado.Items.Add(new ListItem("Preactiva", "X")); //cboEstado.SelectedValue = "A"; //cboEstado.Enabled = false; } if (sLectura == "true") { ModoLectura.Poner(this.Controls); } } catch (Exception ex) { sErrores += Errores.mostrarError("Error al obtener los datos de la línea", ex); } //1º Se indican (por este orden) la función a la que se va a devolver el resultado // y la función que va a acceder al servidor string cbRespuesta = Page.ClientScript.GetCallbackEventReference(this, "arg", "RespuestaCallBack", "context", false); string cbLlamada = "function RealizarCallBack(arg, context)" + "{" + cbRespuesta + ";" + "}"; //2º Se "registra" la función que va a acceder al servidor. Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "RealizarCallBack", cbLlamada, true); } }