Example #1
0
    private void SlingJobs(Sling Sling, DateTime dtBeg)
    {
        StringBuilder sbHtml = new StringBuilder();

        sbHtml.AppendLine("<tr><td colspan=\"4\"><h2 class=\"section\">Sling Shifts Missing Job</h2></td></tr>");
        sbHtml.AppendFormat("<tr><th>Date/Time</th><th>Job #</th><th>Sling Shift</th><th>Delete Shift</th><td><label class=\"TextLink All Shifts\">All</label>&nbsp;&nbsp;<label class=\"TextLink None Shifts\">None</label></td></tr>\n");
        Sling.SortShifts();

        int i = 0;

        foreach (Sling.CalendarEvent Shift in Sling.Shifts)
        {
            if (Shift.Beg > dtBeg)
            {
                string ShiftID;
                bool   fFound = MarvellJobs.TryGetValue(Shift.JobRno, out ShiftID);
                if (fFound && Shift.ID != ShiftID && Shift.User == null)
                {
                    fFound = false;
                }
                if (!fFound)
                {
                    sbHtml.AppendFormat("<tr><td>{0}</td><td><a href='Job.aspx?JobRno={1}' target='Job'>{1}</a></td><td>{2}</td><td class=\"checkbox\"><input type=checkbox name=\"SlingId_{3}\" value=\"{2}\" checked=\"checked\" class=\"Shift\"></td></tr>\n", Shift.Beg.ToString(), Shift.JobRno, Shift.ID, ++i);
                }
            }
        }

        ltlData.Text += sbHtml.ToString();

        hfNumSlingIDs.Value = i.ToString();
    }
Example #2
0
        public List <ViewModels.SlingArticlesView> SlingGetArticles(string channel)
        {
            //Sling s = new Sling();
            var result = Sling.GetArticles(channel);

            return(result);
        }
Example #3
0
    protected async Task <bool> SetupSlingShifts()
    {
        Sling = new Sling();
        if (await Sling.Login(Sling.Email, Sling.Password))
        {
            await Sling.LoadUsers();

            dtEnd = dtEnd.AddDays(1);
            await Sling.LoadCalendar(dtBeg, dtEnd);

            //    // organize shifts into Jobs
            //    foreach (Sling.CalendarEvent Shift in Sling.Shifts)
            //    {
            //        Job Job = FindJob(Shift.JobRno);
            //        if (Job == null)
            //        {
            //            Job = new Job() { JobRno = Shift.JobRno };
            //            cJobs.Add(Job);
            //        }
            //        Job.cShifts.Add(Shift);
            //    }

            //    // sort shifts within each job, job lead in first shift
            //    foreach (Job Job in cJobs)
            //    {
            //        Sling.SortShiftCrew(Job.cShifts);
            //    }
        }

        return(true);
    }
Example #4
0
    private async Task <bool> StartSling()
    {
        WebConfig wc            = new WebConfig();
        string    SlingEmail    = wc.Str("SlingEmail");
        string    SlingPassword = wc.Str("SlingPassword");
        string    SlingOrg      = wc.Str("SlingOrgId");

        Sling = new Sling();
        await Sling.Login(SlingEmail, SlingPassword);

        return(true);
    }
Example #5
0
    protected async Task SetupSling()
    {
        Sling = new Sling();
        if (await Sling.Login(Sling.Email, Sling.Password))
        {
            await Sling.LoadUsers();

            DateTime dtBeg = DateTime.Now;
            DateTime dtEnd = dtBeg.AddDays(14);

            await Sling.LoadCalendar(dtBeg, dtEnd);
        }
    }
