Esempio n. 1
0
        /// <summary>
        /// 得到某城市下的所有推荐产品
        /// </summary>
        /// <param name="CityId"></param>
        /// <returns></returns>
        public IList <EyouSoft.Model.AdvStructure.ExtendProductInfo> GetExtendProductList(int CityId)
        {
            DbCommand dc = this.DB.GetStoredProcCommand("proc_SelectExtendProduct");

            this.DB.AddInParameter(dc, "CityId", DbType.Int32, CityId);
            IList <EyouSoft.Model.AdvStructure.ExtendProductInfo> items = new List <EyouSoft.Model.AdvStructure.ExtendProductInfo>();

            EyouSoft.Model.AdvStructure.ExtendProductInfo item = null;
            using (IDataReader rdr = DbHelper.ExecuteReader(dc, DB))
            {
                while (rdr.Read())
                {
                    item = new EyouSoft.Model.AdvStructure.ExtendProductInfo()
                    {
                        ID         = rdr.GetInt32(rdr.GetOrdinal("Id")),
                        SortID     = rdr.GetInt32(rdr.GetOrdinal("SortID")),
                        ShowCity   = rdr["CityName"].ToString(),
                        ShowCityId = rdr.IsDBNull(rdr.GetOrdinal("ShowCityID")) ? 0 : rdr.GetInt32(rdr.GetOrdinal("ShowCityID")),
                        ShowProId  = rdr.IsDBNull(rdr.GetOrdinal("ShowProId")) ? 0 : rdr.GetInt32(rdr.GetOrdinal("ShowProId")),
                        CompanyID  = rdr["CompanyID"].ToString(),
                        ProductID  = rdr["ProductID"].ToString()
                    };
                    if (!rdr.IsDBNull(rdr.GetOrdinal("ProductInfo")))
                    {
                        InputProductInfo(item, rdr.GetString(rdr.GetOrdinal("ProductInfo")));
                    }
                    items.Add(item);
                }
            }
            return(items);
        }
Esempio n. 2
0
        /// <summary>
        /// 修改推荐产品
        /// </summary>
        /// <param name="ExtendProductInfo"></param>
        /// <returns></returns>
        public bool UpdateExtendProduct(EyouSoft.Model.AdvStructure.ExtendProductInfo ExtendProductInfo)
        {
            DbCommand dc = this.DB.GetSqlStringCommand(SQL_UPDATE_ExtendProduct);

            this.DB.AddInParameter(dc, "ID", DbType.Int32, ExtendProductInfo.ID);
            this.DB.AddInParameter(dc, "SortID", DbType.Int32, ExtendProductInfo.SortID);
            this.DB.AddInParameter(dc, "ShowCityID", DbType.Int32, ExtendProductInfo.ShowCityId);
            this.DB.AddInParameter(dc, "ShowProID", DbType.Int32, ExtendProductInfo.ShowProId);
            return(DbHelper.ExecuteSql(dc, DB) > 0 ? true : false);
        }
