public void CreateCondition()
        {
            Conditions.Condition condition = new Conditions.Condition(mainForm);

            CheckIfConditionAlreadyExistedInDb();

            if (createdConditionsList.Count == 0)
            {
                createdConditionsList.Add("DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = " + condition.sourceType + " AND `SourceGroup` = " + condition.sourceGroup + " AND `SourceEntry` = " + condition.sourceEntry + ";");
                createdConditionsList.Add("INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ScriptName`, `Comment`) VALUES");
            }

            if (condition.scriptName == "")
            {
                string conditionString = "(" + condition.sourceType + ", " + condition.sourceGroup + ", " + condition.sourceEntry + ", " + condition.sourceId + ", " + condition.elseGroup + ", " + condition.conditionType + ", " + condition.conditionTarget + ", " + condition.conditionValue1 + ", " + condition.conditionValue2 + ", " + condition.conditionValue3 + ", " + condition.negativeCondition + ", " + "\"\"" + ", " + GetCommentForCondition(condition) + ")";

                if (!createdConditionsList.Contains(conditionString))
                {
                    createdConditionsList.Add(conditionString);
                }
            }
            else
            {
                string conditionString = "(" + condition.sourceType + ", " + condition.sourceGroup + ", " + condition.sourceEntry + ", " + condition.sourceId + ", " + condition.elseGroup + ", " + 0 + ", " + 0 + ", " + 0 + ", " + 0 + ", " + 0 + ", " + 0 + ", " + "\"" + condition.scriptName + "\"" + ", " + GetCommentForCondition(condition) + ")";

                if (!createdConditionsList.Contains(conditionString))
                {
                    createdConditionsList.Add(conditionString);
                }
            }

            UpdateOutputTexbox();
        }
        private string GetCommentForCondition(Conditions.Condition condition)
        {
            string comment = "\"";

            comment += Conditions.sourceTypeCommentsDictionary[(Conditions.ConditionSourceTypes)condition.sourceType];
            comment  = comment.Replace("@sourceGroup", condition.sourceGroup).Replace("@sourceEntry", condition.sourceEntry);

            string targetLine = comment.Split(' ').Where(x => x.Contains("/")).FirstOrDefault();

            if (targetLine != null)
            {
                string target = targetLine.Split('/')[Convert.ToInt32(condition.conditionTarget)].ToString().Replace("@", "");
                comment = comment.Replace(targetLine, target);
            }

            if (condition.negativeCondition == "1")
            {
                comment += " not ";
            }
            else
            {
                comment += " ";
            }

            if (condition.scriptName == "")
            {
                comment += Conditions.conditionTypeCommentsDictionary[(Conditions.ConditionTypes)condition.conditionType];
                comment  = comment.Replace("@conditionValue1", condition.conditionValue1).Replace("@conditionValue2", condition.conditionValue2).Replace("@conditionValue3", condition.conditionValue3);
            }
            else if (condition.scriptName != "")
            {
                comment += "satisfies script";
            }
            else if ((Conditions.ConditionTypes)condition.conditionType == Conditions.ConditionTypes.CONDITION_DISABLED)
            {
                comment = "Condition disabled";
            }

            comment += "\"";

            return(comment);
        }