Beispiel #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public tdps.Model.GNMKB GetModel(string gnbh, string nsrsbh)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,GNMC,SJ,SFKY,SFBX,SWJGT,GNBH,NSRSBH from GNMKB ");
            strSql.Append(" where gnbh=@gnbh and nsrsbh=@nsrsbh");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@gnbh",   DbType.String, 4),
                new SQLiteParameter("@nsrsbh", DbType.String, 20)
            };
            parameters[0].Value = gnbh;
            parameters[1].Value = nsrsbh;

            tdps.Model.GNMKB model = new tdps.Model.GNMKB();
            DataSet          ds    = SQLiteHelper.ExecuteDataSet(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                //if (ds.Tables[0].Rows[0]["ID"].ToString() != "")
                //{
                model.ID = ds.Tables[0].Rows[0]["ID"].ToString();
                //}
                model.GNMC   = ds.Tables[0].Rows[0]["GNMC"].ToString();
                model.SJ     = ds.Tables[0].Rows[0]["SJ"].ToString();
                model.SFKY   = ds.Tables[0].Rows[0]["SFKY"].ToString();
                model.SFBX   = ds.Tables[0].Rows[0]["SFBX"].ToString();
                model.SWJGT  = ds.Tables[0].Rows[0]["SWJGT"].ToString();
                model.GNBH   = ds.Tables[0].Rows[0]["GNBH"].ToString();
                model.NSRSBH = ds.Tables[0].Rows[0]["NSRSBH"].ToString();
                //if (ds.Tables[0].Rows[0]["SFKY"].ToString() != "")
                //{
                //    if ((ds.Tables[0].Rows[0]["SFKY"].ToString() == "1") || (ds.Tables[0].Rows[0]["SFKY"].ToString().ToLower() == "true"))
                //    {
                //        model.SFKY = "1";
                //    }
                //    else
                //    {
                //        model.SFKY = "0";
                //    }
                //}
                //if (ds.Tables[0].Rows[0]["SFBX"].ToString() != "")
                //{
                //    if ((ds.Tables[0].Rows[0]["SFBX"].ToString() == "1") || (ds.Tables[0].Rows[0]["SFBX"].ToString().ToLower() == "true"))
                //    {
                //        model.SFBX = "1";
                //    }
                //    else
                //    {
                //        model.SFBX = "0";
                //    }
                //}
                return(model);
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
 public bool XZGN(GNMKB gn)
 {
     if (dal.XZGN(gn) > 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(tdps.Model.GNMKB model)
        {
            string _sql = "update GNMKB set "
                          + " GNMC = '" + model.GNMC + "'"
                          + " SJ = '" + model.SJ + "'"
                          + " SFKY = " + model.SFKY
                          + " SFBX = " + model.SFBX
                          + " SWJGT = " + model.SWJGT
                          + " where GNBH='" + model.GNBH + "' and NSRSBH = '" + model.NSRSBH + "'";

            return(SQLiteHelper.ExecuteSql(_sql));
        }