public static CommentViewModel CreateCommentViewModelDTO(comment comment)
        {
            CommentViewModel cvm = new CommentViewModel();

            cvm.comment_id       = comment.comment_id;
            cvm.comment_content  = comment.comment_content;
            cvm.comment_created  = comment.comment_created;
            cvm.comment_user_id  = (int)comment.comment_user_id;
            cvm.comment_user     = CreateUserViewModelDTO(comment.user);
            cvm.comment_video_id = (int)comment.comment_video_id;
            cvm.comment_likes    = 0;
            cvm.comment_dislikes = 0;
            foreach (var x in comment.comment_like_dislike)
            {
                if (x.is_like)
                {
                    cvm.comment_likes++;
                }
                else
                {
                    cvm.comment_dislikes++;
                }
            }
            return(cvm);
        }
        /// <summary>
        /// Post Comments List Written by Dave Lee
        /// </summary>
        public void Post(comment obj)
        {
            var db = new Entities();

            db.comments.Add(obj);
            db.SaveChanges();
        }
Пример #3
0
    //new code for this box
    public void loadComment(String parameter)
    {
        //new code for this box
        using (DataClassesDataContext context = new DataClassesDataContext())
        {
            comment comment = (from p in context.comments
                               where p.id == Convert.ToInt32(parameter)
                               select p).First();

            CommentToReplyTo.Text = comment.comment1.ToString();
            commentTypeReturn     = Convert.ToInt32(comment.topicId);
            if (commentTypeReturn == 1)
            {
                replyType = 3;
            }
            else
            {
                replyType = 4;
            }

            var commentReplies = from p in context.comments
                                 join ct in context.comment_types on p.topicId equals ct.comment_type_id
                                 join cont in context.Contacts on p.userid equals cont.contactID
                                 where p.parent_comment_id == Convert.ToInt32(parameter)
                                 select new { p.comment2, ct.Comment_type1, cont.firstName, cont.lastName };

            commentRepliesRepeater.DataSource = commentReplies;
            commentRepliesRepeater.DataBind();
        }
    }
