public ActionResult DeleteConfirmed(int id) { ViewBag.Exception = null; string msg = null; Pubs pubs = db.Pubs.Find(id); db.Pubs.Remove(pubs); try { db.SaveChanges(); } catch (Exception e) { if (e.InnerException == null) { msg = e.Message; } else { msg = e.InnerException.InnerException.Message; } ViewBag.Exception = msg; ViewBag.pub_address = (from a in db.Address where a.id == pubs.adress_id select a).First(); return(View(pubs)); } return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { Pubs pubs = db.Pubs.Find(id); db.Pubs.Remove(pubs); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult BeersMap() { ViewBag.Title = "Beers"; GoogleClass gg = new GoogleClass(); Pubs pp = new Pubs(); IList <Visit> beers = pp.ProcessValues(gg.GetBeerData()); return(View(beers)); }
protected void Page_Load(object sender, EventArgs e) { List <publisher> pubs = Pubs.GetPublishers(); ddlPub.DataSource = pubs; ddlPub.DataTextField = "pub_name"; ddlPub.DataValueField = "pub_id"; ddlPub.DataBind(); }
public ActionResult Edit([Bind(Include = "PubsId,LicenciaFiscal,Domicilio,FechaApertura,Horario")] Pubs pubs) { if (ModelState.IsValid) { db.Entry(pubs).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pubs)); }
public _Pub GetPublisher(string pubID) { publisher pub = Pubs.GetSinglePub(pubID); _Pub p = new _Pub(); p.PubID = pub.pub_id; p.Name = pub.pub_name; p.City = pub.city; return(p); }
public ActionResult Create([Bind(Include = "PubsId,LicenciaFiscal,Domicilio,FechaApertura,Horario")] Pubs pubs) { if (ModelState.IsValid) { db.Pubs.Add(pubs); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pubs)); }
public ActionResult Create([Bind(Include = "id,name,adress_id,e_mail,telephone_no")] Pubs pubs) { ViewBag.Exception = null; string msg = ""; if (ModelState.IsValid) { db.Pubs.Add(pubs); try { db.SaveChanges(); } catch (Exception e) { if (e.InnerException == null) { msg = e.Message; } else { msg = e.InnerException.InnerException.Message; } ViewBag.Exception = msg; List <SelectListItem> list = new List <SelectListItem>(); var entities = (from a in db.Address orderby a.street, a.building_no, a.postal_code, a.city select a).ToList(); foreach (var i in entities) { list.Add(new SelectListItem { Selected = false, Text = i.ToString(), Value = i.id.ToString() }); } ViewBag.adress_id = new SelectList(list, "Value", "Text", 1); return(View(pubs)); } return(RedirectToAction("Index")); } List <SelectListItem> list2 = new List <SelectListItem>(); var entities2 = (from a in db.Address orderby a.street, a.building_no, a.postal_code, a.city select a).ToList(); foreach (var i in entities2) { list2.Add(new SelectListItem { Selected = false, Text = i.ToString(), Value = i.id.ToString() }); } ViewBag.adress_id = new SelectList(list2, "Value", "Text", 1); return(View(pubs)); }
// GET: Pubs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Pubs pubs = db.Pubs.Find(id); if (pubs == null) { return(HttpNotFound()); } return(View(pubs)); }
// GET: Pubs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Pubs pubs = db.Pubs.Find(id); ViewBag.pub_address = (from a in db.Address where a.id == pubs.adress_id select a).First(); if (pubs == null) { return(HttpNotFound()); } return(View(pubs)); }
private void RefreshContacts() { List <Pubs._Contact> contacts = Pubs.GetContacts(ddlPubs.SelectedValue); if (contacts.Count() > 0) { GridView2.DataSource = contacts; GridView2.DataBind(); } else { GridView2.EmptyDataText = "There are no PR or Sales Contacts for the selected publisher."; GridView2.DataBind(); } }
public void AddPub(Pubs PubToBeAdded) { try { using (var db = new rftkocsmadbEntities3()) { db.Pubs.Add(PubToBeAdded); db.SaveChanges(); } } catch (Exception e) { throw e; } }
private void RefreshRoyalties() { //bind initial data grid to the default publisher in the DDL //System.Threading.Thread.Sleep(5000); List <Pubs._Royalty> royalties = Pubs.GetRoyalties(ddlPubs.SelectedValue); if (royalties.Count() > 0) { GridView1.DataSource = royalties; GridView1.DataBind(); } else { GridView1.EmptyDataText = "There are no sales for the selected publisher."; GridView1.DataBind(); } }
protected void btnAdd_Click(object sender, EventArgs e) { try { Pubs.AddPub(txtName.Text, txtCity.Text, ddlState.SelectedValue); btnAdd.Visible = false; btnReset.Visible = true; lblResult.Visible = true; lblResult.CssClass = "tip"; lblResult.Text = "The new Publisher has been added."; } catch (Exception ex) { lblResult.Visible = true; lblResult.CssClass = "error"; lblResult.Text = ex.Message.ToString(); } }
private static void MultiCasting() { Subs subs = new Subs(); Pubs pubs = new Pubs(); pubs.Register(subs); pubs.Publish(); Publisher publisher = new Publisher(); // SendViaEmail SE = new SendViaEmail(); // SendViaMobile SM = new SendViaMobile(); // publisher.publishmsg += SE.sendEmail; // publisher.publishmsg += SM.sendMessage; // publisher.PublishMessage("Hello You Have received New Notification"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <publisher> pList = Pubs.GetPublishers(); ddlPubs.DataSource = pList; ddlPubs.DataTextField = "pub_name"; ddlPubs.DataValueField = "pub_id"; ddlPubs.DataBind(); //now repeat the above for jQuery tab ddlPubsJquery.DataSource = pList; ddlPubsJquery.DataTextField = "pub_name"; ddlPubsJquery.DataValueField = "pub_id"; ddlPubsJquery.DataBind(); //bind initial data grid to the default publisher in the DDL RefreshRoyalties(); RefreshContacts(); } }
private async Task SetPubs() { var pubs = new ObservableCollection <PubView>(); switch (pubsViewMode) { case CommonDef.PubsViewMode.UserPubForItem: case CommonDef.PubsViewMode.UserPubForEvent: Title = "店舗一覧"; pubs = await UserController.GetUserPubs(); break; default: break; } foreach (var pub in pubs) { Pubs.Add(pub); } }
async Task ExecuteLoadPubsCommand() { if (IsBusy) { return; } IsBusy = true; try { Pubs.Clear(); await SetPubs(); } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
// GET: Pubs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Pubs pubs = db.Pubs.Find(id); if (pubs == null) { return(HttpNotFound()); } List <SelectListItem> list = new List <SelectListItem>(); var entities = (from a in db.Address orderby a.street, a.building_no, a.postal_code, a.city select a).ToList(); foreach (var i in entities) { list.Add(new SelectListItem { Selected = false, Text = i.ToString(), Value = i.id.ToString() }); } ViewBag.adress_id = new SelectList(list, "Value", "Text", 1); return(View(pubs)); }
public List <Pubs._Contact> GetContacts(string pubID) { return(Pubs.GetContacts(pubID)); }
public void UpdatePub(Pubs PubToBeUpdated) { throw new NotImplementedException(); }
public Task <IEnumerable <Pub> > GetPubs() { return(Task.FromResult(Pubs.AsEnumerable())); }
public Task <Pub> GetPub(int id) { return(Task.FromResult(Pubs.FirstOrDefault(p => p.Id == id))); }
public List <Pubs._Royalty> GetRoyalties(string pubID) { return(Pubs.GetRoyalties(pubID)); }
public ActionResult Edit([Bind(Include = "id,name,adress_id,e_mail,telephone_no,RowVersion")] Pubs pubs) { ViewBag.Exception = null; string msg = null; if (ModelState.IsValid) { var entity = db.Pubs.Single(p => p.id == pubs.id); if (entity.RowVersion != pubs.RowVersion) { TempData["Exception"] = "Entity was modified by another user. Check values and perform edit action again."; return(RedirectToAction("Edit")); } entity.RowVersion++; entity.name = pubs.name; entity.adress_id = pubs.adress_id; entity.e_mail = pubs.e_mail; entity.telephone_no = pubs.telephone_no; db.Entry(entity).State = EntityState.Modified; try { db.SaveChanges(); } catch (Exception e) { if (e.InnerException == null) { msg = e.Message; } else { msg = e.InnerException.InnerException.Message; } ViewBag.Exception = msg; List <SelectListItem> list = new List <SelectListItem>(); var entities = (from a in db.Address orderby a.street, a.building_no, a.postal_code, a.city select a).ToList(); foreach (var i in entities) { list.Add(new SelectListItem { Selected = false, Text = i.ToString(), Value = i.id.ToString() }); } ViewBag.adress_id = new SelectList(list, "Value", "Text", 1); return(View(pubs)); } return(RedirectToAction("Index")); } List <SelectListItem> list2 = new List <SelectListItem>(); var entities2 = (from a in db.Address orderby a.street, a.building_no, a.postal_code, a.city select a).ToList(); foreach (var i in entities2) { list2.Add(new SelectListItem { Selected = false, Text = i.ToString(), Value = i.id.ToString() }); } ViewBag.adress_id = new SelectList(list2, "Value", "Text", 1); return(View(pubs)); }