public async Task <IActionResult> Update(int?id, Explore explore)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Explore exploreDb = await _db.Explores.FindAsync(id);

            if (exploreDb == null)
            {
                return(NotFound());
            }

            if (exploreDb.ChooseCategory.ToLower() != explore.ChooseCategory.ToLower())
            {
                bool isExist = _db.Explores.Any(e => e.ChooseCategory.ToLower() == explore.ChooseCategory.ToLower());
                if (isExist)
                {
                    ModelState.AddModelError("ChooseCategory", "Bu adda bashliq var");
                    return(View());
                }
            }
            exploreDb.ChooseCategory = explore.ChooseCategory;
            exploreDb.CategoryTitle  = explore.CategoryTitle;
            await _db.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Example #2
0
        private void initObjectModels()
        {
            // initializing footer objects
            terms         = new Terms(browser);
            privacy       = new Privacy(browser);
            security      = new Security(browser);
            status        = new Status(browser);
            help          = new Help(browser);
            footerLogo    = new pageObjectModels.footer.Logo(browser);
            contactGitHub = new ContactGitHub(browser);
            api           = new API(browser);
            training      = new Training(browser);
            shop          = new Shop(browser);
            footerBlog    = new pageObjectModels.footer.Blog(browser);
            about         = new About(browser);

            // initializing explore objects
            integrations = new Integrations(browser);
            showcases    = new Showcases(browser);
            trending     = new Trending(browser);

            // initializing header objects
            headerLogo = new pageObjectModels.header.Logo(browser);
            personal   = new Personal(browser);
            openSource = new OpenSource(browser);
            business   = new Business(browser);
            explore    = new Explore(browser);
            pricing    = new Pricing(browser);
            headerBlog = new pageObjectModels.header.Blog(browser);
            support    = new Support(browser);
            searchBar  = new pageObjectModels.header.SearchBar(browser);
            signIn     = new SignIn(browser);
            signUp     = new SignUp(browser);

            // initializing main objects
            signUpUsername  = new SignUpUsername(browser);
            signUpEmail     = new SignUpEmail(browser);
            signUpPassword  = new SignUpPassword(browser);
            signUpSubmit    = new SignUpSubmit(browser);
            signUpForGitHub = new SignUpForGitHubButton(browser);

            // initializing pricing objects
            joinGitHubForFree    = new JoinGitHubForFree(browser);
            upgradeAccount       = new UpgradeAccount(browser);
            createOrganization   = new CreateOrganization(browser);
            startEnterpriseTrial = new StartEnterpriseTrial(browser);

            // initializing blog objects
            featured      = new Featured(browser);
            allPosts      = new AllPosts(browser);
            newFeatures   = new NewFeatures(browser);
            engineering   = new Engineering(browser);
            enterprise    = new Enterprise(browser);
            conferences   = new Conferences(browser);
            meetups       = new Meetups(browser);
            newHires      = new NewHires(browser);
            watercooler   = new Watercooler(browser);
            blogSearchBar = new pageObjectModels.blog.SearchBar(browser);
        }
Example #3
0
 public static void Event4(Dungeon d, Creature p, Event e)
 {
     Console.Clear();
     Console.WriteLine("You find yourself in a hallway, connecting the kitchens to the rest of the castle\nThis area is run by The Cook.\nBe careful, those who run afoul of him often end up in his stew");
     Explore.currentShell.encountered = true;
     Utilities.Keypress();
     Explore.GameDungeon(d, p);
 }
Example #4
0
 public static void Event3(Dungeon d, Creature p, Event e)
 {
     Console.Clear();
     Console.WriteLine("You find yourself in a hallway, connecting the servant's quarters to the rest of the castle\nSomewhere in there is Cecil, the head butler.\nPerhaps he will have the key you need to access the owner's private quarters?");
     Explore.currentShell.encountered = true;
     Utilities.Keypress();
     Explore.GameDungeon(d, p);
 }
Example #5
0
        public async Task Logout()
        {
            await dispatcher.Cleanup();

            await Explore.Cleanup();

            await Auth.Logout();
        }
Example #6
0
 public void Init()
 {
     check   = new Check();
     photo   = new PhotoPage();
     explore = new Explore();
     author  = new Author();
     alboms  = new Alboms();
 }
Example #7
0
 public static void Event1(Dungeon d, Creature p, Event e)
 {
     Console.Clear();
     Console.WriteLine(e.flavor);
     Event.TFRescued = true;
     Explore.currentShell.encountered = true;
     Utilities.Keypress();
     Explore.GameDungeon(d, p);
 }
