Beispiel #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);
        }
        public override void Evaluate(clsContext objContext)
        {
            string strTemp = objContext.strExpression;

            objContext.strExpression = strTemp.Replace(" ", "-");
        }
 public abstract void Evaluate(clsContext objContext);
        public override void Evaluate(clsContext objContext)
        {
            string strTemp = objContext.strExpression;

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