Ejemplo n.º 1
0
        public LimitationDTO GetLimitationByUserId(int id)
        {
            Limitation    limitation    = repository.GetItemByUserId(id);
            LimitationDTO limitationDTO = _mapper.Map <LimitationDTO>(limitation);

            return(limitationDTO);
        }
        // Token: 0x060007B3 RID: 1971 RVA: 0x0003728C File Offset: 0x0003548C
        public Dictionary <string, string> GetNetworkDeviceTypes(List <int> limitationIDs)
        {
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            using (SqlCommand textCommand = SqlHelper.GetTextCommand(Limitation.LimitSQL(" SELECT Vendor + '%' AS Value, '' AS Name \r\n FROM Nodes \r\n WHERE (Vendor <> '')  \r\n GROUP BY Vendor HAVING (Count(Vendor) > 1) \r\n UNION\r\n SELECT MachineType AS Value, MachineType AS Name \r\n FROM Nodes\r\n WHERE MachineType <> '' \r\n GROUP BY MachineType ", limitationIDs)))
            {
                using (IDataReader dataReader = SqlHelper.ExecuteReader(textCommand))
                {
                    int    ordinal  = dataReader.GetOrdinal("Value");
                    int    ordinal2 = dataReader.GetOrdinal("Name");
                    string libcode_VB0_;
                    using (LocaleThreadState.EnsurePrimaryLocale())
                    {
                        libcode_VB0_ = Resources.LIBCODE_VB0_61;
                        goto IL_97;
                    }
IL_53:
                    string text = dataReader.GetString(ordinal2);
                    string @string = dataReader.GetString(ordinal);
                    text = ((!string.IsNullOrEmpty(text)) ? text : string.Format(libcode_VB0_, @string.Substring(0, @string.Length - 1)));
                    dictionary.Add(@string, text);
IL_97:
                    if (dataReader.Read())
                    {
                        goto IL_53;
                    }
                }
            }
            return(dictionary);
        }
    // Starting a new game session
    public void StartSession(FieldTarget sessionType, Limitation limitationType)
    {
        StopAllCoroutines();                    // Ending of all current coroutines
        AudioAssistant.main.PlayMusic("Field"); // Running music

        switch (limitationType)                 // Start corresponding coroutine depending on the limiation mode
        {
        case Limitation.Moves: StartCoroutine(MovesLimitation()); break;

        case Limitation.Time: StartCoroutine(TimeLimitation()); break;
        }

        switch (sessionType)           // Start corresponding coroutine depending on the target level
        {
        case FieldTarget.Score: StartCoroutine(ScoreSession()); break;

        case FieldTarget.Jelly: StartCoroutine(JellySession()); break;

        case FieldTarget.Block: StartCoroutine(BlockSession()); break;

        case FieldTarget.Color: StartCoroutine(ColorSession()); break;

        case FieldTarget.SugarDrop: StartCoroutine(SugarDropSession()); break;
        }

        StartCoroutine(BaseSession());             // Base routine of game session
        StartCoroutine(ShowingHintRoutine());      // Coroutine display hints
        StartCoroutine(ShuffleRoutine());          // Coroutine of mixing chips at the lack moves
        StartCoroutine(FindingSolutionsRoutine()); // Coroutine of finding a solution and destruction of existing combinations of chips
        StartCoroutine(IllnessRoutine());          // Coroutine of Weeds logic
    }
Ejemplo n.º 4
0
        public DataTransferObject.SystemSetting.CompanyGroup.CompanyGroupView QueryCompanyGroup(Guid companyGroup)
        {
            var    result = new DataTransferObject.SystemSetting.CompanyGroup.CompanyGroupView();
            string sql    = "SELECT [T_CompanyGroup].[Name],[T_CompanyGroup].[Description],[T_CompanyGroup].[PurchaseMyPolicyOnly],[T_PurchaseMyPolicyOnlyLimitation].[Airlines]," +
                            "[T_PurchaseMyPolicyOnlyLimitation].[Departures],[T_PurchaseMyPolicyOnlyLimitation].[PurchaseNone],[T_PurchaseMyPolicyOnlyLimitation].[PolicyRebate]" +
                            "FROM [T_CompanyGroup] INNER JOIN [T_PurchaseMyPolicyOnlyLimitation] ON [T_CompanyGroup].[Id]=[T_PurchaseMyPolicyOnlyLimitation].[GroupId] WHERE [T_CompanyGroup].[Id]=@Id";

            using (var dbOperator = new DbOperator(Provider, ConnectionString)) {
                dbOperator.AddParameter("Id", companyGroup);
                using (var reader = dbOperator.ExecuteReader(sql)) {
                    var model = new List <Limitation>();
                    while (reader.Read())
                    {
                        result.Name                 = reader.GetString(0);
                        result.Description          = reader.IsDBNull(1) ? string.Empty : reader.GetString(1);
                        result.PurchaseMyPolicyOnly = reader.GetBoolean(2);
                        Limitation limit = new Limitation();
                        limit.Airlines   = reader.GetString(3).Split(new char[] { ',' });
                        limit.Departures = reader.GetString(4).Split(new char[] { ',' });
                        limit.PurchaseMyPolicyOnlyForNonePolicy = reader.GetBoolean(5);
                        if (!reader.IsDBNull(6))
                        {
                            limit.DefaultRebateForNonePolicy = reader.GetDecimal(6);
                        }
                        model.Add(limit);
                    }
                    result.Limitations = model;
                }
            }
            return(result);
        }
