Beispiel #1
0
        public Event(string id, DateTime dayStart, DateTime dayEnd,
                     DateTime start, DateTime end, DateTime arrival, DateTime departure,
                     string text, string resource, string resourceName, ACType acType, WorkType workType, object source,
                     int fontSize, int cellWidth, int cellDuration, string mhr, string bookedMHR, string stationName)
        {
            this.Id           = id;
            this.Start        = start;
            this.Arrival      = arrival;
            this.End          = end;
            this.Departure    = departure;
            this.Text         = text.Replace("\t", "").Replace("\n", "");
            this.Resource     = resource;
            this.ResourceName = resourceName;
            this.WorkType     = workType;
            this.ACType       = acType;
            //this.WPNOI = wpnoi;
            //this.WPNO = wpno;
            this.MHR         = mhr;
            this.BookedMHR   = bookedMHR;
            this.StationName = stationName;
            Source           = source;
            var boxes = SetBoxes(dayStart, dayEnd, fontSize, cellWidth, cellDuration);

            BoxStart = boxes.BoxStart;
            BoxEnd   = boxes.BoxEnd;
        }
Beispiel #2
0
 public HandBehaviours(ActorBehavioursBase <ACType, ABB> abb, PropHandler ph)
 {
     propHandler = ph;
     this.abb    = (ABB)abb;
     this.ac     = abb.ac;
     muscleGroup = ph.attachedMuscleGroup;
     handMuscle  = muscleGroup.muscles[muscleGroup.muscles.Length - 1];
 }
Beispiel #3
0
    static void Main()
    {
        ACType a, c;
        BType  b;

        c = new ACType {
            Value = 100
        };
        a = b = c;

        Console.WriteLine(a.Value);     // Prints 25
    }
Beispiel #4
0
        private void stripAndAddEvent(DateTime start, DateTime end, DateTime arrived, DateTime departure, string pk, string name, string mhr, string bookedMHR, string resource, string resourceName,
                                      ACType acType, WorkType workType, object source, string stationName)
        {
            if (!String.IsNullOrEmpty(Value)) // this applies to resources view only
            {
                if (Value != resource)        // don't add events that don't belong to this column
                {
                    return;
                }
            }

            // the event happens before this day
            if (end <= Start)
            {
                return;
            }

            // the event happens after this day
            if (start >= End)
            {
                return;
            }

            // this is invalid event that does have no duration
            if (start >= end)
            {
                return;
            }

            //TODo убрана фиксаци¤ даты начала и конца
            //// fix the starting time
            //if (start < Start)
            //    start = Start;


            //// fix the ending time
            //if (end > End)
            //    end = End;


            events.Add(new Event(pk, Start, End, start, end, arrived, departure, name, resource, resourceName, acType, workType, source, fontSize,
                                 cellWidth, cellDuration, mhr, bookedMHR, stationName));
        }
        protected void CreateDataTable(DateTime start, DateTime dateTimeStartTO, DateTime dateTimeEndTO, DataRow dr, DataTable dt, int day,
                                       ACType acType,
                                       /*TypeReport typeReport, int planVersion,*/ List <Resource> resources)
        {
            var counter = 0;

            //По каждому ресурсу
            foreach (var resource in resources)
            {
                //var entriesPL = new List<WPPlanDAO>();
                //if (resource.PL != null)
                //{
                //    foreach (var pl in resource.PL)
                //    {
                //        if (typeReport == TypeReport.Plan)
                //            entriesPL.AddRange(_wpPlanRepository.GetPlanByPLByDates(planVersion, pl, dateTimeStartTO, dateTimeEndTO, acType));
                //        else
                //            entriesPL.AddRange(_wpPlanRepository.GetFactByPLByDates(planVersion, pl, dateTimeStartTO, dateTimeEndTO, acType));
                //    }
                //    //Сортировка в ресурсе
                //    entriesPL = SortResourcesByWC(entriesPL, resource.Filter, typeReport);

                //    var createResource = CreateRowByPL(dt, dr, start, dateTimeStartTO,
                //        dateTimeEndTO, counter, resource.Value, resource.Name, acType, typeReport, entriesPL);
                //    counter = createResource.counter;
                //    dr = createResource.dr;
                //} //Код для вставки моего плана!!!
                //else
                //{
                var entries        = SortResourcesByWorkType(resource.Entries, resource.WorkTypes);
                var createResource = CreateRow(dt, dr, start, dateTimeStartTO, dateTimeEndTO, counter, resource.Value, resource.Name, entries);
                counter = createResource.counter;
                dr      = createResource.dr;
                //}
            }
        }
