public List <TOPIC> convertNodeToTopic(BOARD board, List <Node> listNode) { List <TOPIC> listTopic = new List <TOPIC>(); foreach (Node node in listNode) { TOPIC topic = new TOPIC(); topic.ID = node.id; topic.ID_BOARD = board.ID; topic.ID_PARENT = node.parent.id; topic.LABEL_TP = node.Text; topic.POS_X = node.Location.X; topic.POS_Y = node.Location.Y; topic.SHAPE = node.shape; topic.SIZE = node.size; topic.SIZE_PATH = node.path.size; topic.TEXT_SIZE = (int)node.Font.Size; topic.STYLE_PATH = node.path.type; topic.COLOR_PATH = HexConverter(node.path.color); topic.BACKCOLOR = HexConverter(node.BackColor); topic.FORECOLOR = HexConverter(node.ForeColor); topic.WIDTH = node.Width; topic.HEIGHT = node.Height; topic.FONT = node.Font.FontFamily.Name; topic.BOARD = board; listTopic.Add(topic); } return(listTopic); }
public Guid InsertTopic(TopicModel topic) { Guid id = Guid.NewGuid(); if (topic == null) { throw new NullReferenceException("theme"); } using (AppTourEntities data = new AppTourEntities()) { TOPIC _new = new TOPIC { ID = id, ID_THEME = topic.Theme.Id, NAME = topic.Name, DESCRIPTION = topic.Description, IS_ACTIVE = topic.IsActive, IMAGE = topic.Image, CREATION_DATE = DateTime.Now, UPDATE_DATE = DateTime.Now }; data.TOPIC.AddObject(_new); data.SaveChanges(); } return(id); }
public void DeleteTopic(TopicModel topic) { if (topic == null) { throw new ArgumentNullException(); } using (AppTourEntities data = new AppTourEntities()) { TOPIC current = data.TOPIC.Where(p => p.ID == topic.Id).SingleOrDefault(); if (current != null) { try { data.DeleteObject(current); data.SaveChanges(); } catch (Exception e) { if (e.InnerException != null) { throw new Exception(e.InnerException.Message); } throw; } } } }
public void UpdateTopic(TopicModel topic) { using (AppTourEntities data = new AppTourEntities()) { TOPIC current = data.TOPIC.Where(x => topic.Id == x.ID).SingleOrDefault(); if (current != null) { try { current.NAME = topic.Name; current.DESCRIPTION = topic.Description; current.IMAGE = topic.Image; current.IS_ACTIVE = topic.IsActive; current.CREATION_DATE = topic.CreationDate; current.UPDATE_DATE = DateTime.Now; current.THEME = data.THEME.Where(x => x.ID == topic.Theme.Id).SingleOrDefault(); data.SaveChanges(); } catch (Exception e) { if (e.InnerException != null) { throw new Exception(e.InnerException.Message); } throw; } } } }
public ActionResult DeleteConfirmed(string id) { TOPIC tOPIC = db.TOPICs.Find(id); db.TOPICs.Remove(tOPIC); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "TopicID,SubjectID,W_Prerequisite")] TOPIC tOPIC) { if (ModelState.IsValid) { db.Entry(tOPIC).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tOPIC)); }
public List <string> GetTitleDocByTopicID(string topicid) { TOPIC topic = db.TOPICs.First(x => x.ID == topicid); List <string> titles = new List <string>(); foreach (var doc in topic.DOCUMENTs) { titles.Add(doc.TITLE); } return(titles); }
public ActionResult Create([Bind(Include = "TopicID,SubjectID,W_Prerequisite")] TOPIC tOPIC) { if (ModelState.IsValid) { db.TOPICs.Add(tOPIC); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tOPIC)); }
public ActionResult PostTopic(TOPIC topic) { TopicDAO topicDao = new TopicDAO(); if (topicDao.InsertTopic(topic)) { CommonFunc cf = new CommonFunc(); cf.DelCookieFile(); return(Json(new { success = true })); } return(Json(new { success = false })); }
public bool DeleteTopic(string id) { try { TOPIC topic = db.TOPICs.First(x => x.ID == id); db.TOPICs.Remove(topic); db.SaveChanges(); return(true); } catch { return(false); } }
// GET: TOPICs/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TOPIC tOPIC = db.TOPICs.Find(id); if (tOPIC == null) { return(HttpNotFound()); } return(View(tOPIC)); }
public bool InsertTopic(TOPIC topic) { db.TOPICs.Add(topic); db.SaveChanges(); return(true); }
public string GetTopicIDByDoc(string id) { TOPIC topic = db.DOCUMENTs.Where(x => x.ID == id).Select(x => x.TOPIC).First(); return(topic.ID); }
public TOPICHandler(ISession client, ChatCommandBase cmd) : base(client, cmd) { _cmd = (TOPIC)cmd; }