//保存图片集 private List <Mod_PicList> SetPicList(Mod_Information MProduct) { string[] albumArr = Request.Form.GetValues("hid_photo_name"); string[] remarkArr = Request.Form.GetValues("hid_photo_remark"); string[] modelArr = Request.Form.GetValues("hid_photo_model"); string[] TitleArr = Request.Form.GetValues("hid_photo_Title"); string[] ViceTitleArr = Request.Form.GetValues("hid_photo_ViceTitle"); List <Mod_PicList> ls = new List <Mod_PicList>(); if (albumArr != null) { for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = StringHelper.StrToInt(imgArr[0], 0); if (imgArr.Length == 3) { ls.Add(new Mod_PicList { ID = img_id, Model = modelArr[i], Title = TitleArr[i], ViceTitle = ViceTitleArr[i], ProductID = id, OriginalUrl = imgArr[1], ThumbUrl = imgArr[2], Info = remarkArr[i], State = 1, IsDefault = 0, WebSiteID = AdminManage.WebSiteID }); } } } return(ls); }
private void Bind() { Mod_Information dto = new Mod_Information(); if (id != 0) { dto = BInformation.GetModel(string.Format("ID={0} AND WebSiteID={1}", id, AdminManage.WebSiteID)); if (dto != null) { txtTitle.Text = dto.Title; txtContent.Text = dto.Content1; txtImage.Text = dto.Image; txtVideo.Text = dto.FileURL; txtIntroduction.Text = dto.Introduction; //绑定图片集 rptPicList.DataSource = BPicList.GetList(0, string.Format("ProductID={0} AND WebSiteID={1} AND Model='XWXC' and State=1 ", id, AdminManage.WebSiteID), " OrderBy asc,ID asc "); rptPicList.DataBind(); } else { MessageBox.ShowRedirect(this, "信息已删除或不存在!", "Column/Default/Index.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { ModelInfo = PageCommon.GetModelInformation(id); ModelBaseType = PageCommon.GetModelType(ModelInfo.TypeID); string ObjIDPath = ModelBaseType.IDPath; TopNavigation1.ObjIDPath = ObjIDPath; ucLeft1.TypeId = ObjIDPath.Split(',')[1].ToString(); ucLeft1.ParentId = ObjIDPath.Split(',')[0].ToString(); MBaseType = PageCommon.GetModelType(int.Parse(ObjIDPath.Split(',')[0].ToString())); //if (ModelBaseType.Image != "") //{ // MBaseType.Image = ModelBaseType.Image; //} _ucheader1.ParentID = ObjIDPath.Split(',')[0].ToString(); _ucheader1.TypeId = ModelBaseType.ID.ToString(); //统计浏览量 OperateHelper.SetInformationClick(ModelInfo.ID); Bll_PicList BPicList = new Bll_PicList(); //绑定图片集 PicList = BPicList.GetModelList("Model='XWXC' and ProductID=" + id + " and State=1 AND WebSiteID=" + PageCommon.LanguageID + " ORDER BY OrderBy asc,ID asc "); //上一页下一页 Mod_Information dto2 = GetInfo.GetLastInfo(ModelInfo, "OrderBy desc,AddDate DESC", string.Format("TypeID={0} And Model='{1}' and WebSiteID={2}", ModelInfo.TypeID, ModelInfo.Model, PageCommon.LanguageID)); if (dto2 != null) { LastInfo = "<div><strong>上一篇:</strong><a href=\"NewsInfo.aspx?id=" + dto2.ID + "\" class=\"els\">" + dto2.Title + "</a></div>"; } else { LastInfo = "<div><strong>上一篇:</strong><a class=\"els\">没有了</a></div>"; } Mod_Information dto3 = GetInfo.GetNextInfo(ModelInfo, "OrderBy desc,AddDate DESC", string.Format("TypeID={0} And Model='{1}' and WebSiteID={2}", ModelInfo.TypeID, ModelInfo.Model, PageCommon.LanguageID)); if (dto3 != null) { NextInfo = "<div><strong>下一篇:</strong><a href=\"NewsInfo.aspx?id=" + dto3.ID + "\" class=\"els\">" + dto3.Title + "</a></div>"; } else { NextInfo = "<div><strong>下一篇:</strong><a class=\"els\">没有了</a></div>"; } LinkBind(); }
public static void SetInformationClick(int id) { Bll_Information BInformation = new Bll_Information(); if (id != 0 && GetCookie(id.ToString(), "InformationClick") == 0) { Mod_Information MInformation = PageCommon.GetModelInformation(id); if (MInformation != null) { MInformation.BrowseCount = (MInformation.BrowseCount + 1); BInformation.Update(MInformation); SetCookie(id.ToString(), id.ToString(), "InformationClick"); } } }
protected void btnEdit_Click(object sender, EventArgs e) { if (txtTitle.Text.Trim() == "") { MessageBox.Show(this, "请正确填写信息再提交保存!"); return; } Mod_Information dto = new Mod_Information(); if (id != 0) { dto = BInformation.GetModel(string.Format("ID={0} AND WebSiteID={1}", id, AdminManage.WebSiteID)); } dto.Title = txtTitle.Text.Trim(); dto.Content1 = txtContent.Text.Trim(); //dto.SubTitle = txtSubTitle.Text.Trim(); dto.WebSiteID = AdminManage.WebSiteID; dto.Model = Model; dto.ModifyDate = DateTime.Now; dto.Image = txtImage.Text.Trim(); dto.FileURL = txtVideo.Text.Trim(); dto.Introduction = txtIntroduction.Text; if (id == 0) { dto.UserID = AdminManage.AdminID; dto.UID = BInformation.Add(dto); dto.ID = dto.UID; } BInformation.Update(dto); if (dto.ID != 0) { Dal_PicList DPicList = new Dal_PicList(); DPicList.OperateList(SetPicList(dto), dto.ID, AdminManage.WebSiteID, false); } MessageBox.ShowRedirect(this, "信息保存成功!"); }
//保存图片集 private List <Mod_Attr> SetAttrList(Mod_Information MProduct) { string[] AttrID = Request.Form.GetValues("AttrID"); string[] hidModel = Request.Form.GetValues("hidModel"); string[] AttrValue1 = Request.Form.GetValues("AttrValue1"); string[] AttrValue2 = Request.Form.GetValues("AttrValue2"); string[] AttrValue3 = Request.Form.GetValues("AttrValue3"); string[] AttrValue4 = Request.Form.GetValues("AttrValue4"); List <Mod_Attr> ls = new List <Mod_Attr>(); if (AttrID != null) { for (int i = 0; i < AttrID.Length; i++) { ls.Add(new Mod_Attr { ID = StringHelper.StrToInt(AttrID[i], 0), Model = hidModel[i], AttrValue1 = AttrValue1[i], AttrValue2 = AttrValue2[i], InfoID = id, AttrValue3 = AttrValue3[i], AttrValue4 = AttrValue4[i], WebSiteID = AdminManage.WebSiteID }); } } return(ls); }
private void Bind() { if (IsType == 1) { ddlBaseType.Attributes.Add("datatype", "no0"); } if (IsBrowseCount == 1) { txtBrowseCount.Attributes.Add("datatype", "n"); } if (IsAddDate == 1) { txtAddDate.Attributes.Add("datatype", "datetime"); } txtAddDate.Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); CommendDate.Value = DateTime.Now.ToString("yyyy-MM-dd"); Mod_Information dto = new Mod_Information(); if (id != 0) { dto = BInformation.GetModel(string.Format("ID={0} AND WebSiteID={1}", id, AdminManage.WebSiteID)); if (dto != null) { txtTitle.Text = dto.Title; txtSubTitle.Text = dto.SubTitle; ddlBaseType.SelectedValue = dto.TypeID.ToString(); txtImage.Text = dto.Image; txtVideo.Text = dto.FileURL; txtCitationTitle.Text = dto.CitationTitle; txtContent1.Text = dto.Content1; txtOrderBy.Text = dto.OrderBy.ToString(); foreach (ListItem item in cblShow.Items) { switch (item.Value) { case "1": item.Selected = (dto.State == 1); break; case "2": item.Selected = (dto.IsTop == 1); break; case "3": item.Selected = (dto.IsCommend == 1); break; } } txtOrderBy.Text = dto.OrderBy.ToString(); txtBrowseCount.Text = dto.BrowseCount.ToString(); txtAddDate.Value = DateTime.Parse(dto.AddDate.ToString()).ToString("yyyy-MM-dd HH:mm:ss"); CommendDate.Value = DateTime.Parse(dto.CommendDate.ToString()).ToString("yyyy-MM-dd"); txtSource.Text = dto.Source; txtAuthor.Text = dto.Author; lbIntroduction.SelectedValue = dto.Introduction.ToString(); lbLink.SelectedValue = dto.Link.ToString(); //foreach (ListItem item in lbIntroduction.Items) //{ // if (dto.Introduction.IndexOf(item.Value) > -1) // { // item.Selected = true; // } //} //foreach (ListItem item in lbLink.Items) //{ // if (dto.Link.IndexOf(item.Value) > -1) // { // item.Selected = true; // } //} //绑定图片集 rptPicList.DataSource = BPicList.GetList(0, string.Format("ProductID={0} AND WebSiteID={1} AND Model='XWXC' and State=1 ", id, AdminManage.WebSiteID), " OrderBy asc,ID asc "); rptPicList.DataBind(); //绑定文件集 rptFileList.DataSource = BPicList.GetList(0, string.Format("ProductID={0} AND WebSiteID={1} AND Model='XTWJ' and State=1 ", id, AdminManage.WebSiteID), " OrderBy asc,ID asc "); rptFileList.DataBind(); } else { MessageBox.ShowRedirect(this, "信息已删除或不存在!", "Column/Download/List.aspx?" + StringHelper.DelUrlParameter("ID")); } } else { int TypeID = DNTRequest.GetQueryInt("TypeID", 0); ddlBaseType.SelectedValue = TypeID.ToString(); } }
protected void btnEdit_Click(object sender, EventArgs e) { if (txtTitle.Text.Trim() == "" || !StringHelper.IsNumberId(txtOrderBy.Text.Trim()) || !StringHelper.IsNumberId(txtBrowseCount.Text.Trim())) { MessageBox.Show(this, "请正确填写信息再提交保存!"); return; } Mod_Information dto = new Mod_Information(); if (id != 0) { dto = BInformation.GetModel(string.Format("ID={0} AND WebSiteID={1}", id, AdminManage.WebSiteID)); } dto.Title = txtTitle.Text.Trim(); dto.SubTitle = txtSubTitle.Text.Trim(); dto.TypeID = int.Parse(ddlBaseType.SelectedValue); string tagsStr = string.Empty; dto.Image = txtImage.Text.Trim(); dto.FileURL = txtVideo.Text.Trim(); dto.CitationTitle = txtCitationTitle.Text.Trim(); foreach (ListItem item in cblShow.Items) { switch (item.Value) { case "1": dto.State = item.Selected ? 1 : 0; break; case "2": dto.IsTop = item.Selected ? 1 : 0; break; case "3": dto.IsCommend = item.Selected ? 1 : 0; break; } } dto.Content1 = txtContent1.Text.Trim(); dto.OrderBy = int.Parse(txtOrderBy.Text.Trim()); dto.BrowseCount = int.Parse(txtBrowseCount.Text.Trim()); dto.AddDate = DateTime.Parse(txtAddDate.Value.Trim()); dto.CommendDate = DateTime.Parse(CommendDate.Value.Trim()); dto.WebSiteID = AdminManage.WebSiteID; dto.Model = Model; dto.ModifyDate = DateTime.Now; dto.Source = txtSource.Text.Trim(); dto.Author = txtAuthor.Text.Trim(); //string Brands = string.Empty; //foreach (ListItem item in lbIntroduction.Items) //{ // if (item.Selected) // { // Brands += item.Value + ","; // } //} //dto.Introduction = Brands.Trim(','); //Brands = string.Empty; //foreach (ListItem item in lbLink.Items) //{ // if (item.Selected) // { // Brands += item.Value + ","; // } //} //dto.Link = Brands.Trim(','); dto.Introduction = lbIntroduction.SelectedValue; dto.Link = lbLink.SelectedValue; //for (int i = 0; i < 6; i++) //{ if (id == 0) { dto.UserID = AdminManage.AdminID; dto.UID = BInformation.Add(dto); dto.ID = dto.UID; } BInformation.Update(dto); if (dto.ID != 0) { Dal_PicList DPicList = new Dal_PicList(); DPicList.OperateList(SetPicList(dto), dto.ID, AdminManage.WebSiteID, false); } //} MessageBox.ShowRedirect(this, "信息保存成功!", "Column/Download/List.aspx?" + StringHelper.DelUrlParameter("ID")); }