Exemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(HomeAccountingSystem.Model.jt_sr_zm model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into jt_sr_zm(");
            strSql.Append("v_srzm_no,v_srzm_name,t_xf_time,v_srlx_no,v_srlx_name,v_remark,v_jz_user_pk,v_jz_user_name,t_create_time,i_delete,f_sr_money,v_zffs_no,v_zffs_name,v_who)");
            strSql.Append(" values (");
            strSql.Append("@v_srzm_no,@v_srzm_name,@t_xf_time,@v_srlx_no,@v_srlx_name,@v_remark,@v_jz_user_pk,@v_jz_user_name,@t_create_time,@i_delete,@f_sr_money,@v_zffs_no,@v_zffs_name,@v_who)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@pk",             SqlDbType.Int,          4),
                new SqlParameter("@v_srzm_no",      SqlDbType.VarChar,    256),
                new SqlParameter("@v_srzm_name",    SqlDbType.VarChar,    256),
                new SqlParameter("@t_xf_time",      SqlDbType.DateTime),
                new SqlParameter("@v_srlx_no",      SqlDbType.VarChar,    256),
                new SqlParameter("@v_srlx_name",    SqlDbType.VarChar,    256),
                new SqlParameter("@v_remark",       SqlDbType.VarChar,    256),
                new SqlParameter("@v_jz_user_pk",   SqlDbType.VarChar,   4000),
                new SqlParameter("@v_jz_user_name", SqlDbType.VarChar,    256),
                new SqlParameter("@t_create_time",  SqlDbType.DateTime),
                new SqlParameter("@i_delete",       SqlDbType.Int,          4),
                new SqlParameter("@f_sr_money",     SqlDbType.Float,        8),
                new SqlParameter("@v_zffs_no",      SqlDbType.VarChar,    256),
                new SqlParameter("@v_zffs_name",    SqlDbType.VarChar,    256),
                new SqlParameter("@v_who",          SqlDbType.VarChar,    256),
            };
            parameters[0].Value  = model.pk;
            parameters[1].Value  = model.v_srzm_no;
            parameters[2].Value  = model.v_srzm_name;
            parameters[3].Value  = model.t_xf_time;
            parameters[4].Value  = model.v_srlx_no;
            parameters[5].Value  = model.v_srlx_name;
            parameters[6].Value  = model.v_remark;
            parameters[7].Value  = model.v_jz_user_pk;
            parameters[8].Value  = model.v_jz_user_name;
            parameters[9].Value  = model.t_create_time;
            parameters[10].Value = model.i_delete;
            parameters[11].Value = model.f_sr_money;
            parameters[12].Value = model.v_zffs_no;
            parameters[13].Value = model.v_zffs_name;
            parameters[14].Value = model.v_who;
            int rows = SQLServerHelper.ExecuteSql(strSql.ToString(), parameters);

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

            strSql.Append("select  top 1 pk,v_srzm_no,v_srzm_name,t_xf_time,v_srlx_no,v_srlx_name,v_remark,v_jz_user_pk,v_jz_user_name,t_create_time,i_delete,f_sr_money,v_zffs_no,v_zffs_name,v_who from jt_sr_zm ");
            strSql.Append(" where pk=@pk ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@pk", SqlDbType.Int, 4)
            };
            parameters[0].Value = pk;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public HomeAccountingSystem.Model.jt_sr_zm DataRowToModel(DataRow row)
 {
     HomeAccountingSystem.Model.jt_sr_zm model = new HomeAccountingSystem.Model.jt_sr_zm();
     if (row != null)
     {
         if (row["pk"] != null && row["pk"].ToString() != "")
         {
             model.pk = int.Parse(row["pk"].ToString());
         }
         if (row["v_srzm_no"] != null)
         {
             model.v_srzm_no = row["v_srzm_no"].ToString();
         }
         if (row["v_srzm_name"] != null)
         {
             model.v_srzm_name = row["v_srzm_name"].ToString();
         }
         if (row["t_xf_time"] != null && row["t_xf_time"].ToString() != "")
         {
             model.t_xf_time = DateTime.Parse(row["t_xf_time"].ToString());
         }
         if (row["v_srlx_no"] != null)
         {
             model.v_srlx_no = row["v_srlx_no"].ToString();
         }
         if (row["v_srlx_name"] != null)
         {
             model.v_srlx_name = row["v_srlx_name"].ToString();
         }
         if (row["v_remark"] != null)
         {
             model.v_remark = row["v_remark"].ToString();
         }
         if (row["v_jz_user_pk"] != null)
         {
             model.v_jz_user_pk = row["v_jz_user_pk"].ToString();
         }
         if (row["v_jz_user_name"] != null)
         {
             model.v_jz_user_name = row["v_jz_user_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());
         }
         if (row["f_sr_money"] != null && row["f_sr_money"].ToString() != "")
         {
             model.f_sr_money = decimal.Parse(row["f_sr_money"].ToString());
         }
         if (row["v_zffs_no"] != null)
         {
             model.v_zffs_no = row["v_zffs_no"].ToString();
         }
         if (row["v_zffs_name"] != null)
         {
             model.v_zffs_name = row["v_zffs_name"].ToString();
         }
         if (row["v_who"] != null)
         {
             model.v_who = row["v_who"].ToString();
         }
     }
     return(model);
 }