Ejemplo n.º 5
0
        public ActionResult DeleteConfirmed(int id)
        {
            Limitation limitation = db.Limitations.Find(id);

            db.Limitations.Remove(limitation);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
 public APIRestrictionParallel(FTClient client, Limitation lmt, Func <TRequest, Task <bool> > reqFunc, Func <Task <int> > getQuota = null)
 {
     this.client = client;
     limitation  = lmt;
     GetQuota    = getQuota;
     ReqFunc     = reqFunc;
     reqQueue.CollectionChanged += ReqQueue_CollectionChanged;
     Start();
 }
Ejemplo n.º 7
0
        public static DataTable GetEventTypesTable()
        {
            DataTable dataTable = (DataTable)null;

            using (SqlCommand textCommand = SqlHelper.GetTextCommand(Limitation.LimitSQL("SELECT DISTINCT Name, EventType FROM EventTypes ORDER BY Name", Array.Empty <Limitation>())))
                dataTable = SqlHelper.ExecuteDataTable(textCommand);
            dataTable.TableName = "EventTypesTable";
            return(dataTable);
        }
Ejemplo n.º 8
0
        public void Test_NotReducedWithLimitations()
        {
            double[] expectedSolution = new double[]
            {
                1.0000000000000009,
                1,
                0.9999999999999994,
                1,
                0.9999999999999996,
                1,
                -6.000000000000001
            };
            Result expected = new Result(expectedSolution, false);

            #region Init Params
            int      count = 7;
            double[] Ii    = { 1, 1, 1, 1, 1, 1, 1 };
            double[] w     = { 0.2, 0.121, 0.683, 0.04, 0.102, 0.081, 0.02 };
            double[] d     =
            {
                10.0054919341489,
                3.03265795024749,
                6.83122010827837,
                1.98478460320379,
                5.09293357450987,
                4.05721328676762,
                0.991215230484718
            };
            double[]   b = { 0, 0, 0 };
            double[][] A =
            {
                new double[] { 1, 1, 1,  1,  1,  1,  1 },
                new double[] { 0, 0, 1, -1, -1,  0,  0 },
                new double[] { 0, 0, 0,  0,  1, -1, -1 }
            };

            Limitation[] limitations = new Limitation[]
            {
                new Limitation(1, 1),
                new Limitation(1, 1),
                new Limitation(1, 1),
                new Limitation(1, 1),
                new Limitation(1, 1),
                new Limitation(1, 1),
                new Limitation(1, 1),
            };

            ForSolver data = new ForSolver(count, Ii, w, d, b, A, null, limitations);
            #endregion

            SolverController controller = new SolverController();
            Result           res        = controller.Solve(data);

            Assert.AreEqual(expected.reduced, res.reduced);
            Assert.That(expected.solution, Is.EqualTo(res.solution).Within(0.1));
        }
        public void DeleteLimitation(int id)
        {
            Limitation limitation = db.Limitations.Find(id);

            if (limitation != null)
            {
                db.Limitations.Remove(limitation);
                db.SaveChangesAsync();
            }
        }
        public Limitation Create(Limitation limitation)
        {
            if (context.Limitations.Where(x => x.Identifier != null && x.Identifier == limitation.Identifier).Count() == 0)
            {
                limitation.Id = 0;

                limitation.Active = true;

                limitation.UpdatedAt = DateTime.Now;
                limitation.CreatedAt = DateTime.Now;

                context.Limitations.Add(limitation);
                return(limitation);
            }
            else
            {
                Limitation dbEntry = context.Limitations
                                     .FirstOrDefault(x => x.Identifier == limitation.Identifier && x.Active == true);

                if (dbEntry != null)
                {
                    dbEntry.CompanyId   = limitation.CompanyId ?? null;
                    dbEntry.CreatedById = limitation.CreatedById ?? null;

                    // Set properties
                    dbEntry.ConstructionSiteLimit = limitation.ConstructionSiteLimit;
                    dbEntry.BusinessPartnerConstructionSiteLimit = limitation.BusinessPartnerConstructionSiteLimit;
                    dbEntry.EmployeeConstructionSiteLimit        = limitation.EmployeeConstructionSiteLimit;
                    dbEntry.EmployeeBusinessPartnerLimit         = limitation.EmployeeBusinessPartnerLimit;
                    dbEntry.EmployeeBirthdayLimit = limitation.EmployeeBirthdayLimit;

                    dbEntry.EmployeePassportLimit     = limitation.EmployeePassportLimit;
                    dbEntry.EmployeeEmbasyLimit       = limitation.EmployeeEmbasyLimit;
                    dbEntry.EmployeeVisaTakeOffLimit  = limitation.EmployeeVisaTakeOffLimit;
                    dbEntry.EmployeeVisaLimit         = limitation.EmployeeVisaLimit;
                    dbEntry.EmployeeWorkLicenceLimit  = limitation.EmployeeWorkLicenceLimit;
                    dbEntry.EmployeeDriveLicenceLimit = limitation.EmployeeDriveLicenceLimit;
                    dbEntry.EmployeeEmbasyFamilyLimit = limitation.EmployeeEmbasyFamilyLimit;

                    dbEntry.PersonPassportLimit     = limitation.PersonPassportLimit;
                    dbEntry.PersonEmbasyLimit       = limitation.PersonEmbasyLimit;
                    dbEntry.PersonVisaTakeOffLimit  = limitation.PersonVisaTakeOffLimit;
                    dbEntry.PersonVisaLimit         = limitation.PersonVisaLimit;
                    dbEntry.PersonWorkLicenceLimit  = limitation.PersonWorkLicenceLimit;
                    dbEntry.PersonDriveLicenceLimit = limitation.PersonDriveLicenceLimit;
                    dbEntry.PersonEmbasyFamilyLimit = limitation.PersonEmbasyFamilyLimit;

                    // Set timestamp
                    dbEntry.UpdatedAt = DateTime.Now;
                }

                return(dbEntry);
            }
        }
Ejemplo n.º 11
0
 public ActionResult Edit([Bind(Include = "ID,Name,SystemID,Description,AreaID")] Limitation limitation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(limitation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AreaID   = new SelectList(db.Areas, "ID", "Name", limitation.AreaID);
     ViewBag.SystemID = new SelectList(db.HomeSystems, "ID", "Name", limitation.SystemID);
     return(View(limitation));
 }
Ejemplo n.º 12
0
        // TODO Сделать разделение по приложениям
        Task LoadLimitation()
        {
            return(Task.Factory.StartNew(async() =>
            {
                try
                {
                    Logger.WriteLine("LoadLimitation : start");
                    Device.BeginInvokeOnMainThread(delegate
                    {
                        descriptionLabel.Text = "Загрузка ограничений";
                    });
                    string limit = "";

                    try
                    {
                        limit = MobileStaticVariables.WebUtils.SendSystemRequest("Limitations", "");
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteError(ex);
                        throw ex;
                    }
                    Logger.WriteLine("limit : " + limit);
                    if (limit == "")
                    {
                        throw new Exception("Не удалось получить limit");
                    }

                    Limitation deserialized = new Limitation();
                    if (limit != "")
                    {
                        deserialized = JsonConvert.DeserializeObject <Limitation>(limit);
                    }
                    deserialized.LoadLimitation();
                    isLimitationLoad = true;
                    Logger.WriteLine("LoadLimitation : end");
                }
                catch (Exception ex)
                {
                    Logger.WriteError(ex);
                    if (!_isDatabaseLoad)
                    {
                        if (needDisplayAlert)
                        {
                            needDisplayAlert = false;
                            await DisplayAlert("Внимание", "Не удалось подключиться", "Продолжить");
                        }
                        await LoadLimitation();
                    }
                }
            }));
        }
Ejemplo n.º 13
0
        public void Create(User item)
        {
            dbContext.Set <User>().Add(item);
            dbContext.SaveChanges();

            Limitation limitation = new Limitation();

            limitation.Limit  = 10000;
            limitation.UserId = item.Id;

            dbContext.Set <Limitation>().Add(limitation);
            dbContext.SaveChanges();
        }
Ejemplo n.º 14
0
        // GET: Limitations/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Limitation limitation = db.Limitations.Find(id);

            if (limitation == null)
            {
                return(HttpNotFound());
            }
            return(View(limitation));
        }
Ejemplo n.º 15
0
        // GET: Limitations/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Limitation limitation = db.Limitations.Find(id);

            if (limitation == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AreaID   = new SelectList(db.Areas, "ID", "Name", limitation.AreaID);
            ViewBag.SystemID = new SelectList(db.HomeSystems, "ID", "Name", limitation.SystemID);
            return(View(limitation));
        }
Ejemplo n.º 16
0
        public List <string> GetAllVendors(List <int> limitationIDs)
        {
            List <string> stringList = new List <string>();

            using (SqlCommand textCommand = SqlHelper.GetTextCommand(Limitation.LimitSQL("SELECT DISTINCT Vendor \r\n From Nodes WHERE (Vendor <> '')", (IEnumerable <int>)limitationIDs)))
            {
                using (IDataReader dataReader = SqlHelper.ExecuteReader(textCommand))
                {
                    while (dataReader.Read())
                    {
                        stringList.Add(DatabaseFunctions.GetString(dataReader, "Vendor"));
                    }
                }
            }
            return(stringList);
        }
Ejemplo n.º 17
0
        public static Boolean TryParse(HttpResponseMessage response, out Limitation limitation)
        {
            limitation = null;

            try
            {
                if (response != null)
                {
                    limitation = new Limitation(response);
                }
            }
            catch (Exception exception)
            {
                System.Diagnostics.Debug.WriteLine(exception);
            }

            return(limitation != null);
        }
Ejemplo n.º 18
0
        public static DataTable GetEventSummaryTable(
            int netObjectID,
            string netObjectType,
            DateTime fromDate,
            DateTime toDate,
            List <int> limitationIDs)
        {
            DataTable dataTable = (DataTable)null;

            using (SqlCommand textCommand = SqlHelper.GetTextCommand(string.Empty))
            {
                StringBuilder stringBuilder = new StringBuilder("SELECT Events.EventType as EventType, EventTypes.Name as Name, EventTypes.BackColor as BackColor, Count(Events.EventType) as Total  \r\n                                                        FROM EventTypes \r\n                                                        INNER JOIN Events WITH(NOLOCK) ON EventTypes.EventType = Events.EventType\r\n                                                        LEFT JOIN NodesData WITH(NOLOCK) ON Events.NetworkNode = NodesData.NodeID \r\n                                                        LEFT JOIN NodesCustomProperties WITH(NOLOCK) ON Events.NetworkNode = NodesCustomProperties.NodeID \r\n                                                        WHERE Events.Acknowledged='false' \r\n                                                        AND Events.EventTime >= @fromDate AND Events.EventTime <= @toDate ");
                textCommand.Parameters.Add(new SqlParameter("@fromDate", (object)fromDate));
                textCommand.Parameters.Add(new SqlParameter("@toDate", (object)toDate));
                if (netObjectID >= 0 && !string.IsNullOrEmpty(netObjectType) && netObjectType.Equals("N", StringComparison.OrdinalIgnoreCase))
                {
                    stringBuilder.Append(" AND ((Events.NetObjectID=@netObjectID AND Events.NetObjectType LIKE @netObjectType) OR Events.NetworkNode=@netObjectID)");
                    textCommand.Parameters.Add(new SqlParameter("@netObjectID", (object)netObjectID));
                    textCommand.Parameters.Add(new SqlParameter("@netObjectType", (object)netObjectType));
                }
                else
                {
                    if (netObjectID >= 0)
                    {
                        stringBuilder.Append(" AND Events.NetObjectID=@netObjectID");
                        textCommand.Parameters.Add(new SqlParameter("@netObjectID", (object)netObjectID));
                    }
                    if (!string.IsNullOrEmpty(netObjectType))
                    {
                        stringBuilder.Append(" AND Events.NetObjectType LIKE @netObjectType");
                        SqlParameterCollection parameters   = textCommand.Parameters;
                        SqlParameter           sqlParameter = new SqlParameter("@netObjectType", SqlDbType.VarChar, 10);
                        sqlParameter.Value = (object)netObjectType;
                        parameters.Add(sqlParameter);
                    }
                }
                stringBuilder.Append(" GROUP BY Events.EventType, EventTypes.Name, EventTypes.BackColor ORDER BY Events.EventType");
                textCommand.CommandText = Limitation.LimitSQL(stringBuilder.ToString(), (IEnumerable <int>)limitationIDs);
                dataTable = SqlHelper.ExecuteDataTable(textCommand);
            }
            dataTable.TableName = "EventSummaryTable";
            return(dataTable);
        }
Ejemplo n.º 19
0
    public void Construct(Limitation lim)
    {
        if (lim == Limitation.Moves)
        {
            _toggleMoves.isOn = true;

            _toggleTime.isOn = false;

            ActiveTimePanel(false);
        }
        else
        {
            _toggleMoves.isOn = false;

            _toggleTime.isOn = true;

            ActiveTimePanel(true);
        }
    }
Ejemplo n.º 20
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            if (HasUserAlreadyVoted())
            {
                this.Controls.Add(new LiteralControl("<br/>Vous avez déjà répondu à cette question."));
            }
            else if (!Strings.IsNullOrEmpty(((( RadioButtonList )this.Controls[5]).SelectedValue)))
            {
                Limitation limitation = new Limitation(SessionState.Questionnaire.MembreGUID);
                if (limitation.LimitesReponses)
                {
                    Context.Response.Redirect(Tools.PageErreurPath + "Désolé mais le nombre de réponses pour ce questionnaire est atteinte.", true);
                }

                PollVote pv = new PollVote();
                pv.PollQuestionID  = SessionState.Question.PollQuestionId;
                pv.PollAnswerId    = new Guid((( RadioButtonList )this.Controls[5]).SelectedValue);
                pv.UserGUID        = SessionState.Personne.PersonneGUID;
                pv.QuestionnaireID = SessionState.Question.QuestionnaireID;
                pv.CreationDate    = DateTime.Now;
                PollVote.Create(pv);

                // Le questionnaire est termine
                if (SessionState.CurrentQuestionIndex == SessionState.Questions.Count - 1)
                {
                    SessionState.Questionnaire = null;
                    Page.Response.Redirect("~/Poll/Termine.aspx", true);
                }

                // Passer a la question suivante
                SessionState.CurrentQuestionIndex += 1;
                SessionState.Question              = SessionState.Questions[SessionState.CurrentQuestionIndex];
                SessionState.Reponses              = PollAnswerCollection.GetByPollQuestionID(SessionState.Question.PollQuestionId);
                this.Controls.Clear();
                CreateControls();
            }
            else
            {
                this.Controls.Add(new LiteralControl("<br/>Merci de répondre à la question."));
            }
        }
        public LimitationResponse Create(LimitationViewModel limitation)
        {
            LimitationResponse response = new LimitationResponse();

            try
            {
                Limitation addedLimitation = unitOfWork.GetLimitationRepository().Create(limitation.ConvertToLimitation());
                unitOfWork.Save();

                response.Limitation = addedLimitation.ConvertToLimitationViewModel();
                response.Success    = true;
            }
            catch (Exception ex)
            {
                response.Limitation = new LimitationViewModel();
                response.Success    = false;
                response.Message    = ex.Message;
            }

            return(response);
        }
Ejemplo n.º 22
0
        public static LimitationViewModel ConvertToLimitationViewModel(this Limitation limitation)
        {
            LimitationViewModel limitationViewModel = new LimitationViewModel()
            {
                Id         = limitation.Id,
                Identifier = limitation.Identifier,

                ConstructionSiteLimit = limitation.ConstructionSiteLimit,
                BusinessPartnerConstructionSiteLimit = limitation.BusinessPartnerConstructionSiteLimit,
                EmployeeConstructionSiteLimit        = limitation.EmployeeConstructionSiteLimit,
                EmployeeBusinessPartnerLimit         = limitation.EmployeeBusinessPartnerLimit,
                EmployeeBirthdayLimit = limitation.EmployeeBirthdayLimit,

                EmployeePassportLimit     = limitation.EmployeePassportLimit,
                EmployeeEmbasyLimit       = limitation.EmployeeEmbasyLimit,
                EmployeeVisaTakeOffLimit  = limitation.EmployeeVisaTakeOffLimit,
                EmployeeVisaLimit         = limitation.EmployeeVisaLimit,
                EmployeeWorkLicenceLimit  = limitation.EmployeeWorkLicenceLimit,
                EmployeeDriveLicenceLimit = limitation.EmployeeDriveLicenceLimit,
                EmployeeEmbasyFamilyLimit = limitation.EmployeeEmbasyFamilyLimit,

                PersonPassportLimit     = limitation.PersonPassportLimit,
                PersonEmbasyLimit       = limitation.PersonEmbasyLimit,
                PersonVisaTakeOffLimit  = limitation.PersonVisaTakeOffLimit,
                PersonVisaLimit         = limitation.PersonVisaLimit,
                PersonWorkLicenceLimit  = limitation.PersonWorkLicenceLimit,
                PersonDriveLicenceLimit = limitation.PersonDriveLicenceLimit,
                PersonEmbasyFamilyLimit = limitation.PersonEmbasyFamilyLimit,

                IsActive = limitation.Active,

                CreatedBy = limitation.CreatedBy?.ConvertToUserViewModelLite(),
                Company   = limitation.Company?.ConvertToCompanyViewModelLite(),

                UpdatedAt = limitation.UpdatedAt,
                CreatedAt = limitation.CreatedAt
            };

            return(limitationViewModel);
        }
