Beispiel #1
0
        private IEnumerable <string> BuildImages(StringBuilder sbLocalImage, IList <string> lstFile)
        {
            string text = this.hidUploadImages.Value.Trim();

            string[] array = text.Split(',');
            for (int i = 0; i < array.Length; i++)
            {
                if (!string.IsNullOrEmpty(array[i]))
                {
                    string item = Globals.SaveFile("depot", array[i], "/Storage/master/", true, false, "");
                    lstFile.Add(item);
                }
            }
            sbLocalImage.Append(string.Join(",", lstFile.ToArray()));
            return(WXStoreHelper.ImageUploadForStore(lstFile));
        }
Beispiel #2
0
        private void AddWXStore()
        {
            SiteSettings    masterSettings  = SettingsManager.GetMasterSettings();
            StoresInfo      storeById       = StoresHelper.GetStoreById(this.storeId);
            IList <string>  list            = new List <string>();
            CreateStoreData createStoreData = new CreateStoreData();
            string          text            = this.hidUploadImages.Value.Trim();

            string[] array = text.Split(',');
            for (int i = 0; i < array.Length; i++)
            {
                if (!string.IsNullOrEmpty(array[i]))
                {
                    string item = Globals.SaveFile("depot", array[i], "/Storage/master/", true, false, "");
                    list.Add(item);
                }
            }
            IEnumerable <string> enumerable = WXStoreHelper.ImageUploadForStore(list);

            foreach (string item2 in enumerable)
            {
                createStoreData.business.base_info.photo_list.Add(new Store_Photo
                {
                    photo_url = item2
                });
            }
            string        address = this.txtWxAddress.Text.Trim();
            List <string> list2   = RegionHelper.GetFullRegion(storeById.RegionId, ",", true, 0).Split(',').Take(3)
                                    .ToList();

            list2.ForEach(delegate(string c)
            {
                address = address.Replace(c, string.Empty);
            });
            createStoreData.business.base_info.address       = address;
            createStoreData.business.base_info.avg_price     = this.txtWXAvgPrice.Text.ToInt(0);
            createStoreData.business.base_info.branch_name   = storeById.StoreName;
            createStoreData.business.base_info.business_name = masterSettings.SiteName;
            createStoreData.business.base_info.categories    = new string[1]
            {
                $"{this.ddlCategoryParent.SelectedValue.Trim()},{this.ddlCategoryChild.SelectedValue.Trim()}"
            };
            createStoreData.business.base_info.city         = list2[1];
            createStoreData.business.base_info.district     = this.hfDistrict.Value;
            createStoreData.business.base_info.introduction = this.txtWXIntroduction.Text.Trim();
            createStoreData.business.base_info.latitude     = this.hfLatitude.Value;
            createStoreData.business.base_info.longitude    = this.hfLongitude.Value;
            createStoreData.business.base_info.offset_type  = 1;
            createStoreData.business.base_info.open_time    = this.txtWXOpenTime.Text.Trim();
            createStoreData.business.base_info.province     = list2[0];
            createStoreData.business.base_info.recommend    = this.txtWXRecommend.Text.Trim();
            createStoreData.business.base_info.special      = this.txtWXSpecial.Text.Trim();
            createStoreData.business.base_info.telephone    = this.txtWXTelephone.Text.Trim();
            storeById.StoreImages = ((list.Count == 0) ? string.Empty : string.Join(",", list.ToArray()));
            createStoreData.business.base_info.sid = this.storeId.ToString();
            WxJsonResult wxJsonResult = WXStoreHelper.CreateWXStore(createStoreData);

            if (wxJsonResult.errcode.Equals(ReturnCode.请求成功))
            {
                StoresHelper.FirstAddWXStore(createStoreData, this.storeId, storeById.StoreImages);
            }
            this.ShowMsg("添加成功,等待微信审核", true, "StoresList.aspx");
        }
