Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int found = 0;

            if (txtname.Text.Equals(""))
            {
                MessageBox.Show("Insert data Please");
            }
            else
            {
                DataTable dt = ClassSetting.searchColorByName(txtname.Text);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (txtname.Text.Equals(dt.Rows[i][0].ToString()))
                    {
                        found = 1;
                    }
                }
                if (found == 1)
                {
                    MessageBox.Show("This name already exists . .");
                }
                else
                {
                    int add = ClassSetting.sp_addcolorpro(txtname.Text);
                    txtname.Text = "";
                    MessageBox.Show("Done");
                }
            }
        }