Пример #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(tdps.Model.GSKHYH model, object trans)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update GSKHYH set ");
            strSql.Append("KHYHZL=@KHYHZL,");
            strSql.Append("KHYH=@KHYH,");
            strSql.Append("IsDefault=@IsDefault,");
            strSql.Append("KHYHMC=@KHYHMC,");
            strSql.Append("KHYHZLMC=@KHYHZLMC");
            strSql.Append(" where NSRSBH=@NSRSBH and KHZH=@KHZH ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@NSRSBH",    DbType.String, 20),
                new SQLiteParameter("@KHZH",      DbType.String, 25),
                new SQLiteParameter("@KHYHZL",    DbType.String,  4),
                new SQLiteParameter("@KHYH",      DbType.String, 30),
                new SQLiteParameter("@IsDefault", DbType.Int32,   4),
                new SQLiteParameter("@KHYHMC",    DbType.String, 50),
                new SQLiteParameter("@KHYHZLMC",  DbType.String, 50)
            };
            parameters[0].Value = model.NSRSBH;
            parameters[1].Value = model.KHZH;
            parameters[2].Value = model.KHYHZL;
            parameters[3].Value = model.KHYH;
            parameters[4].Value = model.IsDefault;
            parameters[5].Value = model.KHYHMC;
            parameters[6].Value = model.KHYHZLMC;

            SQLiteHelper.ExecuteNonQueryByTransaction(strSql.ToString(), (SQLiteTransaction)trans, parameters);
        }
Пример #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <tdps.Model.GSKHYH> DataTableToList(DataTable dt)
        {
            List <tdps.Model.GSKHYH> modelList = new List <tdps.Model.GSKHYH>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                tdps.Model.GSKHYH model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model        = new tdps.Model.GSKHYH();
                    model.NSRSBH = dt.Rows[n]["NSRSBH"].ToString();
                    model.KHZH   = dt.Rows[n]["KHZH"].ToString();
                    model.KHYHZL = dt.Rows[n]["KHYHZL"].ToString();
                    model.KHYH   = dt.Rows[n]["KHYH"].ToString();
                    if (dt.Rows[n]["IsDefault"].ToString() != "")
                    {
                        model.IsDefault = int.Parse(dt.Rows[n]["IsDefault"].ToString());
                    }
                    model.KHYHMC   = dt.Rows[n]["KHYHMC"].ToString();
                    model.KHYHZLMC = dt.Rows[n]["KHYHZLMC"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(tdps.Model.GSKHYH model, object trans)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into GSKHYH(");
            strSql.Append("NSRSBH,KHZH,KHYHZL,KHYH,IsDefault,KHYHMC,KHYHZLMC)");
            strSql.Append(" values (");
            strSql.Append("@NSRSBH,@KHZH,@KHYHZL,@KHYH,@IsDefault,@KHYHMC,@KHYHZLMC)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@NSRSBH",    DbType.String, 20),
                new SQLiteParameter("@KHZH",      DbType.String, 25),
                new SQLiteParameter("@KHYHZL",    DbType.String,  4),
                new SQLiteParameter("@KHYH",      DbType.String, 30),
                new SQLiteParameter("@IsDefault", DbType.Int32,   4),
                new SQLiteParameter("@KHYHMC",    DbType.String, 50),
                new SQLiteParameter("@KHYHZLMC",  DbType.String, 50)
            };
            parameters[0].Value = model.NSRSBH;
            parameters[1].Value = model.KHZH;
            parameters[2].Value = model.KHYHZL;
            parameters[3].Value = model.KHYH;
            parameters[4].Value = model.IsDefault;
            parameters[5].Value = model.KHYHMC;
            parameters[6].Value = model.KHYHZLMC;

            SQLiteHelper.ExecuteNonQueryByTransaction(strSql.ToString(), (SQLiteTransaction)trans, parameters);
        }
Пример #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(tdps.Model.GSKHYH model)
 {
     dal.Update(model);
 }
Пример #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(tdps.Model.GSKHYH model)
 {
     dal.Add(model);
 }
Пример #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(tdps.Model.GSKHYH model, object trans)
 {
     dal.Update(model, trans);
 }
Пример #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(tdps.Model.GSKHYH model, object trans)
 {
     dal.Add(model, trans);
 }