Пример #1
0
 protected void btnNewComment_Click(object sender, EventArgs e)
 {
     if (Session["UserCode"] == null)
     {
         Session["Comment"] = txtComment.Text;
         Response.Redirect("~/Users/Login.aspx");
     }
     else
     {
         if (txtComment.Text.Trim() == "")
         {
             lblMessage.Text = "نظر نباید خالی باشد";
             return;
         }
         if (((HiddenField)Page.Master.FindControl("hfItemCode")).Value != "")
         {
             int             ItemCode        = Convert.ToInt32(((HiddenField)Page.Master.FindControl("hfItemCode")).Value);
             int             UserCode        = Convert.ToInt32(Session["UserCode"]);
             BOLUserComments UserCommentsBOL = new BOLUserComments(UserCode);
             UserCommentsBOL.Insert(UserCode, _hCSiteSectionCode, ItemCode, txtComment.Text, DateTime.Now, true);
             lblMessage.Text = "نظر شما ثبت شد.";
             txtComment.Text = "";
             LoadComments();
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        BOLClass = new BOLUserComments((int)MasterCode);

        MasterFieldName = "UserCode";
        Label MasterPageTitle = (Label)Master.FindControl("lblTitle");

        MasterPageTitle.Text = BOLClass.PageLable;

        if (MasterCode == null)
        {
            throw new Exception("No MasterCode Exception");
        }
        if ((Code == null) && (!NewMode))
        {
            return;
        }
        if (!Page.IsPostBack)
        {
            ViewState["InstanceName"]       = Request["InstanceName"];
            cboHCSiteSectionCode.DataSource = new BOLHardCode().GetHCDataTable("HCSiteSections");

            if (!NewMode)
            {
                LoadData((int)Code);
            }
        }
    }
Пример #3
0
 private void LoadComments()
 {
     try
     {
         if (((HiddenField)Page.Master.FindControl("hfItemCode")).Value != "")
         {
             int             ItemCode        = Convert.ToInt32(((HiddenField)Page.Master.FindControl("hfItemCode")).Value);
             BOLUserComments UserCommentsBOL = new BOLUserComments(1);
             rptComments.DataSource = UserCommentsBOL.GetByItemCode(ItemCode, _hCSiteSectionCode);
             rptComments.DataBind();
         }
     }
     catch (Exception err)
     {
         BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs();
         ErrorLogsBOL.Insert(err.Message, DateTime.Now, Request.Url.AbsolutePath, "UCComments::LoadComments");
     }
 }