コード例 #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            InstrumentalBiz  pBiz = new InstrumentalBiz();
            lwg_Instrumental p;

            if (string.IsNullOrEmpty(hdfID.Value))
            {
                p            = new lwg_Instrumental();
                lblNote.Text = "Insert error, please try again";
            }
            else
            {
                p            = pBiz.GetByID(int.Parse(hdfID.Value));
                lblNote.Text = "Update error, please try again";
            }
            if (p != null)
            {
                p.ShortName = txtShortName.Text;
                p.LongName  = txtLongName.Text;
                if (pBiz.SaveInstrumental(p))
                {
                    rptInstrumental.DataSource = pBiz.GetListInstrumental();
                    rptInstrumental.DataBind();
                    txtLongName.Text           = string.Empty;
                    txtShortName.Text          = string.Empty;
                    pnEditInstrumental.Visible = false;
                    pnListInstrumental.Visible = true;
                    return;
                }
            }
            lblNote.Visible = true;
        }
コード例 #2
0
        private void BindingInstrumental()
        {
            InstrumentalBiz pBiz = new InstrumentalBiz();

            rptInstrumental.DataSource = pBiz.GetListInstrumental();
            rptInstrumental.DataBind();
        }
コード例 #3
0
        protected void rptInstrumental_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            InstrumentalBiz  pBiz = new InstrumentalBiz();
            lwg_Instrumental p    = pBiz.GetByID(int.Parse(e.CommandArgument.ToString()));

            if (e.CommandName.Equals("EDIT"))
            {
                if (p != null)
                {
                    btnAdd.Text   = "Update";
                    txtTitle.Text = "Update Instrumental";
                    hdfID.Value   = e.CommandArgument.ToString();
                    pnEditInstrumental.Visible = true;
                    pnListInstrumental.Visible = false;
                    txtShortName.Text          = p.ShortName;
                    txtLongName.Text           = p.LongName;
                }
            }
            else if (e.CommandName.Equals("DELETE"))
            {
                if (p != null)
                {
                    if (pBiz.DeleteInstrumental(p))
                    {
                        BindingInstrumental();
                    }
                }
            }
        }
コード例 #4
0
        private void InitDropdownList()
        {
            InstrumentalBiz iBiz = new InstrumentalBiz();

            PublisherBiz plBiz = new PublisherBiz();

            drpInstrumental.Items.Clear();
            drpInstrumental.DataSource = iBiz.GetListInstrumental();
            drpInstrumental.DataBind();
            drpInstrumental.Items.Add(new ListItem("Please choose ...", "-1"));
            drpInstrumental.SelectedValue = "-1";

            drpCatalogPublisher.Items.Clear();
            drpCatalogPublisher.DataSource = plBiz.GetListPublisher();
            drpCatalogPublisher.DataBind();
            drpCatalogPublisher.Items.Add(new ListItem("Please choose ...", "-1"));
            drpCatalogPublisher.SelectedValue = "-1";
        }