コード例 #1
0
ファイル: frmMain.cs プロジェクト: evelasco85/TimeTracker
        void SafeEditEntry(int primaryKey, string category, string description, bool rememberSetting,
            DateTime createdDate, DateTime systemCreatedDate, DateTime rememberedCreatedDateTime,
            Double hoursRendered
            )
        {
            this.StopTimer();

            MethodInvoker invokeFromUI = new MethodInvoker(
                () =>
                {
                    try
                    {
                        if (this._promptingInProgress)
                            return;

                        this._promptingInProgress = true;

                        this.View_GetObjectiveData(createdDate);

                        using (frmTaskMonitoringEntry monitoring = new frmTaskMonitoringEntry(
                            this.View_GetCategories()
                                .Select(x => x.Name),
                            primaryKey, category, description, rememberSetting, createdDate, systemCreatedDate,
                            this.txtObjectives.Text, hoursRendered
                            ))
                        {
                            DialogResult result = monitoring.ShowDialog(this);

                            if (result != System.Windows.Forms.DialogResult.OK)
                                return;

                            this.SaveLogDetail(monitoring);

                            monitoring.Dispose();
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                    finally
                    {
                        this._promptingInProgress = false;
                    }
                }
            );

            if (this.InvokeRequired)
                this.Invoke(invokeFromUI);
            else
                invokeFromUI.Invoke();

            this.RestartTimer();
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: evelasco85/TimeTracker
        bool SaveLogDetail(frmTaskMonitoringEntry monitoring)
        {
            bool success = false;
            LogEntry logEntry = monitoring.LogEntry;

            if ((logEntry == null) || (string.IsNullOrEmpty(logEntry.Description)))
                return success;

            this.View_SetRememberedSetting(monitoring.RememberSetting);
            this.View_SetRememberedDate(logEntry.Created);

            try
            {
                if (logEntry.System_Created == DateTime.MinValue)
                    logEntry.System_Created = DateTime.Now;

                this.View_SaveRecord(logEntry);
            }
            catch(Exception ex)
            {
                throw ex;
            }

            this.View_QueryRecords(null);
            this.RefreshDashboardData();

            success = true;

            return success;
        }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: evelasco85/TimeTracker
        void PromptMonitoring()
        {
            try
            {
                if (this._promptingInProgress)
                    return;

                this._promptingInProgress = true;

                using (frmTaskMonitoringEntry monitoring = new frmTaskMonitoringEntry(
                    this.View_GetCategories()
                        .Select(x => x.Name),
                    this.View_GetRememberedSetting(),
                    this.View_GetRememberedDate(),
                    this.txtObjectives.Text
                    )
                    )
                {
                    DialogResult result = monitoring.ShowDialog(this);

                    if (result != System.Windows.Forms.DialogResult.OK)
                        return;

                    this.SaveLogDetail(monitoring);

                    monitoring.Dispose();
                }
            }
            catch(Exception ex)
            {
                throw ex;
            }
            finally
            {
                this._promptingInProgress = false;
            }
        }