Exemplo n.º 1
0
  }//public String FilenameSource

  /// <summary>ButtonSubmit_Click().</summary>
  public void ButtonSubmit_Click
  (
   Object sender, 
   EventArgs e
  )
  {

   String                 exceptionMessage       =  null;

   String                 filenameSource         =  null;

   UtilityImageArgument   utilityImageArgument   =  null;
   
   filenameSource  =  FilenameSource;

   /*
   if( sender == ButtonSubmit )
   {
    Response.Write ( "ButtonSubmit" );
    Feedback = "ButtonSubmit";
   }
   */

   utilityImageArgument = new UtilityImageArgument
   (
    filenameSource
   );

   UtilityImage.DatabaseSelect
   (
    ref DatabaseConnectionString,
    ref utilityImageArgument,
    ref exceptionMessage,
    ref HtmlInputFileSource
   );

   Feedback = exceptionMessage;
   
  }//public void ButtonSubmit_Click()
Exemplo n.º 2
0
  }//public static void UtilityContact.ContactDetailSave()   	

  ///<summary>ContactImageUpdate</summary>
  public static void ContactImageUpdate
  (
   ref string      databaseConnectionString,
   ref string      exceptionMessage,
   ref int         sequenceOrderId,
   ref DateTime    dated,   
   ref int         contactId,
   ref byte[]      imageContent,
   ref FileUpload  imageSource,
   ref string      imageType
  )
  {
   int              databaseNumberOfRowsAffected  =  -1;
   string           imageSourcePath               =  null;
   OleDbCommand     oleDbCommand                  =  null;
   OleDbConnection  oleDbConnection               =  null;
   OleDbParameter   oleDbParameter                =  null;
   try
   {
    if ( imageSource.HasFile == false ) { return; }
    imageSourcePath  =  imageSource.PostedFile.FileName;    
    UtilityImage.FileUploadByte
    (
     ref imageSource,
     ref imageContent,
     ref exceptionMessage
    );
    if ( exceptionMessage != null ) { return; }
    oleDbConnection  =  UtilityDatabase.DatabaseConnectionInitialize
    (
         databaseConnectionString,
     ref exceptionMessage
    );
	if ( exceptionMessage != null ) { return; }
	oleDbCommand                  =  new OleDbCommand( "uspContactImageUpdate", oleDbConnection );
    if ( oleDbCommand == null ) { return; }
    oleDbCommand.CommandType      =  CommandType.StoredProcedure;
    oleDbParameter                =  new OleDbParameter( "@sequenceOrderId", OleDbType.Integer );
    if ( sequenceOrderId > 0 )
    {
     oleDbParameter.Value         =  sequenceOrderId;
    }
    else
    {
     oleDbParameter.Value         =  DBNull.Value;
    } 
    oleDbCommand.Parameters.Add( oleDbParameter );
    
    oleDbParameter                =  new OleDbParameter( "@dated", OleDbType.Date );
    if ( dated > DateTime.MinValue )
    {
     oleDbParameter.Value          =  dated;
    }
    else
    {
     oleDbParameter.Value         =  DBNull.Value;
    } 
    oleDbCommand.Parameters.Add( oleDbParameter );

    oleDbParameter                =  new OleDbParameter( "@contactId", OleDbType.Integer );
    if ( contactId > 0 )
    {
     oleDbParameter.Value         =  contactId;
    }
    else
    {
     oleDbParameter.Value         =  DBNull.Value;
    } 
    oleDbCommand.Parameters.Add( oleDbParameter );

    oleDbParameter                =  new OleDbParameter( "@imageContent", OleDbType.Binary );
    oleDbParameter.Value          =  imageContent;
    oleDbCommand.Parameters.Add( oleDbParameter );

    oleDbParameter                =  new OleDbParameter( "@ImageSource", OleDbType.VarChar, 255 );
    oleDbParameter.Value          =  imageSourcePath;
    oleDbCommand.Parameters.Add( oleDbParameter );

    oleDbParameter                =  new OleDbParameter( "@imageType", OleDbType.VarChar, 255 );
    oleDbParameter.Value          =  imageType;
    oleDbCommand.Parameters.Add( oleDbParameter );
    
    databaseNumberOfRowsAffected  =  oleDbCommand.ExecuteNonQuery();
   }//try
   catch ( Exception exception ) { UtilityException.ExceptionLog( exception, exception.GetType().Name, ref exceptionMessage ); }
  }