public void showVendorDetails()
 {
     Console.WriteLine("------------------------------------------");
     Console.WriteLine("Welcome " + vendor.vendorName + " !!!");
     Console.WriteLine("------------------------------------------");
     Console.WriteLine(VendorFactory.vendorDeatils());
     Console.WriteLine("------------------------------------------");
     Console.ReadLine();
 }
        private void Login()
        {
            Console.WriteLine("----------------------------------------------------------------------------------------------");
            Console.WriteLine("                     Are you an User or a Vendor ? Enter u/v...");
            Console.WriteLine("----------------------------------------------------------------------------------------------");
            char identity = Convert.ToChar(Console.ReadLine());

            if (identity == 'u' || identity == 'U')
            {
                Console.WriteLine("Enter your User Id");
                Console.WriteLine("--------------------------");
                uid = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("--------------------------");
                Console.WriteLine("Enter your Password");
                Console.WriteLine("--------------------------");
                string password = Console.ReadLine();
                bool   res      = UserFactory.UserLogin(uid, password, usr);
                if (res == true)
                {
                    mainUserDisplay();
                }
                else
                {
                    Console.WriteLine("--------------------------");
                    Console.WriteLine("Not Successful Login");
                    Console.WriteLine("--------------------------");
                }
            }
            else if (identity == 'v' || identity == 'V')
            {
                Console.WriteLine("Enter your Vendor Id");
                Console.WriteLine("--------------------------");
                int vendorId = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("--------------------------");
                Console.WriteLine("Enter your Password");
                Console.WriteLine("--------------------------");
                string vendorPassword = Console.ReadLine();
                bool   res            = VendorFactory.VendorLogin(vendorId, vendorPassword, vendor);
                if (res == true)
                {
                    mainVendorDisplay();
                }
                else
                {
                    Console.WriteLine("--------------------------");
                    Console.WriteLine("Not Successful Login");
                    Console.WriteLine("--------------------------");
                }
            }
            else
            {
                Console.WriteLine("---------------------------------------");
                Console.WriteLine("Invalid Input.. Enter either u/v ...");
                Console.WriteLine("---------------------------------------");
            }
        }
        public async Task EditAsync(VendorEditModel model)
        {
            var vendor = await _vendorRepository.GetAsync(model.Id);

            VendorFactory.Create(model, vendor, _userId);

            _vendorRepository.Edit(vendor);

            await _unitOfWork.SaveChangesAsync();
        }
        public async Task <int> AddAsync(VendorAddModel model)
        {
            var vendor = VendorFactory.Create(model, _userId);

            await _vendorRepository.AddAsync(vendor);

            await _unitOfWork.SaveChangesAsync();

            return(vendor.Id);
        }
Beispiel #5
0
        public Vendor()
        {
            VendorFactory theVendorFactory = new VendorFactory();

            _repository = theVendorFactory.createRepository();
            if (_repository == null)
            {
                throw new NotImplementedException();
            }
        }
Beispiel #6
0
        public void Start()
        {
            Console.WriteLine("***************Daily Job Started***************");
            try
            {
                var allvendors = _vendors.GetVendors();
                foreach (var vendor in allvendors)
                {
                    switch (vendor.Name)
                    {
                    case "GrowWatt":
                        Factory = new GrowWattFactory(_graph, _growWatt, _misc);
                        break;

                    case "SunGrow":
                        Factory = new SunGrowFactory(_graph, _sunGrow, _misc);
                        break;

                    case "GoodWee":
                        Factory = new GoodWeeFactory(_graph, _goodWee, _misc);
                        break;
                    }

                    Vendor = Factory.Create();
                    if (vendor.Name == "GrowWatt")
                    {
                        #region Energy Graph Recovery
                        Vendor.GetPlants();
                        Vendor.SaveAPIResponses();
                        //Vendor.SaveEnergyGraph(vendor.Name);
                        //Vendor.CalculateRanking();  // TODO : Refactoring Needed for CalculateRanking, Create New Repo for Ranking and move all misc repo code to Ranking Repo
                        //Vendor.UpdatePlantsStatus();
                        //Vendor.CheckDeviceFaults();
                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
                new FailureAlerts().SendEmail(ex.Data["MethodAndClass"].ToString(), ex.Message);
            }

            Console.WriteLine("***************Daily Job End***************");
        }
 public MovieWrapperBase(string vendorId, IVendorService vendorService = null)
 {
     _vendorId      = vendorId;
     _vendorService = vendorService != null ? vendorService : VendorFactory.GetVendorService(vendorId);
 }
        public void GetVendorService_Should_Return_NotSupportedService_If_Vendor_Not_Support()
        {
            var result = VendorFactory.GetVendorService("NotSupport");

            Assert.IsInstanceOfType(result, typeof(NotSupportedVendorService));
        }
        public void GetVendorService_Should_Return_Instance_Of_Service_Case_Lotte()
        {
            var result = VendorFactory.GetVendorService("Lotte");

            Assert.IsInstanceOfType(result, typeof(LotteVendorService));
        }
        public void GetVendorService_Should_Return_Instance_Of_Service_Case_Galaxy()
        {
            var result = VendorFactory.GetVendorService("Galaxy");

            Assert.IsInstanceOfType(result, typeof(GalaxyVendorService));
        }
        public void GetVendorSupported_Should_Be_Correct()
        {
            var result = VendorFactory.GetVendorSupported();

            Assert.AreEqual(2, result.Count);
        }