예제 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Tunnel.Model.Tunnel_information> DataTableToList(DataTable dt)
        {
            List <Tunnel.Model.Tunnel_information> modelList = new List <Tunnel.Model.Tunnel_information>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Tunnel.Model.Tunnel_information model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model         = new Tunnel.Model.Tunnel_information();
                    model.i_id    = Convert.ToInt64(dt.Rows[n]["i_id"].ToString());
                    model.i_title = dt.Rows[n]["i_title"].ToString();
                    if (dt.Rows[n]["i_sort"].ToString() != "")
                    {
                        model.i_sort = int.Parse(dt.Rows[n]["i_sort"].ToString());
                    }
                    if (dt.Rows[n]["i_user"].ToString() != "")
                    {
                        model.i_user = int.Parse(dt.Rows[n]["i_user"].ToString());
                    }
                    if (dt.Rows[n]["i_time"].ToString() != "")
                    {
                        model.i_time = DateTime.Parse(dt.Rows[n]["i_time"].ToString());
                    }
                    if (dt.Rows[n]["i_hit"].ToString() != "")
                    {
                        model.i_hit = int.Parse(dt.Rows[n]["i_hit"].ToString());
                    }
                    model.i_content = dt.Rows[n]["i_content"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        RadioButton1.Enabled = true;
        RadioButton2.Enabled = true;
        if (!string.IsNullOrEmpty(Request.QueryString["id"]))
        {
            i_id = Request.QueryString["id"].ToString();
        }
        if (!IsPostBack)
        {
            Button1.Text = titleName;
            if (TypeId == 1)
            {
                RadioButton1.Checked = true;
            }
            else
            {
                RadioButton2.Checked = true;
            }
            Tunnel.Model.Tunnel_information information = new Tunnel.Model.Tunnel_information();

            information        = bll.GetModel(i_id);
            tb_Title.Text      = information.i_title;
            FreeTextBox1.Value = information.i_content;
            if (!information.i_files.Equals(""))
            {
                Label3.Visible = false;
                Label2.Visible = true;
                Label4.Visible = true;
                if (information.i_files.Equals(""))
                {
                    Label2.Text = "<br/>附件名:" + information.i_files.Substring(information.i_files.LastIndexOf("\\") + 1);
                }
                else
                {
                    Label2.Text = "<br/>附件名:" + information.i_files.Substring(information.i_files.LastIndexOf("\\") + 1);
                }
                Label3.Text = information.i_files;
            }
            else
            {
                Label3.Visible = false;
                Label2.Visible = false;
                Label4.Visible = false;
            }
            //Label2.Text = "<br/>附件名:" + information.i_files.Substring(information.i_files.LastIndexOf("\\") + 1); ;
            //Label3.Text = information.i_files;


            if (ul.LoginID != 1 && ul.JiaoSe(ul.LoginID) != "系统管理员")
            {
                RadioButton1.Enabled = false;
                RadioButton2.Enabled = false;
            }
        }
    }
예제 #3
0
    /// <summary>
    /// 页面数据绑定
    /// </summary>
    public void PageBind()
    {
        if (Id == 0)
        {
            return;
        }
        Tunnel.Model.Tunnel_information        model     = new Tunnel.Model.Tunnel_information();
        List <Tunnel.Model.Tunnel_information> modelList = new List <Tunnel.Model.Tunnel_information>();

        model = tbll.GetModel(Id, ul.LoginID, Tunnel.Common.Common.GetIp());
        modelList.Add(model);
        Repeater1.DataSource = modelList;
        Repeater1.DataBind();
    }
예제 #4
0
        /// <summary>
        /// 得到一个对象实体

        /// </summary>
        public Tunnel.Model.Tunnel_information GetModel(string i_id)
        {
            Tunnel.Model.Tunnel_information model = new Tunnel.Model.Tunnel_information();
            SqlDataReader reader = DbHelperSQL.ExecuteReader("select * from tunnel_information where i_id=" + i_id + "");

            if (reader.Read())
            {
                if (reader["i_id"].ToString() != "")
                {
                    model.i_id = long.Parse(reader["i_id"].ToString());
                }
                model.i_title = reader["i_title"].ToString();
                if (reader["i_sort"].ToString() != "")
                {
                    model.i_sort = int.Parse(reader["i_sort"].ToString());
                }
                if (reader["i_user"].ToString() != "")
                {
                    model.i_user = int.Parse(reader["i_user"].ToString());
                }
                if (reader["i_time"].ToString() != "")
                {
                    model.i_time = DateTime.Parse(reader["i_time"].ToString());
                }
                if (reader["i_hit"].ToString() != "")
                {
                    model.i_hit = int.Parse(reader["i_hit"].ToString());
                }
                if (reader["i_audituser"].ToString() != "")
                {
                    model.i_audituser = Convert.ToInt32(reader["i_audituser"]);
                }
                if (reader["i_auditmark"].ToString() != "")
                {
                    model.i_auditmark = reader["i_auditmark"].ToString();
                }
                if (reader["i_audittime"].ToString() != "")
                {
                    model.i_audittime = reader["i_audittime"].ToString();
                }
                model.i_content = reader["i_content"].ToString();
                model.i_files   = reader["i_files"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
예제 #5
0
    /// <summary>
    /// 发布公告
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button1_Click(object sender, EventArgs e)
    {
        HttpPostedFile hpf = file1.PostedFile;

        if (Convert.ToDouble(hpf.ContentLength) / 1024 / 1024 > 10)
        {
            Response.Write("<script>alert('附件大小不能大于10MB');</script>");

            return;
        }
        else
        {
            CreateMdAndFilePaht(hpf);
        }
        Tunnel.Model.Tunnel_information model = new Tunnel.Model.Tunnel_information();
        model.i_title     = tb_Title.Text;
        model.i_content   = FCKeditor.Value;
        model.i_sort      = TypeId; // 0是新闻 1公告
        model.i_user      = ul.LoginID;
        model.i_time      = DateTime.Now;
        model.i_auditmark = "";
        model.i_audittime = "";
        model.i_audituser = 0;
        model.i_files     = filePaht;
        model.i_Ip        = Tunnel.Common.Common.GetIp();

        int    relt = -1;
        string str  = titleName;


        relt = bll.Add(model);
        if (relt > 0)
        {
            str += "成功!";
        }
        else
        {
            str += "失败!";
        }

        // UpImange(relt);

        MessageBox(str, url);
    }
예제 #6
0
    /// <summary>
    /// 页面数据绑定
    /// </summary>
    public void PageBind()
    {
        if (Id == 0)
        {
            return;
        }
        Tunnel.Model.Tunnel_information model = new Tunnel.Model.Tunnel_information();
        model     = tbll.GetModel(Id, ul.LoginID, Tunnel.Common.Common.GetIp());
        i_title   = model.i_title;
        i_user    = ShowUserName(model.i_user.ToString());
        i_time    = model.i_time.ToString();
        i_content = model.i_content;
        if (!string.IsNullOrEmpty(model.i_files))
        {
            fujian = "<a href='../" + model.i_files + "' style='color: blue' >点击下载附件</a>";
        }
        //if (model.i_files != null && model.i_files != "")
        //{
        //    i_content+="<img src='/"+model.i_files+"'>";
        //}
        imageName = Id + ".jpg";
        string temp = Request.PhysicalApplicationPath + "upload/UpGongGaoImage/" + Id + ".jpg";

        if (System.IO.File.Exists(temp) == false)
        {
            imageName = Id + ".gif";
            temp      = Request.PhysicalApplicationPath + "upload/UpGongGaoImage/" + Id + ".gif";
            if (System.IO.File.Exists(temp) == false)
            {
                str = "none";
            }
            else
            {
                str = "";
            }
        }
        else
        {
            str = "";
        }
    }
예제 #7
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <param name="pb">分页基本信息</param>
        /// <param name="count">返回总数</param>
        /// <returns></returns>
        public List <Tunnel.Model.Tunnel_information> GetList(PageBase pb, ref int count)
        {
            DataTable dt = dal.GetList(pb, ref count).Tables[0];
            List <Tunnel.Model.Tunnel_information> modelList = new List <Tunnel.Model.Tunnel_information>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0 && pb.DoCount == 0)
            {
                Tunnel.Model.Tunnel_information model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model         = new Tunnel.Model.Tunnel_information();
                    model.i_id    = Convert.ToInt64(dt.Rows[n]["i_id"].ToString());
                    model.i_title = dt.Rows[n]["i_title"].ToString();
                    if (dt.Rows[n]["i_sort"].ToString() != "")
                    {
                        model.i_sort = int.Parse(dt.Rows[n]["i_sort"].ToString());
                    }
                    if (dt.Rows[n]["i_user"].ToString() != "")
                    {
                        model.i_user = int.Parse(dt.Rows[n]["i_user"].ToString());
                    }
                    if (dt.Rows[n]["i_time"].ToString() != "")
                    {
                        model.i_time = DateTime.Parse(dt.Rows[n]["i_time"].ToString());
                    }
                    if (dt.Rows[n]["i_hit"].ToString() != "")
                    {
                        model.i_hit = int.Parse(dt.Rows[n]["i_hit"].ToString());
                    }

                    model.i_files   = dt.Rows[n]["i_files"].ToString();
                    model.i_content = dt.Rows[n]["i_content"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #8
0
        /// <summary>
        ///  增加一条数据

        /// </summary>
        public int Add(Tunnel.Model.Tunnel_information model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@i_id",        SqlDbType.Int,         8),
                new SqlParameter("@i_title",     SqlDbType.VarChar,   100),
                new SqlParameter("@i_sort",      SqlDbType.Int,         4),
                new SqlParameter("@i_user",      SqlDbType.Int,         4),
                new SqlParameter("@i_time",      SqlDbType.DateTime),
                new SqlParameter("@i_hit",       SqlDbType.Int,         4),
                new SqlParameter("@i_content",   SqlDbType.Text),
                new SqlParameter("@i_ip",        SqlDbType.VarChar,    20),
                new SqlParameter("@i_files",     SqlDbType.VarChar,   500),
                new SqlParameter("@i_audituser", SqlDbType.Int),
                new SqlParameter("@i_auditmark", SqlDbType.VarChar,   500),
                new SqlParameter("@i_audittime", SqlDbType.VarChar, 30)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.i_title;
            parameters[2].Value     = model.i_sort;
            parameters[3].Value     = model.i_user;
            parameters[4].Value     = model.i_time;
            parameters[5].Value     = model.i_hit;
            parameters[6].Value     = model.i_content;
            parameters[7].Value     = model.i_Ip;
            parameters[8].Value     = model.i_files;
            parameters[9].Value     = model.i_audituser;
            parameters[10].Value    = model.i_auditmark;
            parameters[11].Value    = model.i_audittime;


            DbHelperSQL.RunProcedure("Tunnel_information_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }
예제 #9
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(Tunnel.Model.Tunnel_information model)
 {
     return(dal.Update(model));
 }
예제 #10
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Tunnel.Model.Tunnel_information model)
 {
     return(dal.Add(model));
 }
예제 #11
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        Tunnel.Model.Tunnel_information model = new Tunnel.Model.Tunnel_information();
        model.i_title   = tb_Title.Text;
        model.i_content = FreeTextBox1.Value;
        if (RadioButton1.Checked)
        {
            TypeId = 1;
        }
        else
        {
            TypeId = 0;
        }
        model.i_sort = TypeId; // 0是新闻 1公告
        model.i_user = ul.LoginID;
        model.i_time = DateTime.Now;
        model.i_hit  = 0;
        model.i_Ip   = Tunnel.Common.Common.GetIp();
        model.i_id   = Convert.ToInt32(i_id);
        HttpPostedFile hpf = file1.PostedFile;

        if (Convert.ToDouble(hpf.ContentLength) / 1024 / 1024 > 10)
        {
            Response.Write("<script>alert('附件大小不能大于10MB');</script>");

            return;
        }
        else
        {
            CreateMdAndFilePaht(hpf);
        }
        if (filePaht.Equals(""))
        {
            model.i_files = Label3.Text;
        }
        else
        {
            model.i_files = filePaht; //infofiles
        }
        if (filenames.Equals(""))
        {
            model.i_files = Label3.Text.Replace("<br/>附件名:", "");
        }
        else
        {
            model.i_files = filePaht;
        }
        int    relt = -1;
        string str  = titleName;

        relt = bll.Update(model);
        string strsql2 = "delete tunnel_remind where m_typeid=" + model.i_id.ToString() + " and m_type=4";

        Tunnel.Data.DbHelperSQL.ExecuteSql(strsql2);
        //-------添加消息提示--------
        Tunnel.Model.Tunnel_Remind remindmodel = new Tunnel.Model.Tunnel_Remind();
        remindmodel.m_isread   = 0;
        remindmodel.m_time     = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
        remindmodel.m_title    = "有新闻需要您审核<font color=red>(待审核)</font>";
        remindmodel.m_touser   = model.i_audituser;
        remindmodel.m_url      = "N_News/N_News/N_NewSh.aspx?Id=" + relt;
        remindmodel.m_type     = 4;
        remindmodel.m_typeid   = relt;
        remindmodel.m_callTime = Convert.ToDateTime("1800-01-01");
        Tunnel.BLL.Tunnel_Remind rd = new Tunnel.BLL.Tunnel_Remind();
        rd.Add(remindmodel);



        if (relt > 0)
        {
            str += "成功!";
        }
        else
        {
            str += "失败!";
        }

        // UpImange(relt);

        MessageBox(str, url);
    }
예제 #12
0
        /// <summary>
        /// 得到一个对象实体

        /// </summary>
        public Tunnel.Model.Tunnel_information GetModel(long i_id, int i_user, string i_ip)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@i_id",   SqlDbType.BigInt),
                new SqlParameter("@i_user", SqlDbType.Int),
                new SqlParameter("@i_ip",   SqlDbType.VarChar)
            };
            parameters[0].Value = i_id;
            parameters[1].Value = i_user;
            parameters[2].Value = i_ip;

            Tunnel.Model.Tunnel_information model = new Tunnel.Model.Tunnel_information();
            DataSet ds = DbHelperSQL.RunProcedure("Tunnel_information_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["i_id"].ToString() != "")
                {
                    model.i_id = long.Parse(ds.Tables[0].Rows[0]["i_id"].ToString());
                }
                model.i_title = ds.Tables[0].Rows[0]["i_title"].ToString();
                if (ds.Tables[0].Rows[0]["i_sort"].ToString() != "")
                {
                    model.i_sort = int.Parse(ds.Tables[0].Rows[0]["i_sort"].ToString());
                }
                if (ds.Tables[0].Rows[0]["i_user"].ToString() != "")
                {
                    model.i_user = int.Parse(ds.Tables[0].Rows[0]["i_user"].ToString());
                }
                if (ds.Tables[0].Rows[0]["i_time"].ToString() != "")
                {
                    model.i_time = DateTime.Parse(ds.Tables[0].Rows[0]["i_time"].ToString());
                }
                if (ds.Tables[0].Rows[0]["i_hit"].ToString() != "")
                {
                    model.i_hit = int.Parse(ds.Tables[0].Rows[0]["i_hit"].ToString());
                }
                if (ds.Tables[0].Rows[0]["i_files"].ToString() != "")
                {
                    model.i_files = ds.Tables[0].Rows[0]["i_files"].ToString();
                }
                model.i_content = ds.Tables[0].Rows[0]["i_content"].ToString();
                if (ds.Tables[0].Rows[0]["i_audituser"].ToString() != "")
                {
                    model.i_audituser = Convert.ToInt32(ds.Tables[0].Rows[0]["i_audituser"]);
                }
                if (ds.Tables[0].Rows[0]["i_auditmark"].ToString() != "")
                {
                    model.i_auditmark = ds.Tables[0].Rows[0]["i_auditmark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["i_audittime"].ToString() != "")
                {
                    model.i_audittime = ds.Tables[0].Rows[0]["i_audittime"].ToString();
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
예제 #13
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        Tunnel.Model.Tunnel_information model = new Tunnel.Model.Tunnel_information();
        model.i_title   = tb_Title.Text;
        model.i_content = FreeTextBox1.Value;
        if (RadioButton1.Checked)
        {
            TypeId = 1;
        }
        else
        {
            TypeId = 0;
        }
        model.i_sort = TypeId; // 0是新闻 1公告
        model.i_user = ul.LoginID;
        model.i_time = DateTime.Now;
        model.i_Ip   = Tunnel.Common.Common.GetIp();
        model.i_id   = Convert.ToInt32(i_id);
        HttpPostedFile hpf = file1.PostedFile;

        if (Convert.ToDouble(hpf.ContentLength) / 1024 / 1024 > 10)
        {
            Response.Write("<script>alert('附件大小不能大于10MB');</script>");

            return;
        }
        else
        {
            CreateMdAndFilePaht(hpf);
        }
        if (filePaht.Equals(""))
        {
            model.i_files = Label3.Text;
        }
        else
        {
            model.i_files = filePaht; //infofiles
        }
        if (filenames.Equals(""))
        {
            model.i_files = Label3.Text.Replace("<br/>附件名:", "");
        }
        else
        {
            model.i_files = filePaht;
        }

        int    relt = -1;
        string str  = titleName;


        relt = bll.Update(model);
        if (relt > 0)
        {
            str += "成功!";
        }
        else
        {
            str += "失败!";
        }

        // UpImange(relt);

        MessageBox(str, url);
    }
예제 #14
0
    /// <summary>
    /// 发布公告
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button1_Click(object sender, EventArgs e)
    {
        Tunnel.Model.Tunnel_information model = new Tunnel.Model.Tunnel_information();
        model.i_title     = tb_Title.Text;
        model.i_content   = FCKeditor.Value;
        model.i_sort      = TypeId; // 0是新闻 1公告
        model.i_user      = ul.LoginID;
        model.i_hit       = 0;
        model.i_time      = DateTime.Now;
        model.i_Ip        = Tunnel.Common.Common.GetIp();
        model.i_audituser = Convert.ToInt32(DropDownList1.SelectedValue);
        model.i_audittime = "";
        model.i_auditmark = "";
        HttpPostedFile hpf = file1.PostedFile;

        if (!hpf.FileName.Equals(""))
        {
            string fileContentType = hpf.ContentType;
            if (Convert.ToDouble(hpf.ContentLength) / 1024 / 1024 > 10)
            {
                Response.Write("<script>alert('附件大小不能大于10MB');</script>");

                return;
            }
            else
            {
                CreateMdAndFilePaht(hpf);
            }
        }
        else
        {
            filePaht = "";
        }
        model.i_files = filePaht; //infofiles

        int    relt = -1;
        string str  = titleName;

        relt = bll.Add(model);
        //-------添加消息提示--------
        Tunnel.Model.Tunnel_Remind remindmodel = new Tunnel.Model.Tunnel_Remind();
        remindmodel.m_isread   = 0;
        remindmodel.m_time     = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
        remindmodel.m_title    = "有新闻需要您审核<font color=red>(待审核)</font>";
        remindmodel.m_touser   = model.i_audituser;
        remindmodel.m_url      = "N_News/N_News/N_NewSh.aspx?Id=" + relt;
        remindmodel.m_type     = 4;
        remindmodel.m_typeid   = relt;
        remindmodel.m_callTime = Convert.ToDateTime("1800-01-01");
        Tunnel.BLL.Tunnel_Remind rd = new Tunnel.BLL.Tunnel_Remind();
        rd.Add(remindmodel);

        if (relt > 0)
        {
            str += "成功!";
        }
        else
        {
            str += "失败!";
        }
        // UpImange(relt);


        MessageBox(str, url);
    }