protected void ApplicationStatusDropDownList_SelectedIndexChanged(object sender, EventArgs e) { var applicationStatusDropDownList = (DropDownList)sender; var applicationId = (int)Utility.FindParentControl <GridDataItem>(applicationStatusDropDownList).GetDataKeyValue("ApplicationId"); var application = JobApplication.Load(applicationId); int statusId; if (!Utility.HasValue(applicationStatusDropDownList.SelectedValue)) { application.StatusId = null; } else if (int.TryParse(applicationStatusDropDownList.SelectedValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out statusId)) { application.StatusId = statusId; } else { Exceptions.LogException(new InvalidOperationException("During update of application status, StatusId could not be parsed.")); } application.Save(this.UserId); ////this.BindApplicationStatusDropDownList(applicationStatusDropDownList, application.StatusId); }
protected void UserStatusDropDownList_SelectedIndexChanged(object sender, EventArgs e) { var userStatusDropDownList = (DropDownList)sender; var applicationRow = Utility.FindParentControl <GridDataItem>(userStatusDropDownList); var userId = (int)applicationRow.GetDataKeyValue("UserId"); int statusId; int?statusIdValue = null; if (int.TryParse(userStatusDropDownList.SelectedValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out statusId)) { statusIdValue = statusId; } else if (Utility.HasValue(userStatusDropDownList.SelectedValue)) { Exceptions.LogException(new InvalidOperationException("During update of application status, StatusId could not be parsed.")); } UserStatusInfo.UpdateUserStatus(this.PortalSettings, userId, statusIdValue); // collapse all other application grids, so that the user's status isn't out of sync foreach (GridDataItem item in this.JobsGrid.MasterTableView.Items.Cast <GridDataItem>() .Where(item => item.Expanded && item != applicationRow.OwnerTableView.ParentItem)) { item.Expanded = false; } }
/// <summary> /// Gets the name of the database. /// </summary> /// <returns>The name of the database</returns> private string GetDatabaseName() { if (!Utility.HasValue(this.databaseName)) { this.databaseName = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, "SELECT DB_NAME()").ToString(); } return(this.databaseName); }