Ejemplo n.º 23
0
        public static Limitation ConvertToLimitation(this LimitationViewModel limitationViewModel)
        {
            Limitation limitation = new Limitation()
            {
                Id         = limitationViewModel.Id,
                Identifier = limitationViewModel.Identifier,

                ConstructionSiteLimit = limitationViewModel.ConstructionSiteLimit,
                BusinessPartnerConstructionSiteLimit = limitationViewModel.BusinessPartnerConstructionSiteLimit,
                EmployeeConstructionSiteLimit        = limitationViewModel.EmployeeConstructionSiteLimit,
                EmployeeBusinessPartnerLimit         = limitationViewModel.EmployeeBusinessPartnerLimit,
                EmployeeBirthdayLimit = limitationViewModel.EmployeeBirthdayLimit,

                EmployeePassportLimit     = limitationViewModel.EmployeePassportLimit,
                EmployeeEmbasyLimit       = limitationViewModel.EmployeeEmbasyLimit,
                EmployeeVisaTakeOffLimit  = limitationViewModel.EmployeeVisaTakeOffLimit,
                EmployeeVisaLimit         = limitationViewModel.EmployeeVisaLimit,
                EmployeeWorkLicenceLimit  = limitationViewModel.EmployeeWorkLicenceLimit,
                EmployeeDriveLicenceLimit = limitationViewModel.EmployeeDriveLicenceLimit,
                EmployeeEmbasyFamilyLimit = limitationViewModel.EmployeeEmbasyFamilyLimit,

                PersonPassportLimit     = limitationViewModel.PersonPassportLimit,
                PersonEmbasyLimit       = limitationViewModel.PersonEmbasyLimit,
                PersonVisaTakeOffLimit  = limitationViewModel.PersonVisaTakeOffLimit,
                PersonVisaLimit         = limitationViewModel.PersonVisaLimit,
                PersonWorkLicenceLimit  = limitationViewModel.PersonWorkLicenceLimit,
                PersonDriveLicenceLimit = limitationViewModel.PersonDriveLicenceLimit,
                PersonEmbasyFamilyLimit = limitationViewModel.PersonEmbasyFamilyLimit,

                Active = limitationViewModel.IsActive,

                CreatedById = limitationViewModel.CreatedBy?.Id ?? null,
                CompanyId   = limitationViewModel.Company?.Id ?? null,

                CreatedAt = limitationViewModel.CreatedAt,
                UpdatedAt = limitationViewModel.UpdatedAt
            };

            return(limitation);
        }
