Ejemplo n.º 1
0
        private void BtnDeleteLanguage_Click(object sender, EventArgs e)
        {
            //get selection
            if (activeLanguageRow == null)
            {
                MessageBox.Show("please select row corrently using the left selector column");
            }
            else
            {
                // cell[0] is the id index
                string idAsStr = activeLanguageRow.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.deleteLanguagebyId(id);
                    string[] resultArr = dtFunc.getStrArray(ws.deleteLanguageById(id));

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