Example #1
0
 public DistanceGroup(DistanceGroupAmount amount, int chipNumber = 0)
 {
     _Amount     = amount;
     _ChipNumber = chipNumber;
     _Members    = new List <Person>();
     _MaxMembers = EnumCasters.FromDistanceGroupAmount(Amount);
 }
Example #2
0
        public static void GroupNotFullAlert(int grIndex, DistanceGroupAmount grAmount)
        {
            string title = "Неполная группа";
            string msg   = EnumCasters.GroupAmountStringRepresent(grAmount) + " под номером " + grIndex + " не полная!";

            AlertMsg(msg, title);
        }
Example #3
0
        public static void StartProtocol2Generate()
        {
            DistanceGroupAmount amount  = DistanceGroupAmount.Two;
            List <string>       headers = Settings.StartProtOptions.StartProtGroup2.ChoosedHeaders;
            StartTimer          timer   = new StartTimer(Globals.Options.FirstStartTime2, Globals.Options.StartInterval2);

            StartProtocolGenerate(amount, timer, headers);
        }
        //constructors
        public StartProtocolGenerator(DistanceGroupAmount type, StartTimer timer)
        {
            this.grAmount = type;
            this.LHeaders = Globals.Options.startProtocolHeaders1;
            this.timer    = timer;

            string typeRepresent = EnumCasters.GroupAmountStringRepresent(GrAmount);

            SheetName = Globals.SheetNames.StartProtocol + " (" + typeRepresent + ")";
        }
Example #5
0
        private static void StartProtocolGenerate(DistanceGroupAmount amnt, StartTimer timer, List <string> lHeaders = null)
        {
            //all distances
            List <Distance> lDistances = База.DbList;

            //get all protocol variants
            Dictionary <DistanceLevels, List <DistanceGroupType> > lVariants = new Dictionary <DistanceLevels, List <DistanceGroupType> >();

            foreach (Distance d in lDistances)
            {
                DistanceLevels level = d.Level;
                if (!lVariants.ContainsKey(level))
                {
                    lVariants.Add(level, new List <DistanceGroupType>());
                }

                foreach (KeyValuePair <Structs.GroupIndexAmountStruct, DistanceGroup> kvPair in d.Groups)
                {
                    if (!lVariants[level].Contains(kvPair.Value.Type))
                    {
                        lVariants[level].Add(kvPair.Value.Type);
                    }
                }
            }

            //generate protocol for each distance type
            foreach (KeyValuePair <DistanceLevels, List <DistanceGroupType> > kvPair in lVariants)
            {
                foreach (DistanceGroupType type in kvPair.Value)
                {
                    Distance distance = База.GetOneDistance(amnt, kvPair.Key, type);

                    if (distance.Groups.Count > 0)
                    {
                        string nameSuffix = kvPair.Key.ToString() + "_" + EnumCasters.GroupTypeStringRepresent(type);

                        StartProtocolGenerator generator = new StartProtocolGenerator(amnt, timer);

                        if (lHeaders != null)
                        {
                            generator.LHeaders = lHeaders;
                        }

                        generator.Create(distance, suffix: nameSuffix);

                        timer.Reset();
                    }
                }
            }
        }
Example #6
0
        public static int FromDistanceGroupAmount(DistanceGroupAmount am)
        {
            switch (am)
            {
            case DistanceGroupAmount.One:
                return(1);

            case DistanceGroupAmount.Two:
                return(2);

            case DistanceGroupAmount.Four:
                return(4);

            case DistanceGroupAmount.Six:
                return(6);

            default:
                return(0);
            }
        }
Example #7
0
        public static string GroupAmountStringRepresent(DistanceGroupAmount amnt)
        {
            switch (amnt)
            {
            case DistanceGroupAmount.Four:
                return("Группа (4)");

            case DistanceGroupAmount.One:
                return("Личка");

            case DistanceGroupAmount.Six:
                return("Группа (6)");

            case DistanceGroupAmount.Two:
                return("Связка");

            default:
                throw new ArgumentException("Not valid argument", nameof(amnt));
            }
        }
Example #8
0
 public GroupIndexAmountStruct(int groupIndex, DistanceGroupAmount amnt)
 {
     this.GroupIndex = groupIndex;
     this.Amnt       = amnt;
 }