Esempio n. 1
0
 private void Guardar(bool nuevoRegistro, string id, string nombre, string apPat, string apMat, string puesto, string pagWeb, bool isFb, bool isTw, bool isGoo,
                      bool isInst, bool isPrint, string txtFb, string txtTw, string txtGoo, string txtInst, string txtPrint, string FileName, HttpPostedFile PostedImage, bool BandCambioImagen)
 {
     try
     {
         string BaseDir                 = Server.MapPath("");
         string FileExtension           = BandCambioImagen ? Path.GetExtension(FileName) : string.Empty;
         RR_MiembrosEquipoTrabajo Datos = new RR_MiembrosEquipoTrabajo
         {
             NuevoRegistro   = nuevoRegistro,
             IDMiembroEquipo = id,
             Nombre          = nombre,
             ApePat          = apPat,
             ApeMat          = apMat,
             Puesto          = puesto,
             PagWeb          = pagWeb,
             IsFb            = isFb,
             IsGoo           = isGoo,
             IsInst          = isInst,
             IsTw            = isTw,
             IsPrin          = isPrint,
             Fb               = txtFb,
             Goo              = txtGoo,
             Ins              = txtInst,
             Tw               = txtTw,
             Print            = txtPrint,
             ExtrancionImagen = FileExtension,
             CambiarImagen    = BandCambioImagen,
             UrlImagen        = BaseDir,
             Conexion         = Comun.Conexion,
             IDUsuario        = User.Identity.Name
         };
         RR_AdministradorWebNegocio CN = new RR_AdministradorWebNegocio();
         CN.ACCatalogoMiembrosEquipoTrabajo(Datos);
         Datos.Completado = true;
         if (Datos.Completado)
         {
             if (BandCambioImagen)
             {
                 if (PostedImage != null && PostedImage.ContentLength > 0)
                 {
                     try
                     {
                         Stream S = PostedImage.InputStream;
                         System.Drawing.Image Img = new System.Drawing.Bitmap(S);
                         Img.Save(BaseDir + Datos.UrlImagen);
                         //CN.ImagenSubidaColaboradroXID(Datos);
                     }
                     catch (Exception)
                     {
                     }
                 }
             }
             Response.Redirect("frmMiembrosEquipoTrabajo.aspx", false);
         }
         else
         {
             string ScriptError = DialogMessage.Show(TipoMensaje.Error, "Error al guardar los datos.", "Error", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
             ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }