/// <summary> /// 获取公用价格等级列表 /// </summary> /// <param name="TypeID">价格等级类型 =null时默认0</param> /// <returns></returns> public IList <EyouSoft.Model.CompanyStructure.CommonPriceStand> GetList(EyouSoft.Model.CompanyStructure.CommPriceTypeID?TypeID) { IList <EyouSoft.Model.CompanyStructure.CommonPriceStand> list = new List <EyouSoft.Model.CompanyStructure.CommonPriceStand>(); StringBuilder strSql = new StringBuilder(SQL_CommonPriceStand_SELECT); if (TypeID != null) { strSql.AppendFormat(" where TypeId={0} ", (int)TypeID); } DbCommand dc = this._database.GetSqlStringCommand(strSql.ToString()); using (IDataReader dr = DbHelper.ExecuteReader(dc, this._database)) { while (dr.Read()) { EyouSoft.Model.CompanyStructure.CommonPriceStand model = new EyouSoft.Model.CompanyStructure.CommonPriceStand(); model.ID = dr[0].ToString(); if (!dr.IsDBNull(1)) { model.TypeID = (EyouSoft.Model.CompanyStructure.CommPriceTypeID) int.Parse(dr[1].ToString()); } model.PriceStandName = dr[2].ToString(); list.Add(model); model = null; } } return(list); }
/// <summary> /// 设置价格等级 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected string btnSave() { string strSelect = string.Empty; string PriceId = Request.QueryString["IdList"]; string PriceName = Request.QueryString["priceNameList"]; if (PriceId.Length == 0) { MessageBox.Show(this, "请选择价格等级!"); } else { IList <EyouSoft.Model.CompanyStructure.CommonPriceStand> commonPriceStands = new List <EyouSoft.Model.CompanyStructure.CommonPriceStand>(); for (int i = 0; i < PriceId.Split(',').Length; i++) { EyouSoft.Model.CompanyStructure.CommonPriceStand model = new EyouSoft.Model.CompanyStructure.CommonPriceStand(); model.ID = PriceId.Split(',')[i]; model.PriceStandName = PriceName.Split(',')[i]; model.TypeID = EyouSoft.Model.CompanyStructure.CommPriceTypeID.None; commonPriceStands.Add(model); model = null; } EyouSoft.IBLL.CompanyStructure.ICompanyPriceStand bll = EyouSoft.BLL.CompanyStructure.CompanyPriceStand.CreateInstance(); bool Result = bll.SetCompanyPriceStand(CompanyId, commonPriceStands); if (Result) { strSelect = "<select name=\"drpPriceRank\" onchange=\"TourPriceStand.isSamePrice(this);\">"; string strOption = ""; IList <EyouSoft.Model.CompanyStructure.CompanyPriceStand> list = bll.GetList(CompanyId); if (list != null) { foreach (EyouSoft.Model.CompanyStructure.CompanyPriceStand Pricemodel in list) { strOption += string.Format("<option value=\"{0}\">{1}</option>", Pricemodel.ID, Pricemodel.PriceStandName); } } strSelect += strOption + "</select>"; list = null; } bll = null; } return(strSelect); }