public bool InsertNewSeminar(SeminarsNpm newSeminar) { try { Entity.SeminarsNpms.Add(newSeminar); Entity.SaveChanges(); return(true); } catch { return(false); } }
private void AssignSeminarToSlot(SeminarsNpm seminar, int month) { if (month == -1) { if (string.IsNullOrEmpty(LastMonthSlot1Description.Text)) { //available this.LastMonthSlot1.Visible = true; this.LastMonthSlot1Title.Text = seminar.Title; this.LastMonthSlot1When.Text = "Date: " + seminar.When; this.LastMonthSlot1Description.Text = seminar.Description; this.LastMonthSlot1Where.Text = "Location: " + seminar.Where; this.LastMonthSlot1Price.Text = seminar.Price == 0f ? "Price: TBA" : "Price: " + seminar.Price + "$"; this.LastMonthSlot1PhoneNumber.Text = "Contact us at: " + seminar.PhoneNumber; } else if (string.IsNullOrEmpty(LastMonthSlot2Description.Text)) { //available this.LastMonthSlot2.Visible = true; this.LastMonthSlot2Title.Text = seminar.Title; this.LastMonthSlot2When.Text = "Date: " + seminar.When; this.LastMonthSlot2Description.Text = seminar.Description; this.LastMonthSlot2Where.Text = "Location: " + seminar.Where; this.LastMonthSlot2Price.Text = seminar.Price == 0f ? "Price: TBA" : "Price: " + seminar.Price + "$"; this.LastMonthSlot2PhoneNumber.Text = "Contact us at: " + seminar.PhoneNumber; } else { // None available return; } } else if (month == 0) { if (string.IsNullOrEmpty(LastMonthSlot1Description.Text)) { //available this.ThisMonthSlot1.Visible = true; this.ThisMonthSlot1Title.Text = seminar.Title; this.ThisMonthSlot1When.Text = "Date: " + seminar.When; this.ThisMonthSlot1Description.Text = seminar.Description; this.ThisMonthSlot1Where.Text = "Location: " + seminar.Where; this.ThisMonthSlot1Price.Text = seminar.Price == 0f ? "Price: TBA" : "Price: " + seminar.Price + "$"; this.ThisMonthSlot1PhoneNumber.Text = "Contact us at: " + seminar.PhoneNumber; } else if (string.IsNullOrEmpty(ThisMonthSlot2Description.Text)) { //available this.ThisMonthSlot2.Visible = true; this.ThisMonthSlot2Title.Text = seminar.Title; this.ThisMonthSlot2When.Text = "Date: " + seminar.When; this.ThisMonthSlot2Description.Text = seminar.Description; this.ThisMonthSlot2Where.Text = "Location: " + seminar.Where; this.ThisMonthSlot2Price.Text = seminar.Price == 0f ? "Price: TBA" : "Price: " + seminar.Price + "$"; this.ThisMonthSlot2PhoneNumber.Text = "Contact us at: " + seminar.PhoneNumber; } else { // None available return; } } else if (month == 1) { if (string.IsNullOrEmpty(LastMonthSlot1Description.Text)) { //available this.NextMonthSlot1.Visible = true; this.NextMonthSlot1Title.Text = seminar.Title; this.NextMonthSlot1When.Text = "Date: " + seminar.When; this.NextMonthSlot1Description.Text = seminar.Description; this.NextMonthSlot1Where.Text = "Location: " + seminar.Where; this.NextMonthSlot1Price.Text = seminar.Price == 0f ? "Price: TBA" : "Price: " + seminar.Price + "$"; this.NextMonthSlot1PhoneNumber.Text = "Contact us at: " + seminar.PhoneNumber; } else if (string.IsNullOrEmpty(NextMonthSlot2Description.Text)) { //available this.NextMonthSlot2.Visible = true; this.NextMonthSlot2Title.Text = seminar.Title; this.NextMonthSlot2When.Text = "Date: " + seminar.When; this.NextMonthSlot2Description.Text = seminar.Description; this.NextMonthSlot2Where.Text = "Location: " + seminar.Where; this.NextMonthSlot2Price.Text = seminar.Price == 0f ? "Price: TBA" : "Price: " + seminar.Price + "$"; this.NextMonthSlot2PhoneNumber.Text = "Contact us at: " + seminar.PhoneNumber; } else { // None available return; } } else if (month == 2) { if (string.IsNullOrEmpty(LastMonthSlot1Description.Text)) { //available this.NextNextMonthSlot1.Visible = true; this.NextNextMonthSlot1Title.Text = seminar.Title; this.NextNextMonthSlot1When.Text = "Date: " + seminar.When; this.NextNextMonthSlot1Description.Text = seminar.Description; this.NextNextMonthSlot1Where.Text = "Location: " + seminar.Where; this.NextNextMonthSlot1Price.Text = seminar.Price == 0f ? "Price: TBA" : "Price: " + seminar.Price + "$"; this.NextNextMonthSlot1PhoneNumber.Text = "Contact us at: " + seminar.PhoneNumber; } else if (string.IsNullOrEmpty(NextNextMonthSlot2Description.Text)) { //available this.NextNextMonthSlot2.Visible = true; this.NextNextMonthSlot2Title.Text = seminar.Title; this.NextNextMonthSlot2When.Text = "Date: " + seminar.When; this.NextNextMonthSlot2Description.Text = seminar.Description; this.NextNextMonthSlot2Where.Text = "Location: " + seminar.Where; this.NextNextMonthSlot2Price.Text = seminar.Price == 0f ? "Price: TBA" : "Price: " + seminar.Price + "$"; this.NextNextMonthSlot2PhoneNumber.Text = "Contact us at: " + seminar.PhoneNumber; } else { // None available return; } } else if (month == 3) { if (string.IsNullOrEmpty(LastMonthSlot1Description.Text)) { //available this.NextNextNextMonthSlot1.Visible = true; this.NextNextNextMonthSlot1Title.Text = seminar.Title; this.NextNextNextMonthSlot1When.Text = "Date: " + seminar.When; this.NextNextNextMonthSlot1Description.Text = seminar.Description; this.NextNextNextMonthSlot1Where.Text = "Location: " + seminar.Where; this.NextNextNextMonthSlot1Price.Text = seminar.Price == 0f ? "Price: TBA" : "Price: " + seminar.Price + "$"; this.NextNextNextMonthSlot1PhoneNumber.Text = "Contact us at: " + seminar.PhoneNumber; } else if (string.IsNullOrEmpty(NextNextNextMonthSlot2Description.Text)) { //available this.NextNextNextMonthSlot2.Visible = true; this.NextNextNextMonthSlot2Title.Text = seminar.Title; this.NextNextNextMonthSlot2When.Text = "Date: " + seminar.When; this.NextNextNextMonthSlot2Description.Text = seminar.Description; this.NextNextNextMonthSlot2Where.Text = "Location: " + seminar.Where; this.NextNextNextMonthSlot2Price.Text = seminar.Price == 0f ? "Price: TBA" : "Price: " + seminar.Price + "$"; this.NextNextNextMonthSlot2PhoneNumber.Text = "Contact us at: " + seminar.PhoneNumber; } else { // None available return; } } }