Ejemplo n.º 24
0
        public Dictionary <string, string> GetNetworkDeviceTypes(List <int> limitationIDs)
        {
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            using (SqlCommand textCommand = SqlHelper.GetTextCommand(Limitation.LimitSQL(" SELECT Vendor + '%' AS Value, '' AS Name \r\n FROM Nodes \r\n WHERE (Vendor <> '')  \r\n GROUP BY Vendor HAVING (Count(Vendor) > 1) \r\n UNION\r\n SELECT MachineType AS Value, MachineType AS Name \r\n FROM Nodes\r\n WHERE MachineType <> '' \r\n GROUP BY MachineType ", (IEnumerable <int>)limitationIDs)))
            {
                using (IDataReader dataReader = SqlHelper.ExecuteReader(textCommand))
                {
                    int    ordinal1 = dataReader.GetOrdinal("Value");
                    int    ordinal2 = dataReader.GetOrdinal("Name");
                    string libcodeVb061;
                    using (LocaleThreadState.EnsurePrimaryLocale())
                        libcodeVb061 = Resources.get_LIBCODE_VB0_61();
                    while (dataReader.Read())
                    {
                        string str1 = dataReader.GetString(ordinal2);
                        string key  = dataReader.GetString(ordinal1);
                        string str2 = !string.IsNullOrEmpty(str1) ? str1 : string.Format(libcodeVb061, (object)key.Substring(0, key.Length - 1));
                        dictionary.Add(key, str2);
                    }
                }
            }
            return(dictionary);
        }
Ejemplo n.º 25
0
 public SkillBasic(string name, int maxRank, Timing timing, Judgement judgement, Target target, Range range, Cost cost, Limitation limitation)
     : base(name, maxRank, timing, judgement, target, range, cost, limitation)
 {
 }
Ejemplo n.º 26
0
    // Starting a new game session
    public void StartSession(FieldTarget sessionType, Limitation limitationType)
    {
        StopAllCoroutines (); // Ending of all current coroutines
        AudioAssistant.main.PlayMusic ("Field"); // Running music

        switch (limitationType) { // Start corresponding coroutine depending on the limiation mode
            case Limitation.Moves: StartCoroutine(MovesLimitation()); break;
            case Limitation.Time: StartCoroutine(TimeLimitation());break;
        }

        switch (sessionType) { // Start corresponding coroutine depending on the target level
            case FieldTarget.Score: StartCoroutine(ScoreSession()); break;
            case FieldTarget.Jelly: StartCoroutine(JellySession()); break;
            case FieldTarget.Block: StartCoroutine(BlockSession()); break;
            case FieldTarget.Color: StartCoroutine(ColorSession()); break;
            case FieldTarget.SugarDrop: StartCoroutine(SugarDropSession()); break;
        }

        StartCoroutine (BaseSession()); // Base routine of game session
        StartCoroutine (ShowingHintRoutine()); // Coroutine display hints
        StartCoroutine (ShuffleRoutine()); // Coroutine of mixing chips at the lack moves
        StartCoroutine (FindingSolutionsRoutine()); // Coroutine of finding a solution and destruction of existing combinations of chips
        StartCoroutine (IllnessRoutine()); // Coroutine of Weeds logic
    }
    private void ImporterFichier()
    {
        DateTime dateDebutAnalyse = DateTime.Now;

        if (User.IsInRole("Administrateur") && MemberInfoData == null)
        {
            MessageAnalyse = "Désolé Admin, sélectionnez un Membre pour importer des données.";
            EventFinImport.Set();
            FinTraitement = true;
            return;
        }

        if (DocumentNom.PostedFile.FileName == "")
        {
            MessageAnalyse = "Choisissez un fichier à importer. ";
            EventFinImport.Set();
            FinTraitement = true;
            return;
        }

        if (CheckBoxImportVotes.Checked && CheckBoxImportInterviewes.Checked == false)
        {
            CheckBoxExportIntervieves.Checked = true;
            MessageAnalyse = "Vous ne pouvez pas importer les votes sans exporter les interviewés. ";
            EventFinImport.Set();
            FinTraitement = true;
            return;
        }

        HttpPostedFile file = DocumentNom.PostedFile;
        int            size = file.ContentLength;

        if (size <= 0)
        {
            MessageAnalyse = "Un problème est survenu avec le téléchargement du fichier sur le serveur, le fichier n'est pas disponible. ";
            EventFinImport.Set();
            FinTraitement = true;
            return;
        }

        String virtualPath = "~/MemberDataFiles/";
        string filePath    = virtualPath;

        virtualPath += Path.GetFileName(DocumentNom.PostedFile.FileName);
        String physicalDir  = Server.MapPath(filePath);
        String physicalPath = Server.MapPath(virtualPath);

        // Sauver le fichier
        try
        {
            int tailleMax = 10 * 1024 * 1024; // 10 Mo
            if (DocumentNom.PostedFile.ContentLength >= tailleMax)
            {
                MessageAnalyse += "Error taille du fichier : " + Tools.FileSizeFormat(DocumentNom.PostedFile.ContentLength, "N");
                MessageAnalyse += " supérieure à la taille maximum : " + Tools.FileSizeFormat(tailleMax, "N");
                EventFinImport.Set();
                FinTraitement = true;
                return;
            }
            DocumentNom.PostedFile.SaveAs(physicalPath);
        }
        catch (Exception ex)
        {
            MessageAnalyse += ex.Message;
            EventFinImport.Set();
            FinTraitement = true;
            return;
        }

        DataSet dataSet = new DataSet();

        try
        {
            XmlReader xmlr = XmlReader.Create(physicalPath);
            dataSet.ReadXml(xmlr);
            xmlr.Close();
        }
        catch
        {
            MessageAnalyse += "Fichier non valide. ";
            File.Delete(physicalPath);
            EventFinImport.Set();
            FinTraitement = true;
            return;
        }

        // Dans le cadre d'un Tread on ne peut pas utiliser SessionState
        Limitation limitations = new Limitation(MemberInfoData.MembreGUID);

        //
        // Creer les Questionnaires
        //
        foreach (DataTable dt in dataSet.Tables)
        {
            if (dt.TableName.Contains("Questionnaire"))
            {
                // Tester les limitations avant d'ajouter le questionnaire
                if (limitations.LimiteQuestionnaires)
                {
                    MessageAnalyse += "La limite du nombre de Questionnaires : " + limitations.NombreQuestionnaires + " est atteinte.";
                    File.Delete(physicalPath);
                    EventFinImport.Set();
                    FinTraitement = true;
                    return;
                }

                Questionnaire questionnaire      = Questionnaire.FillFromXML(dt.Rows[0]);
                int           oldQuestionnaireID = questionnaire.QuestionnaireID;
                string        oldCodeAcces       = questionnaire.CodeAcces.ToString();

                questionnaire.MembreGUID   = MemberInfoData.MembreGUID;
                questionnaire.DateCreation = DateTime.Now; // Modifier la date de creation a maintenant

                ArrayList codes     = QuestionnaireDAL.GetCodeAccessAll();
                string    codeAcces = Tools.CalculCodeAcces(MemberInfoData.MembreID, codes).ToString();
                questionnaire.CodeAcces = int.Parse(codeAcces);

                int status = Questionnaire.Create(questionnaire);
                if (status == 1)
                {
                    MessageAnalyse += "Questionnaire : " + questionnaire.Description + " créé correctement.<br/>";
                    limitations.AjouterQuestionnaire();
                }
                else if (status == 2)
                {
                    MessageAnalyse += "Le Questionnaire : " + questionnaire.Description + " existe déjà.<br>";
                    File.Delete(physicalPath);
                    EventFinImport.Set();
                    FinTraitement = true;
                    return;
                }
                else
                {
                    MessageAnalyse += "Erreur sur la création du Questionnaire : " + questionnaire.Description + " <br/>";
                    File.Delete(physicalPath);
                    EventFinImport.Set();
                    FinTraitement = true;
                    return;
                }

                //
                // Tagger les Objets du Questionnaire avec le nouvel ID
                //
                int    newQuestionnaireID = questionnaire.QuestionnaireID;
                string newCodeAcces       = codeAcces;

                // Questions
                TaggerObjet(ref dataSet, "QQuestion", "QuestionnaireID", oldQuestionnaireID.ToString(), newQuestionnaireID.ToString());

                // Interviewe
                TaggerObjet(ref dataSet, "Personne", "QuestionnaireID", oldQuestionnaireID.ToString(), newQuestionnaireID.ToString());
                TaggerObjet(ref dataSet, "Personne", "PersonneCode", oldCodeAcces, newCodeAcces);

                // Votes
                TaggerObjet(ref dataSet, "Vote", "QuestionnaireID", oldQuestionnaireID.ToString(), newQuestionnaireID.ToString());

                // Score
                TaggerObjet(ref dataSet, "Score", "ScoreQuestionnaireID", oldQuestionnaireID.ToString(), newQuestionnaireID.ToString());
            }
            if (dt.TableName.Contains("QQuestion"))
            {
                // On passe aux Questions
                break;
            }
        }

        //
        // Creer les Questions
        //
        int nbQuestions = 0;

        foreach (DataTable dt in dataSet.Tables)
        {
            if (dt.TableName.Contains("QQuestion"))
            {
                // Tester les limitations avant d'ajouter la question
                if (limitations.LimiteQuestions)
                {
                    MessageAnalyse += "La limite du nombre de Questions : " + limitations.NombreQuestions + " est atteinte.";
                    File.Delete(physicalPath);
                    EventFinImport.Set();
                    FinTraitement = true;
                    return;
                }

                PollQuestion question      = PollQuestion.FillFromXML(dt.Rows[0]);
                string       oldQuestionID = question.PollQuestionId.ToString();
                question.MembreGUID = MemberInfoData.MembreGUID;
                int status = PollQuestion.Create(question);
                if (status != 0)
                {
                    MessageAnalyse += "Erreur à la création de la Question : " + question.Question + "<br/>";
                    File.Delete(physicalPath);
                    EventFinImport.Set();
                    FinTraitement = true;
                    return;
                }
                else
                {
                    nbQuestions += 1;
                    limitations.AjouterQuestion();
                }

                //
                // Tagger les Objets de la Question avec le nouvel ID
                //
                string newQuestionID = question.PollQuestionId.ToString();

                // Reponse
                TaggerObjet(ref dataSet, "Reponse", "PollQuestionId", oldQuestionID, newQuestionID);

                // Votes
                TaggerObjet(ref dataSet, "Vote", "PollQuestionId", oldQuestionID, newQuestionID);
            }
            if (dt.TableName.Contains("Reponse"))
            {
                // On passe aux Reponses
                break;
            }
        }
        MessageAnalyse += "Question créées : " + nbQuestions.ToString() + "<br/>";

        int nbReponses = 0;

        foreach (DataTable dt in dataSet.Tables)
        {
            if (dt.TableName.Contains("Reponse"))
            {
                PollAnswer reponse         = PollAnswer.FillFromXML(dt.Rows[0]);
                string     oldPollAnswerID = reponse.PollAnswerId.ToString();
                int        status          = PollAnswer.Create(reponse);
                if (status == 0)
                {
                    nbReponses += 1;
                }
                else
                {
                    MessageAnalyse += "Erreur à la création de la réponse : " + reponse.Answer;
                    File.Delete(physicalPath);
                    EventFinImport.Set();
                    FinTraitement = true;
                    return;
                }

                //
                // Tagger les Objets de la Reponse avec le nouvel ID
                //
                string newPollAnswerID = reponse.PollAnswerId.ToString();

                // Votes
                TaggerObjet(ref dataSet, "Vote", "PollAnswerId", oldPollAnswerID, newPollAnswerID);
            }
            if (dt.TableName.Contains("Personne"))
            {
                break;
            }
        }
        MessageAnalyse += "Réponses créés : " + nbReponses.ToString() + "<br/>";

        int nbInterviewes = 0;

        if (CheckBoxImportInterviewes.Checked)
        {
            foreach (DataTable dt in dataSet.Tables)
            {
                if (dt.TableName.Contains("Personne"))
                {
                    string   message         = "";
                    Personne personne        = Personne.FillFromXML(dt.Rows[0]);
                    string   oldPersonneGUID = personne.PersonneGUID.ToString();

                    // Trouver si l'utilisateur de ce questionnaire est limite
                    if (limitations.LimitesInterviewes)
                    {
                        MessageAnalyse += "La limite du nombre d'Interviewés : " + limitations.NombreInterviewes + " est atteinte.";
                        File.Delete(physicalPath);
                        EventFinImport.Set();
                        FinTraitement = true;
                        return;
                    }

                    int retCode = Personne.Create(personne, true, ref message);
                    if (retCode == 1)
                    {
                        nbInterviewes += 1;
                        limitations.AjouterInterviewes(1);
                    }
                    else
                    {
                        MessageAnalyse += message;
                        File.Delete(physicalPath);
                        EventFinImport.Set();
                        FinTraitement = true;
                        return;
                    }

                    //
                    // Tagger les Objets de la Reponse avec le nouvel ID
                    //
                    string newPersonneGUID = personne.PersonneGUID.ToString();

                    // Votes
                    TaggerObjet(ref dataSet, "Vote", "UserGUID", oldPersonneGUID, newPersonneGUID);
                }
                if (dt.TableName.Contains("Vote"))
                {
                    break;
                }
            }
        }
        MessageAnalyse += "Interviewés créés : " + nbInterviewes.ToString() + "<br/>";

        int nbVotes = 0;

        if (CheckBoxImportVotes.Checked)
        {
            foreach (DataTable dt in dataSet.Tables)
            {
                if (dt.TableName.Contains("Vote"))
                {
                    PollVote vote = PollVote.FillFromXML(dt.Rows[0]);

                    int status = PollVote.Create(vote);
                    if (status == 2)
                    {
                        MessageAnalyse += "Vote existe déjà";
                        File.Delete(physicalPath);
                        EventFinImport.Set();
                        FinTraitement = true;
                        return;
                    }
                    else
                    {
                        nbVotes += 1;
                    }
                }
                if (dt.TableName.Contains("Score"))
                {
                    break;
                }
            }

            if (limitations.LimitesReponses)
            {
                MessageAnalyse += "La limite du nombre de Réponses : " + limitations.NombreReponses + " est atteinte.";
                File.Delete(physicalPath);
                EventFinImport.Set();
                FinTraitement = true;
                return;
            }
        }
        MessageAnalyse += "Votes créés : " + nbVotes.ToString() + "<br/>";

        int nbScore = 0;

        foreach (DataTable dt in dataSet.Tables)
        {
            if (dt.TableName.Contains("Score"))
            {
                Score score  = Score.FillFromXML(dt.Rows[0]);
                int   status = Score.Create(score);
                if (status != 1)
                {
                    MessageAnalyse += "Erreur à la création du Score .<br/>";
                }
                else
                {
                    nbScore += 1;
                }
            }
        }
        MessageAnalyse += "Score créés : " + nbScore.ToString() + "<br/>";

        if (CheckBoxImportServeurSmtp.Checked)
        {
            foreach (DataTable dt in dataSet.Tables)
            {
                if (dt.TableName.Contains("SmtpServeur"))
                {
                    SmtpServer smtp = SmtpServer.FillFromXML(dt.Rows[0]);
                    smtp.UserGUID = MemberInfoData.MembreGUID;
                    int status = SmtpServer.Create(smtp);
                    if (status == 2)
                    {
                        MessageAnalyse += "Smtp : " + smtp.Email + " existe déjà.<br/>";
                        File.Delete(physicalPath);
                        EventFinImport.Set();
                        FinTraitement = true;
                        return;
                    }
                    else
                    {
                        MessageAnalyse += "Smtp crée correctement : " + smtp.Email + "<br/>";
                    }
                }
            }
        }

        DateTime dateFinAnalyse  = DateTime.Now;
        TimeSpan tempsTraitement = dateFinAnalyse - dateDebutAnalyse;

        MessageAnalyse += "- Taille du fichier : " + Tools.FileSizeFormat(DocumentNom.PostedFile.ContentLength, "N") + "<br/>";
        MessageAnalyse += "- Temps d'import : " + Tools.FormatTimeSpan(tempsTraitement) + "<br/>";

        File.Delete(physicalPath);
        EventFinImport.Set();
        FinTraitement = true;
    }