Example #8
0
        public static bool Run()
        {
            if (IsNetConnected)
            {
                Console.WriteLine(@"Connected!");
                return(true);
            }
            IWebDriver driver = null;

            if (Explore.ToLower() == "chrome")
            {
                driver = new ChromeDriver();
            }
            else
            {
                driver = new InternetExplorerDriver();
            }

            //Notice navigation is slightly different than the Java version
            //This is because 'get' is a keyword in C#

            driver.Navigate().GoToUrl(StartUrl);
            try
            {
                IWebElement name  = driver.FindElement(By.Id("un-userName"));
                IWebElement pwd   = driver.FindElement(By.Id("un-password"));
                IWebElement login = driver.FindElement(By.Id("un-login"));

                IWebElement revisit = driver.FindElement(By.Id("freeCertification"));

                if (revisit.Displayed)
                {
                    revisit.Click();
                }
                else
                {
                    name.SendKeys(UserName);
                    pwd.SendKeys(Password);

                    login.Click();//.SendKeys("Cheese");
                }
                System.Threading.Thread.Sleep(10000);
                //if (revisit.Displayed)
                //{
                //    revisit.Click();
                //}
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            var connected = IsNetConnected;

            Console.WriteLine($"IsNetConnected:{connected}");
            driver.Quit();
            return(connected);
        }
Example #9
0
 public void Init()
 {
     check   = new Check();
     photo   = new PhotoPage();
     explore = new Explore();
     Browser.Navigate().GoToUrl("https://www.flickr.com/explore");
     Browser.FindElement(By.CssSelector("a.overlay")).Click();
     Wait.Until(ExpectedConditions.ElementToBeClickable(explore.Photo[0]));
 }
Example #10
0
        //Populate the script lists here.  Follow the example on how to add to a list
        #region Populate Lists
        /// <summary>
        /// Use this method to populate the lists.  They are already set to be selected from the
        /// CycleScripts method and no other work is required.
        /// </summary>
        public override void PopulateLists()
        {
            SignIn.Clear();
            AccountCreation.Clear();
            Activities.Clear();
            ActivityDetail.Clear();
            Workouts.Clear();
            Courses.Clear();
            Dashboard.Clear();
            Navigation.Clear();
            Explore.Clear();
            Reports.Clear();
            Health.Clear();
            Goals.Clear();
            Upload.Clear();
            Settings.Clear();
            CheckFirmware.Clear();
            ManualActivity.Clear();
            Troubleshoot.Clear();
            base.PopulateLists();
            //MyCategory.Add(new TestCase(base.baseURL, base.webdriver, base.verificationErrors));
            SignIn.Add(new Connect_SignIn(base.baseURL, base.webdriver, base.verificationErrors));
            SignIn.Add(new Connect_SignInValidation(base.baseURL, base.webdriver, base.verificationErrors));

            Settings.Add(new Connect_MeasurementSettings(base.baseURL, base.webdriver, base.verificationErrors));
            Navigation.Add(new Connect_GeneralNavigation(base.baseURL, base.webdriver, base.verificationErrors));
            Navigation.Add(new Connect_Navigation_Unauthenticated(base.baseURL, base.webdriver, base.verificationErrors));
            Upload.Add(new Connect_UploadFile(base.baseURL, base.webdriver, base.verificationErrors));
            Activities.Add(new Connect_ActivitiesSort(base.baseURL, base.webdriver, base.verificationErrors));
            ActivityDetail.Add(new Connect_ActivityDetail_Validation(base.baseURL, base.webdriver, base.verificationErrors));
            //CheckFirmware.Add(new Connect_CheckFirmware_Edge800(base.baseURL, base.webdriver, base.verificationErrors));  // Jira opened
            CheckFirmware.Add(new Connect_CheckFirmware_Edge705(base.baseURL, base.webdriver, base.verificationErrors));
            CheckFirmware.Add(new Connect_CheckFirmware_Edge605(base.baseURL, base.webdriver, base.verificationErrors));
            CheckFirmware.Add(new Connect_CheckFirmware_FR60(base.baseURL, base.webdriver, base.verificationErrors));
            CheckFirmware.Add(new Connect_CheckFirmware_FR405CX(base.baseURL, base.webdriver, base.verificationErrors));
            CheckFirmware.Add(new Connect_CheckFirmware_Edge305(base.baseURL, base.webdriver, base.verificationErrors));
            CheckFirmware.Add(new Connect_CheckFirmware_FR201(base.baseURL, base.webdriver, base.verificationErrors));
            //CheckFirmware.Add(new Connect_CheckFirmware_FR210(base.baseURL, base.webdriver, base.verificationErrors)); //Test Failing
            CheckFirmware.Add(new Connect_CheckFirmware_Edge500(base.baseURL, base.webdriver, base.verificationErrors));
            //CheckFirmware.Add(new Connect_CheckFirmware_FR110(base.baseURL, base.webdriver, base.verificationErrors));  //Test Failing
            //CheckFirmware.Add(new Connect_CheckFirmware_FR910(base.baseURL, base.webdriver, base.verificationErrors));
            CheckFirmware.Add(new Connect_CheckFirmware_FR610(base.baseURL, base.webdriver, base.verificationErrors));
            Dashboard.Add(new Connect_Dashboard_CreateGoal(base.baseURL, base.webdriver, base.verificationErrors));
            Dashboard.Add(new Connect_Dashboard_NoGoal(base.baseURL, base.webdriver, base.verificationErrors));
            Dashboard.Add(new Connect_Dashboard_PercentComplete(base.baseURL, base.webdriver, base.verificationErrors));
            Dashboard.Add(new Connect_Dashboard_NoUploads(base.baseURL, base.webdriver, base.verificationErrors));
            Dashboard.Add(new Connect_Dashboard_FiveItems(base.baseURL, base.webdriver, base.verificationErrors));
            Dashboard.Add(new Connect_Dashboard_ActivityNameTabs(base.baseURL, base.webdriver, base.verificationErrors));
            Dashboard.Add(new Connect_Dashboard_ActivityType(base.baseURL, base.webdriver, base.verificationErrors));
            //Dashboard.Add(new Connect_Dashboard_FiveItems(base.baseURL, base.webdriver, base.verificationErrors)); //jira 10209
            ManualActivity.Add(new Connect_ManualActivity_NameCharLimit(base.baseURL, base.webdriver, base.verificationErrors));
            ManualActivity.Add(new Connect_ManualActivity_NoName(base.baseURL, base.webdriver, base.verificationErrors));
            ManualActivity.Add(new Connect_ManualActivity_ActivityType(base.baseURL, base.webdriver, base.verificationErrors));
            ManualActivity.Add(new Connect_ManualActivity_DescriptionLimit(base.baseURL, base.webdriver, base.verificationErrors)); //Related to Jira 10309
            ManualActivity.Add(new Connect_ManualActivity_PaceCalc(base.baseURL, base.webdriver, base.verificationErrors));
        }
Example #11
0
 public override void FillInformation(out string info, out string detailed)  //V
 {
     info = BaseUtils.FieldBuilder.Build("Combat:", Combat.HasValue ? Combat.ToString() : null,
                                         "Trade:", Trade.HasValue ? Trade.ToString() : null,
                                         "Exploration:", Explore.HasValue ? Explore.ToString() : null,
                                         "Empire:", Empire.HasValue ? Empire.ToString() : null,
                                         "Federation:", Federation.HasValue ? Federation.ToString() : null,
                                         "CQC:", CQC.HasValue ? CQC.ToString() : null);
     detailed = "";
 }
 public override void FillInformation(out string info, out string detailed) //V
 {
     info = BaseUtils.FieldBuilder.Build("", Combat.ToString().SplitCapsWord(),
                                         "", Trade.ToString().SplitCapsWord(),
                                         "", Explore.ToString().SplitCapsWord(),
                                         "", Federation.ToString().SplitCapsWord(),
                                         "", Empire.ToString().SplitCapsWord(),
                                         "", CQC.ToString().SplitCapsWord());
     detailed = "";
 }
Example #13
0
 public override void FillInformation(out string summary, out string info, out string detailed)  //V
 {
     summary = EventTypeStr.SplitCapsWord();
     info    = Tools.FieldBuilder("Combat:", Combat.HasValue ? Combat.ToString() : null,
                                  "Trade:", Trade.HasValue ? Trade.ToString() : null,
                                  "Exploration:", Explore.HasValue ? Explore.ToString() : null,
                                  "Empire:", Empire.HasValue ? Empire.ToString() : null,
                                  "Federation:", Federation.HasValue ? Federation.ToString() : null,
                                  "CQC:", CQC.HasValue ? CQC.ToString() : null);
     detailed = "";
 }
Example #14
0
 public override void FillInformation(out string summary, out string info, out string detailed) //V
 {
     summary = EventTypeStr.SplitCapsWord();
     info    = Tools.FieldBuilder("", Combat.ToString().SplitCapsWord(),
                                  "", Trade.ToString().SplitCapsWord(),
                                  "", Explore.ToString().SplitCapsWord(),
                                  "", Federation.ToString().SplitCapsWord(),
                                  "", Empire.ToString().SplitCapsWord(),
                                  "", CQC.ToString().SplitCapsWord());
     detailed = "";
 }
 public override void FillInformation(ISystem sys, out string info, out string detailed)
 {
     info = BaseUtils.FieldBuilder.Build("", Combat.ToString().SplitCapsWord(),
                                         "", Trade.ToString().SplitCapsWord(),
                                         "", Explore.ToString().SplitCapsWord(),
                                         "", SoldierRank.ToString().SplitCapsWord(),
                                         "", ExoBiologistRank.ToString().SplitCapsWord(),
                                         "", Federation.ToString().SplitCapsWord(),
                                         "", Empire.ToString().SplitCapsWord(),
                                         "", CQC.ToString().SplitCapsWord());
     detailed = "";
 }
Example #16
0
        private async Task <List <MyNode> > ProcessNode(MyNode node)
        {
            var areas = Split(node.Report.Area);

            var requestedReport = await _client.ExploreAsync(areas[0]);

            var generatedReport = new Explore()
            {
                Area   = areas[1],
                Amount = node.Report.Amount - requestedReport.Amount
            };

            List <MyNode> cells    = new List <MyNode>();
            List <MyNode> newNodes = new List <MyNode>();
            var           n1       = new MyNode()
            {
                Report = requestedReport
            };
            var n2 = new MyNode()
            {
                Report = generatedReport
            };

            if (!n1.IsEmpty())
            {
                if (n1.IsCell())
                {
                    cells.Add(n1);
                }
                else
                {
                    newNodes.Add(n1);
                }
            }

            if (!n2.IsEmpty())
            {
                if (n2.IsCell())
                {
                    cells.Add(n2);
                }
                else
                {
                    newNodes.Add(n2);
                }
            }

            var newCells = await Task.WhenAll(newNodes.Select(ProcessNode));

            cells.AddRange(newCells.SelectMany(x => x));

            return(cells);
        }
Example #17
0
 private void View_archive_Click(object sender, EventArgs e)
 {
     try
     {
         Explore show = new Explore();
         show.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error" + ex.Message);
     }
 }
Example #18
0
 public static void Event1(Dungeon d, Creature p, Event e)
 {
     Console.Clear();
     Console.WriteLine("You see several townsfolk huddling for warmth, obviously scared.\nOne comes up to you to speak\n\n" + Colour.SPEAK + "'Thank god you're here! We'd given up all hope!" +
                       "\nUntie us and we will reward you handomely when we get back!'\n\n" + Colour.RESET + "You untie them and point the way out.\n" +
                       "Be sure to meet them in the tavern afterwards to claim your reward.\n\nThat is.... if you live");
     Event.TFRescued = true;
     RescueName      = Family.FamilyFirstNames[0];
     Explore.currentShell.encountered = true;
     Utilities.Keypress();
     Explore.GameDungeon(d, p);
 }
Example #19
0
 public void Init()
 {
     explore = new Explore();
     photo   = new PhotoPage();
     alboms  = new Alboms();
     check   = new Check();
     Browser.Navigate().GoToUrl("https://www.flickr.com/explore");
     Browser.FindElement(By.CssSelector("a.overlay")).Click();
     Wait.Until(ExpectedConditions.ElementToBeClickable(explore.Photo[0]));
     photo.Author.Click();
     alboms.GoAlbom.Click();
     System.Threading.Thread.Sleep(5000);
 }
        public async Task <IActionResult> Update(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            Explore explore = await _db.Explores.FindAsync(id);

            if (explore == null)
            {
                return(NotFound());
            }
            return(View(explore));
        }
Example #21
0
    public static void FightReward(Dungeon d, Creature p)
    {
        Utilities.Keypress();
        Console.Clear();
        int    goldroll = Utilities.rand.Next(-2, 6);
        int    xproll   = Utilities.rand.Next(-1, 3);
        double goldAdd  = (Combat.GoldReward + (goldroll * d.tier)) * d.diminishingReturns;
        int    gold     = Convert.ToInt32(goldAdd);
        double xpAdd    = Combat.XPReward + (xproll * d.tier) * d.diminishingReturns;
        int    xp       = Convert.ToInt32(xpAdd);

        Console.WriteLine("You have defeated your enemies\n");
        Console.WriteLine($"You find {gold} gold");
        p.gold += gold;
        Console.WriteLine($"You gain {xp} experience");
        p.xp += xp;
        if (p.xp >= LevelMaster.xpRequired[p.level])
        {
            Utilities.ColourText(Colour.XP, "YOU ARE ELIGIBLE FOR A LEVEL RAISE\n");
        }
        //Get the drops on the drop list
        for (int i = 0; i < Combat.DropList.Count; i++)
        {
            //If you already have it, increase the amount. Otherwise, add it to the list
            Console.WriteLine($"You find a {Combat.DropList[i].name}");
            bool exists = false;
            for (int x = 0; x < p.Drops.Count; x++)
            {
                if (p.Drops[x] == Combat.DropList[i])
                {
                    p.Drops[x].amount++;
                    exists = true;
                    break;
                }
            }
            if (exists == false)
            {
                p.Drops.Add(Combat.DropList[i]);
            }
        }
        Utilities.Keypress();
        Explore.currentShell.encountered = true;
        if (Combat.bossFight)
        {
            BossReward(d, p);
        }
        Explore.GameDungeon(d, p);
    }
Example #22
0
    public static void RoomSearch(Room room, Dungeon d, Creature p)
    {
        Console.Clear();
        //Search or move on. Search can get stuff but risks a fight if you didn't have one yet.
        Console.WriteLine("You appear to be alone... for now");
        Console.WriteLine("You can either [S]earch the room or [M]ove on");
        Console.WriteLine("\nWhat would you like to do?");
        string choice = Console.ReadKey(true).KeyChar.ToString().ToLower();

        if (choice == "m")
        {
            Explore.currentShell.encountered = true;
            Explore.GameDungeon(d, p);
        }

        if (choice == "s")
        {
            //Make a list for events, only add if successful
            EventDisplay = new List <Event> {
            };
            Console.Clear();
            Console.Write("You find");
            Utilities.DotDotDotSL();
            Console.Write(" ");
            for (int i = 0; i < room.EventArray.Length; i++)
            {
                //if successful, add event to list
                int EventSuccessRoll = Utilities.rand.Next(1, 101);
                if (EventSuccessRoll <= room.EventArray[i].success)
                {
                    EventDisplay.Add(room.EventArray[i]);
                }
            }
            //Tell us what we won!
            string a = (EventDisplay.Count == 3) ? $"{EventDisplay[0].flavor},{EventDisplay[1].flavor} and {EventDisplay[2].flavor}" : (EventDisplay.Count == 2) ? $"{EventDisplay[0].flavor} and {EventDisplay[1].flavor}" : (EventDisplay.Count == 1) ? $"{EventDisplay[0].flavor}" : "Nothing!";
            Console.WriteLine(a);
            Console.WriteLine("");
            // Now give it to me!
            Reward.RoomSearch(room, d, p, EventDisplay, d.tier);
            Utilities.Keypress();
        }
        else
        {
            RoomSearch(room, d, p);
        }
    }
Example #23
0
        static void Main(string[] args)
        {
            List<RealAxis> R = new List<RealAxis>();
            List<DiscreteAxis> D = new List<DiscreteAxis>();
            List<BinaryAxis> B = new List<BinaryAxis>();
            for(int i = 0; i < 3; i++)
            {
                R.Add(new RealAxis(-32.768, 32.768));
            }
            Space S = new Space(R, D, B);

            Map<Space, Individual, double> M = new Map<Space, Individual, double>(S, false, 0.5, ME2Functions.RandomIndividual,
                MapFunctions.MapNeighbors, ME2Functions.Ackley, ME2Functions.ApplyFitness, ME2Functions.RouletteSelection);

            Individual Best = M.MappedSpace.ElementAt(0);
            foreach(Individual potentialBest in M.MappedSpace)
            {
                if (potentialBest.Fitness > Best.Fitness)
                    Best = potentialBest;
            }
            Console.WriteLine(Best);

            Explore<Space, Individual, double> E1 = new Explore<Space, Individual, double>(S, false, M.MappedSpace, ExploitFunctions.ExploitNeighbors,
                    ME2Functions.NormalMutate, ME2Functions.Ackley, ME2Functions.ApplyFitness, ExploreFunctions.ApplyExplorePOM, ExploreFunctions.ExploreTP,
                    ME2Functions.TotalFitness, 100);

            Best = E1.Optimized.ElementAt(0);
            foreach (Individual potentialBest in E1.Optimized)
            {
                if (potentialBest.Fitness > Best.Fitness)
                    Best = potentialBest;
            }
            Console.WriteLine(Best);

            Exploit<Space, Individual, double> E2 = new Exploit<Space, Individual, double>(S, false, E1.Optimized, ExploitFunctions.ExploitNeighbors,
                    ME2Functions.NormalMutate, ME2Functions.Ackley, ME2Functions.ApplyFitness, ExploitFunctions.ApplyExploitPOM, ExploitFunctions.ExploitTP,
                    ME2Functions.TotalFitness, 100);

            Best = E2.Optimized.First();
            foreach (Individual potentialBest in E2.Optimized)
            {
                if (potentialBest.Fitness > Best.Fitness)
                    Best = potentialBest;
            }
            Console.WriteLine(Best);
        }
        public async Task <IActionResult> DeletePost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            Explore explore = await _db.Explores.FindAsync(id);

            if (explore == null)
            {
                return(NotFound());
            }
            _db.Explores.Remove(explore);
            await _db.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
        public IActionResult Create(Explore explore)
        {
            if (!ModelState.IsValid)
            {
                return(View(explore));
            }

            return(Content(explore.CategoryTitle + " " + explore.ChooseCategory));


            //bool isExist = _db.Explores.Any(e => e.ChooseCategory.ToLower() == explore.ChooseCategory.ToLower());
            //if (isExist)
            //{
            //    ModelState.AddModelError("ChooseCategory", "Bu adda bashliq var");
            //    return View();
            //}
            //await _db.Explores.AddAsync(explore);
            //await _db.SaveChangesAsync();
            //return RedirectToAction(nameof(Index));
        }
Example #26
0
    private void initExploring()
    {
        Explore explore         = new Explore();
        Explore mountainExplore = new Explore();

        exploreActions = new Queue <Explore>();
        //TODO a mountain climbing explore

        exploreActions.Enqueue(explore);
        exploreActions.Enqueue(mountainExplore);

        //Post conditions are that it will have a path to a resource
        //in the code we do NOT change the state based on these conditions
        //this is only for the planner to know the benefits of exploring
        explore.addPostCond(State.hasPathToWood, true);
        explore.addPostCond(State.hasPathToGrass, true);
        explore.addPostCond(State.hasPathToStone, true);
        explore.addPostCond(State.needsBridge, true);

        mountainExplore.addPreCond(State.hasMtnKit, true);
        mountainExplore.addPostCond(State.hasPathToWind, true);
    }
Example #27
0
        static void Main(string[] args)
        {
            var heroes = new List <Human>()
            {
                new Ninja(),
                new Samurai(),
                new Wizard()
            };

            ILocation location = new Lobby();

            System.Console.WriteLine("You have arrived at the Doding Cojo!");
            System.Console.WriteLine("Welcome and watch your step!");
            System.Console.WriteLine();

            while (heroes.Exists(x => x.Health > 0) ||
                   location.NextLocations.Count == 0 && location.Enemies.Count == 0)
            {
                var ex = new Explore(location);

                if (location.Enemies.Count > 0)
                {
                    System.Console.WriteLine();
                    var e = new Encounter(heroes, location.Enemies);
                    e.Battle();
                }

                if (location.NextLocations.Count == 0)
                {
                    break;
                }

                location = ex.Move();
            }

            // System.Console.WriteLine("Game Over...");
            System.Console.WriteLine("To be continued...");
        }
Example #28
0
 public static void RegularRoom(Dungeon d, Creature p, Shell currentShell)
 {
     //Check for monsters
     Monster.Summon(currentShell.assignedRoom, d, p);
     //Get a chance to explore
     RoomSearch(currentShell.assignedRoom, d, p);
     //If you chose not to explore it's back to main dungeon screen, this second chance at baddies is risk for searching
     //You may have been heard
     Console.Clear();
     Console.Write("You hear shuffling in the distance, were you heard?");
     Utilities.DotDotDot();
     Monster.Summon(currentShell.assignedRoom, d, p);
     if (d.monsterSummon > 50)
     {
         Console.WriteLine("Phew! You got luckey!");
     }
     else
     {
         Console.WriteLine("No one came to investigate.\nNot surprising, the dungeon seems pretty empty");
     }
     Utilities.Keypress();
     Explore.currentShell.encountered = true;
     Explore.GameDungeon(d, p);
 }
Example #29
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            Explore explore = _db.Explores.FirstOrDefault();

            return(View(await Task.FromResult(explore)));
        }
