Esempio n. 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WebDemo.Model.WebDemo.ReportFiles DataRowToModel(DataRow row)
 {
     WebDemo.Model.WebDemo.ReportFiles model = new WebDemo.Model.WebDemo.ReportFiles();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["ReportID"] != null)
         {
             model.ReportID = row["ReportID"].ToString();
         }
         if (row["ReportName"] != null)
         {
             model.ReportName = row["ReportName"].ToString();
         }
         if (row["ReportType"] != null)
         {
             model.ReportType = row["ReportType"].ToString();
         }
         if (row["ReportFileName"] != null)
         {
             model.ReportFileName = row["ReportFileName"].ToString();
         }
         if (row["ReportDbType"] != null && row["ReportDbType"].ToString() != "")
         {
             model.ReportDbType = int.Parse(row["ReportDbType"].ToString());
         }
         if (row["ReportSql"] != null)
         {
             model.ReportSql = row["ReportSql"].ToString();
         }
         if (row["ReportServiceUrl"] != null)
         {
             model.ReportServiceUrl = row["ReportServiceUrl"].ToString();
         }
         if (row["ReportRole"] != null && row["ReportRole"].ToString() != "")
         {
             model.ReportRole = int.Parse(row["ReportRole"].ToString());
         }
         if (row["OperatorID"] != null && row["OperatorID"].ToString() != "")
         {
             model.OperatorID = int.Parse(row["OperatorID"].ToString());
         }
         if (row["InsDate"] != null && row["InsDate"].ToString() != "")
         {
             model.InsDate = DateTime.Parse(row["InsDate"].ToString());
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
     }
     return(model);
 }
