コード例 #1
0
        private void CreateTowOperators(int tenantId, string CountryCode)
        {
            int CountryID = _countries.FirstOrDefault(x => x.Code == CountryCode).Id;

            string allstatus = "1 TIME TOWING,112 AUTOROADSIDE,A1 ASSIST,AA TOWING,ABOVE TOWING,ABS TOWING,ABSOLUTE TOWING,ACJ TOWING," +
                               "ADNANCED RECOVERIES,AFRICA TOWING,AGT TOWING,ALBERTON TOWING,ALL WAYS TOWING,ALLTOW SERVICES,AM TOWING,ATS TOWING,AUTO ACCIDENT ASSIST," +
                               "AUTO TECH TOWING,AUTOHAUS TOWING,BAPELA TOWING,BEUKES TOWING,BIG D ROADSIDE ASSIST,CAS TOWING,CENTOW TOWING,CLASSIQUE TOWING,DA TOWING," +
                               "DAANTJIES TOWING,DC TOWING,DIVERSE TOWING &LOGISTICS,DOT TOWING,EAGLE TOWING,EASYWAY TOWING,EXCLUSIVE TOWING,EXECUTIVE CARRIERS,EXTREME TOWING," +
                               "FIRST ROAD EMERGENCY,FLEETSIDE TOWING,FREDS AUTOBODY,GLOBAL TOW ASSIST,GLYNMART TOWING,J.J TOWING,JIDZ RECOVERIES,JML TOWING,MAGALIES AUTO CENTRE," +
                               "MAGIC TOWING,METRO ACCIDENT ASSISTANCE,MILLENIUM TOWING,MIRACLE TOWING,MOMOS TOWING,NEWLANDS TOWING,NONE,ON CALL TOWING,OTHER,PJ'S TOWING,SEDS 24 HOUR TOWING," +
                               "SNAP 123 TOWING,SOUTHSIDE TOWING,UNIQUE TOWING";

            string[]    str = allstatus.Split(',');
            TowOperator tow = null;

            for (int i = 0; i < str.Length; i++)
            {
                tow             = new TowOperator();
                tow.Description = str[i];
                tow.isActive    = false;
                tow.CountryID   = CountryID;
                _TowOperator.Insert(tow);
            }
        }
コード例 #2
0
        public void VerifyDefaultData(string countrycode)
        {
            int CountryID = _countries.FirstOrDefault(x => x.Code == countrycode).Id;

            string[] defaults    = new string[] { "OTHER", "NONE" };
            string   defaultlogo = "default-profile-picture.png";

            // Verify Bank
            foreach (var data in defaults)
            {
                var bank = _Banks.FirstOrDefault(c => c.BankName == data && c.CountryID == CountryID);
                // If not exist for current country, then add  banknames "OTHER" and "NONE" to tblbanks with countryid and enable
                if (bank == null)
                {
                    var client = new Banks()
                    {
                        BankName  = data,
                        CountryID = CountryID,
                        isActive  = true
                    };
                    _Banks.Insert(client);
                }
                else // Enable Bank if not
                {
                    bank.isActive = true;
                    _Banks.Update(bank);
                }

                // Verify Insurer

                var insurer = _insurer.FirstOrDefault(c => c.InsurerName == data && c.CountryID == CountryID);
                // If not exist for current country, then add  InsurerName "OTHER" and "NONE" to tblinsurerMaster with countryid and enable
                if (insurer == null)
                {
                    var client = new InsurerMaster()
                    {
                        InsurerName = data,
                        CountryID   = CountryID,
                        LogoPicture = defaultlogo,
                        Mask        = data,
                        IsActive    = true
                    };
                    int Id = _insurer.InsertAndGetId(client);

                    var logo = new InsurerPics()
                    {
                        Bytes     = GetBytes(defaultlogo),
                        InsurerID = Id,
                    };
                    _insurerpic.Insert(logo);
                }
                else // Enable Bank if not
                {
                    insurer.IsActive = true;
                    _insurer.Update(insurer);
                }

                // Verify Broker

                var broker = _broker.FirstOrDefault(c => c.BrokerName == data && c.CountryID == CountryID);
                // If not exist for current country, then add  brokerName "OTHER" and "NONE" to tblBrokerMaster with countryid and enable
                if (broker == null)
                {
                    var client = new BrokerMaster()
                    {
                        BrokerName  = data,
                        CountryID   = CountryID,
                        LogoPicture = defaultlogo,
                        Mask        = data,
                        IsActive    = true
                    };
                    int id = _broker.InsertAndGetId(client);


                    var logobroker = new BrokerMasterPics()
                    {
                        Bytes    = GetBytes(defaultlogo),
                        BrokerID = id
                    };
                    _brokerpic.Insert(logobroker);
                }
                else // Enable Bank if not
                {
                    broker.IsActive = true;
                    _broker.Update(broker);
                }
                //Default Vendors
                var vendor = _vendors.FirstOrDefault(c => c.SupplierName == data && c.CountryID == CountryID);
                // If not exist for current country, then add  SupplierName "OTHER" and "NONE" to tblVendorMain with countryid and enable
                if (vendor == null)
                {
                    var client = new VendorMain()
                    {
                        SupplierCode = Guid.NewGuid(),
                        SupplierName = data,
                        CountryID    = CountryID
                    };
                    _vendors.Insert(client);
                }

                //Default Towoperator
                var tow = _tow.FirstOrDefault(c => c.Description == data && c.CountryID == CountryID);
                // If not exist for current country, then add  Description "OTHER" and "NONE" to tblTowOperator with countryid and enable
                if (tow == null)
                {
                    var client = new TowOperator()
                    {
                        Description = data,
                        CountryID   = CountryID,
                        isActive    = true
                    };
                    _tow.Insert(client);
                }
            }
        }