Ejemplo n.º 28
0
 public void Update(Limitation item)
 {
     dbContext.Entry(item).State = EntityState.Modified;
     dbContext.SaveChanges();
 }
    protected void ButtonValiderQuestionnaire_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["valider"] != null)
        {
            if (Request.QueryString["valider"].ToString() == "2")
            {
                Page.Response.Redirect("~/Poll/Termine.Aspx", true);
            }
        }

        if (SessionState.QuestionsEnCours.Count <= 0)
        {
            ValidationMessage.Text   += "Pas de questions en cours.";
            ValidationMessage.Visible = true;
            return;
        }

        if (SessionState.VotesEnCours.Count <= 0)
        {
            // L'interviewe a deja clique sur le bouton
            if (ValidationMessage.Text == "Pas de réponses en cours.")
            {
                Page.Response.Redirect("~/Poll/Termine.Aspx", true);
            }

            ValidationMessage.Text   += "Pas de réponses en cours.";
            ValidationMessage.Visible = true;
            return;
        }

        int statusGlobal = 0;

        Session["_VotesEnCoursCount"] = SessionState.VotesEnCours.Count;
        foreach (PollQuestion question in SessionState.QuestionsEnCours)
        {
            PollAnswerCollection answers = PollAnswerCollection.GetByPollQuestionID(question.PollQuestionId);
            foreach (PollAnswer answer in answers)
            {
                PollVoteCollection pvc = SessionState.VotesEnCours.FindByAnswerID(answer.PollAnswerId);
                if (pvc.Count > 0)
                {
                    foreach (PollVote vote in pvc)
                    {
                        if (HttpContext.Current.User.Identity.IsAuthenticated == false)
                        {
                            Limitation limitation = new Limitation(SessionState.Questionnaire.MembreGUID);
                            if (limitation.LimitesReponses)
                            {
                                Context.Response.Redirect(Tools.PageErreurPath + "Désolé mais le nombre de réponses pour ce questionnaire est atteinte.", true);
                            }

                            int status = PollVote.Create(vote);
                            if (status != 1)
                            {
                                statusGlobal += 1;
                            }
                        }
                        SessionState.Votes.Add(vote);
                        SessionState.VotesEnCours.Remove(vote);
                    }
                }
            }
        }

        if (statusGlobal != 0)
        {
            ValidationMessage.Text   += "Erreur à la création des votes : " + statusGlobal.ToString();
            ValidationMessage.Visible = true;
            return;
        }

        if (Request.QueryString["fin"] != null)
        {
            Page.Response.Redirect("~/Poll/QuestionnaireEnCours.aspx?valider=2", true);
        }
        Page.Response.Redirect("~/Poll/QuestionnaireEnCours.aspx?valider=1", true);
    }
