/// <summary> /// 显示分类模块 /// </summary> /// <param name="cat">一级分类实体</param> /// <returns></returns> protected string showModule(LineCatInfo cat) { if (cat == null) { return(""); } string headFormat = "<div class=\"head\"><span>{0}</span><ul class=\"clearfix\">{1}</ul></div>"; string itemFormat = " <li {0}>{1}</li>"; string onClass = "class=\"on\""; string itemString = ""; string headString = ""; string bodyFormat = "<div class=\"body\">{0}</div>"; string bodyString = ""; string bodyItemFormat = "<li><div class=\"pic\"><a href = \"{0}\" ><img src=\"{1}\" alt=\"\"></a></div><p><a href = \"{0}\" >{2}</a></p><span><i>¥</i>{3}</span></li>"; List <LineCatInfo> sonCats = LineBLL.SelectCatList("IsDel=0 And ParentID=" + cat.ID + " Order by SortOrder"); int i = 0; foreach (LineCatInfo scat in sonCats) { if (i > 0) { onClass = ""; } itemString += string.Format(itemFormat, onClass, scat.Name); List <LineInfo> lines = LineBLL.SelectLineList(10, "IsDel=0 And SecondCatID=" + scat.ID, "ID desc"); bodyString += "<ul class=\"clearfix idx_lst\">"; foreach (LineInfo line in lines) { bodyString += string.Format(bodyItemFormat, "Line.aspx?ID=" + line.ID, getRawCover(line.CoverPath), line.Name, line.MinPrice); } bodyString += "</ul>"; i = i + 1; } //头部html headString = string.Format(headFormat, cat.Name, itemString); //bodyhtml string body = string.Format(bodyFormat, bodyString); return(headString + body); }
protected void BindData() { string condition = "IsDel=0"; string keyword = GetUrlString("keyword"); int catID = GetUrlInt("CatID"); if (!keyword.IsNullOrEmpty()) { condition = condition + " And Name like '%" + keyword + "%'"; } if (catID > 0) { LineCatInfo cat = allCats.Find(s => s.ID == catID); if (cat != null) { if (cat.ParentID == 0) { condition = condition + " And FirstCatID=" + catID; } else { condition = condition + " And SecondCatID=" + catID; } } } AdminSetting.CreateWebPagerForGridView(gvData, ArrowControlPageIndex); WebQuery query = new WebQuery(); query.Fields = LineInfo.AllFields; query.OrderBy = "ID desc"; query.PrimaryKey = LineInfo.TablePrimaryKey; query.SqlCreateType = ControlSqlCreateType.RowNum; query.TableName = LineInfo.TableOrViewName; query.Condition = condition; gvData.Db = TMS.Db.Helper; gvData.Query = query; gvData.CreateDataSource(); gvData.DataBind(); tbKeyWord.Text = keyword; ddlCat.SelectedValue = catID.ToString(); }
/// <summary> /// 显示分类名 /// </summary> /// <param name="allCat"></param> /// <param name="firstID"></param> /// <param name="secondID"></param> /// <returns></returns> public static string ShowCatName(List <LineCatInfo> allCat, int firstID, int secondID) { string result = ""; LineCatInfo firstCat = allCat.Find(s => s.ID == firstID); LineCatInfo secondCat = allCat.Find(s => s.ID == secondID); if (firstCat != null) { result = result + firstCat.Name; if (secondCat != null) { result = result + "—" + secondCat.Name; } } return(result); }
protected void btnSubmit_Click(object sender, EventArgs e) { string name = tbName.Text.Trim(); int catID = ddlCat.SelectedValue.ToArrowInt(); string productNum = tbProductNum.Text.Trim(); string coverPath = tbCoverPath.Text.Trim(); int days = tbDays.Text.Trim().ToArrowInt(); string goTravel = tbGoTravel.Text.Trim(); string backTravel = tbBackTravel.Text.Trim(); string desc = tbRemarks.Text.Trim(); string notice = tbNotice.Text.Trim(); string startAddress = tbStartAddress.Text.Trim(); string targetAddress = tbTargetAddress.Text.Trim(); decimal minPrice = tbMinPrice.Text.Trim().ToArrowDecimal(); #region 验证数据 if (name.ValidateIsNullOrEmpty("请输入线路名称!")) { return; } if (productNum.ValidateIsNullOrEmpty("请输入产品编号!")) { return; } if ((minPrice == 0).ValidateSuccess("最低价不正确!")) { return; } if ((catID == 0).ValidateSuccess("请选择分类!")) { return; } if ((days <= 0).ValidateSuccess("旅游天数不正确!")) { return; } LineCatInfo cat = LineBLL.SelectLineCat(catID); if (cat.ValidateIsNull("该分类不存在!")) { return; } int firstCatID = 0; int secondCatID = 0; //如果是一级分类,则二级分类id为0 if (cat.ParentID == 0) { firstCatID = catID; } else { firstCatID = cat.ParentID; secondCatID = catID; } #endregion if (LineID == 0) { //添加 var model = new LineInfo(); model.AddTime = DateTime.Now; model.AddUserName = CurrentAdmin.UserName; model.AddUserRealName = CurrentAdmin.RealName; model.BackTravel = backTravel; model.BigPicPath = ""; model.CoverPath = coverPath; model.FirstCatID = firstCatID; model.GoTravel = goTravel; model.IsDel = 0; model.LineDesc = desc; model.Name = name; model.OtherNotice = ""; model.ProductNum = productNum; model.Remarks = ""; model.SecondCatID = secondCatID; model.SignUpNotice = notice; model.StartAddress = startAddress; model.Tag = ""; model.TargetAddress = targetAddress; model.TravelDays = days.ToString(); model.WarmTips = ""; model.MinPrice = minPrice; model.IsHot = 0; model.IsTop = 0; model.HitTimes = 0; model.IsPickup = chkPickup.Checked ? 1 : 0; LineBLL.AddLine(model); MessageBox.Show("添加成功!", CurrentUrl); } else { var model = LineBLL.SelectLine(LineID); if (model.ValidateIsNull("该线路不存在!")) { return; } model.BackTravel = backTravel; model.CoverPath = coverPath; model.FirstCatID = firstCatID; model.GoTravel = goTravel; model.LineDesc = desc; model.Name = name; model.ProductNum = productNum; model.SecondCatID = secondCatID; model.SignUpNotice = notice; model.StartAddress = startAddress; model.TargetAddress = targetAddress; model.TravelDays = days.ToString(); model.MinPrice = minPrice; model.IsPickup = chkPickup.Checked ? 1 : 0; LineBLL.UpdateLine(model); MessageBox.Show("修改成功!"); } }
public static int UpdateLineCat(LineCatInfo model) { return(catDAL.Update(model)); }
public static int AddLineCat(LineCatInfo model) { return(catDAL.Add(model)); }