Ejemplo n.º 1
0
        private void PageAccess()
        {
            CommonDao<SafePageAccess> Pagemgr = new CommonDao<SafePageAccess>();
            SafePageAccess pa = new SafePageAccess();
            pa.createtime = DateTime.Now.ToString();

            pa.pagename = Request.RawUrl;
            if (Tools.CookieHelper.GetCookie("CN_ID") != null)
            {

                EPReper.BLL.Userinfo UI = new EPReper.BLL.Userinfo();
                string userid = Tools.CookieHelper.GetCookie("CN_ID").ToString();
                pa.userinfo = UI.GetList("CN_ID = " + userid).Tables[0].Rows[0]["CN_LOGIN"].ToString();


            }

            else
            {
                pa.userinfo = "匿名 IP:" + Request.UserHostAddress;
            }

            if (int.Parse(Pagemgr.GetTotalCount(" pagename='" + pa.pagename + "' and userinfo ='" + pa.userinfo + "'")) <= 0)
            {
                Pagemgr.Add(pa);
                CommonDao<SafeNews> newmgr = new CommonDao<SafeNews>();
                SafeNews safenew = newmgr.FindById(Request["fid"].ToString());
                safenew.newskits++;
                newmgr.Update(safenew);

            }

        }
Ejemplo n.º 2
0
        public void GetAdmin()
        {
            EPReper.BLL.Userinfo UI = new EPReper.BLL.Userinfo();
            CommonDao<HealthAdmin> healadminmgr = new CommonDao<HealthAdmin>();
            string username = UI.GetList("CN_ID = " + userid).Tables[0].Rows[0]["CN_LOGIN"].ToString();
            if (int.Parse(healadminmgr.GetTotalCount(" username='******' ")) > 0)
            {
                admins.Visible = true;
                admins1.Visible = true;
                admins2.Visible = true;
            }

        }
Ejemplo n.º 3
0
        protected void GetValue(object sender, EventArgs e)
        {
            CommonDao<SafeNews> newmgr = new CommonDao<SafeNews>();
            SafeNews safenew = new SafeNews();

            if (Request.QueryString["fid"] != null)
            {
                safenew = newmgr.FindById(Request.QueryString["fid"].ToString());
            }
            safenew.newstitle = this.Txtctitle.Text.Trim().ToString();

            CommonDao<Safezhuan> sugmgr = new CommonDao<Safezhuan>();
            Safezhuan safezhuan = sugmgr.FindByConditions(" ZhuanName='" + this.DropDownListZhuanTi.Text.Trim().ToString() + "' ");

            if(safezhuan!=null){
                safenew.NewsZhuan = safezhuan.fid.ToString();
            }
            safenew.newscontents = this.TxtNewsContent.InnerText.ToString();

            if (Request.QueryString["Infotype"] != null && Request.QueryString["type"] != null)
            {
                safenew.NewsInfoType = Request.QueryString["Infotype"].ToString();
                safenew.newstype = Request.QueryString["type"].ToString();
            }

            if (safenew.NewsInfoType == "安全新闻")
            {
                GetImg getimg = new GetImg();
                safenew.newspics = getimg.MyGetImgUrl(safenew.newscontents);
                if (safenew.newspics.Length > 0)
                {
                    safenew.newstype = "图片新闻";
                }
            }
            EPReper.BLL.Userinfo UI = new EPReper.BLL.Userinfo();
            string userid = Tools.CookieHelper.GetCookie("CN_ID").ToString();
            string username = UI.GetList("CN_ID = " + userid).Tables[0].Rows[0]["CN_LOGIN"].ToString();
            safenew.createperson = username;
            safenew.createtime = DateTime.Now.ToString();

            if (Request.QueryString["fid"]!= null)
            {
                if (newmgr.Update(safenew))
                {
                    MessageBox.ShowAndRedirect(this, "恭喜您," + safenew.newstype + "修改成功!", "SafeAdmin.aspx?Infotype=" + safenew.NewsInfoType + "&type=" + safenew.newstype + "");
                }
                MessageBox.Show(this, "Sorry," + safenew.newstype + "修改失败!,请您重试!");

            }
            else
            {
                if (newmgr.Add(safenew))
                {
                    MessageBox.ShowAndRedirect(this, "恭喜您," + safenew.newstype + "添加成功!", "SafeAdmin.aspx?Infotype=" + safenew.NewsInfoType + "&type=" + safenew.newstype + "");
                }
                MessageBox.Show(this, "Sorry," + safenew.newstype + "添加失败!,请您重试!");
            }
        }
Ejemplo n.º 4
0
        protected void ImgBtnMsg_Click(object sender, ImageClickEventArgs e)
        {
            if (this.TxtUserMsgs.Text.Trim().Length > 0)
            {

                string masterfid = Request["fid"].ToString();
                CommonDao<SafePinJia> Pinjiamgr = new CommonDao<SafePinJia>();
                SafePinJia safepinjia = new SafePinJia();
                safepinjia.masterfid = masterfid;
                safepinjia.createtime = DateTime.Now.ToString();
                safepinjia.msgs = this.TxtUserMsgs.Text.Trim().ToString();
                if (Tools.CookieHelper.GetCookie("CN_ID") != null)
                {
                    EPReper.BLL.Userinfo UI = new EPReper.BLL.Userinfo();
                    string userid = Tools.CookieHelper.GetCookie("CN_ID").ToString();
                    safepinjia.createperson = UI.GetList("CN_ID = " + userid).Tables[0].Rows[0]["CN_LOGIN"].ToString();
                }
                else
                {
                    safepinjia.createperson = "匿名 IP:" + Request.UserHostAddress;
                }

                if (Pinjiamgr.Add(safepinjia))
                {
                    Alert("恭喜您,评论成功!");
                    this.RPMsgs.DataSource = Pinjiamgr.FindByCondition(" masterfid='" + masterfid + "'");
                    this.RPMsgs.DataBind();
                }
                else
                {
                    Alert("评论失败!");
                }
            }
            else
                Alert("评论内容不能为空!");
            TxtUserMsgs.Text = "";

        }