//id,qymc,yydh,hykh,hykh_bz,krxm,id_app,lsbh,fjrb,fjbh,xfsj,hyjf,bz,xfxm,sjxmje,shsc,scsj,is_top,is_select public string Hhyjfxfjl_add_edit(string id, string yydh, string qymc, string hykh, string hykh_bz, string krxm, string id_app, string lsbh, string fjrb, string fjbh, string hyjf, string bz, string xfdr, string xfrb, string xfxm, string sjxmje, string add_edit_delete, string czy, DateTime czsj, string parent_hykh, string xxzs) { string s = common_file.common_app.get_failure; BLL.Hhyjf_xfjl B_Hhyjf_xfjl = new Hotel_app.BLL.Hhyjf_xfjl(); Model.Hhyjf_xfjl M_Hhyjf_xfjl = new Hotel_app.Model.Hhyjf_xfjl(); if (xxzs == common_file.common_app.xxzs_xxvalue) { } if (xxzs == common_file.common_app.xxzs_zsvalue) { } if (add_edit_delete == common_file.common_app.get_add) { // 判断是否有被验证 M_Hhyjf_xfjl.yydh = yydh; M_Hhyjf_xfjl.qymc = qymc; M_Hhyjf_xfjl.lsbh_df = common_file.common_ddbh.ddbh("hyjf", "lsbhdate", "lsbhcounter", 6);; M_Hhyjf_xfjl.hykh = hykh; M_Hhyjf_xfjl.hykh_bz = hykh_bz; M_Hhyjf_xfjl.krxm = krxm; M_Hhyjf_xfjl.id_app = id_app; M_Hhyjf_xfjl.lsbh = lsbh; M_Hhyjf_xfjl.fjrb = fjrb; M_Hhyjf_xfjl.fjbh = fjbh; M_Hhyjf_xfjl.xfrq = DateTime.Parse(czsj.ToShortDateString()); M_Hhyjf_xfjl.xfsj = czsj; M_Hhyjf_xfjl.hyjf = Convert.ToDecimal(hyjf); M_Hhyjf_xfjl.bz = bz; M_Hhyjf_xfjl.xfdr = xfdr; M_Hhyjf_xfjl.xfrb = xfrb; M_Hhyjf_xfjl.xfxm = xfxm; M_Hhyjf_xfjl.sjxfje = Convert.ToDecimal(sjxmje); M_Hhyjf_xfjl.parent_hykh = parent_hykh; M_Hhyjf_xfjl.scsj = common_file.common_app.czsj; M_Hhyjf_xfjl.czy = czy; if (B_Hhyjf_xfjl.Add(M_Hhyjf_xfjl) > 0) { s = common_file.common_app.get_suc; } } else if (add_edit_delete == common_file.common_app.get_edit) { //M_Hhyjf_xfjl = B_Hhyjf_xfjl.GetModel(Convert.ToInt32(id)); //M_Hhyjf_xfjl.hykh = hykh; //M_Hhyjf_xfjl.hykh_bz = hykh_bz; //M_Hhyjf_xfjl.id_app = id_app; //M_Hhyjf_xfjl.krxm = krxm; //M_Hhyjf_xfjl.lsbh = lsbh; //M_Hhyjf_xfjl.sjxfje = Convert.ToDecimal(sjxmje); //M_Hhyjf_xfjl.xfxm = xfxm; //M_Hhyjf_xfjl.hyjf = Convert.ToDecimal(hyjf); //M_Hhyjf_xfjl.fjrb = fjrb; //M_Hhyjf_xfjl.fjbh = fjbh; //M_Hhyjf_xfjl.bz = bz; //M_Hhyjf_xfjl.lsbh_df = lsbh_df; //M_Hhyjf_xfjl.id = Convert.ToInt32(id); //B_Hhyjf_xfjl.Update(M_Hhyjf_xfjl); //s = common_file.common_app.get_suc; } else if (add_edit_delete == common_file.common_app.get_delete) { //if (id != "") //{ // B_Hhyjf_xfjl.Delete(Convert.ToInt32(id)); // s = common_file.common_app.get_suc; //} } return(s); }
/// <summary> /// 得到一个对象实体 /// </summary> public Hotel_app.Model.Hhyjf_xfjl GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,qymc,yydh,lsbh_df,hykh,hykh_bz,krxm,id_app,lsbh,fjrb,fjbh,xfrq,xfsj,hyjf,bz,xfdr,xfrb,xfxm,sjxfje,shsc,scsj,is_top,is_select,shqx,parent_hykh,czy from Hhyjf_xfjl "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Hotel_app.Model.Hhyjf_xfjl model = new Hotel_app.Model.Hhyjf_xfjl(); 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]["qymc"] != null && ds.Tables[0].Rows[0]["qymc"].ToString() != "") { model.qymc = ds.Tables[0].Rows[0]["qymc"].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]["lsbh_df"] != null && ds.Tables[0].Rows[0]["lsbh_df"].ToString() != "") { model.lsbh_df = ds.Tables[0].Rows[0]["lsbh_df"].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]["hykh_bz"] != null && ds.Tables[0].Rows[0]["hykh_bz"].ToString() != "") { model.hykh_bz = ds.Tables[0].Rows[0]["hykh_bz"].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]["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]["lsbh"] != null && ds.Tables[0].Rows[0]["lsbh"].ToString() != "") { model.lsbh = ds.Tables[0].Rows[0]["lsbh"].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]["hyjf"] != null && ds.Tables[0].Rows[0]["hyjf"].ToString() != "") { model.hyjf = decimal.Parse(ds.Tables[0].Rows[0]["hyjf"].ToString()); } if (ds.Tables[0].Rows[0]["bz"] != null && ds.Tables[0].Rows[0]["bz"].ToString() != "") { model.bz = ds.Tables[0].Rows[0]["bz"].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]["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]["shsc"] != null && ds.Tables[0].Rows[0]["shsc"].ToString() != "") { if ((ds.Tables[0].Rows[0]["shsc"].ToString() == "1") || (ds.Tables[0].Rows[0]["shsc"].ToString().ToLower() == "true")) { model.shsc = true; } else { model.shsc = false; } } if (ds.Tables[0].Rows[0]["scsj"] != null && ds.Tables[0].Rows[0]["scsj"].ToString() != "") { model.scsj = DateTime.Parse(ds.Tables[0].Rows[0]["scsj"].ToString()); } if (ds.Tables[0].Rows[0]["is_top"] != null && ds.Tables[0].Rows[0]["is_top"].ToString() != "") { if ((ds.Tables[0].Rows[0]["is_top"].ToString() == "1") || (ds.Tables[0].Rows[0]["is_top"].ToString().ToLower() == "true")) { model.is_top = true; } else { model.is_top = false; } } if (ds.Tables[0].Rows[0]["is_select"] != null && ds.Tables[0].Rows[0]["is_select"].ToString() != "") { if ((ds.Tables[0].Rows[0]["is_select"].ToString() == "1") || (ds.Tables[0].Rows[0]["is_select"].ToString().ToLower() == "true")) { model.is_select = true; } else { model.is_select = false; } } if (ds.Tables[0].Rows[0]["shqx"] != null && ds.Tables[0].Rows[0]["shqx"].ToString() != "") { if ((ds.Tables[0].Rows[0]["shqx"].ToString() == "1") || (ds.Tables[0].Rows[0]["shqx"].ToString().ToLower() == "true")) { model.shqx = true; } else { model.shqx = false; } } if (ds.Tables[0].Rows[0]["parent_hykh"] != null && ds.Tables[0].Rows[0]["parent_hykh"].ToString() != "") { model.parent_hykh = ds.Tables[0].Rows[0]["parent_hykh"].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(); } return(model); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hotel_app.Model.Hhyjf_xfjl model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Hhyjf_xfjl("); strSql.Append("qymc,yydh,lsbh_df,hykh,hykh_bz,krxm,id_app,lsbh,fjrb,fjbh,xfrq,xfsj,hyjf,bz,xfdr,xfrb,xfxm,sjxfje,shsc,scsj,is_top,is_select,shqx,parent_hykh,czy)"); strSql.Append(" values ("); strSql.Append("@qymc,@yydh,@lsbh_df,@hykh,@hykh_bz,@krxm,@id_app,@lsbh,@fjrb,@fjbh,@xfrq,@xfsj,@hyjf,@bz,@xfdr,@xfrb,@xfxm,@sjxfje,@shsc,@scsj,@is_top,@is_select,@shqx,@parent_hykh,@czy)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@qymc", SqlDbType.VarChar, 50), new SqlParameter("@yydh", SqlDbType.VarChar, 50), new SqlParameter("@lsbh_df", SqlDbType.VarChar, 50), new SqlParameter("@hykh", SqlDbType.VarChar, 50), new SqlParameter("@hykh_bz", SqlDbType.VarChar, 50), new SqlParameter("@krxm", SqlDbType.VarChar, 50), new SqlParameter("@id_app", SqlDbType.VarChar, 50), new SqlParameter("@lsbh", 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("@hyjf", SqlDbType.Decimal, 9), new SqlParameter("@bz", SqlDbType.VarChar, 50), new SqlParameter("@xfdr", SqlDbType.VarChar, 50), new SqlParameter("@xfrb", SqlDbType.VarChar, 50), new SqlParameter("@xfxm", SqlDbType.VarChar, 50), new SqlParameter("@sjxfje", SqlDbType.Decimal, 9), new SqlParameter("@shsc", SqlDbType.Bit, 1), new SqlParameter("@scsj", SqlDbType.DateTime), new SqlParameter("@is_top", SqlDbType.Bit, 1), new SqlParameter("@is_select", SqlDbType.Bit, 1), new SqlParameter("@shqx", SqlDbType.Bit, 1), new SqlParameter("@parent_hykh", SqlDbType.VarChar, 50), new SqlParameter("@czy", SqlDbType.VarChar, 50) }; parameters[0].Value = model.qymc; parameters[1].Value = model.yydh; parameters[2].Value = model.lsbh_df; parameters[3].Value = model.hykh; parameters[4].Value = model.hykh_bz; parameters[5].Value = model.krxm; parameters[6].Value = model.id_app; parameters[7].Value = model.lsbh; parameters[8].Value = model.fjrb; parameters[9].Value = model.fjbh; parameters[10].Value = model.xfrq; parameters[11].Value = model.xfsj; parameters[12].Value = model.hyjf; parameters[13].Value = model.bz; parameters[14].Value = model.xfdr; parameters[15].Value = model.xfrb; parameters[16].Value = model.xfxm; parameters[17].Value = model.sjxfje; parameters[18].Value = model.shsc; parameters[19].Value = model.scsj; parameters[20].Value = model.is_top; parameters[21].Value = model.is_select; parameters[22].Value = model.shqx; parameters[23].Value = model.parent_hykh; parameters[24].Value = model.czy; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hotel_app.Model.Hhyjf_xfjl model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Hhyjf_xfjl set "); strSql.Append("qymc=@qymc,"); strSql.Append("yydh=@yydh,"); strSql.Append("lsbh_df=@lsbh_df,"); strSql.Append("hykh=@hykh,"); strSql.Append("hykh_bz=@hykh_bz,"); strSql.Append("krxm=@krxm,"); strSql.Append("id_app=@id_app,"); strSql.Append("lsbh=@lsbh,"); strSql.Append("fjrb=@fjrb,"); strSql.Append("fjbh=@fjbh,"); strSql.Append("xfrq=@xfrq,"); strSql.Append("xfsj=@xfsj,"); strSql.Append("hyjf=@hyjf,"); strSql.Append("bz=@bz,"); strSql.Append("xfdr=@xfdr,"); strSql.Append("xfrb=@xfrb,"); strSql.Append("xfxm=@xfxm,"); strSql.Append("sjxfje=@sjxfje,"); strSql.Append("shsc=@shsc,"); strSql.Append("scsj=@scsj,"); strSql.Append("is_top=@is_top,"); strSql.Append("is_select=@is_select,"); strSql.Append("shqx=@shqx,"); strSql.Append("parent_hykh=@parent_hykh,"); strSql.Append("czy=@czy"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@qymc", SqlDbType.VarChar, 50), new SqlParameter("@yydh", SqlDbType.VarChar, 50), new SqlParameter("@lsbh_df", SqlDbType.VarChar, 50), new SqlParameter("@hykh", SqlDbType.VarChar, 50), new SqlParameter("@hykh_bz", SqlDbType.VarChar, 50), new SqlParameter("@krxm", SqlDbType.VarChar, 50), new SqlParameter("@id_app", SqlDbType.VarChar, 50), new SqlParameter("@lsbh", 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("@hyjf", SqlDbType.Decimal, 9), new SqlParameter("@bz", SqlDbType.VarChar, 50), new SqlParameter("@xfdr", SqlDbType.VarChar, 50), new SqlParameter("@xfrb", SqlDbType.VarChar, 50), new SqlParameter("@xfxm", SqlDbType.VarChar, 50), new SqlParameter("@sjxfje", SqlDbType.Decimal, 9), new SqlParameter("@shsc", SqlDbType.Bit, 1), new SqlParameter("@scsj", SqlDbType.DateTime), new SqlParameter("@is_top", SqlDbType.Bit, 1), new SqlParameter("@is_select", SqlDbType.Bit, 1), new SqlParameter("@shqx", SqlDbType.Bit, 1), new SqlParameter("@parent_hykh", SqlDbType.VarChar, 50), new SqlParameter("@czy", SqlDbType.VarChar, 50), new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = model.qymc; parameters[1].Value = model.yydh; parameters[2].Value = model.lsbh_df; parameters[3].Value = model.hykh; parameters[4].Value = model.hykh_bz; parameters[5].Value = model.krxm; parameters[6].Value = model.id_app; parameters[7].Value = model.lsbh; parameters[8].Value = model.fjrb; parameters[9].Value = model.fjbh; parameters[10].Value = model.xfrq; parameters[11].Value = model.xfsj; parameters[12].Value = model.hyjf; parameters[13].Value = model.bz; parameters[14].Value = model.xfdr; parameters[15].Value = model.xfrb; parameters[16].Value = model.xfxm; parameters[17].Value = model.sjxfje; parameters[18].Value = model.shsc; parameters[19].Value = model.scsj; parameters[20].Value = model.is_top; parameters[21].Value = model.is_select; parameters[22].Value = model.shqx; parameters[23].Value = model.parent_hykh; parameters[24].Value = model.czy; parameters[25].Value = model.id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }