public clsTransferImage GetTransferImage(int TransferID) { clsTransferImage image = new clsTransferImage(); try { using (SqlConnection conn = new SqlConnection(strConn)) { conn.Open(); using (SqlCommand cmd = new SqlCommand("TMR_USP_GetTransferImage")) { cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn; //conn.Open(); cmd.Parameters.AddWithValue("@TransferID", TransferID); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { image.ImageId = reader["PictureID"].ToString(); image.Image = (byte[])reader["Picture"]; } conn.Close(); } } } catch (Exception ex) { return(image = null); } return(image); }
public bool AddTransferImage(clsTransferImage info) { int st = 0; try { using (SqlConnection conn = new SqlConnection(strConn)) { conn.Open(); { using (SqlCommand cmd = new SqlCommand("TMR_USP_AddTransferImage")) { cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.AddWithValue("@TransferID", info.TransferID); cmd.Parameters.AddWithValue("@RegistrationNo", info.RegistrationNo); cmd.Parameters.AddWithValue("@ClientID", info.ClientID); cmd.Parameters.AddWithValue("@ImageId", info.ImageId); cmd.Parameters.AddWithValue("@Image", info.Image); st = cmd.ExecuteNonQuery(); } } conn.Close(); } } catch (Exception ex) { } if (st > 0) { return(true); } else { return(false); } }