Пример #1
0
        private void btn_xoa_Click(object sender, EventArgs e)
        {
            //MessageBox.Show(creComboBox1.SelectedText);
            //MessageBox.Show(creComboBox1.GetItemText(creComboBox1.SelectedItem));
            string CatId = creComboBox1.GetItemText(creComboBox1.SelectedItem);

            if (CatId.Equals("NONE"))
            {
                //MessageBox.Show("Bạn không được xóa thư mục này");
                Alert.Show("Bạn không được xóa thư mục này", Color.Red);
                return;
            }
            DataTable tmp = services.GetAllDepartmentsBySubType(StaticClass.storeId, CatId);

            if (tmp.Rows.Count > 0)
            {
                if (MessBox2Choice.ShowBox("neu xoa thi nhung mat hang thuoc loai nay se dc set None", Color.YellowGreen).Equals(System.Windows.Forms.DialogResult.Yes))
                {
                    services.DeleteCategory(creComboBox1.GetItemText(creComboBox1.SelectedItem), StaticClass.storeId);
                }
                return;
            }

            services.DeleteCategory(creComboBox1.GetItemText(creComboBox1.SelectedItem), StaticClass.storeId);
            catagries = services.GetAllCategories(StaticClass.storeId);
            limit     = catagries.Rows.Count - 1;
            dataBinding();
            button1_Click(button1, null);
        }