Beispiel #1
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 + "添加失败!,请您重试!");
            }
        }
Beispiel #2
0
        protected void GetValue(object sender, EventArgs e)
        {
            CommonDao<Model.SafePitFalls> newmgr = new CommonDao<SafePitFalls>();
            SafePitFalls spf = new SafePitFalls();
           
            
            if (Request.QueryString["fid"] != null)
            {
                spf = newmgr.FindById(Request.QueryString["fid"].ToString());
            }
            spf.area = this.TextAreaQuYu.InnerText.Trim().ToString();

            spf.time = this.TextBoxDate.Text.ToString();
            spf.person = this.DropDownListPerson.Text.Trim().ToString();
            spf.pitresult = this.TextAreaJieguo.InnerHtml.Trim().ToString();
            if (this.TextBoxfk.Text.ToString()!="")
            {
                spf.Fine = Int32.Parse(this.TextBoxfk.Text.ToString());
            }
            
            spf.pitsuggestion = this.TextAreaYijian.InnerHtml.Trim().ToString();
            spf.pitcontents = this.TextAreaYinhuan.InnerText.Trim().ToString().Replace("\"", "'");//.Replace("\"", "\"\'\"")
            spf.dept = this.DropDownListDept.Text.ToString();
            spf.createperson = "测试";
            spf.createtime = DateTime.Now.ToString();
            GetImg getimg = new GetImg();
            spf.picurl = getimg.MyGetImgUrl(this.TextAreaYinhuan.InnerText.ToString());
            if (Request.QueryString["fid"] != null)
            {
                if (newmgr.Update(spf))
                {
                    MessageBox.ShowAndRedirect(this, "恭喜您,安全隐患修改成功!", "SafeResAdd.aspx");
                }
                MessageBox.Show(this, "Sorry,安全隐患修改失败!请您重试!");

            }
            else
            {
                if (newmgr.Add(spf))
                {
                    MessageBox.ShowAndRedirect(this, "恭喜您,安全隐患添加成功!", "SafeResAdd.aspx");
                }
                MessageBox.Show(this, "Sorry,安全隐患添加失败!请您重试!");

            }
        }