public void ReBindPageList() { DBLL.DBcommon dbcom = new DBLL.DBcommon(); DBLL.clsTopicCategory TopicCategory = new DBLL.clsTopicCategory(); DataTable TopicCategorydt = TopicCategory.sp_selectNormalTableOfAllByTopicCategoryAndnType(false, 2); ddlnTCategoryID.DataSource = TopicCategorydt; ddlnTCategoryID.DataValueField = "nTCategoryID"; ddlnTCategoryID.DataTextField = "sTCategoryNameCN"; ddlnTCategoryID.DataBind(); AlbumList.Clear(); DBLL.clsAlbum Album = new DBLL.clsAlbum(); DataTable dt = new DataTable(); dt = Album.sp_selectNormalTableOfAllByAlbum(false, int.Parse(ddlnTCategoryID.SelectedValue)); if (dt != null) { AlbumList.Merge(dt); lvAlbumList.DataSource = AlbumList; lvAlbumList.DataBind(); } else { lvAlbumList.DataSource = null; lvAlbumList.DataBind(); } }
public void SetTyp2Ablum(string sName, int nTCID) { MultiView1.ActiveViewIndex = 1; lblBigTitle.Text = sName; DBLL.clsTopicCategory clstc = new DBLL.clsTopicCategory(); DBLL.clsAlbum clsa = new DBLL.clsAlbum(); dlAlbum.DataSource = clsa.Select_tb_AlbumBynTCategoryID(nTCID); dlAlbum.DataBind(); }
protected void ddlnTCategoryID_SelectedIndexChanged(object sender, EventArgs e) { AlbumList.Clear(); DBLL.clsAlbum Album = new DBLL.clsAlbum(); DataTable dt = new DataTable(); dt = Album.sp_selectNormalTableOfAllByAlbum(false, int.Parse(ddlnTCategoryID.SelectedValue)); if (dt != null) { AlbumList.Merge(dt); lvAlbumList.DataSource = AlbumList; lvAlbumList.DataBind(); } else { lvAlbumList.DataSource = null; lvAlbumList.DataBind(); } }
//protected void lvTopicCategoryList_SelectedIndexChanging(object sender, ListViewSelectEventArgs e) //{ // Label lblnID = (Label)lvTopicCategoryList.Items[e.NewSelectedIndex].FindControl("lblnTCategoryID"); // int _nID = 0; // DBLL.clsTopicCategory TopicCategory = new DBLL.clsTopicCategory(); // if (int.TryParse(lblnID.Text.Trim(), out _nID) && _nID > 0) // { // MultiView1.ActiveViewIndex = 1; // DBLL.DBcommon dbcom = new DBLL.DBcommon(); // DataTable Topicdt = dbcom.selectNormalTableofAll(false, "tb_Topic"); // ddlnTopicID.DataSource = Topicdt; // ddlnTopicID.DataValueField = "nTopicID"; // ddlnTopicID.DataTextField = "sTopicNameCN"; // ddlnTopicID.DataBind(); // DataTable dt = TopicCategory.Select_tb_TopicCategoryBynTCategoryID(_nID); // ddlnTopicID.SelectedValue = dt.Rows[0]["nTopicID"].ToString(); // txtsTCategoryNameCN.Text = dt.Rows[0]["sTCategoryNameCN"].ToString(); // txtsTCategoryNameEN.Text = dt.Rows[0]["sTCategoryNameEN"].ToString(); // rblnType.SelectedValue = dt.Rows[0]["nType"].ToString(); // if (rblnType.SelectedValue == "1") // { // CKEditorControl1.Enabled = true; // CKEditorControl2.Enabled = true; // } // else // { // CKEditorControl1.Enabled = false; // CKEditorControl2.Enabled = false; // } // CKEditorControl1.Text = dt.Rows[0]["sContentCN"].ToString(); // CKEditorControl2.Text = dt.Rows[0]["sContentEN"].ToString(); // ddlnSorting.SelectedValue = dt.Rows[0]["nSorting"].ToString(); // hfTopicCategoryUpdateID.Value = _nID.ToString(); // } //} protected void lvAlbumList_ItemDeleting(object sender, ListViewDeleteEventArgs e) { DBLL.clsAlbum Album = new DBLL.clsAlbum(); Label lblnID = (Label)lvAlbumList.Items[e.ItemIndex].FindControl("lblnAlbumID"); int _nID = 0; if (int.TryParse(lblnID.Text.Trim(), out _nID) && _nID > 0) { bool Result = Album.sp_DeleteNormalTableByIDAlbum(int.Parse(_nID.ToString()), "tb_Album"); if (Result) { //判断文件是不是存在 Image ImsImagePath = (Image)lvAlbumList.Items[e.ItemIndex].FindControl("ImsImagePath"); string sSaveFolderFullPath = Server.MapPath(ImsImagePath.ImageUrl); if (File.Exists(sSaveFolderFullPath)) { //如果存在则删除 File.Delete(sSaveFolderFullPath); } } } ReBindPageList(); }
protected void BtnAdd_Click(object sender, EventArgs e) { //判断session if (Session["User"] == null || Session["User"].ToString().Length < 1) { Response.Redirect(Request.RawUrl); } if (ValiAdd()) { MutileUploaderUserControl21.SavePath(ddlnTCategoryID.SelectedItem.Text); for (int i = 0; i < MutileUploaderUserControl21.ImageDT.Rows.Count; i++) { Response.Write(MutileUploaderUserControl21.ImageDT.Rows[i]["sFilename"].ToString()); DBLL.clsAlbum Album = new DBLL.clsAlbum(); DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL(); int _Result = 0; _Result = Album.insert_tb_Album(int.Parse(ddlnTCategoryID.SelectedValue), MutileUploaderUserControl21.ImageDT.Rows[i]["sImageNameCN"].ToString(), MutileUploaderUserControl21.ImageDT.Rows[i]["sImageNameEN"].ToString(), MutileUploaderUserControl21.filepathlist[i].ToString(), Session["User"].ToString(), DateTime.Now, Session["User"].ToString(), DateTime.Now, true, int.Parse(ddlnSorting.SelectedValue)); if (_Result > 0) { ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "InsertSuccess"); ShowMsg1.Show(); } else { ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "InsertFail"); ShowMsg1.Show(); } } Response.Redirect("~/manage/Album/AddAlbum.aspx"); } else { ShowMsg1.Show(); } }