Beispiel #1
0
 /// <summary>
 /// Populate a Site object.
 /// </summary>
 /// <param name="input">The Site object to populate.</param>
 /// <param name="reader">The data reader from which to populate the Site object.</param>
 public static void PopulateSite(Site input, System.Data.IDataReader reader)
 {
     PopulateRecord(input, reader);
     input.RecordId = input.SiteId = Utilities.ToInt(reader["SiteID"]);
     input.OrganisationId = Utilities.ToInt(reader["OrganisationId"]);
     input.HotelId = Utilities.ToNInt(reader["HotelId"]);
     input.Name = Utilities.ToString(reader["Name"]);
     input.AbbreviatedName = Utilities.ToString(reader["AbbreviatedName"]);
     input.ContactInformationID = Utilities.ToNInt(reader["ContactInformationID"]);
     input.LicenseKey = Utilities.ToNGuid(reader["LicenseKey"]);
     input.StarRating = Utilities.ToNDecimal(reader["StarRating"]);
     input.PropCode = Utilities.ToString(reader["PropCode"]);
     input.DisplayIndex = Utilities.ToInt(reader["DisplayIndex"]);
     input.IsLegacy = Utilities.ToBool(reader["IsLegacy"]);
     input.Availability = Utilities.ToInt(reader["Availability"]);
 }
Beispiel #2
0
 /// <summary>
 /// Creates a Site object using data from a data reader.
 /// </summary>
 /// <param name="reader">A data reader containing a key and corresponding value for each property of a Site object.</param>
 /// <returns>A populated Site object.</returns>
 public static Site PopulateSite(System.Data.IDataReader reader)
 {
     Site result = null;
     if (reader != null && reader.Read())
     {
         result = new Site();
         PopulateSite(result, reader);
     }
     return result;
 }
        //void gvwSites_BeginningEdit(object sender, Telerik.Windows.Controls.GridViewBeginningEditRoutedEventArgs e)
        //{
        //    if (e.Cell.Column.UniqueName == "NumberOfRooms")
        //    {
        //        e.Cancel = true;
        //    }
        //}
        void gvwSites_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
        {
            Site newItem = new Site();
            newItem.RecordId = null;
            newItem.CreatedBy = Globals.UserLogin.UserName;
            newItem.OrganisationId = Globals.UserLogin.UserOrganisationId;
            newItem.ContactInformation = new ContactInformation();
            newItem.ContactInformation.ContactTypeId = (int) ContactType.Site;
            if (_originalItemSource.Count() > 0)
                newItem.DisplayIndex = _originalItemSource.Max(d => d.DisplayIndex) + 1;
            newItem.IsChanged = true;
            e.NewObject = newItem;

            gridContactAccount.Visibility = System.Windows.Visibility.Collapsed;
        }