Пример #1
0
        private void BuildMap(IMap map)
        {
            for (int i = 0; i < map.Height; i++)
            {
                RowDefinition row = new RowDefinition();
                GameArea.RowDefinitions.Add(row);
            }

            for (int i = 0; i < map.Width; i++)
            {
                ColumnDefinition col = new ColumnDefinition();
                GameArea.ColumnDefinitions.Add(col);
            }


            for (int i = 0; i < map.Height; i++)
            {
                for (int j = 0; j < map.Width; j++)
                {
                    CaseTypes caseType = map.Cases[i, j];

                    ICase caseInst = CaseFactory.GetCaseFromType(caseType);
                    Grid.SetRow(caseInst as UserControl, i);
                    Grid.SetColumn(caseInst as UserControl, j);
                    GameArea.Children.Add(caseInst as UserControl);
                }
            }
        }
        /// <summary>
        /// Executes the activity
        /// </summary>
        /// <param name="executionContext">Activity context</param>
        /// <param name="crmWorkflowContext">Includes organisation service</param>
        public override void ExecuteCRMWorkFlowActivity(CodeActivityContext executionContext, LocalWorkflowContext crmWorkflowContext)
        {
            // 1. Validate
            if (crmWorkflowContext == null)
            {
                throw new ArgumentNullException(nameof(crmWorkflowContext));
            }

            // 2. Count lines
            var tracingService = executionContext.GetExtension <ITracingService>();
            var service        = crmWorkflowContext.OrganizationService;

            var application = Application.Get(executionContext);

            if (application == null)
            {
                return;
            }

            var caseTypes = CaseTypes.Get(executionContext);

            if (string.IsNullOrWhiteSpace(caseTypes))
            {
                return;
            }

            var count = service.CountActiveCasesOfType(application.Id, caseTypes);

            // 3. Return Result
            Count.Set(executionContext, count);
            tracingService.Trace("Count = {0}", count);
        }
Пример #3
0
        public static ICase getCase(CaseTypes ct)
        {
            switch (ct)
            {
            case CaseTypes.N11UyeOl:
                return(new N11CaseUyeOl());

            case CaseTypes.N11GirisYap:
                return(new N11CaseGirisYap());

            case CaseTypes.ThedemositeCaseLogin:
                return(new ThedemositeLogin());

            case CaseTypes.ThedemositeCaseAddUser:
                return(new ThedemositeCaseAddUser());

            case CaseTypes.PhptravelsCaseAddUser:
                return(new PhptravelsCaseAddUser());

            case CaseTypes.PhptravelsCaseLogin:
                return(new PhptravelsCaseLogin());

            default:
                return(null);
            }
        }
Пример #4
0
 public static ICase getCase(CaseTypes ct)
 {
     switch (ct)
     {
     default:
         return(null);
     }
 }
Пример #5
0
 public Boolean Add(CaseType record)
 {
     if (record == null)
     {
         return(false);
     }
     CaseTypes.Add(record);
     return(SaveChanges() == 1);
 }
Пример #6
0
 public void RemoveRange(params CaseType[] records)
 {
     if (records.Length == 0)
     {
         return;
     }
     CaseTypes.RemoveRange(records);
     SaveChanges();
 }
Пример #7
0
        public Boolean Update(CaseType record)
        {
            if (record == null)
            {
                return(false);
            }
            var attached = CaseTypes.Attach(record);

            if (attached == null)
            {
                return(false);
            }
            Entry(attached).State = EntityState.Modified;
            return(SaveChanges() == 1);
        }
Пример #8
0
        public Boolean Remove(CaseType record)
        {
            if (record == null)
            {
                return(false);
            }
            var attached = CaseTypes.Attach(record);

            if (attached == null)
            {
                return(false);
            }
            CaseTypes.Remove(attached);
            return(SaveChanges() == 1);
        }
Пример #9
0
        public static ICase GetCaseFromType(CaseTypes caseType)
        {
            switch (caseType)
            {
            case CaseTypes.FOREST:
                var t = new ForestCase();
                t.AddImage();
                return(t);

            case CaseTypes.DESERT:
                return(new DesertCase());

            default:
                throw new System.Exception();
            }
        }
Пример #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            foreach (var item in checkedListBox1.CheckedItems.OfType <string>().ToList())
            {
                CaseTypes tip = (CaseTypes)Enum.Parse(typeof(CaseTypes), item);

                var cs = CaseFactory.getCase(tip);
                if (cs != null)
                {
                    cs.runTest();
                }
                else
                {
                    textBox1.AppendText("-->> " + item + "tipinde test bulunamadı. \n");
                }
            }
        }
