コード例 #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int    code    = int.Parse(txtCode.Text.Trim());
            String name    = txtName.Text.Trim();
            String type    = txtType.Text.Trim();
            int    size    = int.Parse(txtSize.Text.Trim());
            int    price   = int.Parse(txtPrice.Text.Trim());
            Shoe   newShoe = new Shoe()
            {
                Code  = code,
                Name  = name,
                Type  = type,
                Size  = size,
                Price = price,
            };
            bool result = new ShoeBUS().Update(newShoe);

            if (result)
            {
                List <Shoe> shoes = new ShoeBUS().GetAll();
                dgvShoe.DataSource = shoes;
            }
            else
            {
                MessageBox.Show("SORRY BABEEE !!!");
            }
        }
コード例 #2
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            String      keyword = txtKeyword.Text.Trim();
            List <Shoe> shoes   = new ShoeBUS().SearchByName(keyword);

            dgvShoe.DataSource = shoes;
        }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         List <Shoe> shoes = new ShoeBUS().GetAll();
         gvShoe.DataSource = shoes;
         gvShoe.DataBind();
     }
 }
コード例 #4
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int  code   = int.Parse(gvShoe.SelectedRow.Cells[1].Text.Trim());
            bool result = new ShoeBUS().Delete(code);

            if (result)
            {
                List <Shoe> shoes = new ShoeBUS().GetAll();
                gvShoe.DataSource = shoes;
                gvShoe.DataBind();
            }
        }
コード例 #5
0
        protected void gvShoe_SelectedIndexChanged(object sender, EventArgs e)
        {
            int  code = int.Parse(gvShoe.SelectedRow.Cells[1].Text.Trim());
            Shoe shoe = new ShoeBUS().GetDetails(code);

            if (shoe != null)
            {
                txtCode.Text  = shoe.Code.ToString();
                txtName.Text  = shoe.Name;
                txtType.Text  = shoe.Type;
                txtSize.Text  = shoe.Size.ToString();
                txtPrice.Text = shoe.Price.ToString();
            }
        }
コード例 #6
0
 private void dgvShoe_SelectionChanged(object sender, EventArgs e)
 {
     if (dgvShoe.SelectedRows.Count > 0)
     {
         int  code = int.Parse(dgvShoe.SelectedRows[0].Cells["Code"].Value.ToString());
         Shoe shoe = new ShoeBUS().GetDetails(code);
         if (shoe != null)
         {
             txtCode.Text  = shoe.Code.ToString();
             txtName.Text  = shoe.Name.ToString();
             txtType.Text  = shoe.Type.ToString();
             txtSize.Text  = shoe.Size.ToString();
             txtPrice.Text = shoe.Price.ToString();
         }
     }
 }
コード例 #7
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Shoe newShoe = new Shoe()
            {
                Code  = 0,
                Name  = txtName.Text.Trim(),
                Type  = txtType.Text.Trim(),
                Size  = int.Parse(txtSize.Text.Trim()),
                Price = int.Parse(txtPrice.Text.Trim()),
            };
            bool result = new ShoeBUS().AddItem(newShoe);

            if (result)
            {
                List <Shoe> shoes = new ShoeBUS().GetAll();
                gvShoe.DataSource = shoes;
                gvShoe.DataBind();
            }
        }
コード例 #8
0
        private void btnDelete_Click_1(object sender, EventArgs e)
        {
            int          code         = int.Parse(txtCode.Text.Trim());
            DialogResult dialogResult = MessageBox.Show("ARE YOU SURE ?", "CONFIRMATION", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                bool result = new ShoeBUS().Delete(code);
                if (result)
                {
                    List <Shoe> shoes = new ShoeBUS().GetAll();
                    dgvShoe.DataSource = shoes;
                }
                else
                {
                    MessageBox.Show("SORRY BABEEE !!!");
                }
            }
        }
コード例 #9
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Shoe newShoe = new Shoe()
            {
                Code  = 0,
                Name  = txtName.Text.Trim(),
                Type  = txtType.Text.Trim(),
                Size  = int.Parse(txtSize.Text.Trim()),
                Price = int.Parse(txtPrice.Text.Trim()),
            };
            bool result = new ShoeBUS().AddItem(newShoe);

            if (result)
            {
                List <Shoe> shoes = new ShoeBUS().GetAll();
                dgvShoe.DataSource = shoes;
            }
            else
            {
                MessageBox.Show("SORRY BABEEE !!!");
            }
        }
コード例 #10
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            List <Shoe> shoes = new ShoeBUS().GetAll();

            dgvShoe.DataSource = shoes;
        }