示例#1
0
        protected string[] ConvertValues(object[] values)
        {
            if (values == null || values.Length == 1 && values[0] == null)
            {
                return(null);
            }

            //check if paramters are incorrectly picked up as object[]{int[]} and if so, fix this
            if (values.Length == 1 && values[0].GetType().IsArray)
            {
                var tmpList = new List <object>();
                foreach (object o in (IEnumerable)values[0])
                {
                    tmpList.Add(o);
                }
                values = tmpList.ToArray();
            }

            string[] ret = new string[values.Length];

            for (int i = 0; i < ret.Length; i++)
            {
                string convVal = null;

                if (values[i] != null)
                {
                    if (values[i] is int)
                    {
                        convVal = CultureDataFormatter.EncodeInt((int)values[i]);
                    }
                    else if (values[i] is DateTime)
                    {
                        convVal = CultureDataFormatter.EncodeDateTime((DateTime)values[i]);
                    }
                    else if (values[i] is double)
                    {
                        convVal = CultureDataFormatter.EncodeDouble((double)values[i]);
                    }
                    else if (values[i] is string)
                    {
                        convVal = (string)values[i];
                    }
                    else
                    {
                        convVal = CultureDataFormatter.Encode(values[i]);
                    }
                }

                ret[i] = convVal;
            }
            return(ret);
        }
        /// <summary>
        /// Should only show not done appointments from today (actually, current day)
        /// </summary>
        /// <param name="mainId"></param>
        /// <returns></returns>
        protected override ArchiveRestrictionInfo[] GetArchiveRestrictionInfos(int mainId)
        {
            var archiveRest = new ArchiveRestrictionInfo[]
            {
                new ArchiveRestrictionInfo
                {
                    Name     = Keyid,
                    Operator = "=",
                    Values   = new string[]
                    {
                        CultureDataFormatter.EncodeInt(mainId)
                    },
                    IsActive      = true,
                    InterOperator = InterRestrictionOperator.And
                },
                new ArchiveRestrictionInfo
                {
                    Name     = "date",
                    Operator = "today",
                    Values   = new string[] { "" },
                    //Values = new string[]
                    //{
                    //	CultureDataFormatter.EncodeDateTime( DateTime.Today ),
                    //	CultureDataFormatter.EncodeDateTime( DateTime.Today.AddDays( 2 )/*.AddDays( 1 ).AddSeconds( -1 )*/ ),
                    //},
                    IsActive      = true,
                    InterOperator = InterRestrictionOperator.And
                },
                new ArchiveRestrictionInfo
                {
                    Name     = "completed",
                    Operator = "=",
                    Values   = new string[] { CultureDataFormatter.EncodeInt(0) },
                    IsActive = true
                }
            };

            return(archiveRest);
        }