Ejemplo n.º 30
0
        public void Test_Reduced2()
        {
            double[] expectedSolution = new double[]
            {
                0.19999999999999718,
                1.0000000000000002,
                1.1999999999999977,
                3,
                1.8000000000000027,
                0.9954492440018422,
                0.8045507559981595,
            };
            Result expected = new Result(expectedSolution, true);

            #region Init Params
            int      count = 7;
            double[] Ii    = { 1, 1, 1, 1, 1, 1, 1 };
            double[] w     = { 0.2, 0.121, 0.683, 0.04, 0.102, 0.081, 0.02 };
            double[] d     =
            {
                10.0054919341489,
                3.03265795024749,
                6.83122010827837,
                1.98478460320379,
                5.09293357450987,
                4.05721328676762,
                0.991215230484718
            };
            double[]   b = { 0, 0, 0 };
            double[][] A =
            {
                new double[] { 1, 1, -1,  0, 0,  0,  0 },
                new double[] { 0, 0,  1, -1, 1,  0,  0 },
                new double[] { 0, 0,  0,  0, 1, -1, -1 }
            };

            double[][] extra = new double[][]
            {
                new double[] { -5, 1, 0, 0, 0, 0, 0 },
            };

            Limitation[] limitations = new Limitation[]
            {
                new Limitation(0, 100),
                new Limitation(1, 1),
                new Limitation(0, 100),
                new Limitation(3, 3),
                new Limitation(0, 100),
                new Limitation(0, 100),
                new Limitation(0, 100),
            };

            ForSolver data = new ForSolver(count, Ii, w, d, b, A, extra, limitations);
            #endregion

            SolverController controller = new SolverController();
            Result           res        = controller.Solve(data);

            Assert.AreEqual(expected.reduced, res.reduced);
            Assert.That(expected.solution, Is.EqualTo(res.solution).Within(0.1));
        }
Ejemplo n.º 31
0
        public void Test_ReducedExtraLimitations()
        {
            double[] expectedSolution = new double[]
            {
                20.00000000000001,
                2,
                18.000000000000014,
                5.020578731317562,
                12.979421268682454,
                11.532467336779543,
                1.4469539319029119
            };
            Result expected = new Result(expectedSolution, true);

            #region Init Params
            int      count = 7;
            double[] Ii    = { 1, 1, 1, 1, 1, 1, 1 };
            double[] w     = { 0.2, 0.121, 0.683, 0.04, 0.102, 0.081, 0.02 };
            double[] d     =
            {
                10.0054919341489,
                3.03265795024749,
                6.83122010827837,
                1.98478460320379,
                5.09293357450987,
                4.05721328676762,
                0.991215230484718
            };
            double[]   b = { 0, 0, 0 };
            double[][] A =
            {
                new double[] { 1, -1, -1,  0,  0,  0,  0 },
                new double[] { 0,  0,  1, -1, -1,  0,  0 },
                new double[] { 0,  0,  0,  0,  1, -1, -1 }
            };

            double[][] extra = new double[][]
            {
                new double[] { 1, -10, 0, 0, 0, 0, 0 },
            };

            Limitation[] limitations = new Limitation[]
            {
                new Limitation(1, 100),
                new Limitation(2, 100),
                new Limitation(3, 100),
                new Limitation(4, 100),
                new Limitation(-3, 100),
                new Limitation(-2, 100),
                new Limitation(-1, 100),
            };

            ForSolver data = new ForSolver(count, Ii, w, d, b, A, extra, limitations);
            #endregion

            SolverController controller = new SolverController();
            Result           res        = controller.Solve(data);

            Assert.AreEqual(expected.reduced, res.reduced);
            Assert.That(expected.solution, Is.EqualTo(res.solution).Within(0.1));
        }
Ejemplo n.º 32
0
    // Starting a new game session
    public void StartSession(FieldTarget sessionType, Limitation limitationType)
    {
        StopAllCoroutines (); // Ending of all current coroutines

        isPlaying = true;

        blockCountTotal = GameObject.FindObjectsOfType<Block>().Length;

        switch (limitationType) { // Start corresponding coroutine depending on the limiation mode
            case Limitation.Moves: StartCoroutine(MovesLimitation()); break;
            case Limitation.Time: StartCoroutine(TimeLimitation());break;
        }

        switch (sessionType) { // Start corresponding coroutine depending on the target level
            case FieldTarget.None:
                StartCoroutine(TargetSession(() => {
                    return true;
                }));
                break;
            case FieldTarget.Jelly:
                jellyCountTotal = GameObject.FindObjectsOfType<Jelly>().Length;
                Jelly.need_to_update_potentials = true;
                StartCoroutine(TargetSession(() => {
                    return GameObject.FindObjectsOfType<Jelly>().Length == 0;
                }));
                break;
            case FieldTarget.Block:
                StartCoroutine(TargetSession(() => {
                    return GameObject.FindObjectsOfType<Block>().Length == 0;
                }));
                break;
            case FieldTarget.Color:
                for (int i = 0; i < LevelProfile.main.countOfEachTargetCount.Length; i++)
                    countOfEachTargetCount[colorMask[i]] = LevelProfile.main.countOfEachTargetCount[i];
                StartCoroutine(TargetSession(() => {
                    foreach (int c in countOfEachTargetCount)
                        if (c > 0)
                            return false;
                    return true;
                }));
                break;
            case FieldTarget.SugarDrop:
                targetSugarDropsCount = 0;
                creatingSugarDropsCount = LevelProfile.main.targetSugarDropsCount;
                StartCoroutine(TargetSession(() => {
                    return targetSugarDropsCount >= LevelProfile.main.targetSugarDropsCount && GameObject.FindObjectsOfType<SugarChip>().Length == 0;
                }));
                break;
        }

        StartCoroutine (BaseSession()); // Base routine of game session
        StartCoroutine (ShowingHintRoutine()); // Coroutine display hints
        StartCoroutine (ShuffleRoutine()); // Coroutine of mixing chips at the lack moves
        StartCoroutine (FindingSolutionsRoutine()); // Coroutine of finding a solution and destruction of existing combinations of chips
        StartCoroutine (IllnessRoutine()); // Coroutine of Weeds logic
    }