Ejemplo n.º 1
0
        public static ClaimAttachment GetClaimAttachmentByClaimAttachmentId(int claimAttachmentId)
        {
            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetClaimAttachmentByClaimAttachmentId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@ClaimAttachmentId", DbType.Int32, claimAttachmentId);
            db.AddOutParameter(dbCommand, "@Description", DbType.String, 200);
            db.AddOutParameter(dbCommand, "@Attachment", DbType.String, 1000);
            db.AddOutParameter(dbCommand, "@ClaimId", DbType.Int32, 4);
            db.ExecuteNonQuery(dbCommand);
            ClaimAttachment claimAttachment = new ClaimAttachment();

            claimAttachment.ClaimAttachmentId = claimAttachmentId;
            claimAttachment.Description       = db.GetParameterValue(dbCommand, "Description").ToString();
            claimAttachment.Attachment        = db.GetParameterValue(dbCommand, "Attachment").ToString();
            claimAttachment.ClaimId           = Convert.ToInt32(db.GetParameterValue(dbCommand, "ClaimId"));
            return(claimAttachment);
        }
Ejemplo n.º 2
0
        public static List <ClaimAttachment> GetClaimAttachmentListByClaimId(int claimId)
        {
            List <ClaimAttachment> list = new List <ClaimAttachment>();

            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetClaimAttachmentListByClaimId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@ClaimId", DbType.Int32, claimId);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    ClaimAttachment claimAttachment = new ClaimAttachment();
                    claimAttachment.ClaimAttachmentId = Convert.ToInt32(dataReader["ClaimAttachmentId"]);
                    claimAttachment.Description       = dataReader["Description"].ToString();

                    list.Add(claimAttachment);
                }
            }
            return(list);
        }