Example #6
0
    protected async Task <bool> SetupSlingShift()
    {
        Sling = new Sling();
        if (await Sling.Login(SlingEmail, SlingPassword))
        {
            await Sling.LoadUsers();

            dtEnd = dtEnd.AddDays(1);
            await Sling.LoadCalendar(dtBeg, dtEnd);
        }

        return(true);
    }
        public void ShouldReturnCorrectName()
        {
            //arrange
            AllArmor        allArmor        = new AllArmor();
            AllShields      allShields      = new AllShields();
            Battleaxe       battleaxe       = new Battleaxe();
            BrewersSupplies brewersSupplies = new BrewersSupplies();
            Dagger          dagger          = new Dagger();
            Darts           darts           = new Darts();
            Handaxe         handaxe         = new Handaxe();
            LightArmor      lightArmor      = new LightArmor();
            LightCrossbow   lightCrossbow   = new LightCrossbow();
            Longbow         longbow         = new Longbow();
            Longsword       longsword       = new Longsword();
            MartialWeapons  martialWeapons  = new MartialWeapons();
            MasonsTools     masonsTools     = new MasonsTools();
            MediumArmor     mediumArmor     = new MediumArmor();
            Quarterstaff    quarterstaff    = new Quarterstaff();
            Shortbow        shortbow        = new Shortbow();
            Shortsword      shortsword      = new Shortsword();
            SimpleWeapons   simpleWeapons   = new SimpleWeapons();
            Sling           sling           = new Sling();
            SmithsTools     smithsTools     = new SmithsTools();
            ThrowingHammer  throwingHammer  = new ThrowingHammer();
            Warhammer       warhammer       = new Warhammer();

            //assert
            allArmor.Name().Should().Be(new TextObj("All Armor"));
            allShields.Name().Should().Be(new TextObj("All Shields"));
            battleaxe.Name().Should().Be(new TextObj("Battleaxe"));
            brewersSupplies.Name().Should().Be(new TextObj("Brewer's Supplies"));
            dagger.Name().Should().Be(new TextObj("Dagger"));
            darts.Name().Should().Be(new TextObj("Darts"));
            handaxe.Name().Should().Be(new TextObj("Handaxe"));
            lightArmor.Name().Should().Be(new TextObj("Light Armor"));
            lightCrossbow.Name().Should().Be(new TextObj("Light Crossbow"));
            longbow.Name().Should().Be(new TextObj("Longbow"));
            longsword.Name().Should().Be(new TextObj("Longsword"));
            martialWeapons.Name().Should().Be(new TextObj("Martial Weapons"));
            masonsTools.Name().Should().Be(new TextObj("Mason's Tools"));
            mediumArmor.Name().Should().Be(new TextObj("Medium Armor"));
            quarterstaff.Name().Should().Be(new TextObj("Quarterstaff"));
            shortbow.Name().Should().Be(new TextObj("Shortbow"));
            shortsword.Name().Should().Be(new TextObj("Shortsword"));
            simpleWeapons.Name().Should().Be(new TextObj("Simple Weapons"));
            sling.Name().Should().Be(new TextObj("Sling"));
            smithsTools.Name().Should().Be(new TextObj("Smith's Tools"));
            throwingHammer.Name().Should().Be(new TextObj("Throwing Hammer"));
            warhammer.Name().Should().Be(new TextObj("Warhammer"));
        }
