예제 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var record = new Motorcycle
            {
                Id           = Convert.ToInt64(ctlId.Text),
                Manufacturer = ctlManufacturer.Text,
                Model        = ctlModel.Text,
                Alias        = ctlAlias.Text,
                Capacity     = Convert.ToInt64(ctlCapacity.Text),
                Learner      = chkLearner.Checked
            };

            record     = MotorcycleManager.Save(record);
            ctlId.Text = record.Id.ToString();
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            var id = Request.QueryString["id"];

            if (string.IsNullOrEmpty(id))
            {
                ctlId.Text = "0";
            }
            else
            {
                var record = MotorcycleManager.SelectOne(id);
                ctlId.Text           = record.Id.ToString();
                ctlManufacturer.Text = record.Manufacturer;
                ctlModel.Text        = record.Model;
                ctlAlias.Text        = record.Alias;
                ctlCapacity.Text     = record.Capacity.ToString();
                chkLearner.Checked   = record.Learner;
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     gvList.DataSource = MotorcycleManager.SelectAll();
     //need this to generate html for gvList
     gvList.DataBind();
 }