protected void btnCommentSubmit_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            // Check the spam-bot fields for data
            string s1 = Request.Form.Get("url");
            string s2 = Request.Form.Get("email");
            string s3 = Request.Form.Get("comment");
            object o4 = Session["AntiSpamVar"];

            if (!string.IsNullOrEmpty(Request.Form.Get("url")) ||
                !string.IsNullOrEmpty(Request.Form.Get("email")) ||
                !string.IsNullOrEmpty(Request.Form.Get("comment")) ||
                (Session["AntiSpamVar"] == null))
            {
                Response.End();
                return;
            }

            // Save record
            MasterDetailComment rec = new MasterDetailComment();

            rec.ModuleId    = CurrentModuleId;
            rec.Username    = tbCommentName.Text.Trim();
            rec.Email       = tbCommentEmail.Text.Trim();
            rec.IPAddress   = Request.ServerVariables["REMOTE_ADDR"];
            rec.CommentText = tbCommentText.Text.Trim();
            rec.CreatedBy   = Page.User.Identity.IsAuthenticated ? Page.User.Identity.Name : "Anonymous";
            rec.Save();

            Response.Redirect(this.Request.Url.ToString());
        }
        public void Insert(int ModuleId, string Username, string Email, string IPAddress, string CommentText)
        {
            MasterDetailComment item = new MasterDetailComment();

            item.ModuleId = ModuleId;

            item.Username = Username;

            item.Email = Email;

            item.IPAddress = IPAddress;

            item.CommentText = CommentText;

            item.CreatedOn = DateTime.Now;

            item.CreatedBy = UserName;


            item.Save(UserName);
        }
        public void Update(long Id, int ModuleId, string Username, string Email, string IPAddress, string CommentText)
        {
            MasterDetailComment item = new MasterDetailComment();

            item.MarkOld();
            item.IsLoaded = true;

            item.Id = Id;

            item.ModuleId = ModuleId;

            item.Username = Username;

            item.Email = Email;

            item.IPAddress = IPAddress;

            item.CommentText = CommentText;

            item.Save(UserName);
        }
        public void InsertAndReturnIdentity(int ModuleId, string Username, string Email, string IPAddress, string CommentText, out object newId)
        {
            MasterDetailComment item = new MasterDetailComment();

            item.ModuleId = ModuleId;

            item.Username = Username;

            item.Email = Email;

            item.IPAddress = IPAddress;

            item.CommentText = CommentText;

            item.CreatedOn = DateTime.Now;

            item.CreatedBy = UserName;


            item.Save(UserName);

            newId = item.Id;
        }