Esempio n. 3
0
 /// <summary>
 /// 添加推荐产品
 /// </summary>
 /// <param name="ExtendProductInfo"></param>
 /// <returns></returns>
 public bool AddExtendProduct(EyouSoft.Model.AdvStructure.ExtendProductInfo ExtendProductInfo)
 {
     if (!string.IsNullOrEmpty(ExtendProductInfo.ProductID) && ExtendProductInfo.ShowCityId != 0 && !IsZixst(ExtendProductInfo.ShowCityId, ExtendProductInfo.ProductID))
     {
         return(dal.AddExtendProduct(ExtendProductInfo));
     }
     else
     {
         return(false);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 设置产品信息
        /// </summary>
        /// <param name="model"></param>
        private void InputProductInfo(EyouSoft.Model.AdvStructure.ExtendProductInfo model, string ProductInfo)
        {
            XElement root = XElement.Parse(ProductInfo).Element("row");

            if (root != null)
            {
                model.ProductName = EyouSoft.Common.Utility.GetXAttributeValue(root, "RouteName");
                model.CompanyName = EyouSoft.Common.Utility.GetXAttributeValue(root, "CompanyName");
                model.ContactMQ   = EyouSoft.Common.Utility.GetXAttributeValue(root, "TourContacMQ");
                model.Price       = EyouSoft.Common.Utility.GetDecimal(EyouSoft.Common.Utility.GetXAttributeValue(root, "RetailAdultPrice"));
            }
        }
Esempio n. 5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //定义推荐产品集合列表
            IList <EyouSoft.Model.AdvStructure.ExtendProductInfo> list = new List <EyouSoft.Model.AdvStructure.ExtendProductInfo>();
            //城市编号
            int CurrCityId = Utils.GetInt(hCurrCityId.Value, 362);
            //省份编号
            int CurrProvinceId = Utils.GetInt(hCurrProvinceId.Value, 33);
            //省份名称
            string CurrCityName = hCurrCityName.Value;

            //主键ID
            string[] Ids = Utils.GetFormValues("hKeyId");
            //公司Id
            string[] CompanyIds = Utils.GetFormValues("hCId");
            //排序号
            string[] SotrNums = Utils.GetFormValues("txt_Sort");
            //产品价格
            string[] ProductPrices = Utils.GetFormValues("hPrice");
            //产品名称
            string[] ProductNames = Utils.GetFormValues("hProductName");
            //产品编号
            string[] ProductIDS = Utils.GetFormValues("hProductId");
            //公司名称
            string[] CompanyNames = Utils.GetFormValues("hfCompanyName");
            //联系MQ
            string[] ContactMQS = Utils.GetFormValues("hfMQ");
            for (int i = 0; i < Ids.Length; i++)
            {
                //定义推荐产品实体对象
                EyouSoft.Model.AdvStructure.ExtendProductInfo model = new EyouSoft.Model.AdvStructure.ExtendProductInfo();

                model.CompanyID   = CompanyIds[i];
                model.CompanyName = CompanyNames[i];
                model.ProductName = ProductNames[i];
                model.ContactMQ   = ContactMQS[i];
                model.Price       = Utils.GetDecimal(ProductPrices[i], 0);
                model.ProductID   = ProductIDS[i];
                model.ID          = int.Parse(Ids[i]);
                model.ShowCity    = CurrCityName;
                model.ShowCityId  = CurrCityId;
                model.ShowProId   = CurrProvinceId;
                model.SortID      = int.Parse(SotrNums[i]);
                list.Add(model);
                model = null;
            }
            if (list.Count > 0)
            {
                bool result = EyouSoft.BLL.AdvStructure.ExtendProduct.CreateInstance().UpdateExtendProduct(list);
                MessageBox.ShowAndRedirect(this, result ? "保存成功!" : "保存失败!", "/AdManagement/RecommendProductList.aspx");
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 添加推荐产品
        /// </summary>
        /// <param name="ExtendProductInfo"></param>
        /// <returns></returns>
        public bool AddExtendProduct(EyouSoft.Model.AdvStructure.ExtendProductInfo ExtendProductInfo)
        {
            DbCommand dc = this.DB.GetSqlStringCommand(SQL_ADD_ExtendProduct);

            this.DB.AddInParameter(dc, "SortID", DbType.Int32, ExtendProductInfo.SortID);
            this.DB.AddInParameter(dc, "CompanyID", DbType.AnsiStringFixedLength, ExtendProductInfo.CompanyID);
            this.DB.AddInParameter(dc, "ProductID", DbType.AnsiStringFixedLength, ExtendProductInfo.ProductID);
            this.DB.AddInParameter(dc, "ProductName", DbType.String, ExtendProductInfo.ProductName);
            this.DB.AddInParameter(dc, "Price", DbType.Decimal, ExtendProductInfo.Price);
            this.DB.AddInParameter(dc, "ShowCityID", DbType.Int32, ExtendProductInfo.ShowCityId);
            this.DB.AddInParameter(dc, "ShowProID", DbType.Int32, ExtendProductInfo.ShowProId);

            return(DbHelper.ExecuteSql(dc, DB) > 0 ? true : false);
        }
Esempio n. 7
0
        /// <summary>
        /// 得到所有首页推荐产品
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public IList <EyouSoft.Model.AdvStructure.ExtendProductInfo> GetExtendProductList(int pageSize, int pageIndex, ref int recordCount)
        {
            IList <EyouSoft.Model.AdvStructure.ExtendProductInfo> items = new List <EyouSoft.Model.AdvStructure.ExtendProductInfo>();

            EyouSoft.Model.AdvStructure.ExtendProductInfo item = null;
            StringBuilder cmdQuery      = new StringBuilder();
            string        tableName     = "tbl_ExtendProduct";
            string        primaryKey    = "Id";
            string        orderByString = "SortId ASC";
            StringBuilder fields        = new StringBuilder();

            #region 要查询的字段
            fields.Append("  *,(select CityName from tbl_SysCity where ID=tbl_ExtendProduct.ShowCityID) as cityname,(select RouteName,CompanyName,TourContacMQ,RetailAdultPrice from tbl_TourList where ID=tbl_ExtendProduct.ProductID FOR XML RAW,ROOT('ROOT')) as ProductInfo ");
            #endregion
            #region 拼接查询条件
            #endregion
            using (IDataReader rdr = DbHelper.ExecuteReader(this.DB, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fields.ToString(), cmdQuery.ToString(), orderByString))
            {
                while (rdr.Read())
                {
                    item = new EyouSoft.Model.AdvStructure.ExtendProductInfo()
                    {
                        ID         = rdr.GetInt32(rdr.GetOrdinal("Id")),
                        SortID     = rdr.GetInt32(rdr.GetOrdinal("SortID")),
                        ShowCity   = rdr["CityName"].ToString(),
                        ShowCityId = rdr.IsDBNull(rdr.GetOrdinal("ShowCityID")) ? 0 : rdr.GetInt32(rdr.GetOrdinal("ShowCityID")),
                        ShowProId  = rdr.IsDBNull(rdr.GetOrdinal("ShowProId")) ? 0 : rdr.GetInt32(rdr.GetOrdinal("ShowProId")),
                        CompanyID  = rdr["CompanyID"].ToString(),
                        ProductID  = rdr["ProductID"].ToString()
                    };
                    if (!rdr.IsDBNull(rdr.GetOrdinal("ProductInfo")))
                    {
                        InputProductInfo(item, rdr.GetString(rdr.GetOrdinal("ProductInfo")));
                    }
                    items.Add(item);
                }
            }
            return(items);
        }
Esempio n. 8
0
 /// <summary>
 /// 修改推荐产品
 /// </summary>
 /// <param name="ExtendProductInfo"></param>
 /// <returns></returns>
 public bool UpdateExtendProduct(EyouSoft.Model.AdvStructure.ExtendProductInfo ExtendProductInfo)
 {
     return(dal.UpdateExtendProduct(ExtendProductInfo));
 }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!CheckMasterGrant(YuYingPermission.业114广告_管理该栏目))
            {
                Utils.ResponseNoPermit(YuYingPermission.业114广告_管理该栏目, true);
                return;
            }
            #region 异步删除数据
            if (Request.QueryString["mode"] != null && Request.QueryString["mode"].ToString() == "del")
            {
                bool result = EyouSoft.BLL.AdvStructure.ExtendProduct.CreateInstance().DelExtendProduct(Utils.GetInt(Request.QueryString["id"], 0));
                Response.Clear();
                if (result)
                {
                    Response.Write("success");
                }
                else
                {
                    Response.Write("error");
                }
                Response.End();
            }
            #endregion

            #region 异步添加数据
            if (Request.QueryString["mode"] != null && Request.QueryString["mode"].ToString() == "add")
            {
                string strHtml = "error";
                Response.Clear();
                //产品ID
                string productId = Request.QueryString["ProductID"];
                //产品名称
                string productName = Request.QueryString["ProductName"];
                ////产品价格
                //decimal productPrice = Utils.GetDecimal(Request.QueryString["ProductPrice"], 0);
                int    CityId    = Utils.GetInt(Request.QueryString["cityid"], 0);
                string companyId = Request.QueryString["cid"] == null ? "" : Request.QueryString["cid"].ToString();
                if (CityId > 0 && !string.IsNullOrEmpty(companyId))
                {
                    EyouSoft.Model.AdvStructure.ExtendProductInfo model = new EyouSoft.Model.AdvStructure.ExtendProductInfo();
                    model.CompanyID  = companyId;
                    model.ShowCityId = CityId;
                    //model.Price = productPrice;
                    model.ProductName = productName;
                    model.ProductID   = productId;
                    model.SortID      = 0;
                    EyouSoft.BLL.AdvStructure.ExtendProduct.CreateInstance().AddExtendProduct(model);
                    strHtml = JsonConvert.SerializeObject(EyouSoft.BLL.AdvStructure.ExtendProduct.CreateInstance().GetExtendProductList(CityId));
                    model   = null;
                }
                Response.Write(strHtml);
                Response.End();
            }
            #endregion

            if (Request.QueryString["mode"] != null && (Request.QueryString["mode"].ToString().ToLower() == "getlist" ||
                                                        Request.QueryString["mode"].ToString().ToLower() == "getalllist"))
            {
                BindList();
            }
        }