Exemple #1
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public int Update(Tunnel.Model.Tunnel_InfoXJB model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@id",         SqlDbType.Int,         4),
                new SqlParameter("@typeId",     SqlDbType.Int,         4),
                new SqlParameter("@title",      SqlDbType.VarChar,   200),
                new SqlParameter("@content",    SqlDbType.Text),
                new SqlParameter("@imagePaht",  SqlDbType.VarChar,   100),
                new SqlParameter("@htmlSource", SqlDbType.Text),
                new SqlParameter("@modiDate",   SqlDbType.DateTime),
                new SqlParameter("@modiUser",   SqlDbType.Int,         4),
                new SqlParameter("@files",      SqlDbType.VarChar,   500),
                new SqlParameter("@sectype",    SqlDbType.Int,         4),
                new SqlParameter("@filename",   SqlDbType.VarChar, 500)
            };
            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.TypeId;
            parameters[2].Value  = model.Title;
            parameters[3].Value  = model.Content;
            parameters[4].Value  = model.ImagePaht;
            parameters[5].Value  = model.HtmlSource;
            parameters[6].Value  = model.ModiDate;
            parameters[7].Value  = model.ModiUser;
            parameters[8].Value  = model.Files;
            parameters[9].Value  = model.Sectype;
            parameters[10].Value = model.Filename;
            DbHelperSQL.RunProcedure("Tunnel_InfoXJB_Update", parameters, out rowsAffected);
            return(rowsAffected);
        }
Exemple #2
0
 private void InitPage()
 {
     if (id != "")
     {
         m_InfoXJBModel           = m_InfoXJBBLL.GetModel(int.Parse(id));
         tb_Title.Text            = m_InfoXJBModel.Title;
         ddlXJBType.SelectedIndex = -1;
         ddlXJBType.Items.FindByValue(m_InfoXJBModel.TypeId.ToString().Trim()).Selected = true;
         FCKeditor.Value = m_InfoXJBModel.Content;
         if (!m_InfoXJBModel.Files.Equals(""))
         {
             Label3.Visible = false;
             Label2.Visible = true;
             Label4.Visible = true;
             Label2.Text    = "<br/>附件名:" + m_InfoXJBModel.Files.Substring(m_InfoXJBModel.Files.LastIndexOf("\\") + 1);
             Label3.Text    = m_InfoXJBModel.Files;
         }
         else
         {
             Label3.Visible = false;
             Label2.Visible = false;
             Label4.Visible = false;
         }
         ViewState["STATE"] = "U";
     }
     else
     {
         ViewState["STATE"] = "N";
     }
 }
