Example #1
0
        // -------------------------------------------------



        // delete btn press for director, language and genre
        private void BtnDeleteDirector_Click(object sender, EventArgs e)
        {
            //get selection
            if (activeDirectorRow == null)
            {
                MessageBox.Show("please select row corrently using the left selector column");
            }
            else
            {
                // cell[0] is the id index
                string idAsStr = activeDirectorRow.Cells[0].Value.ToString();
                bool   result  = int.TryParse(idAsStr, out int id); //try parse idAsStr to int id

                //delete selection
                if (result)
                {
                    //string[] resultArr = mediaLogic.deleteDirectorbyId(id);
                    string[] resultArr = dtFunc.getStrArray(ws.deleteDirectorById(id));

                    if (resultArr[0] == "true")
                    {
                        MessageBox.Show("Media item successfully deleted");
                        getAndShowDataGridViews();
                    }
                    else
                    {
                        MessageBox.Show(resultArr[1]);
                    }
                }
                else
                {
                    MessageBox.Show("Director: error converting id string to id int");
                }
            }
        }