Esempio n. 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WebDemo.Model.WebDemo.ReportFiles model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ReportFiles set ");
            strSql.Append("ReportID=@ReportID,");
            strSql.Append("ReportType=@ReportType,");
            strSql.Append("ReportFileName=@ReportFileName,");
            strSql.Append("ReportDbType=@ReportDbType,");
            strSql.Append("ReportSql=@ReportSql,");
            strSql.Append("ReportServiceUrl=@ReportServiceUrl,");
            strSql.Append("ReportRole=@ReportRole,");
            strSql.Append("OperatorID=@OperatorID,");
            strSql.Append("InsDate=@InsDate,");
            strSql.Append("Remark=@Remark");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ReportID",         SqlDbType.VarChar,     50),
                new SqlParameter("@ReportType",       SqlDbType.VarChar,     10),
                new SqlParameter("@ReportFileName",   SqlDbType.VarChar,     50),
                new SqlParameter("@ReportDbType",     SqlDbType.Int,          4),
                new SqlParameter("@ReportSql",        SqlDbType.VarChar,   1000),
                new SqlParameter("@ReportServiceUrl", SqlDbType.VarChar,    500),
                new SqlParameter("@ReportRole",       SqlDbType.Int,          4),
                new SqlParameter("@OperatorID",       SqlDbType.Int,          4),
                new SqlParameter("@InsDate",          SqlDbType.DateTime),
                new SqlParameter("@Remark",           SqlDbType.VarChar,    100),
                new SqlParameter("@ID",               SqlDbType.Int,          4),
                new SqlParameter("@ReportName",       SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.ReportID;
            parameters[1].Value  = model.ReportType;
            parameters[2].Value  = model.ReportFileName;
            parameters[3].Value  = model.ReportDbType;
            parameters[4].Value  = model.ReportSql;
            parameters[5].Value  = model.ReportServiceUrl;
            parameters[6].Value  = model.ReportRole;
            parameters[7].Value  = model.OperatorID;
            parameters[8].Value  = model.InsDate;
            parameters[9].Value  = model.Remark;
            parameters[10].Value = model.ID;
            parameters[11].Value = model.ReportName;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
 private void ShowInfo(int ID)
 {
     WebDemo.BLL.WebDemo.ReportFiles   bll   = new WebDemo.BLL.WebDemo.ReportFiles();
     WebDemo.Model.WebDemo.ReportFiles model = bll.GetModel(ID);
     this.lblID.Text               = model.ID.ToString();
     this.lblReportID.Text         = model.ReportID;
     this.lblReportName.Text       = model.ReportName;
     this.lblReportType.Text       = model.ReportType;
     this.lblReportFileName.Text   = model.ReportFileName;
     this.lblReportDbType.Text     = model.ReportDbType.ToString();
     this.lblReportSql.Text        = model.ReportSql;
     this.lblReportServiceUrl.Text = model.ReportServiceUrl;
     this.lblReportRole.Text       = model.ReportRole.ToString();
     this.lblOperatorID.Text       = model.OperatorID.ToString();
     this.lblInsDate.Text          = model.InsDate.ToString();
     this.lblRemark.Text           = model.Remark;
 }
Esempio n. 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WebDemo.Model.WebDemo.ReportFiles model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ReportFiles(");
            strSql.Append("ReportID,ReportName,ReportType,ReportFileName,ReportDbType,ReportSql,ReportServiceUrl,ReportRole,OperatorID,InsDate,Remark)");
            strSql.Append(" values (");
            strSql.Append("@ReportID,@ReportName,@ReportType,@ReportFileName,@ReportDbType,@ReportSql,@ReportServiceUrl,@ReportRole,@OperatorID,@InsDate,@Remark)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ReportID",         SqlDbType.VarChar,     50),
                new SqlParameter("@ReportName",       SqlDbType.VarChar,     50),
                new SqlParameter("@ReportType",       SqlDbType.VarChar,     10),
                new SqlParameter("@ReportFileName",   SqlDbType.VarChar,     50),
                new SqlParameter("@ReportDbType",     SqlDbType.Int,          4),
                new SqlParameter("@ReportSql",        SqlDbType.VarChar,   1000),
                new SqlParameter("@ReportServiceUrl", SqlDbType.VarChar,    500),
                new SqlParameter("@ReportRole",       SqlDbType.Int,          4),
                new SqlParameter("@OperatorID",       SqlDbType.Int,          4),
                new SqlParameter("@InsDate",          SqlDbType.DateTime),
                new SqlParameter("@Remark",           SqlDbType.VarChar, 100)
            };
            parameters[0].Value  = model.ReportID;
            parameters[1].Value  = model.ReportName;
            parameters[2].Value  = model.ReportType;
            parameters[3].Value  = model.ReportFileName;
            parameters[4].Value  = model.ReportDbType;
            parameters[5].Value  = model.ReportSql;
            parameters[6].Value  = model.ReportServiceUrl;
            parameters[7].Value  = model.ReportRole;
            parameters[8].Value  = model.OperatorID;
            parameters[9].Value  = model.InsDate;
            parameters[10].Value = model.Remark;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WebDemo.Model.WebDemo.ReportFiles GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,ReportID,ReportName,ReportType,ReportFileName,ReportDbType,ReportSql,ReportServiceUrl,ReportRole,OperatorID,InsDate,Remark from ReportFiles ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            WebDemo.Model.WebDemo.ReportFiles model = new WebDemo.Model.WebDemo.ReportFiles();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtReportID.Text.Trim().Length == 0)
            {
                strErr += "ReportID不能为空!\\n";
            }
            if (this.txtReportName.Text.Trim().Length == 0)
            {
                strErr += "ReportName不能为空!\\n";
            }
            if (this.txtReportType.Text.Trim().Length == 0)
            {
                strErr += "ReportType不能为空!\\n";
            }
            if (this.txtReportFileName.Text.Trim().Length == 0)
            {
                strErr += "ReportFileName不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtReportDbType.Text))
            {
                strErr += "ReportDbType格式错误!\\n";
            }
            if (this.txtReportSql.Text.Trim().Length == 0)
            {
                strErr += "ReportSql不能为空!\\n";
            }
            if (this.txtReportServiceUrl.Text.Trim().Length == 0)
            {
                strErr += "ReportServiceUrl不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtReportRole.Text))
            {
                strErr += "ReportRole格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtOperatorID.Text))
            {
                strErr += "OperatorID格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtInsDate.Text))
            {
                strErr += "InsDate格式错误!\\n";
            }
            if (this.txtRemark.Text.Trim().Length == 0)
            {
                strErr += "Remark不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   ReportID         = this.txtReportID.Text;
            string   ReportName       = this.txtReportName.Text;
            string   ReportType       = this.txtReportType.Text;
            string   ReportFileName   = this.txtReportFileName.Text;
            int      ReportDbType     = int.Parse(this.txtReportDbType.Text);
            string   ReportSql        = this.txtReportSql.Text;
            string   ReportServiceUrl = this.txtReportServiceUrl.Text;
            int      ReportRole       = int.Parse(this.txtReportRole.Text);
            int      OperatorID       = int.Parse(this.txtOperatorID.Text);
            DateTime InsDate          = DateTime.Parse(this.txtInsDate.Text);
            string   Remark           = this.txtRemark.Text;

            WebDemo.Model.WebDemo.ReportFiles model = new WebDemo.Model.WebDemo.ReportFiles();
            model.ReportID         = ReportID;
            model.ReportName       = ReportName;
            model.ReportType       = ReportType;
            model.ReportFileName   = ReportFileName;
            model.ReportDbType     = ReportDbType;
            model.ReportSql        = ReportSql;
            model.ReportServiceUrl = ReportServiceUrl;
            model.ReportRole       = ReportRole;
            model.OperatorID       = OperatorID;
            model.InsDate          = InsDate;
            model.Remark           = Remark;

            WebDemo.BLL.WebDemo.ReportFiles bll = new WebDemo.BLL.WebDemo.ReportFiles();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }