public void AddDisbursemen_Item(int disbursementID) { List <int> requisitionIDList = new List <int>(); requisitionIDList = EFBroker_Requisition.GetRequisitionIDListbyDisbID(disbursementID); foreach (int rL in requisitionIDList) { List <Requisition_Item> Requisition_ItemList = EFBroker_Requisition.GetRequisitionItemListbyReqID(rL); foreach (Requisition_Item r in Requisition_ItemList) { if (Disbursement_ItemList.Count != 0) { bool add = true; foreach (Disbursement_Item i in Disbursement_ItemList) { if (i.ItemCode == r.ItemCode && i.DisbursementID == r.Requisition.DisbursementID) { add = false; i.TotalRequestedQty += r.RequestedQty; EFBroker_Disbursement.UpdateDisbursementItem(i); } } if (add) { Disbursement_Item dItem1 = CreateDisbursementItemList(disbursementID, r); EFBroker_Disbursement.AddNewDisbursementItem(dItem1); Disbursement_ItemList.Add(dItem1); } } else { Disbursement_Item dItem2 = CreateDisbursementItemList(disbursementID, r); EFBroker_Disbursement.AddNewDisbursementItem(dItem2); Disbursement_ItemList.Add(dItem2); } } } }