コード例 #1
0
        //private void btnUpdate_Click(object sender, EventArgs e)
        //{
        //    //if (txtCusType.Text == string.Empty)
        //    //{
        //    //    MessageBox.Show("Please Enter An Customer Type For Update");
        //    //    return;
        //    //}
        //    if (MessageBox.Show("Are You Sure To Update Customer Type?", "Update Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
        //    {
        //        CusTypeBL obJCus = new CusTypeBL()
        //        {
        //            CusTypeID = Convert.ToInt32(txtCusTypeID.Text),
        //            CusType = txtCusType.Text
        //        };
        //        obJCus.Update();
        //        MessageBox.Show("Update Successful");
        //        LoadData();


        //    }
        //    else
        //    {
        //        MessageBox.Show("Customer Type Not Updated");
        //    }
        //    ClearGroup();
        //}

        //private void btnDelete_Click(object sender, EventArgs e)
        //{
        //     string message = "Are you sure to Delete Customer Type " + txtCusType.Text + "?";

        //     if (MessageBox.Show(message, "Delete Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
        //     {

        //         CusTypeBL objCus = new CusTypeBL()
        //         {
        //              CusTypeID=Convert.ToInt32(txtCusTypeID.Text)
        //         };
        //         objCus.Delete();
        //         MessageBox.Show("Record Deleted Successfull");


        //    }
        //    else
        //    {
        //        MessageBox.Show("Record Not Deleted ");
        //    }
        //    LoadData();
        //     }

        private void LoadData()
        {
            CusTypeBL objCus = new CusTypeBL();
            var       dt     = objCus.Select();

            dgvCusType.Columns.Clear();
            if (dt.Count > 0 && dt != null)
            {
                DataGridViewImageColumn edit = new DataGridViewImageColumn();
                edit.Image       = Properties.Resources.edit;
                edit.ImageLayout = DataGridViewImageCellLayout.Zoom;
                edit.HeaderText  = "Edit";

                DataGridViewImageColumn delete = new DataGridViewImageColumn();
                delete.Image       = Properties.Resources.delete;
                delete.ImageLayout = DataGridViewImageCellLayout.Zoom;
                delete.HeaderText  = "Delete";
                edit.Width         = delete.Width = 40;
                dgvCusType.Columns.Add(edit);
                dgvCusType.Columns.Add(delete);
                dgvCusType.DataSource          = dt;
                dgvCusType.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            }
            else
            {
                MessageBox.Show("No Record Found");
            }
        }
コード例 #2
0
        private void LoadCusType()
        {
            CusTypeBL objCus            = new CusTypeBL();
            List <tbl_CustomerTypes> dt = objCus.Select();

            txtCusType.DataSource         = dt;
            txtCusType.AutoCompleteMode   = AutoCompleteMode.Suggest;
            txtCusType.AutoCompleteSource = AutoCompleteSource.ListItems;
            txtCusType.DisplayMember      = "CusType";
            txtCusType.ValueMember        = "CusTypeID";
        }