private void ImportStopDatePickerCommandHandler(object parameter)
        {
            CmsDateTimePicker dtp = new CmsDateTimePicker(mIssueSetting.ImportStopDate);
            dtp.Show();

            dtp.Closed +=
                (s1, e1) =>
                {
                    if (dtp.DialogResult.HasValue && dtp.DialogResult.Value)
                    {
                        mIssueSetting.ImportStopDate = dtp.Date;
                        RaisePropertyChanged("ImportStopDate");
                    }
                };
        }
        private void SelectDateOverrideButtonHandler(object parameter)
        {
            var currentOverride = parameter as IssueRelatedOverride;

            CmsDateTimePicker cmsDateTimePicker = new CmsDateTimePicker();
            cmsDateTimePicker.Closed +=
                (s1, e1) =>
                    {
                        if (cmsDateTimePicker.DialogResult.HasValue && cmsDateTimePicker.DialogResult.Value)
                        {
                            currentOverride.TargetRemovalDate = cmsDateTimePicker.Date;
                            currentOverride.TargetRemovalDateString = "update"; //This will raise property changed on TargetRemovalDate
                        }
                    };
            cmsDateTimePicker.Show();
        }
        private void ExpiryButtonHandler(object parameter)
        {
            CmsDateTimePicker cmsDateTimePicker = new CmsDateTimePicker();
            cmsDateTimePicker.Closed +=
                (s1, e1) =>
                    {
                        if (cmsDateTimePicker.DialogResult.HasValue && cmsDateTimePicker.DialogResult.Value == true)
                        {
                            Expiry = cmsDateTimePicker.Date;
                            RaisePropertyChanged("Expiry");
                        }

                    };
            cmsDateTimePicker.Show();
        }
        private void DatePickerCommandHandler(object parameter)
        {
            CmsDateTimePicker dtp = new CmsDateTimePicker(mIssueSetting.AccrualCutOfDate);
            dtp.Show();

            dtp.Closed +=
                (s1, e1) =>
                {
                    if (dtp.DialogResult.HasValue && dtp.DialogResult.Value)
                    {
                        mIssueSetting.AccrualCutOfDate = dtp.Date;
                        RaisePropertyChanged("CutOfDate");
                        RaisePropertyChanged("Description");
                    }
                };
        }
 private void StartButtonButtonHandler(object obj)
 {
     CmsDateTimePicker cmsDateTimePicker = new CmsDateTimePicker();
     cmsDateTimePicker.Closed +=
         (s1, e1) =>
         {
             if (cmsDateTimePicker.DialogResult.HasValue && cmsDateTimePicker.DialogResult.Value)
             {
                 StartDate = cmsDateTimePicker.Date;
             }
         };
     cmsDateTimePicker.Show();
 }
        private void UpdateDate(string fieldName)
        {
            CmsDateTimePicker dtp = new CmsDateTimePicker(fieldName == "NextInspectionDate");
            dtp.Show();

            dtp.Closed +=
                (s1, e1) =>
                    {
                        if (dtp.DialogResult.HasValue && dtp.DialogResult.Value)
                        {
                            if (fieldName == "LastInspectedDate")
                            {
                                mInstrumentComponent.LastInspectedDate = dtp.Date;
                                RaisePropertyChanged("LastInspectedDate");
                                ChangeLastModifiedBy();
                            }
                            else if (fieldName == "NextInspectionDate")
                            {
                                mInstrumentComponent.NextInspectionDate = dtp.Date;
                                RaisePropertyChanged("NextInspectionDate");
                                ChangeLastModifiedBy();
                            }
                        }
                    };
        }
        private void PlannedStartCommandHandler(object parameter)
        {
            DateTime dateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

            if (PlannedStart.HasValue) dateTime = PlannedStart.Value;

            var cmsDateTimePicker = new CmsDateTimePicker(dateTime);
            cmsDateTimePicker.Closed +=
                (s1, e1) =>
                {
                    if (cmsDateTimePicker.DialogResult.HasValue && cmsDateTimePicker.DialogResult.Value)
                    {
                        PlannedStart = cmsDateTimePicker.Date;
                        RemoveValidationError("PlannedStart");
                        RaisePropertyChanged("PlannedStart");
                    }
                };

            if (mEditedMilestone.PlannedStart.HasValue)
            {
                cmsDateTimePicker.Date = mEditedMilestone.PlannedStart.Value;
            }
            cmsDateTimePicker.Show();
        }
        private void PlannedEndCommandHandler(object parameter)
        {
            DateTime dateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

            if (PlannedEnd.HasValue) dateTime = PlannedEnd.Value;

            var cmsDateTimePicker = new CmsDateTimePicker(dateTime);
            cmsDateTimePicker.Closed +=
                (s1, e1) =>
                {
                    if (cmsDateTimePicker.DialogResult.HasValue && cmsDateTimePicker.DialogResult.Value)
                    {
                        PlannedEnd = cmsDateTimePicker.Date;
                    }
                };

            if (mEditedMilestone.PlannedEnd.HasValue)
            {
                cmsDateTimePicker.Date = mEditedMilestone.PlannedEnd.Value;
            }
            cmsDateTimePicker.Show();
        }
        private void SelectDateOverrideButtonHandler(object parameter)
        {
            var currentOverride = parameter as IssueRelatedOverride;

            var cmsDateTimePicker = new CmsDateTimePicker();
            cmsDateTimePicker.Closed +=
                (s1, e1) =>
                {
                    if (cmsDateTimePicker.DialogResult.HasValue && cmsDateTimePicker.DialogResult.Value)
                    {
                        currentOverride.TargetRemovalDate = cmsDateTimePicker.Date;
                        currentOverride.RaisePropertyChanged("TargetRemovalDateString");
                    }
                };
            cmsDateTimePicker.Show();
        }