public void SyncVendorClassification(string SystemCode)
        {
            OCRVVendorService CRVWebService = new OCRVVendorService(OApplicationSetting.Current.CRVVendorServiceURL);
            CRVWebService.Codes = CRVWebService.GetVendorClassificationCodes(SystemCode);
            if (CRVWebService.Codes == null) return;

            OCode Parent = TablesLogic.tCode.Load(TablesLogic.tCode.ObjectName == "VendorClassification" &
                                                  TablesLogic.tCode.CodeType.ObjectName == "VendorRelated");
            OCode CodeType = TablesLogic.tCode.Load(TablesLogic.tCode.CodeType.ObjectName == "VendorClassification");
            if (Parent == null) return;
            for (int i = 0; i < CRVWebService.Codes.Length; i++)
            {
                OCode VendorClassification = TablesLogic.tCode.Load(TablesLogic.tCode.ObjectName == CRVWebService.Codes[i].ObjectName.Trim() &
                                                            TablesLogic.tCode.CodeTypeID == CodeType.ObjectID &
                                                            TablesLogic.tCode.ParentID == Parent.ObjectID);
                if (VendorClassification == null)
                {
                    VendorClassification = TablesLogic.tCode.Create();
                    VendorClassification.ParentID = Parent.ObjectID;
                    VendorClassification.CodeTypeID = CodeType.ObjectID;
                    VendorClassification.ObjectName = CRVWebService.Codes[i].ObjectName.Trim();
                    using (Connection c = new Connection())
                    {
                        VendorClassification.Save();
                        c.Commit();
                    }
                }
            }
        }
        /// <summary>
        /// Executes the service.
        /// </summary>
        public override void OnExecute()
        {
            DateTime ServiceStartTime = System.DateTime.Now;
            int updateCounter = 0;
            int createCounter = 0;
            OCRVVendorService CRVWebService = new OCRVVendorService(OApplicationSetting.Current.CRVVendorServiceURL);

            ArrayList SystemCodes = TablesLogic.tLocation.SelectDistinct(TablesLogic.tLocation.SystemCode)
                .Where(TablesLogic.tLocation.SystemCode != null);
            foreach (string SystemCode in SystemCodes)
            {

                //ArrayList VendorBizRegList = TablesLogic.tVendor.SelectDistinct(TablesLogic.tVendor.CompanyRegistrationNumber)
                //                                .Where(TablesLogic.tVendor.IsDeleted == 0 &
                //                                       TablesLogic.tVendor.IsInActive == 0 & 
                //                                       TablesLogic.tVendor.IsDebarred == 0 &
                //                                       TablesLogic.tVendor.CompanyRegistrationNumber != string.Empty &
                //                                       TablesLogic.tVendor.CompanyRegistrationNumber != null);
                //SubscribedVendors(VendorBizRegList.ToArray(), SystemCode);
                //SyncVendorClassification(SystemCode);//Under-Construction
                //SyncVendorTradeType(SystemCode);//Under-Construction
                string[] OutdatedAndNewVendorList = CRVWebService.GetOutdatedAndNewVendorList(SystemCode);                
                if (OutdatedAndNewVendorList != null)
                    for (int i = 0; i < OutdatedAndNewVendorList.Length; i++)       
                        OVendor.SyncVendorInfo(OutdatedAndNewVendorList[i], SystemCode, ServiceStartTime, ref updateCounter, ref createCounter);                
            }

            LogEvent(String.Format("{0} vendor(s) updated. {1} vendor(s) created.", updateCounter, createCounter), BackgroundLogMessageType.Information);
        }