Beispiel #6
0
 public BodyBehaviours(ActorBehavioursBase <ACType, ABB> abb)
 {
     this.abb = (ABB)abb;
     this.ac  = abb.ac;
 }
        protected (DataRow dr, int counter) CreateRowByPL(DataTable dt, DataRow dr, DateTime start, DateTime dateTimeStartTO,
                                                          DateTime dateTimeEndTO, int counter, string resource, string resourceName, ACType acType, TypeReport typeReports, List <WPPlanDAO> entriesPL)
        {
            if (typeReports == TypeReport.Plan)
            {
                foreach (var entryPL in entriesPL)
                {
                    dr       = dt.NewRow();
                    dr["id"] = counter;
                    var differenceBetweenTwoStartDates        = dateTimeStartTO.DifferenceBetweenTwoDates(entryPL.StartDate);
                    var differenceBetweenTwoStartDatesInHours = entryPL.StartDate.Date.DifferenceBetweenTwoDatesInHours(entryPL.StartDate);
                    if (differenceBetweenTwoStartDates >= 0 && differenceBetweenTwoStartDatesInHours >= 0)
                    {
                        dr["start"]   = start.AddDays(differenceBetweenTwoStartDates).AddHours(differenceBetweenTwoStartDatesInHours);
                        dr["arrival"] = entryPL.Arrival;
                    }
                    else
                    {
                        dr["start"]   = entryPL.StartDate;
                        dr["arrival"] = entryPL.Arrival;
                    }
                    var differenceBetweenTwoEndDates        = dateTimeStartTO.DifferenceBetweenTwoDates(entryPL.EndDate);
                    var differenceBetweenTwoEndDatesInHours = entryPL.EndDate.Date.DifferenceBetweenTwoDatesInHours(entryPL.EndDate);
                    if (differenceBetweenTwoEndDates >= 0 && differenceBetweenTwoEndDatesInHours >= 0)
                    {
                        dr["end"]       = start.AddDays(differenceBetweenTwoEndDates).AddHours(differenceBetweenTwoEndDatesInHours);
                        dr["departure"] = entryPL.Departure;
                    }
                    else
                    {
                        dr["end"]       = entryPL.EndDate;
                        dr["departure"] = entryPL.Departure;
                    }
                    dr["name"]         = entryPL.Description;
                    dr["resource"]     = resource;
                    dr["color"]        = entryPL.HEXColorACType;
                    dr["wpnoi"]        = entryPL.WPNO_I;
                    dr["wpno"]         = entryPL.WPNO;
                    dr["mhr"]          = entryPL.MHR;
                    dr["bookedMHR"]    = entryPL.BOOKED_MHR;
                    dr["resourceName"] = resourceName;
                    dr["acType"]       = entryPL.AC_TYP;
                    dr["stationName"]  = entryPL.STATION_NAME;
                    dt.Rows.Add(dr);
                    counter++;
                }
            }
            else
            {
                foreach (var entryPL in entriesPL)
                {
                    dr       = dt.NewRow();
                    dr["id"] = counter;
                    var startDate = entryPL.FactStartDate;
                    var endDate   = entryPL.FactEndDate;

                    if (entryPL.FactStartDate == DateTime.MinValue)
                    {
                        startDate = entryPL.StartDate;
                    }

                    if (entryPL.FactEndDate == DateTime.MinValue)
                    {
                        endDate = entryPL.EndDate;
                    }

                    var differenceBetweenTwoStartDates        = dateTimeStartTO.DifferenceBetweenTwoDates(startDate);
                    var differenceBetweenTwoStartDatesInHours = startDate.Date.DifferenceBetweenTwoDatesInHours(startDate);
                    if (differenceBetweenTwoStartDates >= 0 && differenceBetweenTwoStartDatesInHours >= 0)
                    {
                        dr["start"]   = start.AddDays(differenceBetweenTwoStartDates).AddHours(differenceBetweenTwoStartDatesInHours);
                        dr["arrival"] = entryPL.Arrival;
                    }
                    else
                    {
                        dr["start"]   = startDate;
                        dr["arrival"] = entryPL.Arrival;
                    }
                    var differenceBetweenTwoEndDates        = dateTimeStartTO.DifferenceBetweenTwoDates(endDate);
                    var differenceBetweenTwoEndDatesInHours = endDate.Date.DifferenceBetweenTwoDatesInHours(endDate);
                    if (differenceBetweenTwoEndDates >= 0 && differenceBetweenTwoEndDatesInHours >= 0)
                    {
                        dr["end"]       = start.AddDays(differenceBetweenTwoEndDates).AddHours(differenceBetweenTwoEndDatesInHours);
                        dr["departure"] = entryPL.Departure;
                    }
                    else
                    {
                        dr["end"]       = endDate;
                        dr["departure"] = entryPL.Departure;
                    }
                    var mhrFact   = entryPL.BOOKED_MHR != 0 ? $" - {entryPL.BOOKED_MHR} MH" : "";
                    var readiness = entryPL.CONTAINS_C_CHECK ? $"<br/>(готовность {endDate.ToShortDateString()})" : "";
                    var remarks   = !string.IsNullOrEmpty(entryPL.INTERNAL_REMARKS) ? entryPL.INTERNAL_REMARKS + "<br/>" : "<br/>";
                    var name      = $"{remarks}{entryPL.AC_MODEL} {entryPL.AC_REGISTR} {entryPL.Description}{mhrFact} {readiness}";
                    dr["name"]         = name;
                    dr["resource"]     = resource;
                    dr["color"]        = entryPL.HEXColorACType;
                    dr["wpnoi"]        = entryPL.WPNO_I;
                    dr["wpno"]         = entryPL.WPNO;
                    dr["mhr"]          = entryPL.BOOKED_MHR;
                    dr["bookedMHR"]    = entryPL.BOOKED_MHR;
                    dr["resourceName"] = resourceName;
                    dr["acType"]       = entryPL.AC_TYP;
                    dr["stationName"]  = entryPL.STATION_NAME;
                    dt.Rows.Add(dr);
                    counter++;
                }
            }
            return(dr, counter);
        }
        protected string GetWorkPlanReport(DateTime dateTimeStartTO, DateTime dateTimeEndTO, ACType acType, /*TypeReport typeReports,*/ /*int planVersion,*/ bool oneHeader = false)
        {
            string html = "";

            DayPilotScheduler scheduler = new DayPilotScheduler();

            scheduler.HeaderFontSize        = "11px";
            scheduler.HeaderHeight          = 16;
            scheduler.DataStartField        = "start";
            scheduler.ArrivalField          = "arrival";
            scheduler.DataEndField          = "end";
            scheduler.DepartureField        = "departure";
            scheduler.DataTextField         = "name";
            scheduler.DataValueField        = "id";
            scheduler.DataResourceField     = "resource";
            scheduler.EventFontSize         = "10px";
            scheduler.MHRField              = "mhr";
            scheduler.BookedMHRField        = "bookedMHR";
            scheduler.DataResourceNameField = "resourceName";
            scheduler.ACTypeField           = "acType";
            scheduler.WorkTypeField         = "workType";
            scheduler.StationNameField      = "stationName";

            //отображение по дням без вертикальных линий по два часа
            //scheduler.CellDuration = 1440;
            //scheduler.CellWidth = 120;
            //scheduler.EventHeight = 45;
            //scheduler.RowHeaderWidth = 120;
            //scheduler.TwoHeaders = false;

            //отображение по два часа с дополнительным заголовком
            scheduler.CellDuration       = 120;
            scheduler.CellWidth          = 15;
            scheduler.TimeSpendingHeight = 14;
            scheduler.HeightBar          = 4;
            scheduler.EventHeight        = 50 + scheduler.TimeSpendingHeight;
            scheduler.RowHeaderWidth     = 90;

            if (!oneHeader)
            {
                scheduler.TwoHeaders = true;
            }


            scheduler.BeforeEventRender        += new BeforeEventRenderEventHandler(DayPilotScheduler_BeforeEventRender);
            scheduler.EventClickHandling        = DayPilot.Web.Ui.Enums.EventClickHandlingEnum.JavaScript;
            scheduler.TimeRangeSelectedHandling = DayPilot.Web.Ui.Enums.TimeRangeSelectedHandling.Disabled;


            scheduler.CssOnly        = true;
            scheduler.CssClassPrefix = "scheduler_transparent";


            scheduler.TimeFormat = DayPilot.Web.Ui.Enums.TimeFormat.Clock24Hours;


            var entriesHome = new List <WPPlanDAO>()
            {
                new WPPlanDAO()
                {
                    Arrival = new DateTime(2020, 08, 31, 16, 00, 00), Departure = new DateTime(2020, 08, 31, 20, 00, 00), WorkType = WorkType.Optional, Description = "Готовка еды", StartDate = new DateTime(2020, 08, 31, 20, 00, 00),
                    EndDate = new DateTime(2020, 08, 31, 23, 00, 00)
                },
                new WPPlanDAO()
                {
                    WorkType = WorkType.Optional, Description = "Мойка посуды", StartDate = new DateTime(2020, 08, 31, 22, 00, 00), EndDate = new DateTime(2020, 08, 31, 23, 00, 00)
                },
                new WPPlanDAO()
                {
                    WorkType = WorkType.Sleep, Description = "Сон", StartDate = new DateTime(2020, 09, 01, 02, 00, 00), EndDate = new DateTime(2020, 09, 01, 10, 00, 00)
                },
                new WPPlanDAO()
                {
                    WorkType = WorkType.Sleep, Description = "Сон", StartDate = new DateTime(2020, 09, 02, 02, 00, 00), EndDate = new DateTime(2020, 09, 02, 10, 00, 00)
                },
                new WPPlanDAO()
                {
                    WorkType = WorkType.Sleep, Description = "Сон", StartDate = new DateTime(2020, 09, 03, 02, 00, 00), EndDate = new DateTime(2020, 09, 03, 10, 00, 00)
                },
                new WPPlanDAO()
                {
                    WorkType = WorkType.Sleep, Description = "Сон", StartDate = new DateTime(2020, 09, 04, 02, 00, 00), EndDate = new DateTime(2020, 09, 04, 10, 00, 00)
                },
                new WPPlanDAO()
                {
                    WorkType = WorkType.Sleep, Description = "Сон", StartDate = new DateTime(2020, 09, 05, 02, 00, 00), EndDate = new DateTime(2020, 09, 05, 10, 00, 00)
                },
                new WPPlanDAO()
                {
                    WorkType = WorkType.Primary, Description = "Задача 1 в блокноте", StartDate = new DateTime(2020, 09, 01, 10, 00, 00), EndDate = new DateTime(2020, 09, 01, 12, 00, 00)
                },
                new WPPlanDAO()
                {
                    WorkType = WorkType.Primary, Description = "Задача 2 в блокноте", StartDate = new DateTime(2020, 09, 01, 12, 00, 00), EndDate = new DateTime(2020, 09, 01, 20, 00, 00)
                },
                new WPPlanDAO()
                {
                    WorkType = WorkType.Primary, Description = "Подготовка к собеседованиям", StartDate = new DateTime(2020, 08, 01, 12, 00, 00), EndDate = new DateTime(2020, 09, 20, 20, 00, 00)
                },
                new WPPlanDAO()
                {
                    WorkType = WorkType.Primary, Description = "Переделать проект", StartDate = new DateTime(2020, 08, 01, 12, 00, 00), EndDate = new DateTime(2020, 09, 03, 20, 00, 00)
                }
            };

            var entriesWork = new List <WPPlanDAO>()
            {
                new WPPlanDAO()
                {
                    WorkType = WorkType.Primary, Description = "Задача 789", StartDate = new DateTime(2020, 09, 01, 10, 00, 00), EndDate = new DateTime(2020, 09, 01, 12, 00, 00)
                },
                new WPPlanDAO()
                {
                    WorkType = WorkType.Primary, Description = "Задача 700", StartDate = new DateTime(2020, 09, 01, 12, 00, 00), EndDate = new DateTime(2020, 09, 01, 20, 00, 00)
                },
                new WPPlanDAO()
                {
                    WorkType = WorkType.Primary, Description = "Задача 56", StartDate = new DateTime(2020, 08, 01, 12, 00, 00), EndDate = new DateTime(2020, 09, 20, 20, 00, 00)
                },
                new WPPlanDAO()
                {
                    WorkType = WorkType.Optional, Description = "Задача 53", StartDate = new DateTime(2020, 08, 01, 12, 00, 00), EndDate = new DateTime(2020, 09, 03, 20, 00, 00)
                }
            };

            var listResources = new List <Resource>()
            {
                new Resource("Дом", "A", entriesHome, new List <WorkType> {
                    WorkType.Sleep, WorkType.Primary, WorkType.Optional
                }),
                new Resource("Работа", "B", entriesWork, new List <WorkType> {
                    WorkType.Sleep, WorkType.Optional, WorkType.Primary
                }),
            };

            foreach (var resource in listResources)
            {
                scheduler.Resources.Add(resource);
            }

            scheduler.StartDate = dateTimeStartTO;
            //scheduler.Days = 5;// DateTime.DaysInMonth(DateTime.Today.Year, DateTime.Today.Month);
            scheduler.Days = (int)dateTimeStartTO.DifferenceBetweenTwoDatesAbs(dateTimeEndTO) + 1;

            var dataTable = CreateDataTableColumns();

            CreateDataTable(scheduler.StartDate, dateTimeStartTO, dateTimeEndTO, null, dataTable, scheduler.Days, acType, /*typeReports, planVersion,*/ listResources);

            scheduler.DataSource = dataTable;

            //scheduler.DataSource = GetSchedulerData();
            scheduler.DataBind();

            var sb = new StringBuilder();
            var sw = new StringWriter(sb);

            using (var htmlWriter = new HtmlTextWriter(sw))
            {
                scheduler.RenderControl(htmlWriter);
                //2 - чтобы влезало
                ReportWidth = scheduler.GridWidth + scheduler.RowHeaderWidth + 5;
                //+ подпись
                ReportHeight           = scheduler.GridHeight + 40 + 52;
                ReportRowHeadersWeight = scheduler.RowHeaderWidth;
                html = sb.ToString();
            }

            return(html);
        }
        // Looks for Stackable Properties on item, and sets local variables to count the total bonus.
        // Also links any found AC bonuses/penalties to poly.
        Effect ExamineStackableProperties(uint pc, Effect poly, uint item)
        {
            if (!GetIsObjectValid(item))
            {
                return(poly);                         // If not valid, don't do any unnecessary work.
            }
            ItemProperty ip = GetFirstItemProperty(item);

            while (GetIsItemPropertyValid(ip)) // Loop through all the item properties
            {
                if (GetIsStackingProperty(ip)) // See if it's a stacking property
                {
                    int subType = GetItemPropertySubType(ip);
                    // This contains whether a bonus is str, dex,
                    // concentration skill, universal saving throws, etc.

                    // In the case of AC modifiers, add it directly to the Polymorphing effect.
                    // For the other cases, set local variables on the player to
                    // make a sum of all the bonuses/penalties. We use local
                    // variables here because there are no arrays in NWScript, and
                    // declaring a variable for every skill, ability type and saving
                    // throw type in here is a little overboard.
                    if (GetItemPropertyType(ip) == ItemPropertyType.AbilityBonus) // Which type of property is it?
                    {
                        SetLocalInt(pc, "ws_ability_" + IntToString(subType), GetLocalInt(pc, "ws_ability_" + IntToString(subType)) + GetItemPropertyCostTableValue(ip));
                    }
                    else if (GetItemPropertyType(ip) == ItemPropertyType.ACBonus)
                    {
                        poly = EffectLinkEffects(EffectACIncrease(GetItemPropertyCostTableValue(ip), GetItemACType(item), ACType.VsDamageTypeAll), poly);
                    }
                    else if (GetItemPropertyType(ip) == ItemPropertyType.DecreasedAbilityScore)
                    {
                        SetLocalInt(pc, "ws_ability_" + IntToString(subType), GetLocalInt(pc, "ws_ability_" + IntToString(subType)) - GetItemPropertyCostTableValue(ip));
                    }
                    else if (GetItemPropertyType(ip) == ItemPropertyType.DecreasedAbilityScore)
                    {
                        int value = GetItemPropertyCostTableValue(ip);
                        ItemPropertyArmorClassModifierType modifyType = ItemPropertyArmorClassModifierType.Dodge;
                        ACType damageType  = ACType.VsDamageTypeAll;
                        Effect childEffect = EffectACDecrease(value, modifyType, damageType);
                        poly = EffectLinkEffects(childEffect, poly);
                    }
                    else if (GetItemPropertyType(ip) == ItemPropertyType.SkillBonus)
                    {
                        SetLocalInt(pc, "ws_skill_" + IntToString(subType), GetLocalInt(pc, "ws_skill_" + IntToString(subType)) + GetItemPropertyCostTableValue(ip));
                    }
                    else if (GetItemPropertyType(ip) == ItemPropertyType.DecreasedSkillModifier)
                    {
                        SetLocalInt(pc, "ws_skill_" + IntToString(subType), GetLocalInt(pc, "ws_skill_" + IntToString(subType)) - GetItemPropertyCostTableValue(ip));
                    }
                    else if (GetItemPropertyType(ip) == ItemPropertyType.SavingThrowBonus)
                    {
                        SetLocalInt(pc, "ws_save_elem_" + IntToString(subType), GetLocalInt(pc, "ws_save_elem_" + IntToString(subType)) + GetItemPropertyCostTableValue(ip));
                    }
                    else if (GetItemPropertyType(ip) == ItemPropertyType.SavingThrowBonusSpecific)
                    {
                        SetLocalInt(pc, "ws_save_spec_" + IntToString(subType), GetLocalInt(pc, "ws_save_spec_" + IntToString(subType)) + GetItemPropertyCostTableValue(ip));
                    }
                    else if (GetItemPropertyType(ip) == ItemPropertyType.DecreasedSavingThrows)
                    {
                        SetLocalInt(pc, "ws_save_elem_" + IntToString(subType), GetLocalInt(pc, "ws_save_elem_" + IntToString(subType)) - GetItemPropertyCostTableValue(ip));
                    }
                    else if (GetItemPropertyType(ip) == ItemPropertyType.DecreasedSavingThrowsSpecific)
                    {
                        SetLocalInt(pc, "ws_save_spec_" + IntToString(subType), GetLocalInt(pc, "ws_save_spec_" + IntToString(subType)) - GetItemPropertyCostTableValue(ip));
                    }
                    else if (GetItemPropertyType(ip) == ItemPropertyType.Regeneration)
                    {
                        SetLocalInt(pc, "ws_regen", GetLocalInt(OBJECT_SELF, "ws_regen") + GetItemPropertyCostTableValue(ip));
                    }
                    else if (GetItemPropertyType(ip) == ItemPropertyType.ImmunityDamageType)
                    {
                        SetLocalInt(pc, "ws_dam_immun_" + IntToString(subType), GetLocalInt(pc, "ws_dam_immun_" + IntToString(subType)) + ConvertNumToImmunePercentage(GetItemPropertyCostTableValue(ip)));
                    }
                    else if (GetItemPropertyType(ip) == ItemPropertyType.DamageVulnerability)
                    {
                        SetLocalInt(pc, "ws_dam_immun_" + IntToString(subType), GetLocalInt(pc, "ws_dam_immun_" + IntToString(subType)) - ConvertNumToImmunePercentage(GetItemPropertyCostTableValue(ip)));
                    }
                }
                ip = GetNextItemProperty(item);
            }
            return(poly);
        }