Example #8
0
    private void WebsiteJobs(Sling Sling, DateTime dtBeg, DateTime dtEnd)
    {
        string Sql = string.Format(
            "Select JobRno, SlingShiftId, JobDate, Crew " +
            "From mcJobs " +
            "Where JobDate Between {0} and {1} " +
            "And IsNull(Crew, '') <> '' " +
            "And IsNull(ProposalFlg, 0) = 0 " +
            "Order By JobDate",
            DB.Put(dtBeg),
            DB.Put(dtEnd.AddDays(1).AddSeconds(-1)));

        try
        {
            StringBuilder sbHtml = new StringBuilder();
            sbHtml.AppendLine("<tr><td colspan=\"4\"><h2 class=\"section\">Jobs Missing Sling Shift</h2></td></tr>");
            sbHtml.AppendFormat("<tr><th>Date</th><th>Job #</th><th>Sling Shift</th><th>Add Shift</th><td><label class=\"TextLink All Jobs\">All</label>&nbsp;&nbsp;<label class=\"TextLink None Jobs\">None</label></td></tr>\n");

            int       i  = 0;
            DataTable dt = db.DataTable(Sql);
            foreach (DataRow dr in dt.Rows)
            {
                Int32    JobRno       = DB.Int32(dr["JobRno"]);
                string   SlingShiftId = DB.Str(dr["SlingShiftId"]);
                DateTime JobDt        = DB.DtTm(dr["JobDate"]);

                MarvellJobs.Add(JobRno, SlingShiftId);

                Sling.CalendarEvent Shift = null;
                if (SlingShiftId.Length > 0)
                {
                    Shift = Sling.FindShift(SlingShiftId);
                }
                if (Shift == null)
                {
                    sbHtml.AppendFormat("<tr><td>{0}</td><td><a href='Job.aspx?JobRno={1}' target='Job'>{1}</a></td><td>{2}</td><td class=\"checkbox\"><input type=checkbox name=\"JobId_{3}\" value=\"{1}\" checked=\"checked\" class=\"Job\"></td></tr>\n", JobDt.ToShortDateString(), JobRno, SlingShiftId, ++i);
                }
            }
            ltlData.Text = sbHtml.ToString();

            hfNumJobsIDs.Value = i.ToString();
        }
        catch (Exception Ex)
        {
            Err Err = new Err(Ex, Sql);
            Response.Write(Err.Html());
        }
    }
Example #9
0
    protected async Task <bool> ClearAndLoad(Sling Sling, DateTime dtBeg, DateTime dtEnd)
    {
        try
        {
            Sling.ClearCalendar();
            await Sling.LoadCalendar(dtBeg, dtEnd);

            //await Sling.LoadAvailability(dtBeg, dtEnd);
            Render(Sling, dtBeg, dtEnd);
        }
        catch (Exception Ex)
        {
            Err Err = new Err(Ex);
            Response.Write(Err.Html());
        }

        return(true);
    }
Example #10
0
    protected async Task <bool> GetAvailability()
    {
        try
        {
            DateTime dtBeg = FindBegDate(DateTime.Parse(txtDate.Text));
            DateTime dtEnd = dtBeg.AddDays(6);

            Sling Sling = new Sling();

            if (await Sling.Login(Sling.Email, Sling.Password))
            {
                await Sling.LoadUsers();
                await ClearAndLoad(Sling, dtBeg, dtEnd);
            }
        }
        catch (Exception Ex)
        {
            Err Err = new Err(Ex);
            Response.Write(Err.Html());
        }

        return(true);
    }
Example #11
0
    void Start()
    {
        // assign the rigidbody component
        rb = GetComponent <Rigidbody2D>();
        // assign Wall layer to variable
        walls       = LayerMask.NameToLayer("Walls");
        anchorLayer = LayerMask.NameToLayer("Anchors");
        buttons     = LayerMask.NameToLayer("Buttons");
        // make sure that raycasts don't detect the colliders that they start in
        Physics2D.queriesStartInColliders = false;
        stamina = maxStamina;
        //rend = GetComponentInChildren<SpriteRenderer>();
        leftTentacle.anchorPos  = null;
        rightTentacle.anchorPos = null;
        switchTentacles         = false;
        slingshot   = Sling.None;
        bc          = GetComponent <BoxCollider2D>();
        anim        = GetComponent <Animator>();
        movement    = Movement.Ground;
        groundingLR = Grounding.None;

        anchorGrip = AnchorGrip.None;

        rendTransform = rend.transform;
        increment[0]  = Random.Range(0f, 10f);
        increment[1]  = Random.Range(0f, 10f);



        saveController.LoadGame();

        rend.flipX     = faceDir == -1 ? true : false;
        Cursor.visible = false;

        endgame = false;
    }
Example #12
0
    protected void btnReset_Click(object sender, System.EventArgs e)
    {
        Sling Sling = new Sling();

        Sling.Reset();
    }
Example #13
0
        public IHttpActionResult SlingLogin()
        {
            var result = Sling.Login("", "", "", "");

            return(Ok(result));
        }
