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(); } } } }