Exemplo n.º 1
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     //CommonFunctions.Connection = new System.Data.SqlClient.SqlConnection();
     this.EmailsSet         = new Vacations.EmailsDataset();
     this.EmailsAdapter     = new System.Data.SqlClient.SqlDataAdapter();
     this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
     ((System.ComponentModel.ISupportInitialize)(this.EmailsSet)).BeginInit();
     //
     // CommonFunctions.Connection
     //
     //CommonFunctions.Connection.ConnectionString = "workstation id=MAIN;packet size=4096;integrated security=SSPI;data source=MAIN;pe" +
     //"rsist security info=False;initial catalog=Vacations";
     //
     // EmailsSet
     //
     this.EmailsSet.DataSetName = "EmailsDataset";
     this.EmailsSet.Locale      = new System.Globalization.CultureInfo("en-US");
     //
     // EmailsAdapter
     //
     this.EmailsAdapter.SelectCommand = this.sqlSelectCommand1;
     this.EmailsAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
         new System.Data.Common.DataTableMapping("Table", "Emails", new System.Data.Common.DataColumnMapping[] {
             new System.Data.Common.DataColumnMapping("ID", "ID"),
             new System.Data.Common.DataColumnMapping("PropertyID", "PropertyID"),
             new System.Data.Common.DataColumnMapping("DateTime", "DateTime"),
             new System.Data.Common.DataColumnMapping("ContactName", "ContactName"),
             new System.Data.Common.DataColumnMapping("ContactEmail", "ContactEmail"),
             new System.Data.Common.DataColumnMapping("ContactTelephone", "ContactTelephone"),
             new System.Data.Common.DataColumnMapping("ArrivalDate", "ArrivalDate"),
             new System.Data.Common.DataColumnMapping("DepartureDate", "DepartureDate"),
             new System.Data.Common.DataColumnMapping("Nights", "Nights"),
             new System.Data.Common.DataColumnMapping("Adults", "Adults"),
             new System.Data.Common.DataColumnMapping("Children", "Children"),
             new System.Data.Common.DataColumnMapping("Telephone", "Telephone"),
             new System.Data.Common.DataColumnMapping("Telephone2", "Telephone2"),
             new System.Data.Common.DataColumnMapping("Notes", "Notes"),
             new System.Data.Common.DataColumnMapping("Email", "Email"),
             new System.Data.Common.DataColumnMapping("IfCustom", "IfCustom")
         })
     });
     //
     // sqlSelectCommand1
     //
     this.sqlSelectCommand1.CommandText = @"SELECT ID, PropertyID, DateTime, ContactName, ContactEmail, ContactTelephone, ArrivalDate, DepartureDate, Nights, Adults, Children, Telephone, Telephone2, Notes, Email, IfCustom FROM Emails WHERE (PropertyID = @PropertyID) AND (DATEDIFF(dd, DateTime, GETDATE()) < 356) ORDER BY DateTime DESC";
     this.sqlSelectCommand1.Connection  = CommonFunctions.GetConnection();
     this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@PropertyID", System.Data.SqlDbType.Int, 4, "PropertyID"));
     ((System.ComponentModel.ISupportInitialize)(this.EmailsSet)).EndInit();
 }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     //CommonFunctions.Connection = new System.Data.SqlClient.SqlConnection();
     this.PhotosSet         = new Vacations.PhotosDataset();
     this.PropertiesFullSet = new Vacations.PropertiesFullDataset();
     this.PropertiesAdapter = new System.Data.SqlClient.SqlDataAdapter();
     this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
     this.PhotosAdapter     = new System.Data.SqlClient.SqlDataAdapter();
     this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand();
     this.EmailsAdapter     = new System.Data.SqlClient.SqlDataAdapter();
     this.sqlSelectCommand3 = new System.Data.SqlClient.SqlCommand();
     this.EmailsSet         = new Vacations.EmailsDataset();
     ((System.ComponentModel.ISupportInitialize)(this.PhotosSet)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.PropertiesFullSet)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.EmailsSet)).BeginInit();
     //
     // CommonFunctions.Connection
     //
     //CommonFunctions.Connection.ConnectionString = "workstation id=MAIN;packet size=4096;integrated security=SSPI;data source=MAIN;pe" +
     //"rsist security info=False;initial catalog=Vacations";
     //
     // PhotosSet
     //
     this.PhotosSet.DataSetName = "PhotosDataset";
     this.PhotosSet.Locale      = new System.Globalization.CultureInfo("en-US");
     //
     // PropertiesFullSet
     //
     this.PropertiesFullSet.DataSetName = "PropertiesFullDataset";
     this.PropertiesFullSet.Locale      = new System.Globalization.CultureInfo("en-US");
     //
     // PropertiesAdapter
     //
     this.PropertiesAdapter.SelectCommand = this.sqlSelectCommand1;
     this.PropertiesAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
         new System.Data.Common.DataTableMapping("Table", "Properties", new System.Data.Common.DataColumnMapping[] {
             new System.Data.Common.DataColumnMapping("MinimumNightlyRental", "MinimumNightlyRental"),
             new System.Data.Common.DataColumnMapping("Type", "Type"),
             new System.Data.Common.DataColumnMapping("FirstName", "FirstName"),
             new System.Data.Common.DataColumnMapping("LastName", "LastName"),
             new System.Data.Common.DataColumnMapping("PrimaryTelephone", "PrimaryTelephone"),
             new System.Data.Common.DataColumnMapping("OwnerCountry", "OwnerCountry"),
             new System.Data.Common.DataColumnMapping("Email", "Email"),
             new System.Data.Common.DataColumnMapping("Username", "Username"),
             new System.Data.Common.DataColumnMapping("OwnerAddress", "OwnerAddress"),
             new System.Data.Common.DataColumnMapping("EveningTelephone", "EveningTelephone"),
             new System.Data.Common.DataColumnMapping("DaytimeTelephone", "DaytimeTelephone"),
             new System.Data.Common.DataColumnMapping("MobileTelephone", "MobileTelephone"),
             new System.Data.Common.DataColumnMapping("Website", "Website"),
             new System.Data.Common.DataColumnMapping("OwnerCity", "OwnerCity"),
             new System.Data.Common.DataColumnMapping("OwnerState", "OwnerState"),
             new System.Data.Common.DataColumnMapping("OwnerZip", "OwnerZip"),
             new System.Data.Common.DataColumnMapping("Registered", "Registered"),
             new System.Data.Common.DataColumnMapping("IfPayTravelAgents", "IfPayTravelAgents"),
             new System.Data.Common.DataColumnMapping("City", "City"),
             new System.Data.Common.DataColumnMapping("StateProvince", "StateProvince"),
             new System.Data.Common.DataColumnMapping("Country", "Country"),
             new System.Data.Common.DataColumnMapping("Region", "Region"),
             new System.Data.Common.DataColumnMapping("Smoking", "Smoking"),
             new System.Data.Common.DataColumnMapping("PetFriendly", "PetFriendly"),
             new System.Data.Common.DataColumnMapping("ID", "ID"),
             new System.Data.Common.DataColumnMapping("UserID", "UserID"),
             new System.Data.Common.DataColumnMapping("Name", "Name"),
             new System.Data.Common.DataColumnMapping("TypeID", "TypeID"),
             new System.Data.Common.DataColumnMapping("Address", "Address"),
             new System.Data.Common.DataColumnMapping("CityID", "CityID"),
             new System.Data.Common.DataColumnMapping("IfShowAddress", "IfShowAddress"),
             new System.Data.Common.DataColumnMapping("NumBedrooms", "NumBedrooms"),
             new System.Data.Common.DataColumnMapping("NumBaths", "NumBaths"),
             new System.Data.Common.DataColumnMapping("NumSleeps", "NumSleeps"),
             new System.Data.Common.DataColumnMapping("MinimumNightlyRentalID", "MinimumNightlyRentalID"),
             new System.Data.Common.DataColumnMapping("NumTVs", "NumTVs"),
             new System.Data.Common.DataColumnMapping("NumVCRs", "NumVCRs"),
             new System.Data.Common.DataColumnMapping("NumCDPlayers", "NumCDPlayers"),
             new System.Data.Common.DataColumnMapping("Description", "Description"),
             new System.Data.Common.DataColumnMapping("Amenities", "Amenities"),
             new System.Data.Common.DataColumnMapping("LocalAttractions", "LocalAttractions"),
             new System.Data.Common.DataColumnMapping("Rates", "Rates"),
             new System.Data.Common.DataColumnMapping("CancellationPolicy", "CancellationPolicy"),
             new System.Data.Common.DataColumnMapping("DepositRequired", "DepositRequired"),
             new System.Data.Common.DataColumnMapping("IfMoreThan7PhotosAllowed", "IfMoreThan7PhotosAllowed"),
             new System.Data.Common.DataColumnMapping("IfFinished", "IfFinished"),
             new System.Data.Common.DataColumnMapping("IfApproved", "IfApproved"),
             new System.Data.Common.DataColumnMapping("IfPaid", "IfPaid"),
             new System.Data.Common.DataColumnMapping("DateAdded", "DateAdded"),
             new System.Data.Common.DataColumnMapping("DateStartViewed", "DateStartViewed"),
             new System.Data.Common.DataColumnMapping("VirtualTour", "VirtualTour"),
             new System.Data.Common.DataColumnMapping("RatesTable", "RatesTable"),
             new System.Data.Common.DataColumnMapping("PricesCurrency", "PricesCurrency"),
             new System.Data.Common.DataColumnMapping("CheckIn", "CheckIn"),
             new System.Data.Common.DataColumnMapping("CheckOut", "CheckOut"),
             new System.Data.Common.DataColumnMapping("LodgingTax", "LodgingTax"),
             new System.Data.Common.DataColumnMapping("TaxIncluded", "TaxIncluded"),
             new System.Data.Common.DataColumnMapping("DateAvailable", "DateAvailable"),
             new System.Data.Common.DataColumnMapping("IfDiscounted", "IfDiscounted"),
             new System.Data.Common.DataColumnMapping("IfLastMinuteCancellations", "IfLastMinuteCancellations"),
             new System.Data.Common.DataColumnMapping("HomeExchangeCityID1", "HomeExchangeCityID1"),
             new System.Data.Common.DataColumnMapping("HomeExchangeCityID2", "HomeExchangeCityID2"),
             new System.Data.Common.DataColumnMapping("HomeExchangeCityID3", "HomeExchangeCityID3")
         })
     });
     //
     // sqlSelectCommand1
     //
     this.sqlSelectCommand1.CommandText = "SELECT MinimumNightlyRentalTypes.Name AS MinimumNightlyRental, PropertyTypes.Name" +
                                          " AS Type, Users.FirstName, Users.LastName, Users.PrimaryTelephone, Users.Country" +
                                          " AS OwnerCountry, Users.Email, Users.Username, Users.Address AS OwnerAddress, Us" +
                                          "ers.EveningTelephone, Users.DaytimeTelephone, Users.MobileTelephone, Users.Websi" +
                                          "te, Users.City AS OwnerCity, Users.State AS OwnerState, Users.Zip AS OwnerZip, U" +
                                          "sers.Registered, Users.IfPayTravelAgents, Users.TouristBoard, Cities.City, StateProvinces.StateProvi" +
                                          "nce, Countries.Country, Regions.Region, CASE WHEN EXISTS (SELECT * FROM Properti" +
                                          "esAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID" +
                                          " WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity =" +
                                          " \'Smoking Permitted\')) THEN \'Yes\' ELSE \'No\' END AS Smoking, CASE WHEN EXISTS (SE" +
                                          "LECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.Amen" +
                                          "ityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND " +
                                          "(Amenities.Amenity = \'Pet Friendly\')) THEN \'Yes\' ELSE \'No\' END AS PetFriendly, P" +
                                          "roperties.ID, Properties.UserID, Properties.Name, Properties.TypeID, Properties." +
                                          "Address, Properties.CityID, Properties.IfShowAddress, Properties.NumBedrooms, Pr" +
                                          "operties.NumBaths, Properties.NumSleeps, Properties.MinimumNightlyRentalID, Prop" +
                                          "erties.NumTVs, Properties.NumVCRs, Properties.NumCDPlayers, Properties.IfMoreTha" +
                                          "n7PhotosAllowed, Properties.IfFinished, Properties.IfApproved, CASE WHEN EXISTS" +
                                          " (SELECT * FROM Invoices WHERE (Invoices.PropertyID = Properties.ID) AND" +
                                          " (PaymentAmount >= InvoiceAmount) AND (GETDATE() <= RenewalDate)) THEN 1 ELSE 0 END" +
                                          " AS IfPaid, Properties.DateAdded, Properties.DateStartViewed," +
                                          " Properties.VirtualTour, Properties.RatesTable, Properties.PricesCurrency, Prope" +
                                          "rties.CheckIn, Properties.CheckOut, Properties.LodgingTax, Properties.TaxInclude" +
                                          "d, Properties.DateAvailable, Properties.IfDiscounted, Properties.IfLastMinuteCan" +
                                          "cellations, Properties.HomeExchangeCityID1, Properties.HomeExchangeCityID2, Prop" +
                                          "erties.HomeExchangeCityID3 FROM Properties INNER JOIN Cities ON Properties.CityI" +
                                          "D = Cities.ID INNER JOIN StateProvinces ON StateProvinces.ID = Cities.StateProvi" +
                                          "nceID INNER JOIN Countries ON StateProvinces.CountryID = Countries.ID INNER JOIN" +
                                          " Regions ON Countries.RegionID = Regions.ID INNER JOIN Users ON Properties.UserI" +
                                          "D = Users.ID LEFT OUTER JOIN MinimumNightlyRentalTypes ON Properties.MinimumNigh" +
                                          "tlyRentalID = MinimumNightlyRentalTypes.ID LEFT OUTER JOIN PropertyTypes ON Prop" +
                                          "erties.TypeID = PropertyTypes.ID WHERE (Properties.IfFinished = 1) AND (Properti" +
                                          "es.IfApproved = 1) AND (Properties.ID = @PropertyID)";
     this.sqlSelectCommand1.Connection = CommonFunctions.GetConnection();
     this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@PropertyID", System.Data.SqlDbType.Int, 4, "ID"));
     //
     // PhotosAdapter
     //
     this.PhotosAdapter.SelectCommand = this.sqlSelectCommand2;
     this.PhotosAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
         new System.Data.Common.DataTableMapping("Table", "PropertyPhotos", new System.Data.Common.DataColumnMapping[] {
             new System.Data.Common.DataColumnMapping("ID", "ID"),
             new System.Data.Common.DataColumnMapping("PropertyID", "PropertyID"),
             new System.Data.Common.DataColumnMapping("FileName", "FileName"),
             new System.Data.Common.DataColumnMapping("OrderNumber", "OrderNumber"),
             new System.Data.Common.DataColumnMapping("Width", "Width"),
             new System.Data.Common.DataColumnMapping("Height", "Height")
         })
     });
     //
     // sqlSelectCommand2
     //
     this.sqlSelectCommand2.CommandText = "SELECT TOP 1 ID, PropertyID, FileName, OrderNumber, Width, Height FROM PropertyPh" +
                                          "otos WHERE (PropertyID = @PropertyID) ORDER BY OrderNumber";
     this.sqlSelectCommand2.Connection = CommonFunctions.GetConnection();
     this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@PropertyID", System.Data.SqlDbType.Int, 4, "PropertyID"));
     //
     // EmailsAdapter
     //
     this.EmailsAdapter.SelectCommand = this.sqlSelectCommand3;
     this.EmailsAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
         new System.Data.Common.DataTableMapping("Table", "Emails", new System.Data.Common.DataColumnMapping[] {
             new System.Data.Common.DataColumnMapping("ID", "ID"),
             new System.Data.Common.DataColumnMapping("PropertyID", "PropertyID"),
             new System.Data.Common.DataColumnMapping("DateTime", "DateTime"),
             new System.Data.Common.DataColumnMapping("ContactName", "ContactName"),
             new System.Data.Common.DataColumnMapping("ContactEmail", "ContactEmail"),
             new System.Data.Common.DataColumnMapping("ContactTelephone", "ContactTelephone"),
             new System.Data.Common.DataColumnMapping("ArrivalDate", "ArrivalDate"),
             new System.Data.Common.DataColumnMapping("DepartureDate", "DepartureDate"),
             new System.Data.Common.DataColumnMapping("Nights", "Nights"),
             new System.Data.Common.DataColumnMapping("Adults", "Adults"),
             new System.Data.Common.DataColumnMapping("Children", "Children"),
             new System.Data.Common.DataColumnMapping("Telephone", "Telephone"),
             new System.Data.Common.DataColumnMapping("Telephone2", "Telephone2"),
             new System.Data.Common.DataColumnMapping("Notes", "Notes"),
             new System.Data.Common.DataColumnMapping("Email", "Email"),
             new System.Data.Common.DataColumnMapping("IfCustom", "IfCustom")
         })
     });
     //
     // sqlSelectCommand3
     //
     this.sqlSelectCommand3.CommandText = "SELECT ID, PropertyID, DateTime, ContactName, ContactEmail, ContactTelephone, Arr" +
                                          "ivalDate, DepartureDate, Nights, Adults, Children, Telephone, Telephone2, Notes," +
                                          " Email, IfCustom FROM Emails";
     this.sqlSelectCommand3.Connection = CommonFunctions.GetConnection();
     //
     // EmailsSet
     //
     this.EmailsSet.DataSetName = "EmailsDataset";
     this.EmailsSet.Locale      = new System.Globalization.CultureInfo("en-US");
     ((System.ComponentModel.ISupportInitialize)(this.PhotosSet)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.PropertiesFullSet)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.EmailsSet)).EndInit();
 }