Exemplo n.º 1
0
        public void Gift(string kh, int id, string AdminHotelid)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("select * from hy_hyzlxxb  where CarId IS NOT NULL  ");


            string khs = kh;

            khs = "'" + khs.Replace(",", ",").TrimEnd(',').Replace(",", "','") + "'";

            sql.AppendFormat(" and kh in ({0}) or sjhm in ({0}) ", khs);


            DataTable dt = DataFactory.SqlDataBase(AdminHotelid).GetDataTableBySQL(sql);

            if (dt.Rows.Count > 0)
            {
                string sqlcp = string.Format(@"select * from V_XXZSYHQ where CID=@CID and AdminHotelid=@AdminHotelid ");

                SqlParam[] parmAdd3 = new SqlParam[] {
                    new SqlParam("@CID", id),
                    new SqlParam("@AdminHotelid", AdminHotelid)
                };
                DataTable dts = DataFactory.SqlDataBase().GetDataTableBySQL(new StringBuilder(sqlcp), parmAdd3);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //赠送优惠券

                    if (dts != null && dts.Rows.Count > 0)
                    {
                        CommonMethod.AddCardCoupons(dt.Rows[i]["lsh"].ToString(), AdminHotelid, "指定赠送", dts, "10");
                    }
                }
            }
        }