コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         CargarComboRedes();
         //Se inicializan campos, datos, valores
         if (Request.QueryString["op"] != null)
         {
             if (Request.QueryString["op"] == "2")
             {
                 if (Request.QueryString["id"] != null)
                 {
                     string ID;
                     if (Request.QueryString["id"].ToString() != string.Empty)
                     {
                         ID = Request.QueryString["id"].ToString();
                         //Obtener los datos y dibujarlos.
                         RR_DatosRedesSociales DatosAux = new RR_DatosRedesSociales {
                             Conexion = Comun.Conexion, IDRedSocial = ID
                         };
                         RR_AdministradorWebNegocio CN = new RR_AdministradorWebNegocio();
                         CN.ObtenerRedesSocXID(DatosAux);
                         if (DatosAux.Completado)
                         {
                             this.CargarDatos(DatosAux);
                         }
                         else
                         {
                             //Ocurrió un error
                             Response.Redirect("frmDatosRedesSocialesGrid.aspx?errorMessage=" + DatosAux.Completado);
                         }
                     }
                     else
                     {
                         Response.Redirect("frmDatosRedesSocialesGrid.aspx?errorMessage=1");
                     }
                 }
                 else
                 {
                     Response.Redirect("frmDatosRedesSocialesGrid.aspx?errorMessage=2");
                 }
             }
             else
             {
                 Response.Redirect("frmDatosRedesSocialesGrid.aspx?errorMessage=3");
             }
         }
         else
         {
             this.IniciarDatos();
         }
     }
     else
     {
         //Page.Validate();
         //if (IsValid)
         //{
         if (Request.Form.Count == 7)
         {
             string Cuenta    = Request.Form["ctl00$cph_MasterBody$txtCuenta"].ToString();
             int    redSocial = Convert.ToInt32(Request.Form["cmbRedSocial"].ToString());
             //int cmbPartido = 0;
             //int.TryParse(Request.Form["cmbPartidos"].ToString(), out cmbPartido);
             int IDColab = 0;
             try
             {
                 string AuxID = Request.Form["ctl00$cph_MasterBody$hf"].ToString();
                 int.TryParse(AuxID, out IDColab);
                 bool NuevoRegistro = (AuxID == "-1");
                 this.Guardar(NuevoRegistro, AuxID, redSocial, Cuenta);
             }
             catch (Exception ex)
             {
                 Response.Redirect("ErrorPage.aspx?msjError=" + ex.Message);
             }
             //}
         }
     }
 }