Example #30
0
    public static void Event2(Dungeon d, Creature p, Event e)
    {
        Console.Clear();
        bool key = false;

        for (int i = 0; i < p.Drops.Count; i++)
        {
            if (p.Drops[i].name == "Chest Key" && p.Drops[i].amount > 0)
            {
                key = true;
            }
        }
        Console.WriteLine(e.flavor);
        Utilities.EmbedColourText(Colour.DAMAGE, "You could ", "bash", " the lock, but risk destroying the contents");
        Utilities.EmbedColourText(Colour.ABILITY, "You could", " pick", " the lock, but in the time it takes, more monsters may find you");
        Utilities.EmbedColourText(Colour.NAME, "If only you had a", " key", "!\n\n");
        Utilities.EmbedColourText(Colour.DAMAGE, Colour.ABILITY, Colour.NAME, "", "[B]", "ash the lock        ", "[P]", "ick the lock             ", "[K]", "ey            [R]eturn");
        string choice = Console.ReadKey(true).KeyChar.ToString().ToLower();

        if (choice == "b")
        {
            Console.Clear();
            Utilities.ColourText(Colour.DAMAGE, "BLAM!");
            Utilities.DotDotDot();
            Console.WriteLine("\n\n\n\n\n\n\n");
            int bashRoll = Utilities.rand.Next(1, 101);
            if (bashRoll <= e.success + e.effect)
            {
                Console.WriteLine("Success!\n\n");
                Thread.Sleep(300);
                Reward.TreasureLootTable(d.tier, p);
                Utilities.Keypress();
            }
            else
            {
                Console.WriteLine("Failure!");
                Thread.Sleep(300);
                Console.WriteLine("It looks like the valuables inside were fragile indeed. Oh well, maybe next time");
                Utilities.Keypress();
            }
        }
        else if (choice == "p")
        {
            Console.Clear();
            Utilities.ColourText(Colour.ABILITY, "CHICK CHICK!");
            Utilities.DotDotDot();
            Console.WriteLine("\n\n\n\n\n\n\n");
            int pickRoll = Utilities.rand.Next(1, 101);
            if (pickRoll <= e.success)
            {
                Console.WriteLine("Success!\n\n");
                Thread.Sleep(300);
                Reward.TreasureLootTable(d.tier, p);
                Utilities.Keypress();
            }
            else if (pickRoll > e.success && pickRoll <= e.success + e.effect)
            {
                Console.WriteLine("You got in!\n\n");
                Thread.Sleep(300);
                Reward.TreasureLootTable(d.tier, p);
                Utilities.Keypress();
                Console.WriteLine("\nThat took a while though, it looks like someone found you!");
                p.force = true;
                Utilities.Keypress();
                Console.Clear();
                Monster.Summon(Room.StarterSpecialRoomList[2], d, p);
            }
            else
            {
                Console.WriteLine("Failure!");
                Thread.Sleep(300);
                Console.WriteLine("Not only could you not get in, you took so long that someone found you!");
                p.force = true;
                Utilities.Keypress();
                Console.Clear();
                Monster.Summon(Room.StarterSpecialRoomList[2], d, p);
            }
        }
        else if (choice == "k" && key == true)
        {
            Console.Clear();
            Utilities.ColourText(Colour.NAME, "CLICK!");
            Utilities.DotDotDot();
            Console.WriteLine("\n\n\n\n\n\n\n");
            Console.WriteLine("Success!\n\n");
            Thread.Sleep(300);
            Console.WriteLine("Inside you find a bunch of treasure, to be described later!");
            Utilities.Keypress();
        }
        else if (choice == "k" && key == false)
        {
            Utilities.EmbedColourText(Colour.NAME, "\n\nYou don't have a ", "key", "!");
            Utilities.Keypress();
            Event1(d, p, e);
        }
        else if (choice == "r")
        {
            Explore.currentShell.encountered = true;
            Explore.GameDungeon(d, p);
        }
        else if (choice == "x")
        {
            p.Drops.Add(new Drop("Chest Key", 1, 100, 1));
            Event1(d, p, e);
        }
        else
        {
            Event1(d, p, e);
        }
        Explore.currentShell.encountered = true;
        Explore.GameDungeon(d, p);
    }