Example #14
0
    protected void Render(Sling Sling, DateTime dtBeg, DateTime dtEnd)
    {
        string[] GroupNames = new string[]
        {
            "Female Service Crew",
            "Male Service Crew"
            //"Hot Kitchen",
            //"Cold Kitchen",
            //"Molly's"
        };
        string[] DayNames = new string[]
        {
            "Sunday",
            "Monday",
            "Tuesday",
            "Wednesday",
            "Thursday",
            "Friday",
            "Saturday"
        };

        try
        {
            foreach (string GroupName in GroupNames)
            {
                Sling.Group Group = Sling.FindGroupByName(GroupName);

                if (Group != null)
                {
                    HtmlGenericControl h = new HtmlGenericControl("h1")
                    {
                        InnerText = string.Format("{0} - Times Unavailable", GroupName)
                    };
                    phSchedule.Controls.Add(h);

                    HtmlTable tbl = new HtmlTable()
                    {
                    };
                    phSchedule.Controls.Add(tbl);

                    HtmlTableRow tr = new HtmlTableRow();
                    tbl.Controls.Add(tr);

                    // headers
                    HtmlTableCell th = new HtmlTableCell("th")
                    {
                        InnerText = "Employee"
                    };
                    tr.Controls.Add(th);

                    DateTime dt = dtBeg;
                    for (int iDay = 0; iDay < 7; iDay++)
                    {
                        tr.Controls.Add(new HtmlTableCell("th")
                        {
                            InnerHtml = string.Format("{0}<br/> {1}/{2}", DayNames[(int)dt.DayOfWeek], dt.Month, dt.Day)
                        });
                        dt = dt.AddDays(1);
                    }

                    // employees
                    Sling.SortUsers(Group.Users);
                    foreach (Sling.User User in Group.Users)
                    {
                        tr = new HtmlTableRow();
                        tbl.Controls.Add(tr);

                        HtmlTableCell tc = new HtmlTableCell()
                        {
                            InnerText = string.Format("{0} {1}", User.FirstName, (User.LastName != null && User.LastName.Length > 0 ? User.LastName[0].ToString() : string.Empty))
                        };
                        tr.Controls.Add(tc);

                        // events for the employee
                        dt = dtBeg;
                        for (int iDay = 0; iDay < 7; iDay++)
                        {
                            // one day at a time
                            DateTime dtEndOfDay = dt.AddDays(1);

                            // look for events on the day
                            tc = new HtmlTableCell();
                            tr.Controls.Add(tc);

                            string Desc    = "";
                            bool   fAllDay = false;

                            foreach (Sling.CalendarEvent Event in User.CalendarEvents)
                            {
                                if (Event.Type == cnAvailability && dt.Day == Event.Beg.Day ||
                                    Event.Type == cnLeave &&
                                    (dt <= Event.Beg && Event.Beg <= dtEndOfDay ||
                                     dt <= Event.End && Event.End <= dtEndOfDay ||
                                     Event.Beg < dt && dtEndOfDay < Event.End))
                                {
                                    if (Event.FullDay || Event.Beg < dt && dtEndOfDay < Event.End)
                                    {
                                        fAllDay = true;
                                        Desc    = "All Day";
                                    }
                                    else
                                    {
                                        if (!fAllDay)
                                        {
                                            Desc += string.Format("{0} - {1}<br/>",
                                                                  (dt <= Event.Beg ? TimeFormat(Event.Beg) : "Midnight"),
                                                                  (Event.End <= dtEndOfDay ? TimeFormat(Event.End) : "Midnight"));
                                        }
                                    }
                                }
                            }
                            tc.InnerHtml = Desc;
                            dt           = dt.AddDays(1);
                        }
                    }
                }
            }
        }
        catch (Exception Ex)
        {
            Err Err = new Err(Ex);
            Response.Write(Err.Html());
        }
    }
Example #15
0
 void Start()
 {
     sling = transform.GetComponent <Sling>();
     brush = transform.GetComponent <Brush> ();
 }
Example #16
0
 public IEnumerable <NextNodeOption> ProcessNode(Sling node)
 {
     throw new NotImplementedException();
 }