Пример #1
0
        /// <summary>
        /// 删除按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BT_DeletCity_Click(object sender, EventArgs e)
        {
            if (CB_Province.SelectedIndex <= 0)
            {
                MessageBox.Show("请先指定省份!");
                return;
            }
            if (LB_City.SelectedIndex < 0)
            {
                MessageBox.Show("请选择您要删除的城市!");
                return;
            }
            DialogResult res = MessageBox.Show("该操作会将您选定的城市信息连同该城市的所有店铺等信息全部删除,该操作是不可逆的,是否继续进行?", "警告!!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, 0);

            if (res == DialogResult.OK)
            {
                UserManager_Client = (UserManagerClient)ClientFactory.GetClient(ClientType.Type.UserManager);
                Shop_Client        = (ShopClient)ClientFactory.GetClient(ClientType.Type.Shop);
                int ProvinceID = Province_Client.SelectProvince_Name(CB_Province.SelectedItem.ToString()).Province_ID;
                int CityID     = City_Client.SelectCity_Name(LB_City.SelectedItem.ToString(), ProvinceID).City_ID;
                if (Shop_Client.SelectShop_CityID(CityID).Count() != 0)
                {
                    List <WFpart.ShopService.Car_Shop> List_Shop = Shop_Client.SelectShop_CityID(CityID).ToList();
                    //删除店铺和店铺关系
                    foreach (WFpart.ShopService.Car_Shop temp in List_Shop)
                    {
                        UserManager_Client.UserDropShop_ShopID(temp.Shop_ID);
                        Shop_Client.DeleteShop(temp.Shop_ID);
                    }
                }
                City_Client.DeleteCity(CityID);
            }
            List_City = City_Client.SelectAllCitys().ToList();
            LB_CityBind();
        }
Пример #2
0
        /// <summary>
        /// 删除店铺按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BT_DeletShop_Click(object sender, EventArgs e)
        {
            if (CB_City.SelectedIndex <= 0)
            {
                MessageBox.Show("为了精确定位到您选择的店铺,请指定好城市名称!");
                return;
            }
            DialogResult result = MessageBox.Show("该操作会删除该店铺以及该店铺下所有的成员关系,您确定要删除吗?", "警告!!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);

            if (result == DialogResult.OK)
            {
                int CityID = List_ShopInfo.Where(P => P.City_Name == CB_City.SelectedItem.ToString()).First().City_ID;
                UserManager_Client.UserDropShop_ShopID(List_ShopInfo.Where(P => P.Shop_Name == LB_Shop.SelectedItem.ToString()).First().Shop_ID);
                int ShopID = Shop_Client.SelectShop_Name(LB_Shop.SelectedItem.ToString(), CityID).Shop_ID;
                Shop_Client.DeleteShop(ShopID);
                List_ShopInfo = UserManager_Client.GetAllShops(null, null, null).ToList();
                LB_ShopBind();
            }
            else
            {
                return;
            }
        }