public ActionResult Delete(int?id) { ShowService service = new ShowService(); ShowDetail show = service.GetShowById(id); return(View(show)); }
//Add the show and show details: public bool AddShow(Show s, ShowDetail sd) { // Use these for test client; must already exist in db: // s.VenueKey = 4; // sd.Artist = 6; bool result = true; try { Show show = new Show(); show.ShowName = s.ShowName; show.ShowDate = s.ShowDate; show.ShowDateEntered = DateTime.Now; show.VenueKey = s.VenueKey; show.ShowTime = s.ShowTime; show.ShowTicketInfo = s.ShowTicketInfo; showTrackerDb.Shows.Add(show); ShowDetail showDetail = new ShowDetail(); showDetail.ArtistKey = sd.ArtistKey; showDetail.Show = show; showDetail.ShowDetailAdditional = sd.ShowDetailAdditional; showDetail.ShowDetailArtistStartTime = sd.ShowDetailArtistStartTime; showTrackerDb.ShowDetails.Add(showDetail); showTrackerDb.SaveChanges(); } catch { result = false; } return(result); }
public bool AddShow(Show s, ShowDetail sd) { Show show = new Show(); show.ShowName = s.ShowName; show.ShowDateEntered = s.ShowDateEntered; show.ShowDate = s.ShowDate; show.ShowTicketInfo = s.ShowTicketInfo; show.ShowTime = s.ShowTime; ShowDetail showDetail = new ShowDetail(); showDetail.ShowDetailAdditional = sd.ShowDetailAdditional; showDetail.ShowDetailArtistStartTime = sd.ShowDetailArtistStartTime; showDetail.Show = show; bool result = true; try { db.Shows.Add(show); db.ShowDetails.Add(showDetail); db.SaveChanges(); } catch (Exception ex) { result = false; throw ex; } return(result); }
public bool AddShow(Show s, ShowDetail d) { bool result = true; try { //I was missing some of the show details here Show sh = new Show(); sh.ShowName = s.ShowName; sh.ShowDate = s.ShowDate; sh.ShowDateEntered = s.ShowDateEntered; sh.ShowTime = s.ShowTime; sh.VenueKey = s.VenueKey; sh.ShowTicketInfo = s.ShowTicketInfo; db.Shows.Add(sh); ShowDetail sd = new ShowDetail(); sd.ArtistKey = d.ArtistKey; sd.ShowDetailArtistStartTime = d.ShowDetailArtistStartTime; sd.Show = sh; sd.ShowDetailAdditional = d.ShowDetailAdditional; db.ShowDetails.Add(sd); db.SaveChanges(); } catch { result = false; } return(result); }
//Add the show and show details: public bool AddShow(Show s, ShowDetail sd) { // Use these for test client; must already exist in db: // s.VenueKey = 4; // sd.Artist = 6; bool result = true; try { Show show = new Show(); show.ShowName = s.ShowName; show.ShowDate = s.ShowDate; show.ShowDateEntered = DateTime.Now; show.VenueKey = s.VenueKey; show.ShowTime = s.ShowTime; show.ShowTicketInfo = s.ShowTicketInfo; showTrackerDb.Shows.Add(show); ShowDetail showDetail = new ShowDetail(); showDetail.ArtistKey = sd.ArtistKey; showDetail.Show = show; showDetail.ShowDetailAdditional = sd.ShowDetailAdditional; showDetail.ShowDetailArtistStartTime = sd.ShowDetailArtistStartTime; showTrackerDb.ShowDetails.Add(showDetail); showTrackerDb.SaveChanges(); } catch { result = false; } return result; }
public int AddShowDetails(ShowDetailsLite sdl) { int result = 1; ShowDetail sd = new ShowDetail(); var shk = from sk in db.ShowDetails where sk.Show.ShowName.Equals(sdl.ShowName) select new { sk.ShowKey }; var ark = from ak in db.ShowDetails where ak.Artist.ArtistName.Equals(sdl.ArtistNames) select new { ak.ArtistKey }; sd.ArtistKey = sdl.ArtistKey; sd.ShowKey = sdl.ShowKey; sd.ShowDetailArtistStartTime = sdl.ShowDetailArtistStartTime; sd.ShowDetailAdditional = sdl.ShowDetailAdditional; try { db.ShowDetails.Add(sd); db.SaveChanges(); } catch (Exception ex) { result = 0; throw ex; } return result; }
public bool AddShow(Show s, ShowDetail sd) { Show show = new Show(); ShowDetail showDetail = new ShowDetail(); Boolean result = true; show.ShowName = s.ShowName; show.ShowDateEntered = DateTime.Now; show.ShowDate = s.ShowDate; show.ShowTime = s.ShowTime; show.ShowTicketInfo = s.ShowTicketInfo; show.VenueKey = s.VenueKey; showDetail.Show = show; showDetail.ShowDetailArtistStartTime = sd.ShowDetailArtistStartTime; showDetail.ShowDetailAdditional = sd.ShowDetailAdditional; try { db.Shows.Add(show); db.ShowDetails.Add(showDetail); db.SaveChanges(); } catch { result = false; } return(result); }
protected void btnShow_Click(object sender, EventArgs e) { int vKey = (int)Session["venueKey"]; DateTime shDate = Calendar1.SelectedDate; Show s = new Show(); s.ShowName = txtShowName.Text; s.ShowDate = shDate; s.VenueKey = vKey; s.ShowTime = TimeSpan.Parse(txtTime.Text); s.ShowTicketInfo = txtInfo.Text; ShowDetail sd = new ShowDetail(); sd.ArtistKey = int.Parse(lblArtistKey.Text); sd.ShowDetailArtistStartTime = TimeSpan.Parse(txtArtistStart.Text); sd.ShowDetailAdditional = txtAdditional.Text; bool result = sdsc.AddShow(s, sd); if (!result) { lblResult.Text = "Show was not entered"; } else { lblResult.Text = "Show was Saved"; } }
public bool AddShow(Show sh, ShowDetailInfo sd) { Show s = new Show(); s.ShowName = sh.ShowName; s.ShowDate = sh.ShowDate; s.ShowDateEntered = sh.ShowDateEntered; s.ShowTime = sh.ShowTime; s.ShowTicketInfo = sh.ShowTicketInfo; s.ShowKey = sh.ShowKey; ShowDetail showDet = new ShowDetail(); showDet.ShowKey = sd.ShowKey; showDet.ArtistKey = sd.ArtistKey; showDet.ShowDetailArtistStartTime = sd.ArtistKeyShowDetailArtistStartTime.TimeOfDay; showDet.ShowDetailAdditional = sd.ShowDetailAdditional; bool result = true; try { db.Shows.Add(s); db.ShowDetails.Add(showDet); db.SaveChanges(); } catch (Exception ex) { result = false; } return(result); }
public List <ShowDetail> getDetail(string sName, int vKey) { var sDetails = from d in data.ShowDetails from s in data.Shows from a in data.Artists where s.ShowName.Equals(sName) where s.VenueKey.Equals(vKey) select new { d.Artist, d.ShowDetailArtistStartTime, d.ShowDetailAdditional }; List <ShowDetail> details = new List <ShowDetail>(); foreach (var e in sDetails) { ShowDetail newDetail = new ShowDetail(); newDetail.Artist = e.Artist; newDetail.ShowDetailArtistStartTime = e.ShowDetailArtistStartTime; newDetail.ShowDetailAdditional = e.ShowDetailAdditional; details.Add(newDetail); } return(details); }
public BEncodedValue Encode() { BEncodedDictionary result = new BEncodedDictionary(); result.Add("Width", new BEncodedNumber(FormWidth)); result.Add("height", new BEncodedNumber(FormHeight)); result.Add("splitterDistance", new BEncodedNumber(SplitterDistance)); result.Add("VScrollValue", new BEncodedNumber(VScrollValue)); result.Add("HScrollValue", new BEncodedNumber(HScrollValue)); result.Add("ShowToolbar", new BEncodedString(ShowToolbar.ToString())); result.Add("ShowDetail", new BEncodedString(ShowDetail.ToString())); result.Add("ShowStatusbar", new BEncodedString(ShowStatusbar.ToString())); for (int i = 0; i < torrentViewColumnWidth.Count; i++) { result.Add("TorrentViewColumnWidth" + i.ToString(), new BEncodedNumber(torrentViewColumnWidth[i])); } for (int i = 0; i < peerViewColumnWidth.Count; i++) { result.Add("PeerViewColumnWidth" + i.ToString(), new BEncodedNumber(peerViewColumnWidth[i])); } for (int i = 0; i < pieceViewColumnWidth.Count; i++) { result.Add("PieceViewColumnWidth" + i.ToString(), new BEncodedNumber(pieceViewColumnWidth[i])); } result.Add("CustomButtonPath", new BEncodedString(CustomButtonPath)); return(result); }
private void button4_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { MessageBox.Show("Please select an item to view."); return; } else { int matID = 0; int rowID = dataGridView1.SelectedRows[0].Index; foreach (DataGridViewRow item in dataGridView1.SelectedRows) { foreach (MaterialInfo material in currentMaterialList) { string name = material.name; if (material.type.ToLower() != "none" && material.type != "") { name += " (" + material.type + ")"; } if (name == item.Cells[0].Value.ToString()) { matID = currentMaterialList.IndexOf(material); break; } } } ShowDetail newForm = new ShowDetail(currentMaterialList[matID]); newForm.Show(); return; } }
public ShowDetails(string showId, int current_page = 1) { //getWebPage = new GetWebPage(); _show = new ShowDetail(); _allShows = new Shows(); _showAuthors = new List <Authors>(); this._showId = showId; this._currentPage = current_page; }
public void AddShowDetail(ShowDetailLite sdl) { ShowDetail sd = new ShowDetail(); sd.ShowDetailArtistStartTime = TimeSpan.Parse(sdl.ArtistStartTime); sd.ShowDetailAdditional = sdl.Additional; db.ShowDetails.Add(sd); db.SaveChanges(); }
public static void AddWarehouse(SanPham monHang) { GameObject obj = Instantiate(wareHouseItemPrefabStatic, wareHouseContentStatic.transform); obj.GetComponent <CartItemClick>().sp = monHang; obj.transform.SetAsLastSibling(); wareHouseContentStatic.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(wareHouseContentStatic.transform.GetComponent <RectTransform>().sizeDelta.x, CreateObjOnMap.listItemWareHouse.Count * 50 + CreateObjOnMap.listItemWareHouse.Count * 5 + 20); obj.transform.GetChild(0).GetComponent <RawImage>().texture = ShowDetail.LoadImage(Application.dataPath + "/Images/Products/" + monHang.Image); obj.transform.GetChild(1).GetComponent <Text>().text = " " + monHang.Name; obj.transform.GetChild(2).GetComponent <Text>().text = monHang.Price.ToString() + " đ"; }
// GET: Show Details public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ShowService service = new ShowService(); ShowDetail show = service.GetShowById(id); return(View(show)); }
public int AddShowDetails(ShowDetailsLite sdl) { int result = 1; ShowDetail sd = new ShowDetail(); var shk = from sk in st.Shows where sk.ShowName.Equals(sdl.ShowName) select new { sk.ShowKey }; int skey = 0; foreach (var i in shk) { skey = (int)i.ShowKey; } var ark = from ak in st.Artists where ak.ArtistName.Equals(sdl.ArtistName) select new { ak.ArtistKey }; int akey = 0; foreach (var c in ark) { akey = (int)c.ArtistKey; } sd.ArtistKey = akey; sd.ShowKey = skey; sd.ShowDetailArtistStartTime = sdl.ShowDetailArtistStartTime; sd.ShowDetailAdditional = sdl.ShowDetailAdditional; try { st.ShowDetails.Add(sd); st.SaveChanges(); } catch (Exception ex) { result = 0; throw ex; } return(result); }
public void AddShowDetails(NewShowDetails b) { ShowDetail showDetail = new ShowDetail(); showDetail.ShowDetailKey = b.ShowDetailKey; showDetail.ShowKey = b.ShowKey; showDetail.ArtistKey = b.ArtistKey; showDetail.ShowDetailArtistStartTime = b.ShowDetailArtistStartTime; showDetail.ShowDetailAdditional = b.ShowDetailAdditional; db.ShowDetails.Add(showDetail); db.SaveChanges(); }
public int AddShowDetail(ShowDetailLite sd) { ShowDetail sho = new ShowDetail(); sho.ShowKey = sd.Showkey; sho.ArtistKey = sd.ArtistKey; sho.ShowDetailArtistStartTime = sd.ShowDetailArtistStartTime; sho.ShowDetailAdditional = sd.ShowDetailAdditional; db.ShowDetails.Add(sho); db.SaveChanges(); return 1; }
private void продукцияToolStripMenuItem_Click(object sender, EventArgs e) { int?OldValue = null; if (ShowDetail.SelectedValue != null) { OldValue = (int)ShowDetail.SelectedValue; } ShowDetail.Focus(); (new Production(vypuskDataSet)).ShowDialog(); продукцияTableAdapter.Update(vypuskDataSet.Продукция); продукцияTableAdapter.Fill(this.vypuskDataSet.Продукция); LoadTree(); ShowDetail.SelectedValue = OldValue; }
protected async override void OnAppearing() { base.OnAppearing(); if (this.episodeCollection.ItemsSource == null) { ShowDetails showDetails = new ShowDetails(this.showId, this._currentPage); this.showDetail = await showDetails.getAllContent(); showTitleLabel.Text = this.showDetail.showTitle; // Would suggest that we change this from SHOWS class to List<Episode>. Because it's a list of EPISODES. // Or, it's technically like the shows class. So, we can do one thing, use the same class. Because when you click on Show.. you can redirect to SingleEpisde. // SingleEpisode has all the needed information. this.episodeCollection.ItemsSource = this.showDetail.showEpisodes.result; } }
public int AddShowDetail(ShowDetailLite sdl) { int result = 1; ShowDetail sd = new ShowDetail(); var key = from k in db.Artists where k.ArtistName.Equals(sdl.ArtistName) select new { k.ArtistKey }; int AKey = 0; foreach (var k in key) { AKey = (int)k.ArtistKey; } var kkey = from kk in db.Shows where kk.ShowName.Equals(sdl.ShowName) select new { kk.ShowKey }; int SKey = 0; foreach (var kk in kkey) { SKey = (int)kk.ShowKey; } sd.ArtistKey = AKey; sd.ShowDetailArtistStartTime = TimeSpan.Parse(sdl.ArtistStartTime); sd.ShowDetailAdditional = sdl.Note; sd.ShowKey = SKey; try { db.ShowDetails.Add(sd); db.SaveChanges(); } catch (Exception ex) { result = 0; throw ex; } return(result); }
private async void HideDetailReload(object sender, object e) { HideDetail.Completed -= HideDetailReload; ImageData = await ImageData.DetailDataReLoad(); if (ImageData != null) { Detail.Visibility = Visibility.Visible; ShowDetail.Begin(); } else { ShowMessage("Something wrong!"); } }
public static void AddCart(SanPham monHang) { if (gioHang == null) { gioHang = new List <SanPham>(); } gioHang.Add(monHang); monHang.Obj.SetActive(false); GameObject obj = Instantiate(cartItemPrefabStatic, cartContentStatic.transform); obj.GetComponent <CartItemClick>().sp = monHang; obj.transform.SetAsLastSibling(); cartContentStatic.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(cartContentStatic.transform.GetComponent <RectTransform>().sizeDelta.x, gioHang.Count * 50 + gioHang.Count * 5 + 20); obj.transform.GetChild(0).GetComponent <RawImage>().texture = ShowDetail.LoadImage(Application.dataPath + "/Images/Products/" + monHang.Image); obj.transform.GetChild(1).GetComponent <Text>().text = " " + monHang.Name; obj.transform.GetChild(2).GetComponent <Text>().text = monHang.Price.ToString() + " đ"; gioHangUI.Add(obj); }
// GET: Edit Movie public ActionResult Edit(int?id) { ShowService service = new ShowService(); ShowDetail detail = service.GetShowById(id); ShowEdit show = new ShowEdit() { Id = detail.Id, Title = detail.Title, Description = detail.Description, PosterUrl = detail.PosterUrl, NextReleaseDate = detail.NextReleaseDate, Franchise = detail.Franchise, AnticipationValue = detail.AnticipationValue }; return(View(show)); }
private void OpenDet_Click(object sender, EventArgs e) { int?OldValue = null; if (ShowDetail.SelectedValue != null) { OldValue = (int)ShowDetail.SelectedValue; } ShowDetail.Focus(); if (!ShowDetail.Focused) { switch (tabControl1.SelectedIndex) { case (0): { if (dataGridView1.SelectedCells[0].OwningRow.Cells[2].Value.GetType() != typeof(DBNull)) { (new Production(vypuskDataSet)).ShowDialog((int)dataGridView1.SelectedCells[0].OwningRow.Cells[2].Value); } break; } case (1): { (new Production(vypuskDataSet)).ShowDialog((treeView1.SelectedNode.Tag as int[])[1]); break; } case (2): { (new Production(vypuskDataSet)).ShowDialog((treeView2.SelectedNode.Tag as int[])[1]); break; } } } else { (new Production(vypuskDataSet)).ShowDialog((int)ShowDetail.SelectedValue); } продукцияTableAdapter.Update(vypuskDataSet.Продукция); продукцияTableAdapter.Fill(this.vypuskDataSet.Продукция); LoadTree(); ShowDetail.SelectedValue = OldValue; }
public List <ShowDetail> GetDetails(int sKey) { List <ShowDetail> details = new List <ShowDetail>(); var det = from d in showTrackerDb.ShowDetails where d.ShowKey == sKey select new { d.ShowDetailArtistStartTime, d.ShowDetailAdditional, d.Artist.ArtistName }; foreach (var sd in det) { ShowDetail showDetail = new ShowDetail(); showDetail.ShowDetailArtistStartTime = sd.ShowDetailArtistStartTime; showDetail.ShowDetailAdditional = sd.ShowDetailAdditional; showDetail.Artist.ArtistName = sd.ArtistName; details.Add(showDetail); } return(details); }
/* * private async void Image_Tapped(object sender, TappedRoutedEventArgs e) * { * ImageData = await ((sender as Image).DataContext as Models.Image).DetailDataLoad(); * if (ImageData != null) * { * PrepareToOpen(); * * SetLeftRightButtonsEnable(); * Detail.Visibility = Visibility.Visible; * DetailImageProgressTextBlock.Opacity = 1; * SetProgressValue(0); * ShowDetail.Begin(); * } * else * { * ShowMessage("Something wrong!"); * } * } */ private async void ImagesGrid_ImageTapped(object sender, Models.Image e) { ImageData = await e.DetailDataLoad(); if (ImageData != null) { PrepareToOpen(); SetLeftRightButtonsEnable(); Detail.Visibility = Visibility.Visible; DetailImageProgressTextBlock.Opacity = 1; SetProgressValue(0); ShowDetail.Begin(); } else { ShowMessage("Something wrong!"); } }
public void ShowDetailAdd(ShowDetailLite sl) { var skey = from s in db.Shows where s.ShowName.Equals(sl.Title) select new { s.ShowKey }; int key = 0; foreach (var k in skey) { key = (int)k.ShowKey; } ShowDetail sh = new ShowDetail(); sh.ShowDetailArtistStartTime = sl.StartTime; sh.ShowDetailAdditional = sl.Additional; sh.ShowKey = key; db.ShowDetails.Add(sh); db.SaveChanges(); }
public static void ShowDetails(SanPham sanPham, bool isAdd) { detailSt.SetActive(true); if (isAdd) { okSt.SetActive(true); updateSt.SetActive(false); deleteSt.SetActive(false); nameSt.GetComponent <InputField>().text = ""; priceSt.GetComponent <InputField>().text = ""; desciptionSt.GetComponent <InputField>().text = ""; typeSt.GetComponent <Dropdown>().value = 0; expSt.GetComponent <InputField>().text = ""; weightSt.GetComponent <InputField>().text = ""; quantitySt.GetComponent <InputField>().text = ""; sizeSt.GetComponent <Toggle>().isOn = false; } else { okSt.SetActive(false); updateSt.SetActive(true); deleteSt.SetActive(true); nameSt.GetComponent <InputField>().text = sanPham.Name; priceSt.GetComponent <InputField>().text = sanPham.Price.ToString(); desciptionSt.GetComponent <InputField>().text = sanPham.Description; expSt.GetComponent <InputField>().text = sanPham.Exp; weightSt.GetComponent <InputField>().text = sanPham.Weight.ToString(); quantitySt.GetComponent <InputField>().text = sanPham.Quantity.ToString(); sizeSt.GetComponent <Toggle>().isOn = (sanPham.Size == 1) ? false : true; imageSt.GetComponent <RawImage>().texture = ShowDetail.LoadImage(Application.dataPath + "/Images/Products/" + sanPham.Image); int index = 0; foreach (LoaiSanPham lsp in CreateObjOnMap.listType) { if (lsp.Id == sanPham.Type) { break; } index++; } typeSt.GetComponent <Dropdown>().value = index; } }
public bool addDetail(string showName, string artistName, TimeSpan artistStart, string moreDetail) { ShowDetail detail = new ShowDetail(); bool result = true; detail.ArtistKey = data.Artists.FirstOrDefault(x => x.ArtistName.Equals(artistName)).ArtistKey; detail.ShowKey = data.Shows.FirstOrDefault(x => x.ShowName.Equals(showName)).ShowKey; detail.ShowDetailArtistStartTime = artistStart; detail.ShowDetailAdditional = moreDetail; try { data.ShowDetails.Add(detail); data.SaveChanges(); } catch { result = false; } return(result); }
void OnMouseOver() { if (Input.GetMouseButtonDown(1)) { if (Input.GetKey(KeyCode.LeftControl)) { Cart.AddCart(sanPham); posObj.GetChild(2).gameObject.SetActive(true); if (transform.tag == "Item2x") { posObj2.GetChild(2).gameObject.SetActive(true); } } else { ShowDetail.ShowDetails(sanPham, true); Cart.sanPhamAdd = sanPham; } } }
public ActionResult ConfirmSelection([FromForm] VMSheatSelection formData) { ShowDetail dataTable = _dbAccess.SelectShow(formData.ShowId); ViewBag.SelectedSheats = formData.chkSheats; ViewBag.ShowId = formData.ShowId; var _hfDynamic = ""; System.Collections.Hashtable _hashtableSelectSheats = new System.Collections.Hashtable(); foreach (string sheat in formData.chkSheats.Split(',')) { string initial = sheat.ToString().Substring(0, 1); if (initial == "A" || initial == "B" || initial == "C") { _hashtableSelectSheats.Add(sheat, "100"); } else if (initial == "D" || initial == "E" || initial == "F") { _hashtableSelectSheats.Add(sheat, "175"); } else if (initial == "G" || initial == "H" || initial == "I") { _hashtableSelectSheats.Add(sheat, "225"); } } decimal totalCost = 0; foreach (string item in _hashtableSelectSheats.Keys) { totalCost += Convert.ToDecimal(_hashtableSelectSheats[item]); _hfDynamic += "<tr><td align=\"center\" class=\"style2\" style=\"background-color: #FF9900\">" + item + "</td><td align=\"center\" style=\"background-color: #FF9900\">" + _hashtableSelectSheats[item].ToString() + " Rs.</td><td align=\"center\" style=\"background-color: #FF9900\"> </td></tr>"; } _hfDynamic += "<tr><td align=\"center\" class=\"style2\" style=\"background-color: #00FF00\"> Total Cost = </td><td align=\"center\" style=\"background-color: #00FF00\">" + totalCost + " Rs.</td><td align=\"center\" style=\"background-color: #00FF00\"> </td></tr>"; ViewBag._hfDynamic = _hfDynamic; ViewBag.totalCost = totalCost; ViewBag.totalCount = _hashtableSelectSheats.Count; Session["_hashtableSelectSheats"] = _hashtableSelectSheats; return(View(dataTable)); }
public int AddShowDetails(ShowDetailsLite sdl) { int result = 1; ShowDetail sd = new ShowDetail(); var shk = from sk in st.Shows where sk.ShowName.Equals(sdl.ShowName) select new { sk.ShowKey }; int skey = 0; foreach (var i in shk) { skey = (int)i.ShowKey; } var ark = from ak in st.Artists where ak.ArtistName.Equals(sdl.ArtistName) select new { ak.ArtistKey }; int akey = 0; foreach (var c in ark) { akey = (int)c.ArtistKey; } sd.ArtistKey = akey; sd.ShowKey = skey; sd.ShowDetailArtistStartTime = sdl.ShowDetailArtistStartTime; sd.ShowDetailAdditional = sdl.ShowDetailAdditional; try { st.ShowDetails.Add(sd); st.SaveChanges(); } catch (Exception ex) { result = 0; throw ex; } return result; }
public int AddShowDetail(ShowDetailLite sdl) { int result = 1; ShowDetail sd = new ShowDetail(); var key = from k in db.Artists where k.ArtistName.Equals(sdl.ArtistName) select new { k.ArtistKey }; int AKey = 0; foreach (var k in key) { AKey = (int)k.ArtistKey; } var kkey = from kk in db.Shows where kk.ShowName.Equals(sdl.ShowName) select new { kk.ShowKey }; int SKey = 0; foreach (var kk in kkey) { SKey = (int)kk.ShowKey; } sd.ArtistKey = AKey; sd.ShowDetailArtistStartTime = TimeSpan.Parse(sdl.ArtistStartTime); sd.ShowDetailAdditional = sdl.Note; sd.ShowKey = SKey; try { db.ShowDetails.Add(sd); db.SaveChanges(); } catch (Exception ex) { result = 0; throw ex; } return result; }
public List<ShowDetail> GetDetails(int sKey) { List<ShowDetail> details = new List<ShowDetail>(); var det = from d in showTrackerDb.ShowDetails where d.ShowKey == sKey select new { d.ShowDetailArtistStartTime, d.ShowDetailAdditional,d.Artist.ArtistName }; foreach (var sd in det) { ShowDetail showDetail = new ShowDetail(); showDetail.ShowDetailArtistStartTime = sd.ShowDetailArtistStartTime; showDetail.ShowDetailAdditional = sd.ShowDetailAdditional; showDetail.Artist.ArtistName = sd.ArtistName; details.Add(showDetail); } return details; }