Example #31
0
    public static void Event3(Dungeon d, Creature p, Event e)
    {
        Console.Clear();
        Console.WriteLine(e.flavor);
        Utilities.EmbedColourText(Colour.ENERGY, "You could ", "study ", "the runes, trying to learn the secrets of the Orc gods");
        Utilities.EmbedColourText(Colour.DAMAGE, "You could ", "desecrate ", "the runes, angering the orcs but possibly interrupting their power source");
        Utilities.EmbedColourText(Colour.MITIGATION, "You could ", "walk away, ", "moving on to the next room\n\n");
        Utilities.EmbedColourText(Colour.ENERGY, Colour.DAMAGE, Colour.MITIGATION, "", "[S]", "tudy        ", "[D]", "esecrate             ", "[W]", "alk away\n\n");
        string choice = Console.ReadKey(true).KeyChar.ToString().ToLower();

        if (choice == "s")
        {
            Console.Clear();
            Utilities.ColourText(Colour.ENERGY, "Studying");
            Utilities.DotDotDot();
            Console.WriteLine("\n\n\n\n\n\n\n");
            int roll = Utilities.rand.Next(1, 101);
            if (roll <= 75)
            {
                if (p.health < p.maxHealth)
                {
                    Utilities.ColourText(Colour.ENERGY, "Success! ");
                    Utilities.EmbedColourText(Colour.HEALTH, "Your ", "health ", "returns to maximum!");
                    p.health = p.maxHealth;
                }
                else
                {
                    Console.WriteLine("Sadly, you glean very little from the runes");
                }
            }
            else
            {
                Utilities.ColourText(Colour.DAMAGE, "This was not for you to know! It's too much for your mind or body!");
                p.health = 1;
                Utilities.EmbedColourText(Colour.HEALTH, Colour.DAMAGE, "Your ", "health ", "is reduced to ", "1", "!");
            }
            Utilities.Keypress();
            Explore.currentShell.encountered = true;
            Explore.GameDungeon(d, p);
        }
        if (choice == "d")
        {
            Console.Clear();
            Utilities.ColourText(Colour.DAMAGE, "Desecrating");
            Utilities.DotDotDot();
            Console.WriteLine("\n\n\n\n\n\n\n");
            int roll = Utilities.rand.Next(1, 101);
            if (roll <= 25)
            {
                Utilities.ColourText(Colour.HEALTH, "Success! ");
                desecrated = true;
                Utilities.EmbedColourText(Colour.HEALTH, "You hear screams from further in the dungeon!\nNext fight, every monster starts with", " HALF ", "health!");
            }
            else
            {
                Utilities.ColourText(Colour.DAMAGE, "You have made the gods angry!");
                Utilities.EmbedColourText(Colour.HEALTH, Colour.DAMAGE, "Your ", "health ", "is reduced to ", "1", "!");
            }
            Utilities.Keypress();
            Explore.currentShell.encountered = true;
            Explore.GameDungeon(d, p);
        }
        if (choice == "w")
        {
            Explore.currentShell.encountered = true;
            Explore.GameDungeon(d, p);
        }
        else
        {
            Event3(d, p, e);
        }
    }
