protected void Page_Load(object sender, EventArgs e)
 {
     MyAddInit();
     if (!IsPostBack)
     {
         DigiPower.Onlinecol.Standard.BLL.T_EFile_BLL   bll   = new DigiPower.Onlinecol.Standard.BLL.T_EFile_BLL();
         DigiPower.Onlinecol.Standard.Model.T_EFile_MDL model = bll.GetModel(Common.ConvertEx.ToInt(ID));
         txtTitle.Text = model.Title;
     }
 }
 protected void btnOK_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(ID))
     {
         DigiPower.Onlinecol.Standard.BLL.T_EFile_BLL   bll   = new DigiPower.Onlinecol.Standard.BLL.T_EFile_BLL();
         DigiPower.Onlinecol.Standard.Model.T_EFile_MDL model = bll.GetModel(Common.ConvertEx.ToInt(ID));
         model.Title = this.txtTitle.Text;
         bll.Update(model);
         ClientScript.RegisterStartupScript(Page.GetType(), "close", "<script type='text/javascript'>reloadopener();</script>");
     }
 }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DigiPower.Onlinecol.Standard.Model.T_EFile_MDL GetModel(int ArchiveListCellRptID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ArchiveListCellRptID,FileListID,DH,FileType,Status,Title,FilePath,PDFFilePath,PageCounts,OrderIndex,RootPath from T_EFile ");
            strSql.Append(" where ArchiveListCellRptID=@ArchiveListCellRptID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ArchiveListCellRptID", SqlDbType.Int, 8)
            };
            parameters[0].Value = ArchiveListCellRptID;

            DigiPower.Onlinecol.Standard.Model.T_EFile_MDL model = new DigiPower.Onlinecol.Standard.Model.T_EFile_MDL();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ArchiveListCellRptID"].ToString() != "")
                {
                    model.ArchiveListCellRptID = int.Parse(ds.Tables[0].Rows[0]["ArchiveListCellRptID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["FileListID"].ToString() != "")
                {
                    model.FileListID = int.Parse(ds.Tables[0].Rows[0]["FileListID"].ToString());
                }
                model.DH = ds.Tables[0].Rows[0]["DH"].ToString();
                if (ds.Tables[0].Rows[0]["FileType"].ToString() != "")
                {
                    model.FileType = int.Parse(ds.Tables[0].Rows[0]["FileType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Status"].ToString() != "")
                {
                    model.Status = int.Parse(ds.Tables[0].Rows[0]["Status"].ToString());
                }
                model.Title       = ds.Tables[0].Rows[0]["Title"].ToString();
                model.FilePath    = ds.Tables[0].Rows[0]["FilePath"].ToString();
                model.PDFFilePath = ds.Tables[0].Rows[0]["PDFFilePath"].ToString();
                if (ds.Tables[0].Rows[0]["PageCounts"].ToString() != "")
                {
                    model.PageCounts = int.Parse(ds.Tables[0].Rows[0]["PageCounts"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OrderIndex"].ToString() != "")
                {
                    model.OrderIndex = int.Parse(ds.Tables[0].Rows[0]["OrderIndex"].ToString());
                }
                model.RootPath = ds.Tables[0].Rows[0]["RootPath"].ToString();

                return(model);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(DigiPower.Onlinecol.Standard.Model.T_EFile_MDL model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_EFile(");
            strSql.Append("FileListID,DH,FileType,Status,Title,FilePath,PDFFilePath,PageCounts,Status_Text,CREATE_DT,CONVERT_FLAG,OrderIndex,RootPath)");
            strSql.Append(" values (");
            strSql.Append("@FileListID,@DH,@FileType,@Status,@Title,@FilePath,@PDFFilePath,@PageCounts,@Status_Text,@CREATE_DT,@CONVERT_FLAG,@OrderIndex,@RootPath)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FileListID",   SqlDbType.Int,        8),
                new SqlParameter("@DH",           SqlDbType.NVarChar,  30),
                new SqlParameter("@FileType",     SqlDbType.Int,        8),
                new SqlParameter("@Status",       SqlDbType.Int,        8),
                new SqlParameter("@Title",        SqlDbType.NVarChar, 200),
                new SqlParameter("@FilePath",     SqlDbType.NVarChar, 250),
                new SqlParameter("@PDFFilePath",  SqlDbType.NVarChar, 250),
                new SqlParameter("@PageCounts",   SqlDbType.Int,        8),

                new SqlParameter("@Status_Text",  SqlDbType.NVarChar,  20),
                new SqlParameter("@CREATE_DT",    SqlDbType.NVarChar,  20),
                new SqlParameter("@CONVERT_FLAG", SqlDbType.Bit,        1),

                new SqlParameter("@OrderIndex",   SqlDbType.Int,        8),
                new SqlParameter("@RootPath",     SqlDbType.VarChar, 100)
            };
            parameters[0].Value  = model.FileListID;
            parameters[1].Value  = model.DH;
            parameters[2].Value  = model.FileType;
            parameters[3].Value  = model.Status;
            parameters[4].Value  = model.Title;
            parameters[5].Value  = model.FilePath;
            parameters[6].Value  = model.PDFFilePath;
            parameters[7].Value  = model.PageCounts;
            parameters[8].Value  = model.Status_Text;
            parameters[9].Value  = model.CREATE_DT;
            parameters[10].Value = model.CONVERT_FLAG;
            parameters[11].Value = model.OrderIndex;
            parameters[12].Value = model.RootPath;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #5
0
        /// <summary>
        /// 绑定页面
        /// </summary>
        /// <param name="ID"></param>
        private void BindPage(string ID)
        {
            Model.T_EFile_MDL model = new DigiPower.Onlinecol.Standard.Model.T_EFile_MDL();

            BLL.T_EFile_BLL bll = new DigiPower.Onlinecol.Standard.BLL.T_EFile_BLL();

            model = bll.GetModel(Convert.ToInt32(ID));

            if (model != null)
            {
                DigiPower.Onlinecol.Standard.Web.Comm.SetValueToPage(model, this.tbl);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(DigiPower.Onlinecol.Standard.Model.T_EFile_MDL model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_EFile set ");
            strSql.Append("FileListID=@FileListID,");
            strSql.Append("DH=@DH,");
            strSql.Append("FileType=@FileType,");
            strSql.Append("Status=@Status,");
            strSql.Append("Title=@Title,");
            strSql.Append("FilePath=@FilePath,");
            strSql.Append("PDFFilePath=@PDFFilePath,");
            strSql.Append("PageCounts=@PageCounts,");
            strSql.Append("OrderIndex=@OrderIndex,");
            strSql.Append("RootPath=@RootPath");
            strSql.Append(" where ArchiveListCellRptID=@ArchiveListCellRptID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ArchiveListCellRptID", SqlDbType.Int,        8),
                new SqlParameter("@FileListID",           SqlDbType.Int,        8),
                new SqlParameter("@DH",                   SqlDbType.NVarChar,  30),
                new SqlParameter("@FileType",             SqlDbType.Int,        8),
                new SqlParameter("@Status",               SqlDbType.Int,        8),
                new SqlParameter("@Title",                SqlDbType.NVarChar, 200),
                new SqlParameter("@FilePath",             SqlDbType.NVarChar, 250),
                new SqlParameter("@PDFFilePath",          SqlDbType.NVarChar, 250),
                new SqlParameter("@PageCounts",           SqlDbType.Int,        8),
                new SqlParameter("@OrderIndex",           SqlDbType.Int,        8),
                new SqlParameter("@RootPath",             SqlDbType.VarChar, 100)
            };
            parameters[0].Value  = model.ArchiveListCellRptID;
            parameters[1].Value  = model.FileListID;
            parameters[2].Value  = model.DH;
            parameters[3].Value  = model.FileType;
            parameters[4].Value  = model.Status;
            parameters[5].Value  = model.Title;
            parameters[6].Value  = model.FilePath;
            parameters[7].Value  = model.PDFFilePath;
            parameters[8].Value  = model.PageCounts;
            parameters[9].Value  = model.OrderIndex;
            parameters[10].Value = model.RootPath;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }