예제 #1
0
        private void txtStartTime_Validated(object sender, EventArgs e)
        {
            TextBox txtBox = (TextBox)sender;

            if (txtBox.Text != string.Empty)
            {
                if (_errors.GetError(txtBox) == string.Empty)
                {
                    DateTime?dt = DateTimeHelper.ParseGregorian(txtBox.Text, PaddingMethod.First);
                    txtBox.Text = dt.Value.ToString("yyyy/MM/dd HH:mm:ss");
                }
            }
        }
        //private void txtStartTime_Validated(object sender, EventArgs e)
        //{
        //    if (txtStartTime.Text != string.Empty)
        //        FormatDateTime(txtStartTime, PaddingMethod.First);

        //    CurrentItem.StartTime = txtStartTime.Text;

        //    ShowDirtyStatus();
        //}

        //private void txtEndTime_Validated(object sender, EventArgs e)
        //{
        //    if (txtEndTime.Text != string.Empty)
        //        FormatDateTime(txtEndTime, PaddingMethod.Last);

        //    CurrentItem.EndTime = txtEndTime.Text;

        //    ShowDirtyStatus();
        //}

        //private void cboScoreSource_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    if (CurrentItem == null) return;

        //    if (cboScoreSource.SelectedIndex == 0)
        //    {
        //        CurrentItem.AllowUpload = "是";
        //        txtStartTime.Enabled = true;
        //        txtEndTime.Enabled = true;
        //    }
        //    else
        //    {
        //        CurrentItem.AllowUpload = "否";
        //        txtStartTime.Enabled = false;
        //        txtEndTime.Enabled = false;
        //    }

        //    ShowDirtyStatus();
        //}

        private void FormatDateTime(TextBoxX textbox, PaddingMethod method)
        {
            if (_errors.GetError(textbox) == string.Empty)
            {
                DateTime?dt = DateTimeHelper.ParseGregorian(textbox.Text, method);
                textbox.Text = dt.Value.ToString(Consts.TimeFormat);
            }
        }