Exemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(JMP.MDL.jmp_risklevelallocation model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update jmp_risklevelallocation set ");

            strSql.Append(" r_apptypeid = @r_apptypeid , ");
            strSql.Append(" r_risklevel = @r_risklevel , ");
            strSql.Append(" r_state = @r_state  ");
            strSql.Append(" where r_id=@r_id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@r_id",        SqlDbType.Int, 4),
                new SqlParameter("@r_apptypeid", SqlDbType.Int, 4),
                new SqlParameter("@r_risklevel", SqlDbType.Int, 4),
                new SqlParameter("@r_state",     SqlDbType.Int, 4)
            };

            parameters[0].Value = model.r_id;
            parameters[1].Value = model.r_apptypeid;
            parameters[2].Value = model.r_risklevel;
            parameters[3].Value = model.r_state;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(JMP.MDL.jmp_risklevelallocation model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into jmp_risklevelallocation(");
            strSql.Append("r_apptypeid,r_risklevel,r_state");
            strSql.Append(") values (");
            strSql.Append("@r_apptypeid,@r_risklevel,@r_state");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@r_apptypeid", SqlDbType.Int, 4),
                new SqlParameter("@r_risklevel", SqlDbType.Int, 4),
                new SqlParameter("@r_state",     SqlDbType.Int, 4)
            };

            parameters[0].Value = model.r_apptypeid;
            parameters[1].Value = model.r_risklevel;
            parameters[2].Value = model.r_state;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <JMP.MDL.jmp_risklevelallocation> DataTableToList(DataTable dt)
        {
            List <JMP.MDL.jmp_risklevelallocation> modelList = new List <JMP.MDL.jmp_risklevelallocation>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                JMP.MDL.jmp_risklevelallocation model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new JMP.MDL.jmp_risklevelallocation();
                    if (dt.Rows[n]["r_id"].ToString() != "")
                    {
                        model.r_id = int.Parse(dt.Rows[n]["r_id"].ToString());
                    }
                    if (dt.Rows[n]["r_apptypeid"].ToString() != "")
                    {
                        model.r_apptypeid = int.Parse(dt.Rows[n]["r_apptypeid"].ToString());
                    }
                    if (dt.Rows[n]["r_risklevel"].ToString() != "")
                    {
                        model.r_risklevel = int.Parse(dt.Rows[n]["r_risklevel"].ToString());
                    }
                    if (dt.Rows[n]["r_state"].ToString() != "")
                    {
                        model.r_state = int.Parse(dt.Rows[n]["r_state"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public JMP.MDL.jmp_risklevelallocation GetModel(int r_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select r_id, r_apptypeid,r_risklevel,r_state  ");
            strSql.Append("  from jmp_risklevelallocation ");
            strSql.Append(" where r_id=@r_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@r_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = r_id;


            JMP.MDL.jmp_risklevelallocation model = new JMP.MDL.jmp_risklevelallocation();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["r_id"].ToString() != "")
                {
                    model.r_id = int.Parse(ds.Tables[0].Rows[0]["r_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["r_apptypeid"].ToString() != "")
                {
                    model.r_apptypeid = int.Parse(ds.Tables[0].Rows[0]["r_apptypeid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["r_risklevel"].ToString() != "")
                {
                    model.r_risklevel = int.Parse(ds.Tables[0].Rows[0]["r_risklevel"].ToString());
                }
                if (ds.Tables[0].Rows[0]["r_state"].ToString() != "")
                {
                    model.r_state = int.Parse(ds.Tables[0].Rows[0]["r_state"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(JMP.MDL.jmp_risklevelallocation model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(JMP.MDL.jmp_risklevelallocation model)
 {
     return(dal.Add(model));
 }