Example #32
0
        protected void BuildIt(Explore.NetSuite.DataAccess.NDAL client, Customer cust)
        {
            Session["formpage"] = "6";
            Session["Edit"] = "True";
            ThePanel.Controls.Clear();
            try
            {
                //HttpContext.Current.Trace.Warn("FormPage_BuildReviewForm()", string.Format("{0},{1},{2}",
                //              DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                //              "info",
                //              "---Draw Review Form GetCustomer() Begin------"));

                //Explore.NetSuite.DataAccess.NDAL client = new Explore.NetSuite.DataAccess.NDAL();
                //Customer cust = client.GetCustomer(Session["UserID"].ToString());

                //HttpContext.Current.Trace.Warn("FormPage_BuildReviewForm()", string.Format("{0},{1},{2}",
                //              DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                //              "info",
                //              "---Draw Review Form GetCustomer() End------"));

                FillCheckOutBilling(cust);
                FillCheckOutShipping(cust);
                FillCheckOutDelivery(cust);
                FillCheckOutPayment();

                string thecartID = Session["yourcart"].ToString();

                int multisystemdiscountcount = (int)Session["MultiSystemCount"];

                DataView dvMulti = doQueryDV("SELECT * FROM NetSuitePriceLevel WHERE CustomerType=1 AND MaxQuantity >= " +
                             multisystemdiscountcount.ToString() + " AND MinQuantity <= " + multisystemdiscountcount.ToString());

                decimal multiDiscount = 1.00M;
                if (dvMulti.Count > 0)
                    multiDiscount = (1.00M - decimal.Parse(dvMulti[0]["Discount"].ToString().Trim().Replace("%", "")) / 100.00M);

                DataSet dsCartParent = doQuery("SELECT DISTINCT ID, NID, Quantity, isParent, SubProductID, " +
                    "ParentID, SKU, isLoneSKU FROM Cart WHERE CartSessionID='" + thecartID + "' AND isParent ='True'");

                DataSet dsProduct1 = doQuery("SELECT * FROM NetSuiteProducts WHERE NID='" +
                    dsCartParent.Tables[0].Rows[0]["NID"].ToString()+"'");

                DataSet dsCart = doQuery("SELECT * FROM Cart C WHERE C.CartSessionID='" +
                    thecartID + "'");

                DataSet dsCartNotParent = doQuery("SELECT * FROM Cart C, NetSuiteBoxes NSB WHERE " +
                    "NSB.NID=C.SubProductID AND C.isParent='False' AND C.CartSessionID='" +
                    thecartID + "' ORDER BY C.BoxID");

                DataView dvParents = new DataView(doQuery("SELECT * FROM NetSuiteProducts").Tables[0], "", "",
                    DataViewRowState.CurrentRows);

                DataSet dsProdCount = doQuery("SELECT DISTINCT ID, NID, Quantity, isParent, SubProductID, " +
                    "ParentID FROM Cart WHERE CartSessionID='" + thecartID + "' AND isParent ='True'");

                DataView dv = new DataView(dsCart.Tables[0], "", "", DataViewRowState.CurrentRows);
                DataView dvSub = new DataView(dsCartNotParent.Tables[0], "", "", DataViewRowState.CurrentRows);
                decimal estimatedTotal = 0.00M;

                string parentID = "";
                Label lab = new Label();
                lab.ID = "TheLabel";
                lab.Visible = false;
                lab.Text = dsCartParent.Tables[0].Rows.Count.ToString();
                ThePanel.Controls.Add(lab);

                #region forloop
                for (int i = 0; i < dsCartParent.Tables[0].Rows.Count; i++)
                {
                    Literal ColumnsLiteral = new Literal();
                    Literal ColumnsLiteralEnd = new Literal();
                    dv.RowFilter = "NID ='" + dsProdCount.Tables[0].Rows[i]["NID"].ToString().Trim().ToUpper() + "' AND isParent = 'True'";
                    parentID = dsProdCount.Tables[0].Rows[i]["ID"].ToString();
                    dvParents.RowFilter = "NID='" + dsProdCount.Tables[0].Rows[i]["NID"].ToString().Trim().ToUpper()+"'";

                    //<a onclick=\"var answer = confirm('Are you sure you want to remove the " +
                    //    dvParents[0]["PriceTitle"].ToString() +
                    //    " from your cart?'); if(answer){ RemoveItem();}\" class=\"LinkUnderline\">Remove</a>

                    string tempSKU = dsCartParent.Tables[0].Rows[i]["SKU"].ToString().Trim();

                    Session["tempSKU"] = "first: " + tempSKU;

                    if (bool.Parse(dsCartParent.Tables[0].Rows[i]["isLoneSKU"].ToString()))
                    {
                        //DataSet dsTemp = doQuery("SELECT * FROM NetSuiteProducts WHERE NID='" +
                        //    dsCartParent.Tables[0].Rows[i]["NID"].ToString().Trim().ToUpper()+"'");

                        //colLiteral2.Text += "<li>" + dsTemp.Tables[0].Rows[0]["Name"].ToString() + "</li>";
                    }
                    else
                    {
                        dvSub.RowFilter = "ParentID=" + parentID;
                        for (int j = 0; j < dvSub.Count; j++)
                        {

                            tempSKU += dvSub[j]["SKU"].ToString().Trim();
                            Session["tempSKU"] += ", " + j + ":" + tempSKU;
                            //allPrice += decimal.Parse(dvSub[j]["Price"].ToString());
                            //eduPrice += decimal.Parse(dvSub[j]["Price"].ToString());
                            //colLiteral2.Text += "<li>" + dvSub[j]["Name"].ToString() + "</li>";
                        }
                    }

                    Literal colLiteral2 = new Literal();
                    colLiteral2.Text = "<td width=\"200px\" aligh=\"left\">" +
                    tempSKU + "<br/>";
                    dvSub.RowFilter = "ParentID=" + dsProdCount.Tables[0].Rows[i]["ID"].ToString();
                    //decimal allPrice = decimal.Parse(dvParents[0]["Price"].ToString());
                    //decimal eduPrice = decimal.Parse(dvParents[0]["EducationalPrice"].ToString());
                    Session["tempSKU"] += ", whole: "+tempSKU;
                    DataView dvDESC = doQueryDV("SELECT * FROM NetSuiteGroupItem WHERE ItemName='"+tempSKU+"'");

                    colLiteral2.Text += "<ul class=\"CartUL\">";
                    colLiteral2.Text += "<li>" + dvDESC[0]["Description"].ToString() + "</li>";

                    Label label = new Label();
                    label.ID = "labelY" + i.ToString();
                    label.Visible = false;
                    label.Text = tempSKU;

                    ThePanel.Controls.Add(label);

                    dv.RowFilter = "ID ='" + dsProdCount.Tables[0].Rows[i]["ID"].ToString().Trim().ToUpper() +
                        "' AND isParent = 'True'";
                    colLiteral2.Text += "</ul>";
                    colLiteral2.Text += "</td>";
                    colLiteral2.Text += "<td>";

                    ThePanel.Controls.Add(colLiteral2);

                    Label qtyTextBox = new Label();
                    qtyTextBox.ID = "TextBox" + i.ToString();
                    qtyTextBox.Width = 20;
                    qtyTextBox.Height = 20;
                    qtyTextBox.Text = dv[0]["Quantity"].ToString();

                    ThePanel.Controls.Add(qtyTextBox);

                    Literal ColumnsLiteral5 = new Literal();
                    ColumnsLiteral5.Text += "</td>";

                    string msrpCSS = "PriceLabel";

                    if (Session["UserType"] != null)
                        if ((NDAL.DataTypes.PriceLevels)Session["UserType"] ==
                            NDAL.DataTypes.PriceLevels.Educational)
                            msrpCSS = "PriceLabelCrossed";

                    ColumnsLiteral5.Text += "<td align=\"right\">MSRP: <span class=\"" + msrpCSS + "\">$";

                    ThePanel.Controls.Add(ColumnsLiteral5);

                    Literal ColumnsLiteral2 = new Literal();
                    Label labelAllPrice = new Label();
                    Session["message"] += tempSKU;
                    labelAllPrice.Text = InsertCommaForPrice((multiDiscount*CalculatePrice(tempSKU,
                        1,
                        NDAL.DataTypes.PriceLevels.MSRP)).ToString(), true); //allPrice.ToString();
                    labelAllPrice.ID = "labelAllPrice" + i.ToString();

                    ThePanel.Controls.Add(labelAllPrice);

                    string priceClass = "PriceLabel";

                    Literal ColumnsLiteral3 = new Literal();
                    Label labelEduPrice = new Label();

                    if (Session["UserType"] != null)
                    {
                        if ((NDAL.DataTypes.PriceLevels)Session["UserType"] ==
                            NDAL.DataTypes.PriceLevels.Educational)
                        {

                            priceClass = "PriceLabelCrossed";

                            ColumnsLiteral2.Text += "</span><br/><label class=\"CartColumn\">ED Price:</label> <span class=\"PriceLabel\">$";

                            ThePanel.Controls.Add(ColumnsLiteral2);

                            labelEduPrice.Text = InsertCommaForPrice(((CalculatePrice(tempSKU, multisystemdiscountcount,
                                NDAL.DataTypes.PriceLevels.Educational))).ToString(), true); //eduPrice.ToString();
                            labelEduPrice.ID = "labelEduPrice" + i.ToString();

                            ThePanel.Controls.Add(labelEduPrice);

                        }
                    }
                    ColumnsLiteral3.Text += "</span></td>";
                    ColumnsLiteral3.Text += "<td align=\"right\"><span class=\"" + priceClass +
                        "\"><label id=\"allPrice" + i.ToString() + "\">$";

                    ThePanel.Controls.Add(ColumnsLiteral3);

                    Literal ColumnsLiteral4 = new Literal();
                    Label totalAllPrice = new Label();
                    totalAllPrice.ID = "totalAllPrice" + i.ToString();
                    totalAllPrice.Text = InsertCommaForPrice((decimal.Parse(dv[0]["Quantity"].ToString()) * decimal.Parse(labelAllPrice.Text)).ToString(), false);
                    totalAllPrice.ID = "totalAllPrice" + i.ToString();

                    ThePanel.Controls.Add(totalAllPrice);

                    ColumnsLiteral4.Text += "</label></span><br/>";

                    if (Session["UserType"] != null)
                    {
                        if ((NDAL.DataTypes.PriceLevels)Session["UserType"] ==
                                NDAL.DataTypes.PriceLevels.Educational)
                        {
                            ColumnsLiteral4.Text += "<span class=\"PriceLabel\" id=\"eduPrice" +
                                i.ToString() + "\"><label  id=\"eduPrice" + i.ToString() + "\">$";
                        }
                    }
                    ThePanel.Controls.Add(ColumnsLiteral4);

                    if (Session["UserType"] != null)
                    {
                        if ((NDAL.DataTypes.PriceLevels)Session["UserType"] ==
                                NDAL.DataTypes.PriceLevels.Educational)
                        {
                            Label totalEduPrice = new Label();
                            totalEduPrice.Text =
                                InsertCommaForPrice((decimal.Parse(dv[0]["Quantity"].ToString()) *
                                decimal.Parse(labelEduPrice.Text)).ToString(), false);
                            totalEduPrice.ID = "totalEduPrice" + i.ToString();
                            estimatedTotal += decimal.Parse(totalEduPrice.Text);
                            ThePanel.Controls.Add(totalEduPrice);

                            ColumnsLiteralEnd.Text += "</label></span></td></tr>";
                            ColumnsLiteralEnd.Text += "<tr><td colspan=\"5\" align=\"right\" class=\"PriceLabel\">You Save: $" +
                                InsertCommaForPrice((decimal.Parse(dv[0]["Quantity"].ToString()) * CalculatePrice(tempSKU, 1,
                                NDAL.DataTypes.PriceLevels.MSRP) - decimal.Parse(totalEduPrice.Text)).ToString(), false) +
                                "</td></tr><tr><td><div style=\"display: none;\">";
                        }
                        else
                        {
                            estimatedTotal += decimal.Parse(totalAllPrice.Text);
                            ColumnsLiteralEnd.Text += "</td></tr><tr><td><div style=\"display: none;\">";
                        }
                    }
                    else
                    {
                        estimatedTotal += decimal.Parse(totalAllPrice.Text);
                        ColumnsLiteralEnd.Text += "</td></tr><tr><td><div style=\"display: none;\">";
                    }

                    Label qtyLabel = new Label();
                    qtyLabel.ID = "qtyLabel" + i.ToString();
                    qtyLabel.Text = dv[0]["Quantity"].ToString();

                    Label idLabel = new Label();
                    idLabel.Visible = false;
                    idLabel.ID = "IDLabel" + i.ToString();
                    idLabel.Text = parentID;

                    Literal ColumnsLiteral6 = new Literal();
                    ColumnsLiteral6.Text = "</div></td></tr><tr><td colspan=\"4\" style=\"padding-top: 10px;\"></td></tr>";

                    ThePanel.Controls.Add(ColumnsLiteralEnd);
                    ThePanel.Controls.Add(qtyLabel);
                    ThePanel.Controls.Add(idLabel);
                    ThePanel.Controls.Add(ColumnsLiteral6);

                    //if ((NDAL.DataTypes.PriceLevels)Session["UserType"] == NDAL.DataTypes.PriceLevels.Educational)
                    //{
                    //    estimatedTotal += decimal.Parse((decimal.Parse(dv[0]["Quantity"].ToString()) * multiDiscount*CalculatePrice(tempSKU, 1,
                    //        NDAL.DataTypes.PriceLevels.Educational)).ToString());
                    //}
                    //else
                    //{
                    //    estimatedTotal += decimal.Parse((decimal.Parse(dv[0]["Quantity"].ToString()) * multiDiscount*CalculatePrice(tempSKU, 1,
                    //        NDAL.DataTypes.PriceLevels.MSRP)).ToString());
                    //}
                }

            #endregion

                Session["numProds"] = dsProdCount.Tables[0].Rows.Count;

                //not doing promo for phase I
                //DataSet dsPromo = doQuery("SELECT * FROM CartPromos CP, NetSuitePromos NSP WHERE "+
                //    "CP.CodeID=NSP.NetSuiteID AND CP.CartSession='" + thecartID + "'");

                EstimatedTotalLabel.Text = InsertCommaForPrice(estimatedTotal.ToString(), false);
                TheTotal.Text = InsertCommaForPrice(estimatedTotal.ToString(), false);

                //HttpContext.Current.Trace.Warn("FormPage_BuildReviewForm()", string.Format("{0},{1},{2}",
                //              DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                //              "info",
                //              "---Draw Review Form GetCustomer() Begin------"));
                //HttpContext.Current.Trace.Warn("FormPage_BuildReviewForm()", string.Format("{0},{1},{2}",
                //              DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                //              "info",
                //              "---Draw Review Form GetCustomer() End------"));
                Address shipToAddress = new Address();

                for (int i = 0; i < cust.Addresses.Count; i++)
                {
                    if (cust.Addresses[i].DefaultShipping.Value)
                    {
                        shipToAddress = cust.Addresses[i];
                    }
                }

                //HttpContext.Current.Trace.Warn("FormPage_BuildReviewForm()", string.Format("{0},{1},{2}",
                //              DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                //              "info",
                //              "---Draw Review Form Get Transaction lines Begin------"));
                List<TransactionLineItem> transList = new List<TransactionLineItem>();

                GetTransactionLines(ref transList);

                //HttpContext.Current.Trace.Warn("FormPage_BuildReviewForm()", string.Format("{0},{1},{2}",
                //              DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                //              "info",
                //              "---Draw Review Form Get Transaction lines End------"));

                HttpContext.Current.Trace.Warn("FormPage_BuildReviewForm()", string.Format("{0},{1},{2}",
                              DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                              "info",
                              "---Draw Review Form GetUPSRate Begin------"));
                string shippingTotal = client.GetUPSRate(Session["UserID"].ToString(), shipToAddress.InternalID,
                    ShippingMethods.UPSGround, transList);
                HttpContext.Current.Trace.Warn("FormPage_BuildReviewForm()", string.Format("{0},{1},{2}",
                              DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                              "info",
                              "---Draw Review Form GetUPSRate End------"));
                ShippingUPSLabel.Text = "$" + InsertCommaForPrice(shippingTotal, false);

                //Not doing promo for phase I
                //if (dsPromo.Tables.Count > 0)
                //    if (dsPromo.Tables[0].Rows.Count > 0)
                //    {
                //        TheDiscountPercent.Text = dsPromo.Tables[0].Rows[0]["PercentDiscount"].ToString();
                //        MakePromo(dsPromo.Tables[0].Rows[0]["Code"].ToString(),
                //            dsPromo.Tables[0].Rows[0]["PercentDiscount"].ToString());
                //    }

                decimal taxableAmount = 0.00M;
                decimal taxAmount = 0.00M;

                HttpContext.Current.Trace.Warn("FormPage_BuildReviewForm()", string.Format("{0},{1},{2}",
                              DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                              "info",
                              "---Draw Review Form GetTax Begin------"));
                decimal taxPercentage = GetTax(shipToAddress, false, ref taxableAmount, ref taxAmount);
                HttpContext.Current.Trace.Warn("FormPage_BuildReviewForm()", string.Format("{0},{1},{2}",
                              DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                              "info",
                              "---Draw Review Form GetTax End------"));

                TaxLabel.Text = InsertCommaForPrice(taxAmount.ToString(), false);

                //decimal theTax = (decimal.Parse(TaxLabel.Text) / decimal.Parse("100.00")) * (taxableAmount);

                //TaxLabel.Text = InsertCommaForPrice(theTax.ToString());

                TheTotal.Text = (estimatedTotal + taxAmount +
                    decimal.Parse(shippingTotal)).ToString();
                EstimatedTotalLabel.Text = InsertCommaForPrice(TheTotal.Text, false);

                //char[] delim = { '.'};
                //string[] tokens = TheTotal.Text.Split(delim);

                //if (tokens[0].Trim().Length > 3)
                //{
                //    //tokens[0] = tokens[0].Insert(tokens[0].Length - 3, ",");
                //    EstimatedTotalLabel.Text = tokens[0];

                //    if (tokens.Length > 1)
                //    {
                //        EstimatedTotalLabel.Text += "." + tokens[1];
                //    }
                //}

                //if (tokens.Length < 2)
                //{
                //    EstimatedTotalLabel.Text += ".00";
                //}

            }
            catch (Exception ex)
            {
                Literal ColumnsLiteral = new Literal();
                //ColumnsLiteral.Text = "<tr><td><div>Your cart is empty.</div></td></tr>";
                ColumnsLiteral.Text = ex.ToString();
                //ColumnsLiteral.Text = "<tr><td><div>TempSKU: "+ex.ToString()+"</div></td></tr>";
                ThePanel.Controls.Add(ColumnsLiteral);

            }
        }
Example #33
0
        protected void ContBilling(bool fromPayment, bool validate, Explore.NetSuite.DataAccess.NDAL client, ref Customer cust)
        {
            try
            {
                if (!fromPayment)
                {
                    Session["RedrawForm"] = false;
                }

                bool goOn = true;
                if (validate)
                {
                    if (!Page.IsValid)
                    {
                        goOn = false;
                    }
                }

                if (goOn)
                {
                    if (!fromPayment)
                    {
                        Session["FormClicked"] = true;
                    }
                    bool isStateValid = false;
                    if (StateLabel2RadComboBox.Visible)
                    {
                        if (StateLabel2RadComboBox.SelectedValue != "-1")
                            isStateValid = true;
                    }
                    else
                    {
                        if (StateLabel2TextBox.Text.Trim() != "")
                            isStateValid = true;
                    }

                    if (isStateValid)
                    {
                        if (Session["UserID"] != null)
                        {

                            //HttpContext.Current.Trace.Warn("FormPage_ContinuePayment()", string.Format("{0},{1},{2}",
                            //  DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                            //  "info",
                            //  "---SaveBilling address function GetCustomer() Begin------"));

                            //HttpContext.Current.Trace.Warn("FormPage_ContinuePayment()", string.Format("{0},{1},{2}",
                            //  DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                            //  "info",
                            //  "---SaveBilling address function GetCustomer() End------"));

                            Address adr = new Address();
                            adr.DefaultBilling = true;
                            adr.DefaultShipping = false;
                            adr.DefaultDelivery = false;
                            adr.Residential = false;
                            adr.DefaultAccount = false;

                            if (!fromPayment)
                            {
                                Session["RedrawForm"] = true;
                                Session["formpage"] = "3";
                            }

                            Session["BillingNameLabel"] = AttentionLabel1TextBox.Text;
                            BillingNameLabel.Text = AttentionLabel1TextBox.Text;

                            Session["BillingCompanyLabel"] = CompanyLabel2TextBox.Text;
                            BillingCompanyLabel.Text = CompanyLabel2TextBox.Text;
                            adr.CompanyName = CompanyLabel2TextBox.Text;

                            string state = "";
                            if (StateLabel2RadComboBox.Visible)
                                state = StateLabel2RadComboBox.SelectedItem.Text;
                            else
                                state = StateLabel2TextBox.Text;

                            Session["BillingStateLabel"] = state;
                            BillingStateLabel.Text = CityLabel2TextBox.Text + ", " + state + " " + ZipLabel2TextBox.Text;
                            adr.State = state;

                            Session["BillingCityLabel"] = CityLabel2TextBox.Text;
                            adr.City = CityLabel2TextBox.Text;

                            Session["BillingPhoneLabel"] = PhoneLabel2TextBox.Text;
                            Session["BillingEx"] = ex2TextBox.Text;
                            BillingPhoneLabel.Text = PhoneLabel2TextBox.Text;
                            adr.Phone = PhoneLabel2TextBox.Text;
                            if (ex2TextBox.Text.Trim() != "")
                            {
                                BillingPhoneLabel.Text = PhoneLabel2TextBox.Text + " x" + ex2TextBox.Text;
                                adr.Phone = PhoneLabel2TextBox.Text + " x" + ex2TextBox.Text;
                            }

                            Session["BillingAttentionLabel"] = AttentionLabel1TextBox.Text;
                            adr.Attention = AttentionLabel1TextBox.Text;

                            Session["BillingAddressLabel"] = Address1Label2TextBox.Text;
                            adr.Address1 = Address1Label2TextBox.Text;

                            Session["BillingAddress2Label"] = Address2Label2TextBox.Text;
                            adr.Address2 = Address2Label2TextBox.Text;

                            Session["BillingZipLabel"] = ZipLabel2TextBox.Text;
                            adr.Zip = ZipLabel2TextBox.Text;

                            Session["BillingCountryLabel"] = CountryLabel2RadComboBox.SelectedValue;
                            DataSet dsCount = doQuery("SELECT * FROM Countries WHERE country_name = '" +
                            CountryLabel2RadComboBox.SelectedItem.Text + "'");
                            adr.Country = dsCount.Tables[0].Rows[0]["country_2_code"].ToString();

                            object refAdrs = (object)adr;
                            SaveDynamicFields("2", ref refAdrs);
                            adr = (Address)refAdrs;

                            UpdateAddress(adr, ref cust, AddressTypes.Billing);

                            //HttpContext.Current.Trace.Warn("FormPage_ContinuePayment()", string.Format("{0},{1},{2}",
                            //  DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                            //  "info",
                            //  "---SaveBilling address function UpdateCustomer() Begin------"));
                            //
                            //HttpContext.Current.Trace.Warn("FormPage_ContinuePayment()", string.Format("{0},{1},{2}",
                            //  DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                            //  "info",
                            //  "---SaveBilling address function UpdateCustomer() End------"));

                            client.UpdateCustomer(cust);

                            SamesAsCheckBox2.Checked = false;

                            if (!fromPayment)
                            {
                                FillShipping();
                                if (Session["EditBillingClicked"] != null)
                                    if (bool.Parse(Session["EditBillingClicked"].ToString()))
                                    {

                                        Session["formpage"] = "6";
                                        GoToForm(6, 2);
                                        SetBoxes();
                                        BuildIt(client, cust);
                                    }
                                    else
                                        GoToForm(3, 2);
                                else
                                    GoToForm(3, 2);
                            }
                        }
                        else
                        {
                            ErrorLabel.Text = "user is null";
                        }
                    }
                    else
                    {
                        ErrorLabelBilling.Text = "State is required.";
                    }
                }

            }
            catch (Exception ex)
            {
                ErrorLabel.Text = ex.ToString();
            }
        }