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

            strSql.Append("insert into jt_zc_zm(");
            strSql.Append("v_zczm_no,v_zczm_name,t_xf_time,f_zc_money,v_zclx_no,v_zclx_name,v_remark,v_jz_user_pk,v_jz_user_name,t_create_time,i_delete,v_zffs_no,v_zffs_name,v_who)");
            strSql.Append(" values (");
            strSql.Append("@v_zczm_no,@v_zczm_name,@t_xf_time,@f_zc_money,@v_zclx_no,@v_zclx_name,@v_remark,@v_jz_user_pk,@v_jz_user_name,@t_create_time,@i_delete,@v_zffs_no,@v_zffs_name,@_v_who)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@pk",             SqlDbType.Int,          4),
                new SqlParameter("@v_zczm_no",      SqlDbType.VarChar,    256),
                new SqlParameter("@v_zczm_name",    SqlDbType.VarChar,    256),
                new SqlParameter("@t_xf_time",      SqlDbType.DateTime),
                new SqlParameter("@f_zc_money",     SqlDbType.Float,        8),
                new SqlParameter("@v_zclx_no",      SqlDbType.VarChar,    256),
                new SqlParameter("@v_zclx_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("@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_zczm_no;
            parameters[2].Value  = model.v_zczm_name;
            parameters[3].Value  = model.t_xf_time;
            parameters[4].Value  = model.f_zc_money;
            parameters[5].Value  = model.v_zclx_no;
            parameters[6].Value  = model.v_zclx_name;
            parameters[7].Value  = model.v_remark;
            parameters[8].Value  = model.v_jz_user_pk;
            parameters[9].Value  = model.v_jz_user_name;
            parameters[10].Value = model.t_create_time;
            parameters[11].Value = model.i_delete;
            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);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HomeAccountingSystem.Model.jt_zc_zm GetModel(int pk)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 pk,v_zczm_no,v_zczm_name,t_xf_time,f_zc_money,v_zclx_no,v_zclx_name,v_remark,v_jz_user_pk,v_jz_user_name,t_create_time,i_delete,v_zffs_no,v_zffs_name,v_who from jt_zc_zm ");
            strSql.Append(" where pk=@pk ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@pk", SqlDbType.Int, 4)
            };
            parameters[0].Value = pk;

            HomeAccountingSystem.Model.jt_zc_zm model = new HomeAccountingSystem.Model.jt_zc_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);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public HomeAccountingSystem.Model.jt_zc_zm DataRowToModel(DataRow row)
 {
     HomeAccountingSystem.Model.jt_zc_zm model = new HomeAccountingSystem.Model.jt_zc_zm();
     if (row != null)
     {
         if (row["pk"] != null && row["pk"].ToString() != "")
         {
             model.pk = int.Parse(row["pk"].ToString());
         }
         if (row["v_zczm_no"] != null)
         {
             model.v_zczm_no = row["v_zczm_no"].ToString();
         }
         if (row["v_zczm_name"] != null)
         {
             model.v_zczm_name = row["v_zczm_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["f_zc_money"] != null && row["f_zc_money"].ToString() != "")
         {
             model.f_zc_money = decimal.Parse(row["f_zc_money"].ToString());
         }
         if (row["v_zclx_no"] != null)
         {
             model.v_zclx_no = row["v_zclx_no"].ToString();
         }
         if (row["v_zclx_name"] != null)
         {
             model.v_zclx_name = row["v_zclx_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["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);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(HomeAccountingSystem.Model.jt_zc_zm model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update jt_zc_zm set ");
            strSql.Append("v_zczm_no=@v_zczm_no,");
            strSql.Append("v_zczm_name=@v_zczm_name,");
            strSql.Append("t_xf_time=@t_xf_time,");
            strSql.Append("f_zc_money=@f_zc_money,");
            strSql.Append("v_zclx_no=@v_zclx_no,");
            strSql.Append("v_zclx_name=@v_zclx_name,");
            strSql.Append("v_remark=@v_remark,");
            strSql.Append("v_jz_user_pk=@v_jz_user_pk,");
            strSql.Append("v_jz_user_name=@v_jz_user_name,");
            strSql.Append("t_create_time=@t_create_time,");
            strSql.Append("i_delete=@i_delete,");
            strSql.Append("v_zffs_no=@v_zffs_no,");
            strSql.Append("v_zffs_name=@v_zffs_name,");
            strSql.Append("v_who=@v_who");
            strSql.Append(" where pk=@pk ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@v_zczm_no",      SqlDbType.VarChar,    256),
                new SqlParameter("@v_zczm_name",    SqlDbType.VarChar,    256),
                new SqlParameter("@t_xf_time",      SqlDbType.DateTime),
                new SqlParameter("@f_zc_money",     SqlDbType.Float,        8),
                new SqlParameter("@v_zclx_no",      SqlDbType.VarChar,    256),
                new SqlParameter("@v_zclx_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("@v_zffs_no",      SqlDbType.VarChar,    256),
                new SqlParameter("@v_zffs_name",    SqlDbType.VarChar,    256),
                new SqlParameter("@v_who",          SqlDbType.VarChar,    256),
                new SqlParameter("@pk",             SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.v_zczm_no;
            parameters[1].Value  = model.v_zczm_name;
            parameters[2].Value  = model.t_xf_time;
            parameters[3].Value  = model.f_zc_money;
            parameters[4].Value  = model.v_zclx_no;
            parameters[5].Value  = model.v_zclx_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.v_zffs_no;
            parameters[12].Value = model.v_zffs_name;
            parameters[13].Value = model.v_who;
            parameters[14].Value = model.pk;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }