public void Delete(Handout h) { using (var context = new SwuDBContext()) { var existing = context.Handout .Where(i => i.Id == h.Id) .FirstOrDefault(); context.Handout.Remove(existing); context.SaveChanges(); } }
public void Update(Handout h) { using (var context = new SwuDBContext()) { var existing = context.Handout .Where(i => i.Id == h.Id) .FirstOrDefault(); existing.FilePath = h.FilePath; context.Entry(existing).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public static Handout[] GetHandouts(int lessonId, string type) { DataTable dt = DBHelper.GetDataTable(" select * from handout where lesson_id = " + lessonId.ToString() + " " + ((!type.Trim().Equals(""))? " and [type] = '" + type.Trim() + "' ": "") + " order by [type], sort, [id] "); Handout[] handoutArray = new Handout[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { handoutArray[i] = new Handout(); handoutArray[i]._fields = dt.Rows[i]; } return(handoutArray); }
override public void Apply(RegularContainer pmaster) { var master = (Handout)pmaster; TraceLogger.DebugInternal("HandoutMasterMapping.Apply"); uint masterId = 0; // master.PersistAtom.SlideId; this._ctx.RegisterHandoutMasterMapping(masterId, this); this.Master = master; this.MasterId = 0; // master.PersistAtom.SlideId; }
public void CreateNew(Handout h) { using (var context = new SwuDBContext()) { var course = context.Courses .Where(i => i.Id == h.CourseId) .FirstOrDefault(); context.Courses.Attach(course); h.Course = course; context.Handout.Add(h); context.SaveChanges(); } }
private void ui_main_panel_Load(object sender, EventArgs e) { // tips绑定 tip_main_panel.SetToolTip(picBox_setting, "右键单击,展示工具箱"); tip_main_panel.SetToolTip(picBox_user_icon, "单击修改个人信息"); show_list = new ShowList(SetList); handout = new Handout(SetForm); // 设置用户昵称、签名 this.lbl_nickname.Text = user.Nickname; this.tbx_signature.Text = user.Signature; }
/// <summary> /// Writes a handout master. /// /// <param name="ppt">PowerpointDocument record</param> /// <param name="m">Handout master record</param> private void WriteHandoutMaster2(PowerpointDocument ppt, Handout m) { _writer.WriteStartElement("p", "handoutMasterId", OpenXmlNamespaces.PresentationML); HandoutMasterMapping mapping = _ctx.GetOrCreateHandoutMasterMappingByMasterId(0); mapping.Write(); string relString = mapping.targetPart.RelIdToString; _writer.WriteAttributeString("r", "id", OpenXmlNamespaces.Relationships, relString); _writer.WriteEndElement(); }