예제 #1
0
        public static void CalculateCredit(String strTableName, Guid ID)
        {
            List <Guid> lstPartnerIDs     = new List <Guid>();
            BusinessObjectController ctrl = BusinessControllerFactory.GetBusinessController(strTableName);

            if (ctrl != null)
            {
                BusinessObject obj = ctrl.GetObjectByID(ID);
                if (obj != null)
                {
                    String strPartnerFKCol = DataStructureProvider.GetForeignKeyOfTableName(strTableName, "MAPartners");
                    if (String.IsNullOrWhiteSpace(strPartnerFKCol) == false)
                    {
                        Guid partnerID = ABCHelper.DataConverter.ConvertToGuid(ABCDynamicInvoker.GetValue(obj, strPartnerFKCol));
                        if (partnerID != Guid.Empty && !lstPartnerIDs.Contains(partnerID))
                        {
                            lstPartnerIDs.Add(partnerID);
                        }
                    }

                    foreach (GEVoucherItemsInfo voucherItem in VoucherProvider.GetConfigItems(strTableName, ""))
                    {
                        strPartnerFKCol = DataStructureProvider.GetForeignKeyOfTableName(voucherItem.ItemTableName, "MAPartners");
                        if (String.IsNullOrWhiteSpace(strPartnerFKCol) == false)
                        {
                            Guid partnerID = ABCHelper.DataConverter.ConvertToGuid(ABCDynamicInvoker.GetValue(obj, strPartnerFKCol));
                            if (partnerID != Guid.Empty && !lstPartnerIDs.Contains(partnerID))
                            {
                                lstPartnerIDs.Add(partnerID);
                            }
                        }
                    }
                }
            }
            foreach (Guid partnerID in lstPartnerIDs)
            {
                CreditProvider.CalculateCredit(partnerID);
            }
        }
예제 #2
0
 public static void DetectAndDoPeriodEnding( )
 {
     InventoryProvider.PeriodEndingProcessings();
     CreditProvider.CalculateCredits();
 }