/// <summary> /// Creates a new appointment type. /// </summary> /// <param name="name">The name of the appointment type.</param> /// <returns>A new <see cref="AppointmentType"/>.</returns> public static AppointmentType Create(string name) { var appointmentType = new AppointmentType { Name = name }; return appointmentType; }
/// <summary> /// Handles the InsertCommand event of the AppointmentTypesGrid control. /// </summary> /// <param name="source">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.GridCommandEventArgs"/> instance containing the event data.</param> private void AppointmentTypesGridInsertCommand(object source, GridCommandEventArgs e) { if (!this.Page.IsValid) { e.Canceled = true; return; } var newValues = new Dictionary <string, string>(2); e.Item.OwnerTableView.ExtractValuesFromItem(newValues, (GridEditableItem)e.Item); var appointmentType = AppointmentType.Create(newValues["Name"]); appointmentType.Save(this.UserId, this.ModuleId); this.SuccessModuleMessage.Visible = true; this.SuccessModuleMessage.Text = this.Localize("AppointmentTypeInsertSuccess"); }
/// <summary> /// Handles the <see cref="RadGrid.DeleteCommand"/> event of the <see cref="AppointmentTypesGrid"/> control. /// </summary> /// <param name="source">The source of the event.</param> /// <param name="e">The <see cref="GridCommandEventArgs"/> instance containing the event data.</param> private void AppointmentTypesGridDeleteCommand(object source, GridCommandEventArgs e) { var appointmentTypeId = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"]; AppointmentType.Delete(appointmentTypeId); }
/// <summary> /// Fills an <see cref="AppointmentType"/> with the data in the specified <paramref name="appointmentTypeRecord"/>. /// </summary> /// <param name="appointmentTypeRecord">A pre-initialized data record that represents an <see cref="AppointmentType"/> instance.</param> /// <returns>An instantiated <see cref="AppointmentType"/> object.</returns> internal static AppointmentType Fill(IDataRecord appointmentTypeRecord) { var appointmentType = new AppointmentType { Id = (int)appointmentTypeRecord["AppointmentTypeId"], Name = appointmentTypeRecord["Name"].ToString() }; return appointmentType; }
/// <summary> /// Updates the type of the appointment. /// </summary> /// <param name="appointmentType">Type of the appointment.</param> /// <param name="revisingUserId">The revising user id.</param> public static void UpdateAppointmentType(AppointmentType appointmentType, int revisingUserId) { SqlDataProvider.Instance.ExecuteNonQuery( "UpdateAppointmentType", Engage.Utility.CreateIntegerParam("@appointmentTypeId", appointmentType.Id), Engage.Utility.CreateVarcharParam("@name", appointmentType.Name, 250), Engage.Utility.CreateIntegerParam("@revisingUser", revisingUserId)); }
/// <summary> /// Inserts an <paramref name="appointmentType"/> into SkyNet Central Repository (The database) /// </summary> /// <param name="appointmentType">The appointment type.</param> /// <param name="revisingUserId">The revising user id.</param> /// <param name="moduleId">The module id.</param> public static void InsertAppointmentType(AppointmentType appointmentType, int revisingUserId, int moduleId) { SqlDataProvider.Instance.ExecuteNonQuery( "InsertAppointmentType", Engage.Utility.CreateTextParam("@name", appointmentType.Name), Engage.Utility.CreateIntegerParam("@revisingUserId", revisingUserId), Engage.Utility.CreateIntegerParam("@moduleId", moduleId)); }