public void SaveCookingStyles(StoreInfoEntity storeInfoEntity, IEnumerable<CookingStyles> cookingStylesList)
 {
     var storeCookingStylesBll = new Maticsoft.BLL.StoreCookingStyles();
     storeCookingStylesBll.Remove(string.Format("bizid = '{0}'", storeInfoEntity.BizID));
     DoProgress(20);
     foreach (var specialTag in cookingStylesList)
     {
         if (specialTag != null)
         {
             var storeCookingStyles = new Maticsoft.Model.StoreCookingStyles();
             storeCookingStyles.BizID = storeInfoEntity.BizID;
             storeCookingStyles.CookingStyleID = specialTag.CookingStyleID;
             storeCookingStyles.CookingStyleName = specialTag.CookingStyleName;
             storeCookingStyles.KeyID = Guid.NewGuid().ToString();
             storeCookingStylesBll.Add(storeCookingStyles);
         }
     }
     DoProgress();
 }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (catalogueListBox.SelectedIndex < 0)
                {
                    return;
                }
                var catalogueInfo = catalogueListBox.SelectedItem as Maticsoft.Model.Catalogue;
                if (catalogueInfo == null)
                {
                    return;
                }

                var stopwatch = new Stopwatch();
                stopwatch.Start();
                var storeInfoEntity = new Maticsoft.Model.StoreInfoEntity();
                var storeBll = new StoreInfoBll();
                storeInfoEntity.BizID = catalogueInfo.StoreId;
                storeInfoEntity.BasicIntroduction = txtBasic.Text.Trim();
                storeInfoEntity.StoreAddress = txtStoreAddress.Text.Trim();
                storeInfoEntity.StoreHours = txtStoreHours.Text.Trim();
                storeInfoEntity.StoreName = txtStoreName.Text.Trim();
                storeInfoEntity.Box = chbbox.Checked;
                storeInfoEntity.Bus = txtBus.Text.Trim();
                storeInfoEntity.CarPark = !string.IsNullOrEmpty(txtCarPark.Text.Trim());
                storeInfoEntity.PayCar = chbPayCar.Checked;
                storeInfoEntity.WIFI = chbWIFI.Checked;
                storeInfoEntity.KCVIP = chbKCVIP.Checked;
                storeInfoEntity.ChildrenChair = chbChildrenChair.Checked;
                storeInfoEntity.PayCar = chbPayCar.Checked;
                storeInfoEntity.NoSmoke = chbNoSmoke.Checked;
                storeInfoEntity.IsCoupon = chbIsCoupon.Checked;
                storeInfoEntity.IsCitySend = chbIsCitySend.Checked;
                storeInfoEntity.OnlinePay = chbOnlinePay.Checked;
                storeInfoEntity.IsSend = chbIsSend.Checked ? 1 : 0;
                storeInfoEntity.Cod = chbCod.Checked;
                storeInfoEntity.Onlineorder = chbOnlineorder.Checked ? 1 : 0;
                var maxPrice = 0;
                if (int.TryParse(txtMaxPrice.Text, out maxPrice))
                {
                    storeInfoEntity.MaxPrice = maxPrice;
                }
                var minPrice = 0;
                if (int.TryParse(txtMinPrice.Text, out minPrice))
                {
                    storeInfoEntity.MinPrice = minPrice;
                }
                storeInfoEntity.CityID = ((Maticsoft.Model.City)cbBoxCity.SelectedItem).CityID;
                storeInfoEntity.BusinessTypeID = "2";
                if (!string.IsNullOrEmpty(txtDoubleName.Text))
                {
                    storeInfoEntity.BranchName = txtDoubleName.Text.Trim();
                }
                storeInfoEntity.StorePhone = txtStorePhone.Text.Trim();
                storeInfoEntity.BusinessState = 40;
                storeInfoEntity.BusinessAddTime = DateTime.Now;
                if (!string.IsNullOrEmpty(txtImageName.Text.Trim()))
                {
                    storeInfoEntity.StorePhoto = txtImageName.Text;
                }
                storeInfoEntity.DistrictID = ((Maticsoft.Model.District)cbbDistrict.SelectedItem).DistrictID;
                var isExists = false;
                isExists = storeBll.Exists(storeInfoEntity.BizID);

                var storeSpecialBll = new Maticsoft.BLL.StoreSpecialTag();
                if (isExists)
                {
                    storeBll.Update(storeInfoEntity);
                }
                else
                {
                    var storeList = storeBll.GetModelList(string.Empty);
                    var maxShortID = storeList.Max(x =>
                    {
                        var shortId = string.IsNullOrEmpty(x.ShortID) ? "0" : x.ShortID;
                        return int.Parse(shortId);
                    });
                    storeInfoEntity.ShortID = (maxShortID + 1).ToString();
                    storeBll.Add(storeInfoEntity);
                }
                var oldSpecialTagList = storeSpecialBll.GetModelList(string.Format("bizid = '{0}'", storeInfoEntity.BizID));
                foreach (var specialTag in oldSpecialTagList)
                {
                    storeSpecialBll.Delete(specialTag.StoreSpecialTagID);
                }
                foreach (var checkedItem in chlBoxSpecialTag.CheckedItems)
                {
                    var specialTag = checkedItem as SpecialTag;
                    if (specialTag != null)
                    {
                        var storeSpecial = new Maticsoft.Model.StoreSpecialTag();
                        storeSpecial.BizID = storeInfoEntity.BizID;
                        storeSpecial.SpecialTagID = specialTag.SpecialTagID;
                        storeSpecial.TagName = specialTag.TagName;
                        storeSpecial.StoreSpecialTagID = Guid.NewGuid().ToString();
                        storeSpecialBll.Add(storeSpecial);
                    }
                }
                var storeCookingStylesBll = new Maticsoft.BLL.StoreCookingStyles();
                var oldStoreCookingStylesList = storeCookingStylesBll.GetModelList(string.Format("bizid = '{0}'", storeInfoEntity.BizID));
                foreach (var storeCookingStylese in oldStoreCookingStylesList)
                {
                    storeCookingStylesBll.Delete(storeCookingStylese.KeyID);
                }
                foreach (var checkedItem in chbCookingStyles.CheckedItems)
                {
                    var specialTag = checkedItem as Maticsoft.Model.CookingStyles;
                    if (specialTag != null)
                    {
                        var storeCookingStyles = new Maticsoft.Model.StoreCookingStyles();
                        storeCookingStyles.BizID = storeInfoEntity.BizID;
                        storeCookingStyles.CookingStyleID = specialTag.CookingStyleID;
                        storeCookingStyles.CookingStyleName = specialTag.CookingStyleName;
                        storeCookingStyles.KeyID = Guid.NewGuid().ToString();
                        storeCookingStylesBll.Add(storeCookingStyles);
                    }
                }
                var dishesBll = new Maticsoft.BLL.Dishes();
                if (chbDish.Checked)
                {
                    var dishList = dishesBll.GetModelList(string.Format("storeId = '{0}'", storeInfoEntity.BizID));
                    var dishesEntityBll = new Maticsoft.BLL.DishesBll();
                    var dishesEntityList = dishesEntityBll.GetModelList(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID));
                    foreach (var dishesEntity in dishesEntityList)
                    {
                        dishesEntityBll.Delete(dishesEntity.DishesID);
                    }
                    foreach (var dishese in dishList)
                    {
                        var dishesEntity = new DishesEntity();
                        dishesEntity.BusinessID = dishese.StoreId;
                        dishesEntity.DishesName = dishese.DishesName;
                        dishesEntity.CreateDate = DateTime.Now;
                        dishesEntity.DishesID = dishese.DishesID;
                        dishesEntity.ImageUrl = dishese.PictureName;
                        dishesEntity.State = 1;
                        dishesEntity.DishesTypeID = dishese.dishTypeID;
                        if (string.IsNullOrEmpty(dishese.DishesUnit))
                        {
                            dishesEntity.DishesUnit = "份";
                        }
                        else
                        {
                            dishesEntity.DishesUnit = dishese.DishesUnit;
                        }
                        dishesEntity.DishesMoney = decimal.Parse(string.IsNullOrEmpty(dishese.DishesMoney) ? "0" : dishese.DishesMoney.Replace("¥", string.Empty));
                        dishesEntity.IsCurrentPrice = dishesEntity.DishesMoney == 0;
                        dishesEntityBll.Add(dishesEntity);
                    }
                    var dishesTyepTableBll = new Maticsoft.BLL.DishesTyepTable();
                    var dishTypeBll = new Maticsoft.BLL.DishesTyep();
                    var dishTypeList = dishTypeBll.GetModelList(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID));
                    foreach (var dishesTyep in dishTypeList)
                    {
                        dishTypeBll.Delete(dishesTyep.DishesTypeID);
                    }
                    var dishesTypeTableList = dishesTyepTableBll.GetModelList(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID));
                    foreach (var disheseTypeTable in dishesTypeTableList)
                    {
                        var dishesTyep = new Maticsoft.Model.DishesTyep();
                        dishesTyep.BusinessID = disheseTypeTable.BusinessID;
                        dishesTyep.CreateDate = DateTime.Now;
                        dishesTyep.DishesTypeName = disheseTypeTable.DishesTypeName;
                        dishesTyep.DishesTypeID = disheseTypeTable.DishesTypeID;
                        dishTypeBll.Add(dishesTyep);
                    }
                }

                if (chbPic.Checked)
                {
                    var storePicturesTableBll = new StorePicturesTable();
                    var storePicturesBll = new StorePictures();
                    var picList = storePicturesBll.GetModelList(string.Format("BusinessID ='{0}'", storeInfoEntity.BizID));
                    foreach (var storePicturese in picList)
                    {
                        storePicturesBll.Delete(storePicturese.StorePicturesID);
                    }
                    var pcituresList =
                        storePicturesTableBll.GetModelList(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID));
                    foreach (var picturesTable in pcituresList)
                    {
                        var storePicturesTable = new Maticsoft.Model.StorePictures();
                        storePicturesTable.StorePicturesID = picturesTable.StorePicturesID;
                        storePicturesTable.BusPhotoAlbumID = picturesTable.BusPhotoAlbumID;
                        storePicturesTable.BusinessID = picturesTable.BusinessID;
                        storePicturesTable.PictureAddress = picturesTable.PictureAddress;
                        storePicturesTable.PicName = picturesTable.PicName;
                        storePicturesTable.PicState = picturesTable.PicState;
                        storePicturesTable.UploadTime = DateTime.Now;
                        storePicturesBll.Add(storePicturesTable);
                    }

                    var busPhotoAlbumBll = new Maticsoft.BLL.BusPhotoAlbum();
                    var oldBusPhotoAlbumList = busPhotoAlbumBll.GetModelList(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID));
                    foreach (var busPhotoAlbum in oldBusPhotoAlbumList)
                    {
                        busPhotoAlbumBll.Delete(busPhotoAlbum.BusPhotoAlbumID);
                    }
                    var busPhotoAlbumTableBll = new Maticsoft.BLL.BusPhotoAlbumTable();
                    if (!isExists)
                    {
                        var busPhotoAlbumList =
                            busPhotoAlbumTableBll.GetModelList(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID));
                        foreach (var busPhotoAlbumTable in busPhotoAlbumList)
                        {
                            var busPhotoAlbum = new Maticsoft.Model.BusPhotoAlbum();
                            busPhotoAlbum.BusinessID = busPhotoAlbumTable.BusinessID;
                            busPhotoAlbum.BusPhotoAlbumID = busPhotoAlbumTable.BusPhotoAlbumID;
                            busPhotoAlbum.AlbumName = busPhotoAlbumTable.AlbumName;
                            busPhotoAlbum.IsDefault = busPhotoAlbumTable.IsDefault;
                            busPhotoAlbumBll.Add(busPhotoAlbum);
                        }
                    }
                }

                var storeLocalTagBll = new Maticsoft.BLL.StoreLocalTag();
                var oldStoreLocalTagList = storeLocalTagBll.GetModelList(string.Format("bizid = '{0}'", storeInfoEntity.BizID));
                foreach (var storeLocalTag in oldStoreLocalTagList)
                {
                    storeLocalTagBll.Delete(storeLocalTag.KeyID);
                }
                foreach (var selectedItem in clbStoreTag.CheckedItems)
                {
                    var cityLocalTag = ((Maticsoft.Model.CityLocalTagEntity)selectedItem);
                    var storeLocalTag = new Maticsoft.Model.StoreLocalTag();
                    storeLocalTag.BizID = storeInfoEntity.BizID;
                    storeLocalTag.BizType = 10;
                    storeLocalTag.DistrictID = storeInfoEntity.DistrictID;
                    storeLocalTag.KeyID = Guid.NewGuid().ToString();
                    storeLocalTag.LocalTagID = cityLocalTag.LocalTagID;
                    storeLocalTag.LocalTagName = cityLocalTag.TagName;
                    storeLocalTagBll.Add(storeLocalTag);
                }

                var storeInfoBll = new Maticsoft.BLL.StoreInfo();
                var storeInfo = storeInfoList.Find(x => x.storeId == storeInfoEntity.BizID);
                if (storeInfo != null)
                {
                    if (isExists)
                    {
                        storeInfoBll.Update(storeInfo);
                    }
                    else
                    {
                        storeInfoBll.Add(storeInfo);
                    }
                }

                foreach (var selectedIndex in clbStoreTag.CheckedIndices)
                {
                    clbStoreTag.SetItemCheckState((int)selectedIndex, CheckState.Unchecked);
                }
                foreach (var selectedIndex in chlBoxSpecialTag.CheckedIndices)
                {
                    chlBoxSpecialTag.SetItemCheckState((int)selectedIndex, CheckState.Unchecked);
                }
                foreach (var selectedIndex in chbCookingStyles.CheckedIndices)
                {
                    chbCookingStyles.SetItemCheckState((int)selectedIndex, CheckState.Unchecked);
                }
                stopwatch.Stop();
                MessageBox.Show(string.Format(@"{0}保存成功,耗时{1}", storeInfoEntity.StoreName, stopwatch.ElapsedMilliseconds));
                catalogueListBox.SetItemCheckState(catalogueListBox.SelectedIndex, CheckState.Checked);
                if (catalogueListBox.SelectedIndex < catalogueListBox.Items.Count - 1)
                {
                    catalogueListBox.SelectedIndex += 1;
                }
                SetCatalogueListBox();

            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {

                if (catalogueListBox.SelectedIndex < 0)
                {
                    return;
                }
                var catalogueInfo = catalogueListBox.SelectedItem as Maticsoft.Model.Catalogue;
                if (catalogueInfo == null)
                {
                    return;
                }
                //var collection = new Collection();
                //var storeInfo = collection.CollectionStore(catalogueInfo.href, catalogueInfo);
                //if (storeInfo == null)
                //{
                //    return;
                //}
                var storeInfoEntity = new Maticsoft.Model.StoreInfoEntity();
                var storeBll = new StoreInfoBll();
                storeInfoEntity.BizID = catalogueInfo.StoreId;
                storeInfoEntity.BasicIntroduction = txtBasic.Text.Trim();
                storeInfoEntity.StoreAddress = txtStoreAddress.Text.Trim();
                storeInfoEntity.StoreHours = txtStoreHours.Text.Trim();
                storeInfoEntity.StoreName = txtStoreName.Text.Trim();
                storeInfoEntity.Box = chbbox.Checked;
                storeInfoEntity.Bus = txtBus.Text.Trim();
                storeInfoEntity.CarPark = !string.IsNullOrEmpty(txtCarPark.Text.Trim());
                storeInfoEntity.PayCar = chbPayCar.Checked;
                storeInfoEntity.WIFI = chbWIFI.Checked;
                storeInfoEntity.KCVIP = chbKCVIP.Checked;
                storeInfoEntity.ChildrenChair = chbChildrenChair.Checked;
                storeInfoEntity.PayCar = chbPayCar.Checked;
                storeInfoEntity.NoSmoke = chbNoSmoke.Checked;
                storeInfoEntity.IsCoupon = chbIsCoupon.Checked;
                storeInfoEntity.IsCitySend = chbIsCitySend.Checked;
                storeInfoEntity.OnlinePay = chbOnlinePay.Checked;
                storeInfoEntity.IsSend = chbIsSend.Checked ? 1 : 0;
                storeInfoEntity.Cod = chbCod.Checked;
                storeInfoEntity.Onlineorder = chbOnlineorder.Checked ? 1 : 0;
                var maxPrice = 0;
                if (int.TryParse(txtMaxPrice.Text, out maxPrice))
                {
                    storeInfoEntity.MaxPrice = maxPrice;
                }
                var minPrice = 0;
                if (int.TryParse(txtMinPrice.Text, out minPrice))
                {
                    storeInfoEntity.MinPrice = minPrice;
                }
                storeInfoEntity.CityID = ((Maticsoft.Model.City)cbBoxCity.SelectedItem).CityID;
                storeInfoEntity.BusinessTypeID = "2";
                if (!string.IsNullOrEmpty(txtDoubleName.Text))
                {
                    storeInfoEntity.BranchName = txtDoubleName.Text.Trim();
                }
                storeInfoEntity.StorePhone = txtStorePhone.Text.Trim();
                storeInfoEntity.BusinessState = 40;
                storeInfoEntity.BusinessAddTime = DateTime.Now;
                if (!string.IsNullOrEmpty(txtImageName.Text.Trim()))
                {
                    storeInfoEntity.StorePhoto = txtImageName.Text;
                }
                storeInfoEntity.DistrictID = ((Maticsoft.Model.District)cbbDistrict.SelectedItem).DistrictID;
                var isExists = false;
                isExists = storeBll.Exists(storeInfoEntity.BizID);

                var storeSpecialBll = new Maticsoft.BLL.StoreSpecialTag();
                if (isExists)
                {
                    storeBll.Update(storeInfoEntity);
                }
                else
                {
                    var storeList = storeBll.GetModelList(string.Empty);
                    var maxShortID = storeList.Max(x =>
                    {
                        var shortId = string.IsNullOrEmpty(x.ShortID) ? "0" : x.ShortID;
                        return int.Parse(shortId);
                    });
                    storeInfoEntity.ShortID = (maxShortID + 1).ToString();
                    storeBll.Add(storeInfoEntity);
                }
                foreach (var checkedItem in chlBoxSpecialTag.CheckedItems)
                {
                    var specialTag = checkedItem as SpecialTag;
                    if (specialTag != null)
                    {
                        var storeSpecial = new Maticsoft.Model.StoreSpecialTag();
                        storeSpecial.BizID = storeInfoEntity.BizID;
                        storeSpecial.SpecialTagID = specialTag.SpecialTagID;
                        storeSpecial.TagName = specialTag.TagName;
                        storeSpecial.StoreSpecialTagID = Guid.NewGuid().ToString();
                        storeSpecialBll.Add(storeSpecial);
                    }
                }
                var storeCookingStylesBll = new Maticsoft.BLL.StoreCookingStyles();
                foreach (var checkedItem in chbCookingStyles.CheckedItems)
                {
                    var specialTag = checkedItem as Maticsoft.Model.CookingStyles;
                    if (specialTag != null)
                    {
                        var storeCookingStyles = new Maticsoft.Model.StoreCookingStyles();
                        storeCookingStyles.BizID = storeInfoEntity.BizID;
                        storeCookingStyles.CookingStyleID = specialTag.CookingStyleID;
                        storeCookingStyles.CookingStyleName = specialTag.CookingStyleName;
                        storeCookingStyles.KeyID = Guid.NewGuid().ToString();
                        storeCookingStylesBll.Add(storeCookingStyles);
                    }
                }
                var dishesBll = new Maticsoft.BLL.Dishes();
                if (chbDish.Checked)
                {
                    var dishList = dishesBll.GetModelList(string.Format("storeId = '{0}'", storeInfoEntity.BizID));
                    var dishesEntityBll = new Maticsoft.BLL.DishesBll();
                    var dishesEntityList = dishesEntityBll.GetModelList(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID));
                    foreach (var dishesEntity in dishesEntityList)
                    {
                        dishesEntityBll.Delete(dishesEntity.DishesID);
                    }
                    foreach (var dishese in dishList)
                    {
                        var dishesEntity = new DishesEntity();
                        dishesEntity.BusinessID = dishese.StoreId;
                        dishesEntity.DishesName = dishese.DishesName;
                        dishesEntity.CreateDate = DateTime.Now;
                        dishesEntity.DishesID = dishese.DishesID;
                        dishesEntity.ImageUrl = dishese.PictureName;
                        dishesEntity.State = 1;
                        dishesEntity.DishesTypeID = dishese.dishTypeID;
                        dishesEntity.DishesUnit = "份";
                        dishesEntity.DishesMoney = decimal.Parse(dishese.DishesMoney.Replace("¥", string.Empty));
                        dishesEntityBll.Add(dishesEntity);
                    }
                    var dishesTyepTableBll = new Maticsoft.BLL.DishesTyepTable();
                    var dishTypeBll = new Maticsoft.BLL.DishesTyep();
                    var dishTypeList = dishTypeBll.GetModelList(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID));
                    foreach (var dishesTyep in dishTypeList)
                    {
                        dishTypeBll.Delete(dishesTyep.DishesTypeID);
                    }
                    var dishesTypeTableList = dishesTyepTableBll.GetModelList(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID));
                    foreach (var disheseTypeTable in dishesTypeTableList)
                    {
                        var dishesTyep = new Maticsoft.Model.DishesTyep();
                        dishesTyep.BusinessID = disheseTypeTable.BusinessID;
                        dishesTyep.CreateDate = DateTime.Now;
                        dishesTyep.DishesTypeName = disheseTypeTable.DishesTypeName;
                        dishesTyep.DishesTypeID = disheseTypeTable.DishesTypeID;
                        dishTypeBll.Add(dishesTyep);
                    }
                }

                if (chbPic.Checked)
                {
                    var storePicturesTableBll = new StorePicturesTable();
                    var storePicturesBll = new StorePictures();
                    var picList = storePicturesBll.GetModelList(string.Format("BusinessID ='{0}'", storeInfoEntity.BizID));
                    foreach (var storePicturese in picList)
                    {
                        storePicturesBll.Delete(storePicturese.StorePicturesID);
                    }
                    var pcituresList =
                        storePicturesTableBll.GetModelList(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID));
                    foreach (var picturesTable in pcituresList)
                    {
                        var storePicturesTable = new Maticsoft.Model.StorePictures();
                        storePicturesTable.StorePicturesID = picturesTable.StorePicturesID;
                        storePicturesTable.BusPhotoAlbumID = picturesTable.BusPhotoAlbumID;
                        storePicturesTable.BusinessID = picturesTable.BusinessID;
                        storePicturesTable.PictureAddress = picturesTable.PictureAddress;
                        storePicturesTable.PicName = picturesTable.PicName;
                        storePicturesTable.PicState = picturesTable.PicState;
                        storePicturesTable.UploadTime = DateTime.Now;
                        storePicturesBll.Add(storePicturesTable);
                    }

                    var busPhotoAlbumBll = new Maticsoft.BLL.BusPhotoAlbum();
                    var oldBusPhotoAlbumList = busPhotoAlbumBll.GetModelList(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID));
                    foreach (var busPhotoAlbum in oldBusPhotoAlbumList)
                    {
                        busPhotoAlbumBll.Delete(busPhotoAlbum.BusPhotoAlbumID);
                    }
                    var busPhotoAlbumTableBll = new Maticsoft.BLL.BusPhotoAlbumTable();
                    if (!isExists)
                    {
                        var busPhotoAlbumList =
                            busPhotoAlbumTableBll.GetModelList(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID));
                        foreach (var busPhotoAlbumTable in busPhotoAlbumList)
                        {
                            var busPhotoAlbum = new Maticsoft.Model.BusPhotoAlbum();
                            busPhotoAlbum.BusinessID = busPhotoAlbumTable.BusinessID;
                            busPhotoAlbum.BusPhotoAlbumID = busPhotoAlbumTable.BusPhotoAlbumID;
                            busPhotoAlbum.AlbumName = busPhotoAlbumTable.AlbumName;
                            busPhotoAlbum.IsDefault = busPhotoAlbumTable.IsDefault;
                            busPhotoAlbumBll.Add(busPhotoAlbum);
                        }
                    }
                }

                var storeLocalTagBll = new Maticsoft.BLL.StoreLocalTag();
                foreach (var selectedItem in clbStoreTag.SelectedItems)
                {
                    var cityLocalTag = ((Maticsoft.Model.CityLocalTagEntity)selectedItem);
                    var storeLocalTag = new Maticsoft.Model.StoreLocalTag();
                    storeLocalTag.BizID = storeInfoEntity.BizID;
                    storeLocalTag.BizType = 10;
                    storeLocalTag.DistrictID = storeInfoEntity.DistrictID;
                    storeLocalTag.KeyID = Guid.NewGuid().ToString();
                    storeLocalTag.LocalTagID = cityLocalTag.LocalTagID;
                    storeLocalTag.LocalTagName = cityLocalTag.TagName;
                    storeLocalTagBll.Add(storeLocalTag);
                }

                var storeInfoBll = new Maticsoft.BLL.StoreInfo();
                var storeInfo = storeInfoList.Find(x => x.storeId == storeInfoEntity.BizID);
                if (storeInfo != null)
                {
                    if (isExists)
                    {
                        storeInfoBll.Update(storeInfo);
                    }
                    else
                    {
                        storeInfoBll.Add(storeInfo);
                    }
                }

                foreach (var selectedIndex in clbStoreTag.CheckedIndices)
                {
                    clbStoreTag.SetItemCheckState((int)selectedIndex, CheckState.Unchecked);
                }
                foreach (var selectedIndex in chlBoxSpecialTag.CheckedIndices)
                {
                    chlBoxSpecialTag.SetItemCheckState((int)selectedIndex, CheckState.Unchecked);
                }
                foreach (var selectedIndex in chbCookingStyles.CheckedIndices)
                {
                    chbCookingStyles.SetItemCheckState((int)selectedIndex, CheckState.Unchecked);
                }
                //try
                //{
                //    if (!string.IsNullOrEmpty(storeInfoEntity.StorePhoto))
                //    {
                //        var fileName = file.FileName;
                //        string newPath = string.Format("./imagefiles/shop/"); //大图添加水印保存路径
                //        string newThumbnail = string.Format("./imagefiles/Thumbnail//shop/");
                //        //缩略图添加水印保存路径

                //        if (!Directory.Exists(newPath))
                //        {
                //            Directory.CreateDirectory(newPath);
                //        }
                //        if (!Directory.Exists(newThumbnail))
                //        {
                //            Directory.CreateDirectory(newThumbnail);
                //        }
                //        var initImage = new Bitmap(fileName);
                //        db.ZoomAuto(fileName, newPath + storeInfoEntity.StorePhoto, initImage.Width, initImage.Height);
                //        //生成缩略图
                //        db.ZoomAuto(fileName, newThumbnail + storeInfoEntity.StorePhoto, 350,
                //            260);
                //        //生成缩略图
                //        db.ZoomAuto(fileName, string.Format(newThumbnail + "350_260_" + storeInfoEntity.StorePhoto), 350,
                //            260); //生成缩略图
                //        db.ZoomAuto(fileName, string.Format(newThumbnail + "160_120_" + storeInfoEntity.StorePhoto), 160,
                //            120); //生成缩略图

                //    }

                //}
                //catch (Exception)
                //{

                //    throw;
                //}
                MessageBox.Show(string.Format(@"{0}保存成功", storeInfoEntity.StoreName));
                if (catalogueListBox.SelectedIndex < catalogueListBox.Items.Count - 1)
                {
                    catalogueListBox.SelectedIndex += 1;
                }
                SetCatalogueListBox();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }