Пример #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Bitshare.DataDecision.Model.tblProcessNotice model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tblProcessNotice(");
            strSql.Append("ProcessName,NodeName,NoticeRole,Remark");
            strSql.Append(") values (");
            strSql.Append("@ProcessName,@NodeName,@NoticeRole,@Remark");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProcessName", SqlDbType.VarChar, 50),
                new SqlParameter("@NodeName",    SqlDbType.VarChar, 50),
                new SqlParameter("@NoticeRole",  SqlDbType.VarChar, 50),
                new SqlParameter("@Remark",      SqlDbType.VarChar, 500)
            };

            parameters[0].Value = model.ProcessName;
            parameters[1].Value = model.NodeName;
            parameters[2].Value = model.NoticeRole;
            parameters[3].Value = model.Remark;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Пример #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Bitshare.DataDecision.Model.tblProcessNotice GetModel(int Rid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Rid, ProcessName, NodeName, NoticeRole, Remark  ");
            strSql.Append("  from tblProcessNotice ");
            strSql.Append(" where Rid=@Rid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Rid", SqlDbType.Int, 4)
            };
            parameters[0].Value = Rid;


            Bitshare.DataDecision.Model.tblProcessNotice model = new Bitshare.DataDecision.Model.tblProcessNotice();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Rid"].ToString() != "")
                {
                    model.Rid = int.Parse(ds.Tables[0].Rows[0]["Rid"].ToString());
                }
                model.ProcessName = ds.Tables[0].Rows[0]["ProcessName"].ToString();
                model.NodeName    = ds.Tables[0].Rows[0]["NodeName"].ToString();
                model.NoticeRole  = ds.Tables[0].Rows[0]["NoticeRole"].ToString();
                model.Remark      = ds.Tables[0].Rows[0]["Remark"].ToString();

                return(model);
            }
            else
            {
                return(null);
            }
        }
Пример #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Bitshare.DataDecision.Model.tblProcessNotice> DataTableToList(DataTable dt)
        {
            List <Bitshare.DataDecision.Model.tblProcessNotice> modelList = new List <Bitshare.DataDecision.Model.tblProcessNotice>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Bitshare.DataDecision.Model.tblProcessNotice model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Bitshare.DataDecision.Model.tblProcessNotice();
                    if (dt.Rows[n]["Rid"].ToString() != "")
                    {
                        model.Rid = int.Parse(dt.Rows[n]["Rid"].ToString());
                    }
                    model.ProcessName = dt.Rows[n]["ProcessName"].ToString();
                    model.NodeName    = dt.Rows[n]["NodeName"].ToString();
                    model.NoticeRole  = dt.Rows[n]["NoticeRole"].ToString();
                    model.Remark      = dt.Rows[n]["Remark"].ToString();


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Bitshare.DataDecision.Model.tblProcessNotice model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tblProcessNotice set ");

            strSql.Append(" ProcessName = @ProcessName , ");
            strSql.Append(" NodeName = @NodeName , ");
            strSql.Append(" NoticeRole = @NoticeRole , ");
            strSql.Append(" Remark = @Remark  ");
            strSql.Append(" where Rid=@Rid ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@Rid",         SqlDbType.Int,      4),
                new SqlParameter("@ProcessName", SqlDbType.VarChar, 50),
                new SqlParameter("@NodeName",    SqlDbType.VarChar, 50),
                new SqlParameter("@NoticeRole",  SqlDbType.VarChar, 50),
                new SqlParameter("@Remark",      SqlDbType.VarChar, 500)
            };

            parameters[0].Value = model.Rid;
            parameters[1].Value = model.ProcessName;
            parameters[2].Value = model.NodeName;
            parameters[3].Value = model.NoticeRole;
            parameters[4].Value = model.Remark;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Bitshare.DataDecision.Model.tblProcessNotice model)
 {
     return(dal.Update(model));
 }
Пример #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Bitshare.DataDecision.Model.tblProcessNotice model)
 {
     return(dal.Add(model));
 }