protected void LinkButtonOptions_Click(object sender, EventArgs e) { if (leaseOption == null) { leaseOption = new QuickPM.LeaseOption(tenant.TenantId); } leaseOption.ExercisedBy = TextBoxOptionExercisedBy.Text.Trim(); int notificationDate = 0; if (!int.TryParse(TextBoxOptionNotificationDate.Text, out notificationDate)) { Session["Message"] = "<font color=\"red\">Please enter a number for the option notification date field</font>"; return; } leaseOption.NotificationDate = notificationDate; int numberOptions = 0; if (!int.TryParse(TextBoxNumberOptions.Text, out numberOptions)) { Session["Message"] = "<font color=\"red\">Please enter a number the #options field</font>"; return; } leaseOption.NumberOptions = numberOptions; leaseOption.ExercisedBy = TextBoxOptionExercisedBy.Text.Trim(); int optionLength = 0; if (!int.TryParse(TextBoxOptionLength.Text, out optionLength)) { Session["Message"] = "<font color=\"red\">Please enter a whole number for the option length</font>"; return; } leaseOption.OptionLength = optionLength; leaseOption.Save(); hasOptions = true; return; }
protected void LoadOption() { if (tenant != null && !newLeaseOption) { leaseOption = new QuickPM.LeaseOption(tenant.TenantId); /*if (leaseOption.Id != -1) { hasOptions = true; }*/ if (leaseOption.ExercisedBy != "" || leaseOption.NotificationDate != 0 || leaseOption.NumberOptions != 0 || leaseOption.OptionLength != 0) { hasOptions = true; if (TextBoxOptionLength.Text.Trim() == "" && TextBoxNumberOptions.Text.Trim() == "" && TextBoxOptionNotificationDate.Text.Trim() == "") { TextBoxOptionLength.Text = leaseOption.OptionLength.ToString(); TextBoxNumberOptions.Text = leaseOption.NumberOptions.ToString(); TextBoxOptionNotificationDate.Text = leaseOption.NotificationDate.ToString(); TextBoxOptionExercisedBy.Text = leaseOption.ExercisedBy; } } } }