Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(HomeAccountingSystem.Model.jt_sr_lx model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update jt_sr_lx set ");
            strSql.Append("v_sr_no=@v_sr_no,");
            strSql.Append("v_srlx_name=@v_srlx_name,");
            strSql.Append("t_create_time=@t_create_time,");
            strSql.Append("i_delete=@i_delete");
            strSql.Append(" where pk=@pk ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@v_sr_no",       SqlDbType.VarChar,   4000),
                new SqlParameter("@v_srlx_name",   SqlDbType.VarChar,   4000),
                new SqlParameter("@t_create_time", SqlDbType.DateTime),
                new SqlParameter("@i_delete",      SqlDbType.Int,          4),
                new SqlParameter("@pk",            SqlDbType.Int, 4)
            };
            parameters[0].Value = model.v_sr_no;
            parameters[1].Value = model.v_srlx_name;
            parameters[2].Value = model.t_create_time;
            parameters[3].Value = model.i_delete;
            parameters[4].Value = model.pk;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public HomeAccountingSystem.Model.jt_sr_lx DataRowToModel(DataRow row)
 {
     HomeAccountingSystem.Model.jt_sr_lx model = new HomeAccountingSystem.Model.jt_sr_lx();
     if (row != null)
     {
         if (row["pk"] != null && row["pk"].ToString() != "")
         {
             model.pk = int.Parse(row["pk"].ToString());
         }
         if (row["v_sr_no"] != null)
         {
             model.v_sr_no = row["v_sr_no"].ToString();
         }
         if (row["v_srlx_name"] != null)
         {
             model.v_srlx_name = row["v_srlx_name"].ToString();
         }
         if (row["t_create_time"] != null && row["t_create_time"].ToString() != "")
         {
             model.t_create_time = DateTime.Parse(row["t_create_time"].ToString());
         }
         if (row["i_delete"] != null && row["i_delete"].ToString() != "")
         {
             model.i_delete = int.Parse(row["i_delete"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(HomeAccountingSystem.Model.jt_sr_lx model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into jt_sr_lx(");
            strSql.Append("v_sr_no,v_srlx_name,t_create_time,i_delete)");
            strSql.Append(" values (");
            strSql.Append("@v_sr_no,@v_srlx_name,@t_create_time,@i_delete)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@pk",            SqlDbType.Int,          4),
                new SqlParameter("@v_sr_no",       SqlDbType.VarChar,   4000),
                new SqlParameter("@v_srlx_name",   SqlDbType.VarChar,   4000),
                new SqlParameter("@t_create_time", SqlDbType.DateTime),
                new SqlParameter("@i_delete",      SqlDbType.Int, 4)
            };
            parameters[0].Value = model.pk;
            parameters[1].Value = model.v_sr_no;
            parameters[2].Value = model.v_srlx_name;
            parameters[3].Value = model.t_create_time;
            parameters[4].Value = model.i_delete;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HomeAccountingSystem.Model.jt_sr_lx GetModel(int pk)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 pk,v_sr_no,v_srlx_name,t_create_time,i_delete from jt_sr_lx ");
            strSql.Append(" where pk=@pk ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@pk", SqlDbType.Int, 4)
            };
            parameters[0].Value = pk;

            HomeAccountingSystem.Model.jt_sr_lx model = new HomeAccountingSystem.Model.jt_sr_lx();
            DataSet ds = SQLServerHelper.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }