Пример #1
0
        private void btnDate_Click(object sender, EventArgs e)
        {
            ArrayList  obj        = new ArrayList();
            clsContext objContext = new clsContext(txtDateFormat.Text.Trim());

            string[] strArray = objContext.strExpression.Split(' ');

            foreach (string strTemp in strArray)
            {
                if (strTemp == "MM")
                {
                    obj.Add(new clsMonthExpression());
                }
                else if (strTemp == "DD")
                {
                    obj.Add(new clsDayExpression());
                }
                else if (strTemp == "YYYY")
                {
                    obj.Add(new clsYearExpression());
                }
            }

            obj.Add(new clsSeperator());

            foreach (clsAbstractExpression objAbstract in obj)
            {
                objAbstract.Evaluate(objContext);
            }
            MessageBox.Show(objContext.strExpression);
        }
Пример #2
0
        public override void Evaluate(clsContext objContext)
        {
            string strTemp = objContext.strExpression;

            objContext.strExpression = strTemp.Replace(" ", "-");
        }
Пример #3
0
 public abstract void Evaluate(clsContext objContext);
Пример #4
0
        public override void Evaluate(clsContext objContext)
        {
            string strTemp = objContext.strExpression;

            objContext.strExpression = strTemp.Replace("DD", DateTime.Now.Day.ToString());
        }