コード例 #1
0
        /// <summary>
        /// 所有价格列表
        /// </summary>
        private void Getpice()
        {
            System.Text.StringBuilder sbtext = new System.Text.StringBuilder();
            int id = Convert.ToInt32(context.Request.QueryString["id"]);

            //判断是不是使用固定折扣值
            BLL.cprotocol   bllcp   = new BLL.cprotocol();
            Model.cprotocol modelcp = bllcp.GetModel(id);
            if (!modelcp.Isdiscount)
            { //如果使用自定义折扣
                BLL.cprotocolPrice          bllcpp  = new BLL.cprotocolPrice();
                List <Model.cprotocolPrice> listcpp = bllcpp.GetModelList("cpID=" + id);
                BLL.room_type          bllty        = new BLL.room_type();
                List <Model.room_type> listrt       = bllty.GetModelList("");
                foreach (Model.room_type item in listrt)
                {
                    List <Model.cprotocolPrice> newcpp = listcpp.Where(d => d.RoomType == item.id).ToList();
                    if (newcpp.Count > 0)
                    {
                        sbtext.Append("<tr><td>" + GetFxName(Convert.ToInt32(newcpp[0].RoomType)) + "</td><td>" + Convert.ToDecimal(newcpp[0].Price).ToString("0.##") + "</td><td>" + Convert.ToDecimal(newcpp[0].protoPrice).ToString("0.##") + "</td><td>" + Convert.ToDecimal(newcpp[0].mothPrice).ToString("0.##") + "</td></tr>");
                    }
                    else
                    {
                        sbtext.Append("<tr><td>" + GetFxName(item.id) + "</td><td>" + Convert.ToDecimal(item.room_listedmoney).ToString("0.##") + "</td><td>" + Convert.ToDecimal(item.room_listedmoney).ToString("0.##") + "</td><td>" + Convert.ToDecimal(item.Room_Moth_price).ToString("0.##") + "</td></tr>");
                    }
                }
            }
            else
            {
                decimal                duding = Convert.ToDecimal(modelcp.discount);
                BLL.room_type          bllty  = new BLL.room_type();
                List <Model.room_type> listrt = bllty.GetModelList("");
                foreach (Model.room_type item in listrt)
                {
                    sbtext.Append("<tr><td>" + GetFxName(item.id) + "</td><td>" + Convert.ToDecimal(item.room_listedmoney).ToString("0.##") + "</td><td>" + Convert.ToDecimal(item.room_listedmoney * duding).ToString("0.##") + "</td><td>" + Convert.ToDecimal(item.Room_Moth_price * duding).ToString("0.##") + "</td></tr>");
                }
            }

            context.Response.Write(sbtext.ToString());
        }