Пример #11
0
        /// <summary>
        /// Возвращает строку в заданном регистре
        /// </summary>
        public static string ToCase(this string text, CaseTypes type)
        {
            if (string.IsNullOrEmpty(text))
            {
                return(text);
            }

            switch (type)
            {
            case CaseTypes.Upper:
                text = text.ToUpper();
                break;

            case CaseTypes.Lower:
                text = text.ToLower();
                break;
            }
            return(text);
        }
Пример #12
0
        //public IPrisonerService PrisonerService{ get; set; }
        //public ICaseTypeService oCaseTypeService { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                return;
            }
            //RegisterTypes();

            if (!Page.IsPostBack)
            {
                //oCaseTypeService = UnityWebActivator.Container.Resolve<ICaseTypeService>();
                CaseTypes.DataTextField  = "CaseTypeName";
                CaseTypes.DataValueField = "CaseTypeId";
                //CaseTypes.DataSource = oCaseTypeService.LoadAll();
                CaseTypes.DataBind();
                CaseTypes.Items.Insert(0, new ListItem("--- Select Case type ---", "0"));

                //  PopulateControls();
            }

            SetupReport();
        }
Пример #13
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="CaseType">What case change to perform</param>
 public CaseChangingStrategy(CaseTypes CaseType)
 {
     _caseType = CaseType;
 }
Пример #14
0
        private static string GetCaseConverted(string Value, CaseTypes CaseFrom, CaseTypes CaseTo)
        {
            StringBuilder sb = new StringBuilder();

            switch (CaseFrom)
            {
            case CaseTypes.PascalCase:
                for (int i = 0, i2 = Value.Length; i < i2; i++)
                {
                    char c       = Value[i];
                    bool IsUpper = char.IsUpper(c);

                    string s = "";
                    switch (CaseTo)
                    {
                    case CaseTypes.LowerCaseUnderbar:
                    case CaseTypes.UpperCaseUnderbar:
                        if ((i != 0) && IsUpper)
                        {
                            s = "_";
                        }

                        if (CaseTo == CaseTypes.LowerCaseUnderbar)
                        {
                            s += c.ToString().ToLower();
                        }
                        else if (CaseTo == CaseTypes.UpperCaseUnderbar)
                        {
                            s += c.ToString().ToUpper();
                        }

                        break;
                    }

                    sb.Append(s);
                }

                break;

            case CaseTypes.LowerCaseUnderbar:
            case CaseTypes.UpperCaseUnderbar:
                bool IsUnder = false, IsUnderOld = false;
                for (int i = 0, i2 = Value.Length; i < i2; i++)
                {
                    char c = Value[i];
                    IsUnderOld = IsUnder;
                    IsUnder    = (c == '_');

                    string s = "";
                    switch (CaseTo)
                    {
                    case CaseTypes.PascalCase:
                        //_는 뺌.
                        if (IsUnder)
                        {
                            continue;
                        }

                        if ((i == 0) || (IsUnderOld))
                        {
                            s = c.ToString().ToUpper();
                        }
                        else
                        {
                            s = c.ToString().ToLower();
                        }

                        break;
                    }

                    sb.Append(s);
                }

                break;
            }

            return(sb.ToString());
        }
Пример #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Stmt"></param>
        /// <param name="aTableFieldName"></param>
        /// <param name="CaseFrom"></param>
        /// <param name="CaseTo"></param>
        /// <param name="IsReplaceOnlyInDoubleQuote"></param>
        /// <returns></returns>
        /// <example>
        /// <code>
        /// string[] aNamePascal = new string[] { "UserName", "UserId" };
        /// string s = "SELECT a.UserName, a.UserId, a.UserJumin FROM UserInfo AS a WHERE a.UserId LIKE 'UserId%'";
        ///
        /// string s2 = CSql.GetTableFieldNameToCase(s, aNamePascal, CSql.CaseTypes.PascalCase, CSql.CaseTypes.UpperCaseUnderbar);
        /// Console.WriteLine(s2);
        /// //--결과
        /// //SELECT a.USER_NAME, a.USER_ID, a.UserJumin FROM UserInfo AS a WHERE a.USER_ID LIKE 'UserId%'
        ///
        /// string[] aNameUpper = new string[] { "USER_NAME", "USER_ID" };
        /// string s3 = CSql.GetTableFieldNameToCase(s2, aNameUpper, CSql.CaseTypes.UpperCaseUnderbar, CSql.CaseTypes.PascalCase);
        /// Console.WriteLine(s3);
        /// //--결과
        /// //SELECT a.UserName, a.UserId, a.UserJumin FROM UserInfo AS a WHERE a.UserId LIKE 'UserId%'
        /// </code>
        /// </example>
        public static string GetTableFieldNameToCase(string Stmt, string[] aTableFieldName,
                                                     CaseTypes CaseFrom, CaseTypes CaseTo, bool IsReplaceOnlyInDoubleQuote)
        {
            string[] aKeywords = GetSqlServerKeyword();

            SortedList slIndexValue = new SortedList();

            // \w+: 연속된(+) 글자(w), 즉 단어
            // ': 작은 따옴표
            // ": 큰 따옴표

            bool  IsDoubleQuotStarted = false;
            int   QuoteEnd            = -1;
            Regex r = new Regex(@"\w+|'|""", RegexOptions.Compiled);

            for (Match m = r.Match(Stmt); m.Success; m = m.NextMatch())
            {
                if (m.Index <= QuoteEnd)
                {
                    continue;
                }

                switch (m.Value)
                {
                case "\"":
                    if (IsDoubleQuotStarted)
                    {
                        IsDoubleQuotStarted = false;
                    }
                    else
                    {
                        IsDoubleQuotStarted = true;
                    }

                    break;

                case "'":
                    QuoteEnd = CDelim.GetQuoteEnd(Stmt, m.Index, '\'');
                    break;

                default:
                    bool IsReplace = true;
                    //따옴표 안의 문자열만 변경하는 옵션일 때 따옴표 안에 있지 않거나,
                    //현재 Value가 Table, Field 이름이 아닌 경우.
                    if ((IsReplaceOnlyInDoubleQuote && !IsDoubleQuotStarted) ||
                        (CArray.IndexOf(aTableFieldName, m.Value, true) == -1))
                    {
                        IsReplace = false;
                    }

                    if (IsReplace)
                    {
                        string Value = GetCaseConverted(m.Value, CaseFrom, CaseTo);
                        slIndexValue.Add(m.Index, new string[] { m.Value, Value });
                    }
                    else
                    {
                        slIndexValue.Add(m.Index, new string[] { m.Value, m.Value });
                    }
                    break;
                }
            }

            string s = GetIndexValueMerged(Stmt, slIndexValue);

            return(s);
        }
Пример #16
0
        public static string ChangeCase(this string text, CaseTypes caseType, bool changeOnlyTargetChar, bool trim)
        {
            var sb =
                new StringBuilder(changeOnlyTargetChar
                    ? (trim ? text.Trim(',', '.', ' ', '»', '«', '\"') : text)
                    : (trim ? text.ToLower().Trim(',', '.', ' ', '»', '«', '\"') : text.ToLower()));

            if (sb.Length > 0)
            {
                if (trim)
                {
                    int l;

                    do
                    {
                        l = sb.Length;
                        sb.Replace("  ", " ");
                    } while (l > sb.Length);

                    sb.Replace("|", "/");
                    sb.Replace("\\", "/");
                    sb.Replace("[", "(");
                    sb.Replace("]", ")");

                    InsertSpace(sb, ",", false, true);
                    InsertSpace(sb, "/", true, true);
                    InsertSpace(sb, ".", false, true);
                    InsertSpace(sb, "(", true, false);
                    InsertSpace(sb, ")", false, true);

                    if (sb[0] == ' ')
                    {
                        sb.Remove(0, 1);
                    }
                    if (sb[sb.Length - 1] == ' ')
                    {
                        sb.Remove(sb.Length - 1, 1);
                    }
                }

                sb[0] = sb[0].ToString(CultureInfo.InvariantCulture).ToUpper()[0];

                switch (caseType)
                {
                case CaseTypes.AllWords:

                    for (var z = 1; z < sb.Length; z++)
                    {
                        if (sb[z] != ' ' && sb[z - 1] == ' ')
                        {
                            sb[z] = sb[z].ToString(CultureInfo.InvariantCulture).ToUpper()[0];
                        }
                    }

                    break;

                case CaseTypes.AfterSplitter:
                    var splitter = false;

                    for (var z = 1; z < sb.Length; z++)
                    {
                        if (sb[z] == '.' || sb[z] == ',' || sb[z] == '/' || sb[z] == '\\' || sb[z] == '*' ||
                            sb[z] == '|')
                        {
                            splitter = true;
                        }
                        else if (sb[z] != ' ' && splitter)
                        {
                            sb[z]    = sb[z].ToString(CultureInfo.InvariantCulture).ToUpper()[0];
                            splitter = false;
                        }
                    }

                    break;
                }
            }

            return(sb.ToString());
        }