Пример #1
0
        public ActionResult feedbackEdit([Bind(Include = "stt,topic")] CommentTopic commentTopic)
        {
            if (ModelState.IsValid)
            {
                var    item     = db.CommentTopics.Single(x => (x.stt == commentTopic.stt));
                string oldTopic = item.topic;
                db.CommentTopics.Remove(item);
                CommentTopic newCmt = new CommentTopic();
                newCmt.topic = commentTopic.topic;
                db.CommentTopics.Add(newCmt);

                var itemUserCmt = db.UserComments.Where(x => x.topic == oldTopic).ToList();
                for (int i = 0; i < itemUserCmt.Count(); i++)
                {
                    itemUserCmt.ElementAt(i).topic = commentTopic.topic;
                }

                db.SaveChanges();
                //var itemUserCmt1 = db.UserComments.Where(x => x.topic == null).ToList();
                //for (int i = 0; i < itemUserCmt1.Count(); i++)
                //    itemUserCmt1.ElementAt(i).topic = commentTopic.topic;
                //db.SaveChanges();
                return(RedirectToAction("feedbackManagement"));
            }
            return(View(commentTopic));
        }
Пример #2
0
        // GET: AdminHomePage/feedbackEdit/5
        public ActionResult feedbackEdit(int?stt)
        {
            if (stt == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CommentTopic cmt = db.CommentTopics.Where(x => (x.stt == stt)).FirstOrDefault();

            if (cmt == null)
            {
                return(HttpNotFound());
            }
            return(View(cmt));
        }
Пример #3
0
        private Markup WriteDefaultMarkup()
        {
            Markup markup = new Markup();

            try
            {
                HeaderFile[] headerfiles = new HeaderFile[1];
                HeaderFile   header      = new HeaderFile();
                header.IfcProject = GUIDUtil.CreateGUID(m_doc.ProjectInformation);
                header.Filename   = m_doc.Title;
                header.Date       = DateTime.Now;
                headerfiles[0]    = header;
                markup.Header     = headerfiles;

                Topic topic = new Topic();
                topic.Guid  = Guid.NewGuid().ToString();
                topic.Title = "Color Schemes Editor";

                BimSnippet bimSnippet      = new BimSnippet();
                string     currentAssembly = System.Reflection.Assembly.GetAssembly(this.GetType()).Location;
                string     schemaPath      = Path.GetDirectoryName(currentAssembly) + "\\Resources\\colorscheme.xsd";
                bimSnippet.ReferenceSchema = schemaPath;
                bimSnippet.Reference       = "colorscheme.xml";
                topic.BimSnippet           = bimSnippet;
                markup.Topic = topic;

                Comment[] comments = new Comment[1];
                Comment   comment  = new Comment();
                comment.Guid     = Guid.NewGuid().ToString();
                comment.Date     = header.Date;
                comment.Author   = Environment.UserName;
                comment.Comment1 = "Color Schemes and Color Filters by Add-Ins";
                CommentTopic commentTopic = new CommentTopic();
                commentTopic.Guid = topic.Guid;
                comment.Topic     = commentTopic;
                comments[0]       = comment;
                markup.Comment    = comments;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to wirte the default Markup.\n" + ex.Message, "Write Default Markup", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            return(markup);
        }
Пример #4
0
        public ActionResult feedbackAdd(CommentTopic model)
        {
            var item = db.CommentTopics.Where(x => (x.topic == model.topic));

            if (item.Count() > 0)
            {
                TempData["msg"] = "<script>alert('Đã tồn tại topic.');</script>";
                return(View());
            }
            try
            {
                CommentTopic newCmt = new CommentTopic();
                newCmt.topic = model.topic;

                db.CommentTopics.Add(newCmt);
                db.SaveChanges();
                TempData["msg"] = "<script>alert('Đã thêm topic thành công.');</script>";
            }
            catch
            {
            }
            return(View());
        }