public Results CreateAnnounment(AnnouncementsView model) { if (model.Title == null || model.Contents == null) { return(new Results("标题和内容均不能为空")); } return(_announcementDapper.Create(model)); }
public ActionResult Add(AnnouncementsView model) { model.CreateOn = DateTime.Now; model.CreateBy = _authentication.MemberShipId; model.Id = Guid.NewGuid(); var result = _announcementRespository.CreateAnnounment(model); return(Json(result)); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { /* Inflate the layout for the fragment */ AnnouncementsView = inflater.Inflate( Resource.Layout.AnnouncementsFragmentLayout, parent, false); /* Get the recyclerview layout */ AnnouncementRecyclerView = AnnouncementsView.FindViewById <RecyclerView>( Resource.Id.AnnouncementsRecyclerView); /* Create a new layout manager using the activity containing */ /* this fragment as the context */ AnnouncementLayoutManager = new LinearLayoutManager(Activity); /* Create a custom adapter and pass it the data that it will be */ /* recycling through */ AnnouncementAdapter = new announcementsRecyclerViewAdapter(Activity as mainActivity, Announcements); /* Helps with performance: HasStableIds = true * ALTHOUGH FOR NOW, DO NOT INCLUDE THIS: DATA DOES NOT DISPLAY * CORRECTLY */ //AnnouncementAdapter.HasStableIds = true; /* Selecting the tab will automatically scroll back to the top */ /* of the list */ TabLayout = ParentFragment.View.FindViewById <TabLayout>( Resource.Id.MainTabLayout); TabLayout.TabReselected += TabReselected; /* "Pulling" down on the page will refresh the view */ RefreshLayout = AnnouncementsView.FindViewById <SwipeRefreshLayout>( Resource.Id.SwipeRefreshAnnouncements); RefreshLayout.SetColorSchemeResources(Resource.Color.primary, Resource.Color.accent, Resource.Color.primary_text, Resource.Color.secondary_text); RefreshLayout.Refresh += RefreshLayoutRefresh; /* Setup the recyclerview with the created adapter and layout */ /* manager */ AnnouncementRecyclerView.SetLayoutManager(AnnouncementLayoutManager); AnnouncementRecyclerView.SetAdapter(AnnouncementAdapter); return(AnnouncementsView); }
public void RenderView(AppState astate) { if (!_initViews) { InitViews(); } //background ShowBackground(); //header ShowHeader(); //add things based on appstate if (astate == AppState.ANNOUNCEMENTS) { AnnouncementsView.AddToView(); //render sidebar thingy if (ButtonHandler.BARS_OPEN) { //sidebar background fill rect, XBARINSET = space to main background render(Access.newRect(0, 0, C.X_BAR_INSET, vc.ViewHeight, UIColor.White)); //add sidebar buttons for things, options mby //little seperator for constant button and groups render(Access.newRect(0, 96, C.X_BAR_INSET, 3, UIColor.Gray)); } } else if (astate == AppState.TUTOR) { } else if (astate == AppState.PROFILE) { ProfileView.AddToView(); } else if (astate == AppState.ROOM) { new RoomView(Room); } else if (astate == AppState.GRADES) { GradesView.AddToView(); } ShowTaskbar(); }
public Results UpdateAnnouncement(AnnouncementsView model) { if (model.Id == null || model.Id == Guid.Empty) { return(new Results("Id不能为空")); } if (model.Title == null || model.Title == "") { return(new Results("标题不能为空")); } if (model.Contents == null || model.Contents == "") { return(new Results("内容不能为空")); } return(_announcementDapper.Update(model)); }
public Results Update(AnnouncementsView model) { using (var connection = GetConnection()) { try { connection.Open(); var result = connection.Update(new { Title = model.Title, Contents = model.Contents }, new { Id = model.Id }, OPIM_Common.TableName.Announcement); return(new Results()); } catch (Exception ex) { return(new Results(ex.Message)); } } }
public Results Create(AnnouncementsView model) { using (var connection = GetConnection()) { try { connection.Open(); var result = connection.Insert(new { Id = model.Id, Title = model.Title, Contents = model.Contents, CreateBy = model.CreateBy, CreateOn = model.CreateOn, }, OPIM_Common.TableName.Announcement); return(new Results()); } catch (Exception ex) { return(new Results(ex.Message)); } } }
public ActionResult Update(AnnouncementsView model) { var result = _announcementRespository.UpdateAnnouncement(model); return(Json(result)); }