Exemple #3
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(Tunnel.Model.Tunnel_InfoXJB model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@id",         SqlDbType.Int,       4),
                new SqlParameter("@typeId",     SqlDbType.Int,       4),
                new SqlParameter("@title",      SqlDbType.VarChar, 200),
                new SqlParameter("@content",    SqlDbType.Text),
                new SqlParameter("@imagePaht",  SqlDbType.VarChar, 100),
                new SqlParameter("@htmlSource", SqlDbType.Text),
                new SqlParameter("@userId",     SqlDbType.Int,       4),
                new SqlParameter("@files",      SqlDbType.VarChar, 500),
                new SqlParameter("@bum_bz",     SqlDbType.Int,       4),
                new SqlParameter("@sectype",    SqlDbType.Int,       4),
                new SqlParameter("@filename",   SqlDbType.VarChar, 500)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.TypeId;
            parameters[2].Value     = model.Title;
            parameters[3].Value     = model.Content;
            parameters[4].Value     = model.ImagePaht;
            parameters[5].Value     = model.HtmlSource;
            parameters[6].Value     = model.UserId;
            parameters[7].Value     = model.Files;
            parameters[8].Value     = model.Bum_bz;
            parameters[9].Value     = model.Sectype;
            parameters[10].Value    = model.Filename;
            DbHelperSQL.RunProcedure("Tunnel_InfoXJB_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }
Exemple #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Tunnel.Model.Tunnel_InfoXJB GetModel(int id)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["typeId"].ToString() != "")
                {
                    model.TypeId = int.Parse(ds.Tables[0].Rows[0]["typeId"].ToString());
                }
                model.Title      = ds.Tables[0].Rows[0]["title"].ToString();
                model.Content    = ds.Tables[0].Rows[0]["content"].ToString();
                model.ImagePaht  = ds.Tables[0].Rows[0]["imagePaht"].ToString();
                model.HtmlSource = ds.Tables[0].Rows[0]["htmlSource"].ToString();
                if (ds.Tables[0].Rows[0]["setDate"].ToString() != "")
                {
                    model.SetDate = Convert.ToDateTime(ds.Tables[0].Rows[0]["setDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["userId"].ToString() != "")
                {
                    model.UserId = int.Parse(ds.Tables[0].Rows[0]["userId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["modiUser"].ToString().Trim() != "")
                {
                    model.ModiUser = int.Parse(ds.Tables[0].Rows[0]["modiUser"].ToString().Trim());
                }
                if (ds.Tables[0].Rows[0]["modiDate"].ToString().Trim() != "")
                {
                    model.ModiDate = Convert.ToDateTime(ds.Tables[0].Rows[0]["modiDate"].ToString().Trim());
                }
                if (ds.Tables[0].Rows[0]["delUser"].ToString().Trim() != "")
                {
                    model.DelUser = int.Parse(ds.Tables[0].Rows[0]["delUser"].ToString().Trim());
                }
                if (ds.Tables[0].Rows[0]["delDate"].ToString().Trim() != "")
                {
                    model.DelDate = Convert.ToDateTime(ds.Tables[0].Rows[0]["delDate"].ToString().Trim());
                }
                model.Files    = ds.Tables[0].Rows[0]["files"].ToString();
                model.Sectype  = Convert.ToInt32(ds.Tables[0].Rows[0]["sectype"].ToString());
                model.Filename = ds.Tables[0].Rows[0]["filename"].ToString();

                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #5
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Tunnel.Model.Tunnel_InfoXJB> DataTableToList(DataTable dt)
        {
            List <Tunnel.Model.Tunnel_InfoXJB> modelList = new List <Tunnel.Model.Tunnel_InfoXJB>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Tunnel.Model.Tunnel_InfoXJB model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Tunnel.Model.Tunnel_InfoXJB();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["typeId"].ToString() != "")
                    {
                        model.TypeId = int.Parse(dt.Rows[n]["typeId"].ToString());
                    }
                    model.Title      = dt.Rows[n]["title"].ToString();
                    model.Content    = dt.Rows[n]["content"].ToString();
                    model.ImagePaht  = dt.Rows[n]["imagePaht"].ToString();
                    model.HtmlSource = dt.Rows[n]["htmlSource"].ToString();
                    if (dt.Rows[n]["setDate"].ToString() != "")
                    {
                        model.SetDate = Convert.ToDateTime(dt.Rows[n]["setDate"].ToString());
                    }
                    if (dt.Rows[n]["userId"].ToString() != "")
                    {
                        model.UserId = int.Parse(dt.Rows[n]["userId"].ToString());
                    }
                    if (dt.Rows[n]["modiDate"].ToString() != "")
                    {
                        model.ModiDate = Convert.ToDateTime(dt.Rows[n]["modiDate"].ToString());
                    }
                    if (dt.Rows[n]["modiUser"].ToString() != "")
                    {
                        model.ModiUser = int.Parse(dt.Rows[n]["modiUser"].ToString());
                    }
                    if (dt.Rows[n]["delDate"].ToString() != "")
                    {
                        model.DelDate = Convert.ToDateTime(dt.Rows[n]["delDate"].ToString());
                    }
                    if (dt.Rows[n]["delUser"].ToString() != "")
                    {
                        model.DelUser = int.Parse(dt.Rows[n]["DelUser"].ToString());
                    }
                    model.Files    = dt.Rows[n]["files"].ToString();
                    model.Sectype  = Convert.ToInt32(dt.Rows[n]["sectype"]);
                    model.Filename = dt.Rows[n]["filename"].ToString();
                    modelList.Add(model);
                }
            }
            return((List <Tunnel.Model.Tunnel_InfoXJB>)modelList);
        }
Exemple #6
0
 /// <summary>
 /// 页面数据绑定
 /// </summary>
 public void PageBind()
 {
     Tunnel.Model.Tunnel_InfoXJB model = new Tunnel.Model.Tunnel_InfoXJB();
     model      = tbll.GetModel(Id);
     title      = model.Title;
     content    = model.Content;
     setDate    = model.SetDate.ToString("yyyy-MM-dd");
     htmlSource = model.HtmlSource;
     userId     = model.UserId;
     if (!string.IsNullOrEmpty(model.Files))
     {
         fujian = "<a href='../" + model.Files + "' style='color: blue' >点击下载附件</a>";
     }
 }
Exemple #7
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <param name="pb">分页基本信息</param>
        /// <param name="count">返回总数</param>
        /// <returns></returns>
        public List <Tunnel.Model.Tunnel_InfoXJB> GetList3(PageBase pb, ref int count)
        {
            DataTable dt = dal.GetList2(pb, ref count).Tables[0];
            List <Tunnel.Model.Tunnel_InfoXJB> modelList = new List <Tunnel.Model.Tunnel_InfoXJB>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0 && pb.DoCount == 0)
            {
                Tunnel.Model.Tunnel_InfoXJB model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model        = new Tunnel.Model.Tunnel_InfoXJB();
                    model.Id     = Convert.ToInt32(dt.Rows[n]["id"].ToString());
                    model.TypeId = int.Parse(dt.Rows[n]["typeId"].ToString());
                    if (dt.Rows[n]["setDate"].ToString() != "")
                    {
                        model.SetDate = Convert.ToDateTime(dt.Rows[n]["setDate"].ToString());
                    }
                    if (dt.Rows[n]["userId"].ToString() != "")
                    {
                        model.UserId = int.Parse(dt.Rows[n]["userId"].ToString());
                    }
                    if (dt.Rows[n]["modiDate"].ToString() != "")
                    {
                        model.ModiDate = Convert.ToDateTime(dt.Rows[n]["modiDate"].ToString());
                    }
                    if (dt.Rows[n]["modiUser"].ToString() != "")
                    {
                        model.ModiUser = int.Parse(dt.Rows[n]["modiUser"].ToString());
                    }
                    if (dt.Rows[n]["delDate"].ToString() != "")
                    {
                        model.DelDate = Convert.ToDateTime(dt.Rows[n]["delDate"].ToString());
                    }
                    if (dt.Rows[n]["delUser"].ToString() != "")
                    {
                        model.DelUser = int.Parse(dt.Rows[n]["DelUser"].ToString());
                    }
                    model.Title      = dt.Rows[n]["title"].ToString();
                    model.Content    = dt.Rows[n]["content"].ToString();
                    model.ImagePaht  = dt.Rows[n]["ImagePaht"].ToString();
                    model.HtmlSource = dt.Rows[n]["HtmlSource"].ToString();
                    model.Sectype    = Convert.ToInt32(dt.Rows[n]["sectype"]);
                    model.Filename   = dt.Rows[n]["filename"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #8
0
 private void PageBind(int indexId)
 {
     Tunnel.Model.Tunnel_InfoXJB model = new Tunnel.Model.Tunnel_InfoXJB();
     Tunnel.BLL.Tunnel_InfoXJB   index = new Tunnel.BLL.Tunnel_InfoXJB();
     model         = index.GetModel(indexId);
     tb_Title.Text = model.Title;
     DropDownList1.SelectedValue = model.TypeId.ToString();
     Binddroplist(model.TypeId);
     DropDownList2.SelectedValue = model.Sectype.ToString();
     FCKeditor.Value             = model.Content; if (!model.Files.Equals(""))
     {
         Label3.Visible = false;
         Label2.Visible = true;
         Label4.Visible = true;
         Label2.Text    = "<br/>附件名:" + model.Files.Substring(model.Files.LastIndexOf("\\") + 1);
         Label3.Text    = model.Files;
     }
     else
     {
         Label3.Visible = false;
         Label2.Visible = false;
         Label4.Visible = false;
     }
 }
Exemple #9
0
    //添加至信息表
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (titleId == 1)
        {
            if (!"0".Equals(Request.Form["DropDownList1"]))
            {
                string title       = this.tb_Title.Text.Trim();
                int    typeid      = Convert.ToInt32(this.DropDownList1.SelectedValue);
                int    sectype     = Convert.ToInt32(DropDownList2.SelectedValue);
                string htmlsourcce = this.FCKeditor.Value; // Request.Form["content1"];  //this.FCKeditor.Value;
                string imagepaht   = stringFormat(From_Content(htmlsourcce)).Trim();
                string content     = FCKeditor.Value;      //Request.Form["content1"]; //FreeTextBox1.HtmlStrippedText;
                int    userid      = ul.LoginID;
                if (!string.IsNullOrEmpty(imagepaht))
                {
                    if (imagepaht.Substring(0, 1) == "/")
                    {
                        imagepaht = imagepaht.Substring(1, imagepaht.Length - 1);
                    }
                    imagepaht = imagepaht.Replace("src=/sdoa/", "");
                }

                Tunnel.Model.Tunnel_InfoXJB model = new Tunnel.Model.Tunnel_InfoXJB();
                model.Id         = indexId;
                model.Title      = title;
                model.TypeId     = typeid;
                model.HtmlSource = htmlsourcce;
                model.ImagePaht  = imagepaht;
                model.Content    = content;
                model.UserId     = userid;
                model.Sectype    = sectype;
                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.Files = Label3.Text;
                }
                else
                {
                    model.Files = filePaht; //infofiles
                }
                //string str = titleName;
                Tunnel.BLL.Tunnel_InfoXJB index = new Tunnel.BLL.Tunnel_InfoXJB();
                int relt = -1;
                relt = index.Update(model);
                if (relt > 0)
                {
                    Tunnel.Common.Message.Show("修改成功!", "N_XJBManage.aspx");
                    string strsql = "";
                    strsql = "insert into tunnel_log(l_user,l_time,l_content,l_ip,l_sort) values(" + ul.LoginID + ",'" + DateTime.Now + "','公司事务>>项经部信息>>修改项经部信息。标题:" + model.Title + "','" + Tunnel.Common.Common.GetIp() + "',1)";
                    Tunnel.Data.DbHelperSQL.ExecuteSql(strsql);
                }
                else
                {
                    Tunnel.Common.Message.Show("修改失败!", "N_XJBManage.aspx");
                }

                // MessageBox(str, url);
            }
            else
            {
                Tunnel.Common.Message.Show("请选择子栏目!");
            }
        }
        else
        {
            if (!"0".Equals(Request.Form["DropDownList1"]))
            {
                string title       = this.tb_Title.Text.Trim();
                int    typeid      = Convert.ToInt32(this.DropDownList1.SelectedValue);
                int    sectype     = Convert.ToInt32(DropDownList2.SelectedValue);
                string htmlsourcce = this.FCKeditor.Value; // Request.Form["content1"];  //this.FCKeditor.Value;
                string imagepaht   = stringFormat(From_Content(htmlsourcce)).Trim();
                string content     = FCKeditor.Value;      //Request.Form["content1"]; //FreeTextBox1.HtmlStrippedText;
                int    userid      = ul.LoginID;
                if (!string.IsNullOrEmpty(imagepaht))
                {
                    if (imagepaht.Substring(0, 1) == "/")
                    {
                        imagepaht = imagepaht.Substring(1, imagepaht.Length - 1);
                    }
                    imagepaht = imagepaht.Replace("src=/sdoa/", "");
                }

                Tunnel.Model.Tunnel_InfoXJB model = new Tunnel.Model.Tunnel_InfoXJB();
                model.Title      = title;
                model.TypeId     = typeid;
                model.HtmlSource = htmlsourcce;
                model.ImagePaht  = imagepaht;
                model.Content    = content;
                model.UserId     = userid;
                model.Bum_bz     = ul.getUserModel(ul.LoginID).m_bum;
                model.Sectype    = sectype;
                HttpPostedFile hpf = file1.PostedFile;
                if (Convert.ToDouble(hpf.ContentLength) / 1024 / 1024 > 10)
                {
                    Response.Write("<script>alert('附件大小不能大于10MB');</script>");

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


                //string str = titleName;

                Tunnel.BLL.Tunnel_InfoXJB bllf = new Tunnel.BLL.Tunnel_InfoXJB();
                int relt = -1;
                relt = bllf.Add(model);
                if (relt > 0)
                {
                    Tunnel.Common.Message.Show("增加成功!", "N_XJBManage.aspx");
                    string strsql = "";
                    strsql = "insert into tunnel_log(l_user,l_time,l_content,l_ip,l_sort) values(" + ul.LoginID + ",'" + DateTime.Now + "','公司事务>>项经部信息>>发布项经部信息。标题:" + model.Title + "','" + Tunnel.Common.Common.GetIp() + "',1)";
                    Tunnel.Data.DbHelperSQL.ExecuteSql(strsql);
                }
                else
                {
                    Tunnel.Common.Message.Show("增加失败!", "N_XJBManage.aspx");
                }

                // MessageBox(str, url);
            }
            else
            {
                Tunnel.Common.Message.Show("请选择子栏目!");
            }
        }
    }
Exemple #10
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(Tunnel.Model.Tunnel_InfoXJB model)
 {
     return(dal.Update(model));
 }
Exemple #11
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Tunnel.Model.Tunnel_InfoXJB model)
 {
     return(dal.Add(model));
 }