/// <summary> /// Create a new LeadComment object. /// </summary> /// <param name="commentId">Initial value of the CommentId property.</param> public static LeadComment CreateLeadComment(global::System.Int32 commentId) { LeadComment leadComment = new LeadComment(); leadComment.CommentId = commentId; return leadComment; }
protected void btnSaveContinue_Click(object sender, EventArgs e) { lblError.Text = string.Empty; lblError.Visible = false; lblMessage.Text = string.Empty; lblMessage.Visible = false; lblSave.Text = string.Empty; lblSave.Visible = false; int commentID = 0; try { if (int.TryParse(hfCommentId.Value, out commentID) && commentID > 0) { LeadComment comment = LeadCommentManager.GetLeadCommentById(commentID); comment.CommentText = txtComment.Text.Trim(); comment.UserId = Convert.ToInt32(Session["UserId"]); LeadComment objld = LeadCommentManager.Save(comment); int LeadID = Convert.ToInt32(hfLeadsId.Value); lblSave.Text = "Comment Saved Successfully"; lblSave.Visible = true; txtComment.Text = string.Empty; FillComments(LeadID); dvEdit.Visible = false; btnNewComment.Visible = true; btnCancelNew.Visible = true; } else { LeadComment objLeadComment = new LeadComment(); int LeadID = 0; if (hfLeadsId.Value != null && Convert.ToInt32(hfLeadsId.Value) > 0) { LeadID = Convert.ToInt32(hfLeadsId.Value); } else { lblError.Text = string.Empty; lblError.Text = "There is a problem to save."; lblError.Visible = true; return; } objLeadComment.LeadId = LeadID; objLeadComment.UserId = Convert.ToInt32(Session["UserId"]); objLeadComment.CommentText = txtComment.Text; objLeadComment.Status = 1; LeadComment objld = LeadCommentManager.Save(objLeadComment); if (objLeadComment.CommentId > 0) { lblSave.Text = string.Empty; lblSave.Text = "Comment Saved Successfully"; lblSave.Visible = true; txtComment.Text = string.Empty; FillComments(LeadID); dvEdit.Visible = false; btnNewComment.Visible = true; btnCancelNew.Visible = true; } } } catch (Exception ex) { lblError.Text = string.Empty; lblError.Text = "There is a problem to save."; lblError.Visible = true; } }
/// <summary> /// Deprecated Method for adding a new object to the LeadComments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToLeadComments(LeadComment leadComment) { base.AddObject("LeadComments", leadComment); }