public clsTransferCNIC GetTransferCNIC(int TransferID) { clsTransferCNIC image = new clsTransferCNIC(); try { using (SqlConnection conn = new SqlConnection(strConn)) { conn.Open(); using (SqlCommand cmd = new SqlCommand("TMR_USP_GetTransferCNIC")) { 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 AddTransferCNIC(clsTransferCNIC info) { int st = 0; try { using (SqlConnection conn = new SqlConnection(strConn)) { conn.Open(); { using (SqlCommand cmd = new SqlCommand("TMR_USP_AddTransferCNIC")) { 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); } }