public static StationeryCollectionDetails getStationeryCollectionDetails(String disbursementId)
        {
            Disbursement disbursement = getFirstDisbursement(disbursementId);

            String connectionString = "Data Source=.;Initial Catalog=SSIS10;Integrated Security=True";
            var    connection       = new SqlConnection(connectionString);

            connection.Open();
            String query = " SELECT Stationery.Description, DisbursementDetails.QuantityRequested, DisbursementDetails.QuantityReceived, Disbursement.Status, Disbursement.DateCreated, CollectionPoint.LocationName " +
                           " FROM Disbursement INNER JOIN DisbursementDetails ON Disbursement.DisbursementId = DisbursementDetails.DisbursementId " +
                           " INNER JOIN Stationery ON Stationery.ItemCode = DisbursementDetails.ItemCode " +
                           " INNER JOIN Department ON Department.DeptId = Disbursement.DeptId " +
                           " INNER JOIN CollectionPoint ON CollectionPoint.LocationId = Department.LocationId " +
                           " WHERE DisbursementDetails.DisbursementId = " + disbursementId +
                           " ORDER BY DisbursementDetails.DisbursementDetailsId ";
            var command = new SqlCommand(query, connection);
            var reader  = command.ExecuteReader();

            reader.Read();

            StationeryCollectionDetails stationerycollectiondetails = new StationeryCollectionDetails();

            String status          = disbursement.Status;
            String collectionPoint = reader.GetString(5);

            stationerycollectiondetails.Status          = status;
            stationerycollectiondetails.CollectionPoint = collectionPoint;
            stationerycollectiondetails.Date            = (disbursement.DateDisbursed != null) ? ((DateTime)disbursement.DateDisbursed).ToString("dd MMM yyyy") : "";
            connection.Close();

            return(stationerycollectiondetails);
        }
        public static List <StationeryCollectionDetails> getStationeryCollectionDetailsLists(int disbursementId)
        {
            Disbursement disbursement = getFirstDisbursement(disbursementId.ToString());

            List <StationeryCollectionDetails> stationerycollectiondetailsLists = new List <StationeryCollectionDetails>();

            String connectionString = "Data Source=.;Initial Catalog=SSIS10;Integrated Security=True";
            var    connection       = new SqlConnection(connectionString);

            connection.Open();
            String query = " SELECT Stationery.Description, DisbursementDetails.QuantityRequested, DisbursementDetails.QuantityReceived, Disbursement.Status, Disbursement.DateCreated, CollectionPoint.LocationName " +
                           " FROM Disbursement INNER JOIN DisbursementDetails ON Disbursement.DisbursementId = DisbursementDetails.DisbursementId " +
                           " INNER JOIN Stationery ON Stationery.ItemCode = DisbursementDetails.ItemCode " +
                           " INNER JOIN Department ON Department.DeptId = Disbursement.DeptId " +
                           " INNER JOIN CollectionPoint ON CollectionPoint.LocationId = Department.LocationId " +
                           " WHERE DisbursementDetails.DisbursementId = " + disbursementId +
                           " ORDER BY DisbursementDetails.DisbursementDetailsId ";
            var command = new SqlCommand(query, connection);
            var reader  = command.ExecuteReader();

            while (reader.Read())
            {
                StationeryCollectionDetails stationerycollectiondetailsList = new StationeryCollectionDetails();

                String   stationeryDescription = reader.GetString(0);
                int      quantityNeed          = reader.GetInt32(1);
                int      QuantityReceived      = reader.GetInt32(2);
                String   status           = disbursement.Status;
                DateTime requestDate      = reader.GetDateTime(4);
                string   requestDatetring = requestDate.ToString("dd MMM yyyy");
                String   collectionPoint  = reader.GetString(5);

                stationerycollectiondetailsList.StationeryDescription = stationeryDescription;
                stationerycollectiondetailsList.QuantityNeed          = quantityNeed;
                stationerycollectiondetailsList.QuantityDisbursed     = QuantityReceived;
                stationerycollectiondetailsList.Status          = status;
                stationerycollectiondetailsList.RequestDate     = requestDatetring;
                stationerycollectiondetailsList.CollectionPoint = collectionPoint;

                stationerycollectiondetailsLists.Add(stationerycollectiondetailsList);
            }
            connection.Close();

            return(stationerycollectiondetailsLists);
        }