Beispiel #3
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            SiteSettings    masterSettings  = SettingsManager.GetMasterSettings();
            StoresInfo      storeById       = StoresHelper.GetStoreById(this.storeId);
            IList <string>  list            = new List <string>();
            CreateStoreData createStoreData = new CreateStoreData();

            if (string.IsNullOrEmpty(this.txtWxAddress.Text.Trim()) || this.txtWxAddress.Text.Trim().Length > 50)
            {
                this.ShowMsg("微信门店地址不能为空长度必须为2-50个字符", false);
            }
            else
            {
                string text = $"{this.ddlCategoryParent.SelectedValue.Trim()},{this.ddlCategoryChild.SelectedValue.Trim()}";
                if (string.IsNullOrEmpty(text) || text.Length > 50)
                {
                    this.ShowMsg("类目不能为空,长度必须为2-50个字符", false);
                }
                else if (string.IsNullOrEmpty(this.txtWXTelephone.Text.Trim()) || this.txtWXTelephone.Text.Trim().Length > 25)
                {
                    this.ShowMsg("电话不能为空,长度必须为2-50个字符", false);
                }
                else if (!string.IsNullOrEmpty(this.txtWXAvgPrice.Text.Trim()) && this.txtWXAvgPrice.Text.Trim().ToInt(0) <= 0)
                {
                    this.ShowMsg("人均价格必须大于零的整数,须如实填写,默认单位为人民币", false);
                }
                else
                {
                    string text2 = this.txtWXOpenTime.Text.Trim();
                    if (!string.IsNullOrEmpty(text2) && text2.Split('-').Length != 2)
                    {
                        this.ShowMsg("营业时间如,10:00-21:00", false);
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(text2))
                        {
                            DateTime minValue = DateTime.MinValue;
                            string[] array    = text2.Split('-');
                            if (!DateTime.TryParse(array[0], out minValue) || !DateTime.TryParse(array[1], out minValue))
                            {
                                this.ShowMsg("营业时间如,10:00-21:00", false);
                                return;
                            }
                        }
                        if (!string.IsNullOrEmpty(this.txtWXRecommend.Text.Trim()) && this.txtWXRecommend.Text.Trim().Length > 150)
                        {
                            this.ShowMsg("推荐长度必须为2-150个字符", false);
                        }
                        else if (!string.IsNullOrEmpty(this.txtWXSpecial.Text.Trim()) && this.txtWXSpecial.Text.Trim().Length > 150)
                        {
                            this.ShowMsg("特色服务必须为2-150个字符", false);
                        }
                        else if (!string.IsNullOrEmpty(this.txtWXIntroduction.Text.Trim()) && this.txtWXIntroduction.Text.Trim().Length > 150)
                        {
                            this.ShowMsg("简介必须为2-150个字符", false);
                        }
                        else
                        {
                            string   text3  = this.hidUploadImages.Value.Trim();
                            string[] array2 = text3.Split(',');
                            for (int i = 0; i < array2.Length; i++)
                            {
                                if (!string.IsNullOrEmpty(array2[i]))
                                {
                                    string item = Globals.SaveFile("depot", array2[i], "/Storage/master/", true, false, "");
                                    list.Add(item);
                                }
                            }
                            IEnumerable <string> enumerable = WXStoreHelper.ImageUploadForStore(list);
                            foreach (string item2 in enumerable)
                            {
                                createStoreData.business.base_info.photo_list.Add(new Store_Photo
                                {
                                    photo_url = item2
                                });
                            }
                            string        address = this.txtWxAddress.Text.Trim();
                            List <string> list2   = RegionHelper.GetFullRegion(storeById.RegionId, ",", true, 0).Split(',').Take(3)
                                                    .ToList();
                            list2.ForEach(delegate(string c)
                            {
                                address = address.Replace(c, string.Empty);
                            });
                            createStoreData.business.base_info.address       = address;
                            createStoreData.business.base_info.avg_price     = this.txtWXAvgPrice.Text.ToInt(0);
                            createStoreData.business.base_info.branch_name   = storeById.StoreName;
                            createStoreData.business.base_info.business_name = masterSettings.SiteName;
                            createStoreData.business.base_info.categories    = new string[1]
                            {
                                $"{this.ddlCategoryParent.SelectedValue.Trim()},{this.ddlCategoryChild.SelectedValue.Trim()}"
                            };
                            createStoreData.business.base_info.city         = list2[1];
                            createStoreData.business.base_info.district     = this.hfDistrict.Value;
                            createStoreData.business.base_info.introduction = this.txtWXIntroduction.Text.Trim();
                            createStoreData.business.base_info.latitude     = this.hfLatitude.Value;
                            createStoreData.business.base_info.longitude    = this.hfLongitude.Value;
                            createStoreData.business.base_info.offset_type  = 1;
                            createStoreData.business.base_info.open_time    = this.txtWXOpenTime.Text.Trim();
                            createStoreData.business.base_info.province     = list2[0];
                            createStoreData.business.base_info.recommend    = this.txtWXRecommend.Text.Trim();
                            createStoreData.business.base_info.special      = this.txtWXSpecial.Text.Trim();
                            createStoreData.business.base_info.telephone    = this.txtWXTelephone.Text.Trim();
                            storeById.StoreImages = ((list.Count == 0) ? string.Empty : string.Join(",", list.ToArray()));
                            createStoreData.business.base_info.sid = this.storeId.ToString();
                            WxJsonResult wxJsonResult = WXStoreHelper.CreateWXStore(createStoreData);
                            if (wxJsonResult.errcode.Equals(ReturnCode.请求成功))
                            {
                                StoresHelper.FirstAddWXStore(createStoreData, this.storeId, storeById.StoreImages);
                            }
                            this.ShowMsg("添加成功,等待微信审核", true, "StoresList.aspx");
                        }
                    }
                }
            }
        }