示例#1
0
        private void Load_Info(int iid)
        {
            CNews DAL = new CNews(CCommon.LANG);
            NewsInfo info = DAL.Getinfo(iid);
            if (info != null)
            {
                if (info.Allowcomment > 0)
                {
                    CommentInfo comment = new CComment(CCommon.LANG).Getinforating(Webcmm.Id.News, info.Id);
                    if (comment != null)
                    {
                        if ((comment.Viewcounter + 1) != info.Allowcomment)
                        {
                            info.Allowcomment = comment.Viewcounter + 1;
                            DAL.Updatenum(info.Id.ToString(), Queryparam.Sqlcolumn.Allowcomment, info.Allowcomment);
                        }
                        info.Rating = comment.Rating / (comment.Viewcounter == 0 ? 1 : comment.Viewcounter);
                    }
                }
                List<NewsInfo> list = new List<NewsInfo>();
                list.Add(info);
                (new GenericList<NewsInfo>()).Bind_DataList(rptInfo, null, list, 0);
                DAL.Updatenum(iid.ToString(), Queryparam.Sqlcolumn.Viewcounter, CConstants.NUM_INCREASE);

                Master.AddMeta_Title(info.Name);
                Master.AddMeta_Description(info.Introduce);
                Master.AddMeta_Keywords(info.Tag);
            }

            pnlListfollow.Visible = pnlInfo.Visible = info != null;
        }
示例#2
0
        protected void cmdUpdateorder_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                if (grdView.Rows.Count == 0) return;

                CComment BLL = new CComment(CCommon.LANG);
                foreach (GridViewRow row in grdView.Rows)
                {
                    HiddenField txtId = (HiddenField)row.FindControl("txtId");
                    TextBox txtOrderd = (TextBox)row.FindControl("txtOrderd");
                    if (txtId != null && txtOrderd != null)
                    {
                        int id = int.Parse(txtId.Value);
                        int orderd = 0;
                        int.TryParse(txtOrderd.Text, out orderd);
                        BLL.Updatenum(id.ToString(), Queryparam.Sqlcolumn.Orderd, orderd);
                    }
                    lstError = new List<Errorobject>();
                    lstError = Form_GetError(lstError, Errortype.Completed, Definephrase.Saveorderd_completed, "", null);
                    Master.Form_ShowError(lstError);
                }
            }
            catch
            {
                lstError = new List<Errorobject>();
                lstError = Form_GetError(lstError, Errortype.Error, Definephrase.Saveorderd_error, "", null);
                Master.Form_ShowError(lstError);
            }
        }
示例#3
0
        protected void cmdSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (!this.Validata())
                {
                    goto gotoExit;
                }

                lstError = new List<Errorobject>();
                CommentInfo info = this.Take();
                if (info == null)
                {
                    lstError = CCommon.Form_GetError(lstError, Errortype.Error, Definephrase.Takeinfo_error, "", null);
                    CCommon.Form_ShowError(lstError, lblError);
                    goto gotoExit;
                }

                CComment DAL = new CComment(CCommon.LANG);
                if (hidCheckemail.Value == "1" && !CFunctions.IsNullOrEmpty(info.Sender_Email))
                {
                    if (DAL.Checkdupemail(info.Belongto, info.Iid, info.Sender_Email))
                    {
                        lstError = CCommon.Form_GetError(lstError, Errortype.Error, Definephrase.Comment_dupemail, "", null);
                        CCommon.Form_ShowError(lstError, lblError);
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "showCForm", "showCForm();", true);
                        goto gotoExit;
                    }
                }
                if (hidCheckphone.Value == "1" && !CFunctions.IsNullOrEmpty(info.Sender_Phone))
                {
                    if (DAL.Checkdupphone(info.Belongto, info.Iid, info.Sender_Phone))
                    {
                        lstError = CCommon.Form_GetError(lstError, Errortype.Error, Definephrase.Comment_dupphone, "", null);
                        CCommon.Form_ShowError(lstError, lblError);
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "showCForm", "showCForm();", true);
                        goto gotoExit;
                    }
                }

                if (DAL.Save(info))
                {
                    new CGeneral(CCommon.LANG, Belongto).Updatenum(Pid.ToString(), Queryparam.Sqlcolumn.Allowcomment, CConstants.NUM_INCREASE);
                    CCommon.Session_Set(Sessionparam.WEBUSERCOMMENT, info);
                    pnlForm.Visible = false;
                    lstError = CCommon.Form_GetError(lstError, Errortype.Error, Definephrase.Feedback_done, "", null);
                    CCommon.Form_ShowError(lstError, lblError);

                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Comment", "Comment();", true);
                }
                else
                {
                    pnlForm.Visible = false;
                    lstError = CCommon.Form_GetError(lstError, Errortype.Error, Definephrase.Feedback_error, "", null);
                    CCommon.Form_ShowError(lstError, lblError);
                }
                return;

            gotoExit:
                {
                    CCommon.LoadCaptcha(imgCaptcha);
                    txtCaptcha.Text = "";
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "showCForm", "showCForm();", true);
                }
            }
            catch (Exception ex)
            {
                CCommon.CatchEx(ex);
            }
        }
示例#4
0
        private void Load_Info(int iid)
        {
            CNews DAL = new CNews(CCommon.LANG);
            NewsInfo info = DAL.Getinfo(iid);
            if (info != null)
            {
                if (info.Allowcomment > 0)
                {
                    CommentInfo comment = new CComment(CCommon.LANG).Getinforating(Webcmm.Id.News, info.Id);
                    if (comment != null)
                    {
                        if ((comment.Viewcounter + 1) != info.Allowcomment)
                        {
                            info.Allowcomment = comment.Viewcounter + 1;
                            DAL.Updatenum(info.Id.ToString(), Queryparam.Sqlcolumn.Allowcomment, info.Allowcomment);
                        }
                        info.Rating = comment.Rating / (comment.Viewcounter == 0 ? 1 : comment.Viewcounter);
                    }
                }
                List<NewsInfo> list = new List<NewsInfo>();
                list.Add(info);
                list = list.OrderBy(m => m.Name).ToList();
                (new GenericList<NewsInfo>()).Bind_DataList(rptInfo, null, list, 0);
                DAL.Updatenum(iid.ToString(), Queryparam.Sqlcolumn.Viewcounter, CConstants.NUM_INCREASE);
                breadcrums += tach;
                string linkCat = "<a href=\"/tu-dien-thuat-ngu-" + Langview + "/" + info.eUrl2 + "\">" + info.Name + "</a>";
                breadcrums += linkCat;
                Master.AddMeta_Title(info.Name);
                Master.AddMeta_Description(info.Introduce);
                Master.AddMeta_Keywords(info.Tag);
            }

            pnlListfollow.Visible = pnlInfo.Visible = info != null;
        }