private void BindingTitleType() { CatalogTitleTypeBiz pBiz = new CatalogTitleTypeBiz(); rptTitleType.DataSource = pBiz.GetListTitleType(); rptTitleType.DataBind(); }
protected void btnAdd_Click(object sender, EventArgs e) { CatalogTitleTypeBiz pBiz = new CatalogTitleTypeBiz(); lwg_TitleType p; if (string.IsNullOrEmpty(hdfID.Value)) { p = new lwg_TitleType(); lblNote.Text = "Insert error, please try again"; } else { p = pBiz.GetTitleTypeByID(int.Parse(hdfID.Value)); lblNote.Text = "Update error, please try again"; } if (p != null) { p.Name = txtName.Text; if (pBiz.SaveTitleType(p)) { BindingTitleType(); txtName.Text = string.Empty; pnEditTitleType.Visible = false; pnListTitleType.Visible = true; return; } } lblNote.Visible = true; }
protected void rptTitleType_ItemCommand(object source, RepeaterCommandEventArgs e) { CatalogTitleTypeBiz pBiz = new CatalogTitleTypeBiz(); lwg_TitleType p = pBiz.GetTitleTypeByID(int.Parse(e.CommandArgument.ToString())); if (e.CommandName.Equals("EDIT")) { if (p != null) { btnAdd.Text = "Update"; txtTitle.Text = "Update TitleType"; hdfID.Value = e.CommandArgument.ToString(); pnEditTitleType.Visible = true; pnListTitleType.Visible = false; txtName.Text = p.Name; } } else if (e.CommandName.Equals("DELETE")) { if (p != null) { if (pBiz.DeleteTitleType(p)) { BindingTitleType(); } } } }
//protected void lnkbtnTitleTypeManage_Click(object sender, EventArgs e) //{ // BindingTitleType(); // pnListTitleType.Visible = true; // pnEditTitleType.Visible = false; // divInstrTitle.Attributes.Add("style", "display: none;"); // divTitleType.Attributes.Add("style", "display: block;"); //} protected void rptListrInstrTitle_ItemCommand(object source, RepeaterCommandEventArgs e) { CatalogTitleTypeBiz pBiz = new CatalogTitleTypeBiz(); lwg_InstrTitle p = pBiz.GetInstrTitleByID(int.Parse(e.CommandArgument.ToString())); if (e.CommandName.Equals("EDIT")) { if (p != null) { btnAddEditInstrTitle.Text = "Update"; lblTitleInstrTitle.Text = "Update InstrTitle"; HiddenField1.Value = e.CommandArgument.ToString(); pnEditInstrTitle.Visible = true; pnListInstrTitle.Visible = false; txtInstrTitleName.Text = p.Name; if (drpTitleType.Items.Count > 0) { drpTitleType.SelectedValue = p.TitleTypeId.ToString(); } } } else if (e.CommandName.Equals("DELETE")) { if (p != null) { if (pBiz.DeleteInstrTitle(p)) { BindingInstrTitle(); } } } }
protected void btnAddEditInstrTitle_Click(object sender, EventArgs e) { CatalogTitleTypeBiz pBiz = new CatalogTitleTypeBiz(); lwg_InstrTitle p; if (string.IsNullOrEmpty(HiddenField1.Value)) { p = new lwg_InstrTitle(); lblNoteAddeditInstrTitle.Text = "Insert error, please try again"; } else { p = pBiz.GetInstrTitleByID(int.Parse(HiddenField1.Value)); lblNoteAddeditInstrTitle.Text = "Update error, please try again"; } if (p != null) { p.Name = txtInstrTitleName.Text; if (drpTitleType.Items.Count > 0) { p.TitleTypeId = int.Parse(drpTitleType.SelectedValue); } if (pBiz.SaveInstrTitle(p)) { BindingInstrTitle(); txtInstrTitleName.Text = string.Empty; pnEditInstrTitle.Visible = false; pnListInstrTitle.Visible = true; return; } } lblNoteAddeditInstrTitle.Visible = true; }
//protected void gvCatalogInstrTitle_RowDataBound(object sender, GridViewRowEventArgs e) //{ // if (e.Row.DataItem == null) // { // return; // } // lwg_CatalogTitle lg = (lwg_CatalogTitle)e.Row.DataItem; // if (lg != null) // { // Literal ltrProductName = (Literal)e.Row.FindControl("ltrProductName"); // ltrProductName.Text = lg.lwg_Catalog.TitleDisplay; // Literal ltrInstrTitleName = (Literal)e.Row.FindControl("ltrInstrTitleName"); // ltrInstrTitleName.Text = lg.lwg_InstrTitle.Name; // Literal ltrTitleTypeName = (Literal)e.Row.FindControl("ltrTitleTypeName"); // ltrTitleTypeName.Text = lg.lwg_InstrTitle.lwg_TitleType.Name; // LinkButton lnkbtnRemove = (LinkButton)e.Row.FindControl("lnkbtnRemove"); // lnkbtnRemove.CommandArgument = lg.InstrTitleId.ToString(); // } //} //protected void gvCatalogInstrTitle_RowCommand(object sender, GridViewCommandEventArgs e) //{ // if (e.CommandName.Equals("REMOVE")) // { // CatalogBiz cBiz = new CatalogBiz(); // int id = int.Parse(e.CommandArgument.ToString()); // if (cBiz.DeleteCatalogTitle(id,ProductId)) // { // BindingCatalogInstrTitle(); // } // } //} //protected void btnAddInstrTitle_Click(object sender, EventArgs e) //{ // CatalogBiz pBiz = new CatalogBiz(); // if (drpInstrTitle.Items.Count > 0) // { // if (pBiz.SaveCatalogTitle(ProductId, int.Parse(drpInstrTitle.SelectedValue))) // { // BindingCatalogInstrTitle(); // } // } //} //protected void drpTitleType_SelectedIndexChanged(object sender, EventArgs e) //{ // CatalogTitleTypeBiz cttBiz = new CatalogTitleTypeBiz(); // if (drpTitleType.Items.Count > 0) // { // drpInstrTitle.DataSource = cttBiz.GetListInstrTitle(int.Parse(drpTitleType.SelectedValue)); // drpInstrTitle.DataBind(); // } //} //private void BindingCatalogInstrTitle() //{ // CatalogTitleTypeBiz ctBiz = new CatalogTitleTypeBiz(); // gvCatalogInstrTitle.DataSource = ctBiz.GetListCatalogTitleByCatalogID(ProductId); // gvCatalogInstrTitle.DataBind(); //} #endregion private void InitDropdownList() { CatalogTitleTypeBiz cttBiz = new CatalogTitleTypeBiz(); GenerBiz gBiz = new GenerBiz(); PeriodBiz pBiz = new PeriodBiz(); ReprintSourceBiz rBiz = new ReprintSourceBiz(); SeriesBiz sBiz = new SeriesBiz(); drpCatalogGenre.DataSource = gBiz.GetListGenre(); drpCatalogGenre.DataBind(); //drpTitleType.DataSource = cttBiz.GetListTitleType(); //drpTitleType.DataBind(); //if (drpTitleType.Items.Count > 0) //{ // drpInstrTitle.DataSource = cttBiz.GetListInstrTitle(int.Parse(drpTitleType.SelectedValue)); // drpInstrTitle.DataBind(); //} drpPeriod.DataSource = pBiz.GetListPeriod(); drpPeriod.DataBind(); drpReprintSource.DataSource = rBiz.GetListReprintSource(); drpReprintSource.DataBind(); grdReprintsource.DataSource = null; grdReprintsource.DataBind(); drpSeries.DataSource = sBiz.GetListSeries(); drpSeries.DataBind(); grdSeries.DataSource = null; grdSeries.DataBind(); }
private void BindingInstrTitle() { CatalogTitleTypeBiz cBiz = new CatalogTitleTypeBiz(); rptListrInstrTitle.DataSource = cBiz.GetListInstrTitle(); rptListrInstrTitle.DataBind(); drpTitleType.DataSource = cBiz.GetListTitleType(); drpTitleType.DataBind(); }