Пример #4
0
        //添加评论
        private void add_comment(comment comment, string guid)
        {
            try
            {
                //数据库标示
                jsonModel = Constant.comment_S.Add(comment);

                if (workreport_handle.dic_Self.ContainsKey(guid))
                {
                    //工作报告,当前用户
                    List <workreport> workreport_selfs = workreport_handle.dic_Self[guid];
                    //已阅读则进行标示【报告】
                    workreport workreport = workreport_selfs.Where(item => item.id == comment.com_table_id).FirstOrDefault();
                    //标示
                    if (workreport != null)
                    {
                        workreport.report_status = "1";
                        Constant.workreport_S.Update(workreport);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }
Пример #5
0
        public ActionResult Edit(int id)
        {
            comment c = null;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://localhost:50122/api/");
                var responseTalk = client.GetAsync("comments/" + id);
                responseTalk.Wait();

                var result = responseTalk.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <comment>();
                    readTask.Wait();

                    c = readTask.Result;
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Error");
                }
            }
            return(View(c));
        }
        public ActionResult ChangeApproval(int num = 0)
        {
            string  result  = "";
            comment comment = Db.comment.Find(num);

            if (comment != null)
            {
                if (comment.IsApproval == true)
                {
                    comment.IsApproval = false;
                    result             = "Cevabın onayı başarıyla kaldırıldı.";
                    OK.UpdateRating((int)comment.WriterId, -15);
                    OK.ChangePostApproval((int)comment.WriterId, comment.TopicId.ToString() + "-" + comment.Id.ToString(), "create-comment", false);
                    foreach (var likepost in Db.post.Where(x => x.ItemId == comment.Id.ToString() && (x.Type == "like-comment" || x.Type == "dislike-comment")))
                    {
                        likepost.IsApproval = false;
                    }
                }
                else
                {
                    comment.IsApproval = true;
                    result             = "Cevap başarıyla onaylandı.";
                    OK.UpdateRating((int)comment.WriterId, +15);
                    OK.ChangePostApproval((int)comment.WriterId, comment.TopicId.ToString() + "-" + comment.Id.ToString(), "create-comment", true);
                    foreach (var likepost in Db.post.Where(x => x.ItemId == comment.Id.ToString() && (x.Type == "like-comment" || x.Type == "dislike-comment")))
                    {
                        likepost.IsApproval = true;
                    }
                }
                Db.SaveChanges();
            }
            return(Content("<script type=\"text/javascript\">SuccessInfo('" + result + "');</script>"));
        }
Пример #7
0
        // Expert image view page
        public ActionResult ExpImageView(long?id, int?page, string sortOrder, string currentFilter, string preColumn, string sucMsg)
        {
            int userID = Convert.ToInt32(Session["UserID"] != null ? Session["UserID"].ToString() : "0"); // Convert session user id to integer for comparison and prevent from NULL

            image  img = db.images.Find(id);                                                              // Find images belong to user id in DB
            report rep = (from r in db.reports
                          where r.ImgID == id
                          select r).FirstOrDefault();     // Find reports belong to this image
            comment cmt = (from s in db.comments
                           where s.ImgID == id
                           select s).FirstOrDefault();      // Find comment belong to the image

            var view = new ImgRepCmtViewModels()            // Initialise a view model for passing into view
            {
                Image   = img,
                Report  = rep,
                Comment = cmt
            };

            //string server = db.Database.Connection.DataSource.ToString(); // Get db server name for retrieving image
            //string img_link = "http://" + server + "/" + img.ImgPath;    // Concatenate image URL
            string img_link = "~/" + img.ImgPath;

            ViewBag.link       = img_link;      // Create viewbag variable for image URL
            ViewBag.Page       = page;          // Create viewbag variable for current page
            ViewBag.Order      = sortOrder;     // Create viewbag variable for current sort
            ViewBag.Filter     = currentFilter; // Create viewbag variable for current filter
            ViewBag.PreColumn  = preColumn;     // Create viewbag variable for filtering column
            ViewBag.SuccessMsg = sucMsg;        // Create viewbag variable for comment successful message
            ViewBag.userName   = (from usr in db.users
                                  where (usr.UserID == userID)
                                  select usr.UserFName).FirstOrDefault().ToString();    // Passing user first name to view
            return(View(view));
        }
Пример #8
0
        public void AddComment(int id)
        {
            string   currid = Request.Params["id"].ToString();
            user     us     = Session["User" + currid] as user;
            NewsFeed feed   = db.NewsFeeds.Find(id);
            comment  com    = new comment();

            com.newsfeed_id    = id;
            com.datetime       = DateTime.Now;
            com.comment1       = Request.Params["content"];
            com.commentator_id = us.id;
            db.comments.Add(com);

            if (feed.user_id != us.id)
            {
                notification notif = new notification();
                notif.datetime   = DateTime.Now;
                notif.sender_id  = us.id;
                notif.user_id    = feed.user_id;
                notif.on_feed_id = id;
                notif.state      = 1;
                notif.text_id    = 5;
                db.notifications.Add(notif);
            }
            db.SaveChanges();
        }
Пример #9
0
        public JsonResult themcommentdg(string a, string b)
        {
            string trave = "";

            if (save.taikhoan == null || save.taikhoan == "")
            {
                trave = "-1";
            }
            else
            {
                int xyz = Convert.ToInt32(a);
                try
                {
                    comment con = new comment();
                    con.noidung  = b;
                    con.idDG     = xyz;
                    con.daxoa    = false;
                    con.taikhoan = save.taikhoan;
                    con.solike   = 0;
                    db.comments.Add(con);
                    db.SaveChanges();

                    trave = "1";
                }
                catch (Exception)
                {
                    trave = "-2";
                }
            }
            return(Json(trave));
        }
Пример #10
0
        public ActionResult Edit(comment comment, HttpPostedFileBase comment_photo, string oldImg)
        {
            string id = comment.tourism_id.Substring(0, 1);
            string controller;

            switch (id)
            {
            case "A":
                controller = "web_activities";
                break;

            case "H":
                controller = "WebHotels";
                break;

            case "R":
                controller = "WebRestaurants";
                break;

            case "S":
                controller = "WebSpots";
                break;

            default:
                controller = "web_activities";
                break;
            }
            db.Entry(comment).State = EntityState.Modified;
            db.SaveChanges();

            //處理圖檔上傳
            string fileName        = "";
            string rename_filename = "";

            if (comment_photo != null)
            {
                if (comment_photo.ContentLength > 0)
                {
                    System.IO.File.Delete(Server.MapPath("~/images/comment/" + oldImg));
                    fileName        = System.IO.Path.GetFileName(comment_photo.FileName);        //取得檔案的檔名(主檔名+副檔名)
                    rename_filename = comment.comment_id + "_" + DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "") + Path.GetExtension(fileName);
                    comment_photo.SaveAs(Server.MapPath("~/images/comment/" + rename_filename)); //將檔案存到該資料夾
                    comment.comment_photo = rename_filename;
                }
            }
            else
            {
                comment.comment_photo = oldImg;
            }
            //end
            if (ModelState.IsValid)
            {
                db.SaveChanges();


                return(RedirectToRoute(new { controller = controller, action = "Details", id = comment.tourism_id }));
            }

            return(View(comment));
        }
        public async Task <IActionResult> Putcomment(int id, comment comment)
        {
            if (id != comment.id)
            {
                return(BadRequest());
            }

            _context.Entry(comment).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!commentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult <comment> > Postcomment(comment comment)
        {
            _context.comments.Add(comment);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getcomment", new { id = comment.id }, comment));
        }
        public ActionResult Delete(long id, FormCollection collection)
        {
            //debut code khawla
            IUserService service   = new UserService();
            user         u         = service.GetById(User.Identity.GetUserId());
            string       firstName = u.firstName;
            string       lastName  = u.lastName;
            string       email     = u.Email;

            ViewBag.userFirstName = firstName;
            ViewBag.userLastName  = lastName;
            ViewBag.userMail      = email;
            ViewBag.sexe          = u.sexe.ToLower();
            //fin code khawla
            try
            {
                comment comme = cs.GetById(id);
                cs.Delete(comme);
            }
            catch (DataException)
            {
                return(RedirectToAction("Delete",
                                        new System.Web.Routing.RouteValueDictionary {
                    { "id", id },
                    { "saveChangesError", true }
                }));
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Create(string Content, int videoId)
        {
            if (User.Identity.IsAuthenticated == false)
            {
                return(Json(new { message = "redirect" }, JsonRequestBehavior.AllowGet));
            }

            treca_aplikacija_model db = new treca_aplikacija_model();
            comment comment           = new comment();

            comment.comment_video_id = (byte)videoId;

            string LoggedInUserName = User.Identity.GetApplicationUserUsername();

            foreach (var x in db.users)
            {
                if (x.user_username.Equals(LoggedInUserName))
                {
                    comment.comment_user_id = x.users_id;
                }
            }

            comment.comment_created = DateTime.Now;
            comment.comment_content = Content;

            db.comments.Add(comment);
            db.SaveChanges();
            //?


            UserViewModel    CommentOwner = ApplicationUtils.CreateUserViewModelDTO(db.users.Find(comment.comment_user_id));
            CommentViewModel Comment      = ApplicationUtils.CreateCommentViewModelDTO(db.comments.Find(comment.comment_id));

            return(Json(new { User = CommentOwner, Comment = Comment }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Edit(comment comm)
        {
            //debut code khawla
            IUserService service   = new UserService();
            user         u         = service.GetById(User.Identity.GetUserId());
            string       firstName = u.firstName;
            string       lastName  = u.lastName;
            string       email     = u.Email;

            ViewBag.userFirstName = firstName;
            ViewBag.userLastName  = lastName;
            ViewBag.userMail      = email;
            ViewBag.sexe          = u.sexe.ToLower();
            //fin code khawla
            if (ModelState.IsValid)

            {
                comm.editionDate = DateTime.Today;
                comm.customer_id = User.Identity.GetUserId();
                cs.Update(comm);

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(comm));
            }
        }
        public async Task <int> UpdateComment(long id, comment comment)
        {
            var t = _context.Comment.Attach(comment);

            t.State = EntityState.Modified;
            return(await _context.SaveChangesAsync());
        }
Пример #17
0
 /// <summary>
 /// Initializes ActivityComment object from underlying facebook data object
 /// </summary>
 /// <param name="comment">comment object</param>
 internal ActivityComment(comment comment)
 {
     CommentId  = comment.id.ToString();
     FromUserId = comment.fromid;
     Time       = DateHelper.ConvertDoubleToDate(comment.time);
     Text       = comment.text;
 }
Пример #18
0
        public List <comment> getbyUser(String b)
        {
            try
            {
                String query = "select comment.id, bookid,comment,a.userName,a.displayName,createdDate from "
                               + "comment inner join account a on a.userName=comment.Username where comment.Username='******'";
                DataTable dataTable = dataProvider.excuteQuery(query);

                List <comment> list = new List <comment>();
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
                    account a = new account();
                    a.username = dataTable.Rows[i]["userName"].ToString();
                    a.fullname = dataTable.Rows[i]["displayName"].ToString();
                    comment S = new comment();
                    S.id        = int.Parse(dataTable.Rows[i]["id"].ToString());
                    S.bookid    = int.Parse(dataTable.Rows[i]["bookid"].ToString());
                    S.detail    = dataTable.Rows[i]["comment"].ToString();
                    S.createdon = DateTime.Parse(dataTable.Rows[i]["createdDate"].ToString());
                    S.createdby = a;
                    list.Add(S);
                }

                return(list);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "Load comment");
            }
            return(null);
        }
Пример #19
0
        public ActionResult ViewProduct(FormCollection fc)
        {
            var fullName  = fc["txtName"];
            var comment   = fc["TxtComment"];
            var rating    = Convert.ToInt32(fc["slctRating"]);
            var productId = Convert.ToInt32(fc["ID"]);

            comment c = new comment();

            c.FullName     = fullName;
            c.Comments     = comment;
            c.ThisDateTime = DateTime.Now;
            c.ProductID    = productId;
            c.Rating       = rating;
            db.comments.Add(c);
            db.SaveChanges();

            var p       = db.products.Where(x => x.ProductID == productId).FirstOrDefault();
            var ave     = db.comments.Where(x => x.ProductID == productId).Select(x => x.Rating).Average();
            int?average = Convert.ToInt32(ave);

            p.AverageRating = average;
            db.SaveChanges();

            ProductsCommentsModel pcm = new ProductsCommentsModel();

            pcm.Product     = db.products.Find(productId);
            pcm.CommentList = db.comments.Where(x => x.ProductID == productId).ToList();
            return(View(pcm));
        }
Пример #20
0
        public JsonResult delComment(comment comment)
        {
            User user = (User)Session["user"];

            if (user != null)
            {
                if (user.type == 1)
                {
                    DbNewsDataContext db = new DbNewsDataContext();
                    var query            = from t in db.comment
                                           where t.id == comment.id
                                           select t;
                    foreach (comment item in query)
                    {
                        db.comment.DeleteOnSubmit(item);
                    }
                    db.SubmitChanges();
                    return(Json(Result.success()));
                }
                else
                {
                    return(Json(Result.fail()));
                }
            }
            else
            {
                return(Json(Result.fail()));
            }
        }
Пример #21
0
        public IHttpActionResult Putcomment(int id, comment comment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != comment.Id)
            {
                return(BadRequest());
            }

            db.Entry(comment).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!commentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #22
0
        public IHttpActionResult Postcomment(comment comment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.comments.Add(comment);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (commentExists(comment.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = comment.Id }, comment));
        }
Пример #23
0
        public training(int lang_id, int category_id, string langauge, string stemming, bool addtur, int n, bool punctuation, int nov)
        {
            _cr = new classifier(langauge, stemming, addtur, n, punctuation, nov);//classifier hazır
            _category_sentence_count = new Dictionary <int, int>();
            all_sentence_count       = 0;

            word_dic _wd = new word_dic();
            comment  _c  = new comment();

            DataTable _dt = _c.select_comment(lang_id.ToString(), category_id.ToString());

            int id      = 1;
            int yuzde50 = _dt.Rows.Count / 2;

            foreach (DataRow row in _dt.Rows) // Loop over the rows.
            {
                var    type      = row[0];
                string _sentence = row[1].ToString().ToLower();
                int    _type     = Convert.ToInt32(type);

                _cr.AddSentenceforTraining(_sentence, _type);
                AddASentence(_type);//kategorideki cümle sayısı
                all_sentence_count++;
                id++;
                if (id == yuzde50)
                {
                    break;
                }
            }
        }
Пример #24
0
        public IActionResult comment([FromBody] comment Comment)
        {
            var nowComment = context.picComment.
                             FirstOrDefault(c => c.u_id == Comment.userId && c.p_id == Comment.picId);

            if (nowComment != null)
            {//当前评论已经存在,可更改评论内容
                context.Entry(nowComment).CurrentValues.SetValues(new picComment
                {
                    u_id      = nowComment.u_id,
                    p_id      = nowComment.p_id,
                    likes     = nowComment.likes,
                    p_comment = Comment.content
                });
                context.SaveChanges();
            }
            else
            {
                nowComment = new picComment
                {
                    u_id      = Comment.userId,
                    p_id      = Comment.picId,
                    p_comment = Comment.content,
                    likes     = 0
                };
                context.picComment.Add(nowComment);
                context.SaveChanges();
            }
            return(Ok(new
            {
                Success = true,
                msg = "Operation Done"
            }));
        }
Пример #25
0
        public ActionResult ContactUs(ContactUsModel model)
        {
            MailMessage mm = new MailMessage("*****@*****.**", model.EmaiId)
            {
                Subject    = model.FirstName,
                Body       = "Hello," + "<div>-----" + "<div>Subject:  " + model.Subject + "<div>Cmment/Questions:  " + model.comment + "<div><div>-----<div>Regards," + "<div>" + model.FirstName,
                IsBodyHtml = true
            };

            SmtpClient smtp = new SmtpClient();

            smtp.Host      = "smtp.gmail.com";
            smtp.Port      = 587;
            smtp.EnableSsl = true;

            smtp.UseDefaultCredentials = false;
            smtp.Credentials           = new NetworkCredential("*****@*****.**", "Note@tatva");
            smtp.Send(mm);

            projectEntities1 db = new projectEntities1();
            comment          c  = new comment();

            c.FullName = model.FirstName;
            c.EmailId  = model.EmaiId;
            c.Comment1 = model.comment;
            c.Subject  = model.Subject;
            db.comments.Add(c);
            db.SaveChanges();

            TempData["Success"] = "Email sent Successfully Done!";
            return(RedirectToAction("ContactUs", "Auth"));
        }
Пример #26
0
    protected void btnAddComment_Submit_Click(object sender, EventArgs e)
    {
        comment newComment = new comment();

        newComment.commentAuthor = txtNewComment_username.Text.ToString();
        newComment.commentIpSource = Request.ServerVariables["REMOTE_ADDR"];
        newComment.commentPhotoId = new Guid(imgCurrentGuid.Value.ToString());
        newComment.commentText = txtNewComment_Text.Text.ToString();
        newComment.commentId = Guid.NewGuid();
        newComment.commentTimestamp = DateTime.Now;

        db.comments.InsertOnSubmit(newComment);
        db.SubmitChanges();

        Session["nbpEmail"] = txtNewComment_email.Text.ToString();
        Session["nbpName"] = txtNewComment_username.Text.ToString();
        LoadCommentData();
        ToggleAddCommentDiv();

        audit a = new audit();
        a.auditId = Guid.NewGuid();
        a.auditRemoteAddr = Request.ServerVariables["REMOTE_ADDR"].ToString();
        a.auditRequestedUrl = "PhotoView.aspx";
        a.auditSessionEmail = Session["nbpEmail"] != null ? Session["nbpEmail"].ToString() : "";
        a.auditSessionId = Session.SessionID.ToString();
        a.auditSessionName = Session["nbpName"] != null ? Session["nbpName"].ToString() : "";
        a.auditTimestamp = DateTime.Now;
        a.auditType = "PhotoView Comment Posted";
        a.auditDescription = "Author: " + txtNewComment_username.Text.ToString() +
            " Text: " + txtNewComment_Text.Text.ToString();
        a.auditReferrer = Request.UrlReferrer.AbsolutePath.ToString();
        a.auditLogonUser = Request.ServerVariables["LOGON_USER"];
        db.audits.InsertOnSubmit(a);
        db.SubmitChanges();
    }
Пример #27
0
        /// <summary>
        /// Gets the fake comments
        /// </summary>
        /// <returns>A list of fake comments</returns>
        private List <comment> getSeedComments()
        {
            List <workout> workouts = getSeedWorkouts();
            List <user>    users    = getSeedUsers();

            comment comment1 = new comment
            {
                id           = 1,
                message      = "Comment1",
                date_created = Convert.ToDateTime("2015-01-01"),
                user         = users[1],
                workout      = workouts[1]
            };
            comment comment2 = new comment
            {
                id           = 2,
                message      = "Comment2",
                date_created = Convert.ToDateTime("2015-02-02"),
                user         = users[1],
                workout      = workouts[2]
            };
            comment comment3 = new comment
            {
                id           = 3,
                message      = "Comment3",
                date_created = Convert.ToDateTime("2015-03-03"),
                user         = users[2],
                workout      = workouts[1],
            };
            var comment = new List <comment> {
                comment1, comment2, comment3
            };

            return(comment);
        }
Пример #28
0
        protected void SaveAsComment(string message, int personid, int projecttag)
        {
            try
            {
                ctx = new TeeMsEntities();

                var rightperson  = ctx.person.Where(p => p.person_id == personid).SingleOrDefault();
                var rightproject = ctx.project.Where(pr => pr.project_tag == projecttag).SingleOrDefault();

                IHubContext projectContext = GlobalHost.ConnectionManager.GetHubContext <ProjectHub>();

                comment newcomment = new comment()
                {
                    comment_content = message,
                    person          = rightperson,
                    project         = rightproject,
                    creation_date   = DateTime.Now
                };

                ctx.comment.Add(newcomment);
                ctx.SaveChanges();

                // Call updateComments method on the ProjectHub users client side
                projectContext.Clients.Group(rightproject.name + rightproject.project_id.ToString()).updateComments();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #29
0
        private void button1_Click(object sender, EventArgs e)
        {
            string  currentTime = DateTime.Now.ToString();
            comment c           = new comment(textBox1.Text, user.getU_id(), currentTime, user.getName());
            int     n           = idicDao.saveComment(c);

            if (n == 0)
            {
                MessageBox.Show("分享失败!");
            }
            else
            {
                List <comment> ls = idicDao.getComment();
                label1.Text = "";
                label1.Text = "动态:";
                foreach (comment com in ls)
                {
                    label1.Text  += "\n";
                    label1.Text  += com.getName() + "发表动态(" + com.getTime() + "):";
                    label1.Text  += "\n";
                    label1.Text  += com.getText();
                    label1.Text  += "\n";
                    label1.Text  += "\n";
                    textBox1.Text = "";
                }
            }
        }
Пример #30
0
 public JsonResult SetCommentSupplier(long supplierID, string commentary)
 {
     try
     {
         long     userId   = (long)Session["USER_ID"];
         user     curUser  = entities.users.Find(userId);
         supplier supplier = entities.suppliers.Find(supplierID);
         comment  comment  = entities.comments.Where(m => m.supplier_id == supplierID && m.user_id == userId).FirstOrDefault();
         if (comment == null)
         {
             comment             = new comment();
             comment.user_id     = userId;
             comment.supplier_id = supplierID;
             comment.commentary  = commentary;
             comment.created_at  = DateTime.Now;
             comment.user_name   = curUser.first_name1 + " " + curUser.last_name1;
             entities.comments.Add(comment);
         }
         else
         {
             comment.commentary = commentary;
             comment.created_at = DateTime.Now;
             comment.user_name  = curUser.first_name1 + " " + curUser.last_name1;
         }
         entities.SaveChanges();
         return(Json(new { result = "success" }));
     }
     catch (Exception)
     {
         return(Json(new { result = "error" }));
     }
 }
Пример #31
0
 public ActionResult EditCommentSave(comment model)
 {
     model.ModifyDate = DateTime.Now;
     model.IsApproval = false;
     Db.SaveChanges();
     return(Content("<script type=\"text/javascript\">$.OK.SuccessModal('Cevabınız başarıyla düzenlendi.. Onaylandıktan sonra yayınlanacak..');</script>"));
 }
Пример #32
0
	private void attach_comments(comment entity)
	{
		this.SendPropertyChanging();
		entity.user = this;
	}
Пример #33
0
    protected void buildComments(comment c)
    {
        lblComments.Controls.Add(new LiteralControl("<br /><h3 class='smaller'><span class='title_header'>"));
        lblComments.Controls.Add(new LiteralControl("<a href='javascript:void();' class='tooltip'>" + c.user.userName + "<span class='border_color'><q class='inner_color base_text'>"));
        lblComments.Controls.Add(new LiteralControl("<div>" + c.user.email + "</div><div class='rollover'>" + c.user.phone + "</div><div class='rollover'>" + c.user.sub_unit1.unit.unit_name + "</div>"));
        lblComments.Controls.Add(new LiteralControl("<div class='rollover'>" + c.user.sub_unit1.sub_unit_name + "</div>"));
        lblComments.Controls.Add(new LiteralControl("</q></span></a>"));
        lblComments.Controls.Add(new LiteralControl("</span>" + c.submitted.ToString() + "</h3>"));
        lblComments.Controls.Add(new LiteralControl("<div class='comment_border border_color'><div class='comment inner_color'>"));

        string strComment = "<div class='comment_header'><span style='float:left'><span class='bold'>" + Resources.Common.AssignedTo + ": </span>" + c.sub_unit.unit.unit_name + " - " + 
            c.sub_unit.sub_unit_name + "</span>" + "<span style='float:right'><span class='bold'>" + Resources.Common.Status + ": </span>" + c.statuse.status_name + " <span class='bold'>" + 
            Resources.Common.Priority + ": </span>" + c.priority.priority_name + "</span><span  class='clear'></span></div>\n<div>" + c.comment1 + "</div>";
        
        lblComments.Controls.Add(new LiteralControl(strComment));
        bool first_attachment = true;
        foreach (attachment a in c.attachments.AsEnumerable())
        {
            if (first_attachment)
            {
                lblComments.Controls.Add(new LiteralControl("<br />"));
                first_attachment = false;
            }
            lblComments.Controls.Add(new LiteralControl("\n<div class='iconize'>"));
            LinkButton lb = new LinkButton()
            {
                CommandArgument = a.attachment_name,
                Text = a.attachment_name + " " + a.attachment_size + " " + Resources.Common.Bytes + ")",
                CssClass = getExtension(a.attachment_name)
            };
            lb.Click += new EventHandler(btnAttachment_Click);
            lblComments.Controls.Add(lb);
            lblComments.Controls.Add(new LiteralControl("</div>"));
        }
        lblComments.Controls.Add(new LiteralControl("</div></div>"));
    }
Пример #34
0
 node.getNode().setComment(comment.Value());
Пример #35
0
 partial void Updatecomment(comment instance);
Пример #36
0
	private void detach_comments(comment entity)
	{
		this.SendPropertyChanging();
		entity.user = null;
	}
Пример #37
0
 partial void Insertcomment(comment instance);
Пример #38
0
        public Bj_structure(string bjPath)
        {
            commentCount = 0;
            bool IsFunc = false;
            StreamReader bj = new StreamReader(bjPath);

            //读取全部内容放在一个个位置中
            string[] tempbj=bj.ReadToEnd().Replace("\r\n","\n").Split('\n');
            bj.Close();

            for (int i = 0; i < tempbj.Length; i++)
            {
                tempbj[i]=tempbj[i].Trim();

                // 是global
                if (tempbj[i].IndexOf("globals") == 0)
                {

                    i++;
                    string s = tempbj[i].Trim();
                    while (s.IndexOf("endglobals") != 0)
                    {
                        this.global.Add(tempbj[i]);
                        i++;
                        s = tempbj[i].Trim();
                    }
                    this.substance.Add(this.global);
                }

                // 是以//开头的的情况
                if (IsAComment(tempbj[i]) == true)
                {
                    IsFunc = false;  //还原flag
                    comment c = new comment();
                    c.comments = c.comments + (tempbj[i]+System.Environment.NewLine);

                    while (tempbj[i].Length != 0)
                    {
                        i++;
                        tempbj[i]=tempbj[i].Trim();
                        if (tempbj[i].IndexOf("function") == 0)
                        {
                            IsFunc = true;
                            function f = new function();
                            f.description = c.comments;
                            f.name = tempbj[i].Substring(8, tempbj[i].IndexOf(" takes") - 8);
                            f.content = f.content + (tempbj[i].TrimEnd() + System.Environment.NewLine);
                            i++;
                            string s=tempbj[i].Trim();
                            while (s != "endfunction")
                            {
                                f.content = f.content + (tempbj[i] + System.Environment.NewLine);
                                i++;
                                s = tempbj[i].TrimEnd();
                            }
                            f.content = f.content + (tempbj[i].TrimEnd() + System.Environment.NewLine);
                            this.substance.Add(f);
                            break;
                        }
                        c.comments = c.comments + (tempbj[i] + System.Environment.NewLine);
                    }
                    if (!IsFunc)
                    {
                        c.index = commentCount;
                        this.substance.Add(c);
                        commentCount++;
                    }
                }

                // 是函数
                if (tempbj[i].IndexOf("function")==0)
                {
                    function f = new function();
                    f.description = "";
                    f.name = tempbj[i].Substring(8, tempbj[i].IndexOf(" takes") - 8);
                    f.content=f.content+(tempbj[i]+System.Environment.NewLine);
                    i++;
                    string s=tempbj[i].Trim();
                    while (s.IndexOf("endfunction")!=0)
                    {
                        f.content = f.content + (tempbj[i] + System.Environment.NewLine);
                        i++;
                        s = tempbj[i].Trim();
                    }
                    f.content = f.content + (tempbj[i] + System.Environment.NewLine);
                    this.substance.Add(f);
                }
            }
        }
Пример #39
0
 partial void Deletecomment(comment instance);
Пример #40
0
 public static int Add(dbDataContext db, string _comment, int ticket_ref, int userID, int priorityID, int statusID, int sub_unitID)
 {
     comment c = new comment();
     c.submitter = userID;
     c.comment1 = _comment;
     c.submitted = DateTime.Now;
     c.ticket_ref = ticket_ref;
     c.priority_id = priorityID;
     c.status_id = statusID;
     c.assigned_to = sub_unitID;
     c.active = true;
     db.comments.InsertOnSubmit(c);
     db.SubmitChanges();
     return c.id;
 }