示例#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);
        }
示例#2
0
        private void FrmDept_Load(object sender, EventArgs e)
        {
            int i = cmbCate.SelectedIndex;

            DataTable departmentsBysubType = get_service.GetAllDepartmentsBySubType(StaticClass.storeId, get_service.GetAllCategories(StaticClass.storeId).Rows[i][0].ToString());

            changeState(departmentsBysubType, 0);
            departs = get_service.GetAllDepartments2(StaticClass.storeId);
            limit   = departs.Rows.Count - 1;
            //get current index of Cmb in departs
            for (int j = 0; j < departs.Rows.Count; j++)
            {
                DataRowView tmp = (DataRowView)cmbCate.SelectedItem;
                if (tmp.Row[0].Equals(departs.Rows[j][7]))
                {
                    currentIndex = j;
                    break;
                }
            }
        }