コード例 #1
0
        protected void SaveButton_Click(Object sender, EventArgs e)
        {
            try
            {
                SuccessLog currentLog = null;

                if (String.IsNullOrEmpty(this.EditGuidHidden.Value))
                {
                    currentLog = new SuccessLog(this.Session.GetCurrentUser());
                    MyDataContext.Default.SuccessLogs.AddObject(currentLog);
                }
                else
                {
                    currentLog = SuccessLog.LoadSingle(this.EditGuidHidden.Value.ToGuid());
                }

                currentLog.Date = DateTime.Parse(this.DateTextBox.Text);
                currentLog.Text = this.NoteTextBox.Text;
                currentLog.Type = (SuccessLogTypes)Enum.Parse(typeof(SuccessLogTypes), TypeRadioButton.SelectedValue);
                MyDataContext.Default.SaveChanges();

                this.ResponseAddOn.Redirect <Soul.Default>();
            }
            catch (Exception ex)
            {
                this.Master.ShowError(ex);
            }
        }
コード例 #2
0
        protected void EditButton_Click(Object sender, EventArgs e)
        {
            try
            {
                Guid       argument = new Guid((sender as ImageButton).CommandArgument);
                SuccessLog current  = SuccessLog.LoadSingle(argument);

                this.EditGuidHidden.Value          = current.Guid.ToString();
                this.DateTextBox.Text              = current.Date.ToShortDateString();
                this.NoteTextBox.Text              = current.Text;
                this.TypeRadioButton.SelectedValue = current.Type.ToString();
            }
            catch (Exception ex)
            {
                this.Master.ShowError(ex);
            }
        }