/// <summary> /// 增加一条数据 /// </summary> public bool Add(Hotel_app.Model.VS_syxfmx_hyxsy model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into VS_syxfmx_hyxsy("); strSql.Append("id,yydh,qymc,fjrb,fjbh,xfrq,xfsj,xfdr,xfrb,xfxm,id_app,jzbh,lsbh,hykh,xsy,czy,krxm,xfsl,sjxfje,hykh_bz)"); strSql.Append(" values ("); strSql.Append("@id,@yydh,@qymc,@fjrb,@fjbh,@xfrq,@xfsj,@xfdr,@xfrb,@xfxm,@id_app,@jzbh,@lsbh,@hykh,@xsy,@czy,@krxm,@xfsl,@sjxfje,@hykh_bz)"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@yydh", SqlDbType.VarChar, 50), new SqlParameter("@qymc", SqlDbType.VarChar, 50), new SqlParameter("@fjrb", SqlDbType.VarChar, 50), new SqlParameter("@fjbh", SqlDbType.VarChar, 50), new SqlParameter("@xfrq", SqlDbType.DateTime), new SqlParameter("@xfsj", SqlDbType.DateTime), new SqlParameter("@xfdr", SqlDbType.VarChar, 50), new SqlParameter("@xfrb", SqlDbType.VarChar, 50), new SqlParameter("@xfxm", SqlDbType.VarChar, 50), new SqlParameter("@id_app", SqlDbType.VarChar, 50), new SqlParameter("@jzbh", SqlDbType.VarChar, 50), new SqlParameter("@lsbh", SqlDbType.VarChar, 50), new SqlParameter("@hykh", SqlDbType.VarChar, 50), new SqlParameter("@xsy", SqlDbType.VarChar, 50), new SqlParameter("@czy", SqlDbType.VarChar, 50), new SqlParameter("@krxm", SqlDbType.VarChar, 50), new SqlParameter("@xfsl", SqlDbType.Decimal, 9), new SqlParameter("@sjxfje", SqlDbType.Decimal, 9), new SqlParameter("@hykh_bz", SqlDbType.VarChar, 50) }; parameters[0].Value = model.id; parameters[1].Value = model.yydh; parameters[2].Value = model.qymc; parameters[3].Value = model.fjrb; parameters[4].Value = model.fjbh; parameters[5].Value = model.xfrq; parameters[6].Value = model.xfsj; parameters[7].Value = model.xfdr; parameters[8].Value = model.xfrb; parameters[9].Value = model.xfxm; parameters[10].Value = model.id_app; parameters[11].Value = model.jzbh; parameters[12].Value = model.lsbh; parameters[13].Value = model.hykh; parameters[14].Value = model.xsy; parameters[15].Value = model.czy; parameters[16].Value = model.krxm; parameters[17].Value = model.xfsl; parameters[18].Value = model.sjxfje; parameters[19].Value = model.hykh_bz; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hotel_app.Model.VS_syxfmx_hyxsy model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update VS_syxfmx_hyxsy set "); strSql.Append("id=@id,"); strSql.Append("yydh=@yydh,"); strSql.Append("qymc=@qymc,"); strSql.Append("fjrb=@fjrb,"); strSql.Append("fjbh=@fjbh,"); strSql.Append("xfrq=@xfrq,"); strSql.Append("xfsj=@xfsj,"); strSql.Append("xfdr=@xfdr,"); strSql.Append("xfrb=@xfrb,"); strSql.Append("xfxm=@xfxm,"); strSql.Append("id_app=@id_app,"); strSql.Append("jzbh=@jzbh,"); strSql.Append("lsbh=@lsbh,"); strSql.Append("hykh=@hykh,"); strSql.Append("xsy=@xsy,"); strSql.Append("czy=@czy,"); strSql.Append("krxm=@krxm,"); strSql.Append("xfsl=@xfsl,"); strSql.Append("sjxfje=@sjxfje,"); strSql.Append("hykh_bz=@hykh_bz"); strSql.Append(" where "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@yydh", SqlDbType.VarChar, 50), new SqlParameter("@qymc", SqlDbType.VarChar, 50), new SqlParameter("@fjrb", SqlDbType.VarChar, 50), new SqlParameter("@fjbh", SqlDbType.VarChar, 50), new SqlParameter("@xfrq", SqlDbType.DateTime), new SqlParameter("@xfsj", SqlDbType.DateTime), new SqlParameter("@xfdr", SqlDbType.VarChar, 50), new SqlParameter("@xfrb", SqlDbType.VarChar, 50), new SqlParameter("@xfxm", SqlDbType.VarChar, 50), new SqlParameter("@id_app", SqlDbType.VarChar, 50), new SqlParameter("@jzbh", SqlDbType.VarChar, 50), new SqlParameter("@lsbh", SqlDbType.VarChar, 50), new SqlParameter("@hykh", SqlDbType.VarChar, 50), new SqlParameter("@xsy", SqlDbType.VarChar, 50), new SqlParameter("@czy", SqlDbType.VarChar, 50), new SqlParameter("@krxm", SqlDbType.VarChar, 50), new SqlParameter("@xfsl", SqlDbType.Decimal, 9), new SqlParameter("@sjxfje", SqlDbType.Decimal, 9), new SqlParameter("@hykh_bz", SqlDbType.VarChar, 50) }; parameters[0].Value = model.id; parameters[1].Value = model.yydh; parameters[2].Value = model.qymc; parameters[3].Value = model.fjrb; parameters[4].Value = model.fjbh; parameters[5].Value = model.xfrq; parameters[6].Value = model.xfsj; parameters[7].Value = model.xfdr; parameters[8].Value = model.xfrb; parameters[9].Value = model.xfxm; parameters[10].Value = model.id_app; parameters[11].Value = model.jzbh; parameters[12].Value = model.lsbh; parameters[13].Value = model.hykh; parameters[14].Value = model.xsy; parameters[15].Value = model.czy; parameters[16].Value = model.krxm; parameters[17].Value = model.xfsl; parameters[18].Value = model.sjxfje; parameters[19].Value = model.hykh_bz; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Hotel_app.Model.VS_syxfmx_hyxsy GetModel() { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,yydh,qymc,fjrb,fjbh,xfrq,xfsj,xfdr,xfrb,xfxm,id_app,jzbh,lsbh,hykh,xsy,czy,krxm,xfsl,sjxfje,hykh_bz from VS_syxfmx_hyxsy "); strSql.Append(" where "); SqlParameter[] parameters = { }; Hotel_app.Model.VS_syxfmx_hyxsy model = new Hotel_app.Model.VS_syxfmx_hyxsy(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } if (ds.Tables[0].Rows[0]["yydh"] != null && ds.Tables[0].Rows[0]["yydh"].ToString() != "") { model.yydh = ds.Tables[0].Rows[0]["yydh"].ToString(); } if (ds.Tables[0].Rows[0]["qymc"] != null && ds.Tables[0].Rows[0]["qymc"].ToString() != "") { model.qymc = ds.Tables[0].Rows[0]["qymc"].ToString(); } if (ds.Tables[0].Rows[0]["fjrb"] != null && ds.Tables[0].Rows[0]["fjrb"].ToString() != "") { model.fjrb = ds.Tables[0].Rows[0]["fjrb"].ToString(); } if (ds.Tables[0].Rows[0]["fjbh"] != null && ds.Tables[0].Rows[0]["fjbh"].ToString() != "") { model.fjbh = ds.Tables[0].Rows[0]["fjbh"].ToString(); } if (ds.Tables[0].Rows[0]["xfrq"] != null && ds.Tables[0].Rows[0]["xfrq"].ToString() != "") { model.xfrq = DateTime.Parse(ds.Tables[0].Rows[0]["xfrq"].ToString()); } if (ds.Tables[0].Rows[0]["xfsj"] != null && ds.Tables[0].Rows[0]["xfsj"].ToString() != "") { model.xfsj = DateTime.Parse(ds.Tables[0].Rows[0]["xfsj"].ToString()); } if (ds.Tables[0].Rows[0]["xfdr"] != null && ds.Tables[0].Rows[0]["xfdr"].ToString() != "") { model.xfdr = ds.Tables[0].Rows[0]["xfdr"].ToString(); } if (ds.Tables[0].Rows[0]["xfrb"] != null && ds.Tables[0].Rows[0]["xfrb"].ToString() != "") { model.xfrb = ds.Tables[0].Rows[0]["xfrb"].ToString(); } if (ds.Tables[0].Rows[0]["xfxm"] != null && ds.Tables[0].Rows[0]["xfxm"].ToString() != "") { model.xfxm = ds.Tables[0].Rows[0]["xfxm"].ToString(); } if (ds.Tables[0].Rows[0]["id_app"] != null && ds.Tables[0].Rows[0]["id_app"].ToString() != "") { model.id_app = ds.Tables[0].Rows[0]["id_app"].ToString(); } if (ds.Tables[0].Rows[0]["jzbh"] != null && ds.Tables[0].Rows[0]["jzbh"].ToString() != "") { model.jzbh = ds.Tables[0].Rows[0]["jzbh"].ToString(); } if (ds.Tables[0].Rows[0]["lsbh"] != null && ds.Tables[0].Rows[0]["lsbh"].ToString() != "") { model.lsbh = ds.Tables[0].Rows[0]["lsbh"].ToString(); } if (ds.Tables[0].Rows[0]["hykh"] != null && ds.Tables[0].Rows[0]["hykh"].ToString() != "") { model.hykh = ds.Tables[0].Rows[0]["hykh"].ToString(); } if (ds.Tables[0].Rows[0]["xsy"] != null && ds.Tables[0].Rows[0]["xsy"].ToString() != "") { model.xsy = ds.Tables[0].Rows[0]["xsy"].ToString(); } if (ds.Tables[0].Rows[0]["czy"] != null && ds.Tables[0].Rows[0]["czy"].ToString() != "") { model.czy = ds.Tables[0].Rows[0]["czy"].ToString(); } if (ds.Tables[0].Rows[0]["krxm"] != null && ds.Tables[0].Rows[0]["krxm"].ToString() != "") { model.krxm = ds.Tables[0].Rows[0]["krxm"].ToString(); } if (ds.Tables[0].Rows[0]["xfsl"] != null && ds.Tables[0].Rows[0]["xfsl"].ToString() != "") { model.xfsl = decimal.Parse(ds.Tables[0].Rows[0]["xfsl"].ToString()); } if (ds.Tables[0].Rows[0]["sjxfje"] != null && ds.Tables[0].Rows[0]["sjxfje"].ToString() != "") { model.sjxfje = decimal.Parse(ds.Tables[0].Rows[0]["sjxfje"].ToString()); } if (ds.Tables[0].Rows[0]["hykh_bz"] != null && ds.Tables[0].Rows[0]["hykh_bz"].ToString() != "") { model.hykh_bz = ds.Tables[0].Rows[0]["hykh_bz"].ToString(); } return(model); } else { return(null); } }