Exemplo n.º 1
0
        public bool AddPoi(CreateStoreData createStoreData)
        {
            WxJsonResult wxJsonResult = Senparc.Weixin.MP.AdvancedAPIs.PoiApi.AddPoi(_accessToken, createStoreData, 10000);

            if (wxJsonResult.errcode != ReturnCode.请求成功)
            {
                throw new Exception(wxJsonResult.errmsg);
            }
            return(true);
        }
Exemplo n.º 2
0
        public static CreateStoreJsonResult AddPoi(string accessTokenOrAppId, CreateStoreData createStoreData,
                                                   int timeOut = Config.TIME_OUT)
        {
            return(ApiHandlerWapper.TryCommonApi(accessToken =>
            {
                var url = string.Format(Config.ApiMpHost + "/cgi-bin/poi/addpoi?access_token={0}", accessToken.AsUrlData());

                return CommonJsonSend.Send <CreateStoreJsonResult>(null, url, createStoreData, CommonJsonSendType.POST, timeOut);
            }, accessTokenOrAppId));
        }
Exemplo n.º 3
0
        public bool AddPoi(CreateStoreData createStoreData)
        {
            var result = PoiApi.AddPoi(this._accessToken, createStoreData);

            if (result.errcode != 0)
            {
                throw new Exception(result.errmsg);
            }
            return(true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 创建门店
        /// </summary>
        /// <param name="accessTokenOrAppId"></param>
        /// <param name="createStoreData"></param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static WxJsonResult AddPoi(string accessTokenOrAppId, CreateStoreData createStoreData,
                                          int timeOut = Config.TIME_OUT)
        {
            return(ApiHandlerWapper.TryCommonApi(accessToken =>
            {
                var url = string.Format("http://api.weixin.qq.com/cgi-bin/poi/addpoi?access_token={0}", accessToken);

                return CommonJsonSend.Send <WxJsonResult>(null, url, createStoreData, CommonJsonSendType.POST, timeOut);
            }, accessTokenOrAppId));
        }
Exemplo n.º 5
0
        public ActionResult AddPoi(StoreBaseInfo poidata)
        {
            CreateStoreData createStoreDatum = new CreateStoreData()
            {
                business = new CreateStore_Business()
                {
                    base_info = poidata
                }
            };
            bool flag = _poiService.AddPoi(createStoreDatum);

            return(Json(new { success = flag }));
        }
Exemplo n.º 6
0
        public ActionResult AddPoi(StoreBaseInfo poidata)
        {
            CreateStoreData data = new CreateStoreData();

            data.business           = new CreateStore_Business();
            data.business.base_info = poidata;

            bool result = this._iPoiService.AddPoi(data);

            return(Json(new
            {
                success = result
            }));
        }
Exemplo n.º 7
0
        public ActionResult Save(PoiEditModel model)
        {
            string wxPath = "";

            if (!string.IsNullOrEmpty(model.photo_list) && !(model.photo_list.IndexOf("http") >= 0))
            {
                string path = Server.MapPath("~" + model.photo_list);
                wxPath = this._iPoiService.UploadImage(path);
            }


            if (model.id == 0)
            {
                StoreBaseInfo data = new StoreBaseInfo();
                data.sid = Guid.NewGuid().ToString();

                var province = Himall.Application.RegionApplication.GetRegion(model.RegionId, CommonModel.Region.RegionLevel.Province);
                var city     = Himall.Application.RegionApplication.GetRegion(model.RegionId, CommonModel.Region.RegionLevel.City);
                var county   = Himall.Application.RegionApplication.GetRegion(model.RegionId, CommonModel.Region.RegionLevel.County);
                data.province      = province.Name;
                data.city          = city.Name;
                data.district      = county.Name;
                data.address       = model.address;
                data.business_name = model.business_name;
                data.branch_name   = model.branch_name;
                if (string.IsNullOrEmpty(model.categoryTwo))
                {
                    data.categories = new string[] { model.categoryOne };
                }
                else
                {
                    data.categories = new string[] { model.categoryOne + "," + model.categoryTwo };
                }

                data.photo_list = new List <Store_Photo> {
                    new Store_Photo {
                        photo_url = wxPath
                    }
                };
                data.telephone    = model.telephone;
                data.avg_price    = model.avg_price;
                data.open_time    = model.open_time;
                data.offset_type  = 1;
                data.recommend    = model.recommend;
                data.special      = model.special;
                data.longitude    = "0";
                data.latitude     = "0";
                data.introduction = model.introduction;
                CreateStoreData cd = new CreateStoreData();
                cd.business           = new CreateStore_Business();
                cd.business.base_info = data;
                bool result = this._iPoiService.AddPoi(cd);
                return(Json(new
                {
                    success = result
                }));
            }
            else
            {
                UpdateStore_BaseInfo data = new UpdateStore_BaseInfo();
                data.poi_id       = model.poi_id;
                data.telephone    = model.telephone;
                data.recommend    = model.recommend;
                data.special      = model.special;
                data.introduction = model.introduction;
                data.open_time    = model.open_time;
                data.avg_price    = model.avg_price;
                data.photo_list   = new List <Store_Photo> {
                    new Store_Photo {
                        photo_url = wxPath
                    }
                };

                UpdateStoreData ud = new UpdateStoreData();
                ud.business           = new UpdateStore_Business();
                ud.business.base_info = data;
                bool result = this._iPoiService.UpdatePoi(ud);
                return(Json(new
                {
                    success = result
                }));
            }
        }
Exemplo n.º 8
0
        public static async Task <CreateStoreJsonResult> AddPoiAsync(string accessTokenOrAppId, CreateStoreData createStoreData,
                                                                     int timeOut = Config.TIME_OUT)
        {
            return(await ApiHandlerWapper.TryCommonApiAsync(async accessToken =>
            {
                var url = string.Format(Config.ApiMpHost + "/cgi-bin/poi/addpoi?access_token={0}", accessToken.AsUrlData());

                return await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync <CreateStoreJsonResult>(null, url, createStoreData, CommonJsonSendType.POST, timeOut);
            }, accessTokenOrAppId));
        }
Exemplo n.º 9
0
        public ActionResult Save(PoiEditModel model)
        {
            string str = "";

            if (!string.IsNullOrEmpty(model.photo_list) && model.photo_list.IndexOf("http") < 0)
            {
                string str1 = Server.MapPath(string.Concat("~", model.photo_list));
                str = _poiService.UploadImage(str1);
            }
            if (model.id != 0)
            {
                UpdateStore_BaseInfo updateStoreBaseInfo = new UpdateStore_BaseInfo()
                {
                    poi_id       = model.poi_id,
                    telephone    = model.telephone,
                    recommend    = model.recommend,
                    special      = model.special,
                    introduction = model.introduction,
                    open_time    = model.open_time,
                    avg_price    = model.avg_price
                };
                List <Store_Photo> storePhotos = new List <Store_Photo>()
                {
                    new Store_Photo()
                    {
                        photo_url = str
                    }
                };
                updateStoreBaseInfo.photo_list = storePhotos;
                UpdateStoreData updateStoreDatum = new UpdateStoreData()
                {
                    business = new UpdateStore_Business()
                    {
                        base_info = updateStoreBaseInfo
                    }
                };
                bool flag = _poiService.UpdatePoi(updateStoreDatum);
                return(Json(new { success = flag }));
            }
            StoreBaseInfo storeBaseInfo = new StoreBaseInfo()
            {
                sid           = Guid.NewGuid().ToString(),
                province      = model.province,
                city          = model.city,
                district      = model.district,
                address       = model.address,
                business_name = model.business_name,
                branch_name   = model.branch_name
            };

            string[] strArrays = new string[] { string.Concat(model.categoryOne, ",", model.categoryTwo) };
            storeBaseInfo.categories = strArrays;
            List <Store_Photo> storePhotos1 = new List <Store_Photo>()
            {
                new Store_Photo()
                {
                    photo_url = str
                }
            };

            storeBaseInfo.photo_list   = storePhotos1;
            storeBaseInfo.telephone    = model.telephone;
            storeBaseInfo.avg_price    = model.avg_price;
            storeBaseInfo.open_time    = model.open_time;
            storeBaseInfo.offset_type  = 1;
            storeBaseInfo.recommend    = model.recommend;
            storeBaseInfo.special      = model.special;
            storeBaseInfo.longitude    = "0";
            storeBaseInfo.latitude     = "0";
            storeBaseInfo.introduction = model.introduction;
            CreateStoreData createStoreDatum = new CreateStoreData()
            {
                business = new CreateStore_Business()
                {
                    base_info = storeBaseInfo
                }
            };
            bool flag1 = _poiService.AddPoi(createStoreDatum);

            return(Json(new { success = flag1 }));
        }
Exemplo n.º 10
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");
        }
Exemplo n.º 11
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");
                        }
                    }
                }
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 【异步方法】创建门店
        /// </summary>
        /// <param name="accessTokenOrAppId"></param>
        /// <param name="createStoreData"></param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static async Task <WxJsonResult> AddPoiAsync(string accessTokenOrAppId, CreateStoreData createStoreData,
                                                            int timeOut = Config.TIME_OUT)
        {
            return(await ApiHandlerWapper.TryCommonApiAsync(accessToken =>
            {
                var url = string.Format("http://api.weixin.qq.com/cgi-bin/poi/addpoi?access_token={0}", accessToken.AsUrlData());

                return Core.CommonAPIs.CommonJsonSend.SendAsync <WxJsonResult>(null, url, createStoreData, CommonJsonSendType.POST, timeOut);
            }, accessTokenOrAppId));
        }
Exemplo n.º 13
0
        private void SaveStores(out int storeId)
        {
            storeId = 0;
            CreateStoreData createStoreData = new CreateStoreData();
            ManagerInfo     managerInfo     = new ManagerInfo();
            StoresInfo      storesInfo      = new StoresInfo();
            double          num             = 0.0;
            int             num2            = 0;
            int             num3            = 0;
            decimal         num4            = default(decimal);
            string          text            = "";
            string          text2           = "";
            string          Address         = "";
            string          userName        = DataHelper.CleanSearchString(this.txtUserName.Text.Trim());
            string          storeName       = Globals.StripAllTags(this.txtStoresName.Text.Trim());

            Address = Globals.StripAllTags(this.txtAddress.Text);
            string text3 = Globals.StripAllTags(this.txtRegionScop.Value.Trim());
            string text4 = Globals.StripAllTags(this.txtRegionScopName.Value.Trim());

            text  = this.txtTel.Text;
            text2 = Globals.StripAllTags(this.txtContactMan.Text);
            if (StoresHelper.ExistStoreName(storeName))
            {
                this.ResetForm();
                this.ShowMsg("门店名称已经存在,请重新输入!", false);
            }
            else if (Hidistro.SaleSystem.Store.ManagerHelper.FindManagerByUsername(userName) != null)
            {
                this.ResetForm();
                this.ShowMsg("用户名已经存在,请重新输入!", false);
            }
            else if (this.txtUserPwd.Text.Length < 6 || this.txtUserPwd.Text.Length > 20)
            {
                this.ResetForm();
                this.ShowMsg("密码不能为空!", false);
            }
            else if (string.Compare(this.txtUserPwd.Text, this.txtUserRePwd.Text) != 0)
            {
                this.ResetForm();
                this.ShowMsg("请确保两次输入的密码相同", false);
            }
            else if (!this.dropRegion.GetSelectedRegionId().HasValue)
            {
                this.ResetForm();
                this.ShowMsg("请选择店铺所在区域!", false);
            }
            else if (text2.Length > 8 || text2.Length < 2)
            {
                this.ResetForm();
                this.ShowMsg("请输入联系人,联系人长度必须是2-8位!", false);
            }
            else if (string.IsNullOrEmpty(this.hfLatitude.Value) || string.IsNullOrEmpty(this.hfLongitude.Value))
            {
                this.ResetForm();
                this.ShowMsg("请给门店标注定位!", false);
            }
            else if (text == "" || !DataHelper.IsTel(text))
            {
                this.ResetForm();
                this.ShowMsg("请输入正确的联系电话(手机或者固定电话)!", false);
            }
            else if (!this.chkIsSupportExpress.Checked && !this.chkIsAboveSelf.Checked && !this.chkIsStoreDelive.Checked)
            {
                this.ResetForm();
                this.ShowMsg("请选择一种配送方式!", false);
            }
            else
            {
                if (this.chkIsStoreDelive.Checked)
                {
                    if (!double.TryParse(this.txtServeRadius.Text.Trim(), out num) || num > 10000.0 || num <= 0.0)
                    {
                        this.ResetForm();
                        this.ShowMsg("请输入正确的配送半径,为大于0至10000之间的数字!", false);
                        return;
                    }
                    if (!int.TryParse(this.txtStoreFreight.Text.Trim(), out num2) || num2 > 99999999 || num2 < 0)
                    {
                        this.ResetForm();
                        this.ShowMsg("请输入正确的配送费", false);
                        return;
                    }
                    if (!int.TryParse(this.txtMinOrderPrice.Text.Trim(), out num3) || num3 > 99999999 || num3 < 0)
                    {
                        this.ResetForm();
                        this.ShowMsg("请输入正确的起送价", false);
                        return;
                    }
                }
                if (!decimal.TryParse(this.txtCommissionRate.Text.Trim(), out num4) || num4 > 100m || num4 < decimal.Zero)
                {
                    this.ResetForm();
                    this.ShowMsg("请输入正确的平台抽佣比例", false);
                }
                else if (!this.chkOfflinePay.Checked && !this.chkOnlinePay.Checked && !this.chkCashOnDelivery.Checked)
                {
                    this.ResetForm();
                    this.ShowMsg("支付方式请至少选择一种", false);
                }
                else
                {
                    storesInfo.IsOfflinePay     = this.chkOfflinePay.Checked;
                    storesInfo.IsOnlinePay      = this.chkOnlinePay.Checked;
                    storesInfo.IsCashOnDelivery = this.chkCashOnDelivery.Checked;
                    if (string.IsNullOrEmpty(this.txtStoreOpenTimeStartH.Text) || this.txtStoreOpenTimeStartH.Text.ToInt(0) < 0 || this.txtStoreOpenTimeStartH.Text.ToInt(0) >= 24)
                    {
                        this.ResetForm();
                        this.ShowMsg("请输入正确的营业起始小时", false);
                    }
                    else if (string.IsNullOrEmpty(this.txtStoreOpenTimeStartM.Text) || this.txtStoreOpenTimeStartM.Text.ToInt(0) < 0 || this.txtStoreOpenTimeStartM.Text.ToInt(0) >= 60)
                    {
                        this.ResetForm();
                        this.ShowMsg("请输入正确的营业起始分钟", false);
                    }
                    else if (string.IsNullOrEmpty(this.txtStoreOpenTimeEndH.Text) || this.txtStoreOpenTimeEndH.Text.ToInt(0) < 0 || this.txtStoreOpenTimeEndH.Text.ToInt(0) >= 24)
                    {
                        this.ResetForm();
                        this.ShowMsg("请输入正确的营业结束小时", false);
                    }
                    else if (string.IsNullOrEmpty(this.txtStoreOpenTimeEndM.Text) || this.txtStoreOpenTimeEndM.Text.ToInt(0) < 0 || this.txtStoreOpenTimeEndM.Text.ToInt(0) >= 60)
                    {
                        this.ResetForm();
                        this.ShowMsg("请输入正确的营业结束分钟", false);
                    }
                    else
                    {
                        string   empty     = string.Empty;
                        DateTime dateTime  = DateTime.Now;
                        string   text5     = dateTime.ToString("yyyy-MM-dd");
                        DateTime?nullable  = (text5 + " " + this.txtStoreOpenTimeStartH.Text.ToInt(0) + ":" + this.txtStoreOpenTimeStartM.Text.ToInt(0)).ToDateTime();
                        DateTime?nullable2 = (text5 + " " + this.txtStoreOpenTimeEndH.Text.ToInt(0) + ":" + this.txtStoreOpenTimeEndM.Text.ToInt(0)).ToDateTime();
                        dateTime = nullable.Value;
                        string str = dateTime.ToString("HH:mm");
                        dateTime = nullable2.Value;
                        string text6 = dateTime.ToString("HH:mm");
                        if (text6 == "00:00")
                        {
                            nullable2 = (text5 + " 23:59").ToDateTime();
                            text6     = "23:59";
                        }
                        empty = (storesInfo.StoreOpenTime = str + "-" + text6);
                        storesInfo.OpenStartDate    = nullable.Value;
                        storesInfo.OpenEndDate      = nullable2.Value;
                        storesInfo.IsSupportExpress = (this.chkIsSupportExpress.Checked && true);
                        storesInfo.IsAboveSelf      = (this.chkIsAboveSelf.Checked && true);
                        storesInfo.IsStoreDelive    = (this.chkIsStoreDelive.Checked && true);
                        storesInfo.Introduce        = this.editDescription.Text;
                        storesInfo.ServeRadius      = num;
                        if (this.chkIsStoreDelive.Checked)
                        {
                            storesInfo.MinOrderPrice = num3;
                            storesInfo.StoreFreight  = num2;
                        }
                        storesInfo.CommissionRate   = num4;
                        storesInfo.IsShelvesProduct = true;
                        storesInfo.IsModifyPrice    = true;
                        storesInfo.IsRequestBlance  = true;
                        storesInfo.MinPriceRate     = 0.5.ToDecimal(0);
                        storesInfo.MaxPriceRate     = 2;
                        string[] array  = text3.Split(',');
                        string[] array2 = text4.Split(',');
                        IDictionary <int, DeliveryScopeInfo> dictionary = new Dictionary <int, DeliveryScopeInfo>();
                        for (int i = 0; i < array.Length; i++)
                        {
                            int num5 = 0;
                            if (int.TryParse(array[i], out num5) && array2.Length >= i && dictionary != null && !dictionary.ContainsKey(num5))
                            {
                                DeliveryScopeInfo deliveryScopeInfo = new DeliveryScopeInfo();
                                deliveryScopeInfo.RegionId       = num5;
                                deliveryScopeInfo.RegionName     = array2[i];
                                deliveryScopeInfo.FullRegionPath = RegionHelper.GetFullPath(num5, true);
                                dictionary.Add(num5, deliveryScopeInfo);
                            }
                        }
                        managerInfo.RoleId   = -1;
                        managerInfo.UserName = this.txtUserName.Text.Trim();
                        string text8 = this.txtUserPwd.Text;
                        managerInfo.CreateDate = DateTime.Now;
                        string text9 = Globals.RndStr(128, true);
                        text8 = (managerInfo.Password = Users.EncodePassword(text8, text9));
                        managerInfo.PasswordSalt = text9;
                        storesInfo.StoreName     = storeName;
                        storesInfo.CloseStatus   = true;
                        storesInfo.State         = 1;
                        storesInfo.RegionId      = this.dropRegion.GetSelectedRegionId().Value;
                        storesInfo.TopRegionId   = RegionHelper.GetCityId(storesInfo.RegionId);
                        storesInfo.Tel           = text;
                        List <string> list = RegionHelper.GetFullRegion(this.dropRegion.GetSelectedRegionId().Value, ",", true, 0).Split(',').Take(3)
                                             .ToList();
                        list.ForEach(delegate(string c)
                        {
                            Address = Address.Replace(c, string.Empty);
                        });
                        storesInfo.Address    = Address;
                        storesInfo.ContactMan = text2;
                        IList <string> list2  = new List <string>();
                        string         text11 = this.hidUploadImages.Value.Trim();
                        string[]       array3 = text11.Split(',');
                        for (int j = 0; j < array3.Length; j++)
                        {
                            if (!string.IsNullOrEmpty(array3[j]))
                            {
                                string text12         = Globals.SaveFile("depot", array3[j], "/Storage/master/", true, false, "");
                                string sourceFilename = base.Request.MapPath(text12);
                                string virtualPath    = HiContext.Current.GetStoragePath() + "/depot/thum_" + text12.Substring(text12.LastIndexOf("/") + 1);
                                ResourcesHelper.CreateThumbnail(sourceFilename, base.Request.MapPath(virtualPath), 160, 160);
                                list2.Add(text12);
                            }
                        }
                        if (list2.Count == 0)
                        {
                            this.ResetForm();
                            this.ShowMsg("请上传门店logo", false);
                        }
                        else
                        {
                            storesInfo.StoreImages = ((list2.Count == 0) ? string.Empty : string.Join(",", list2.ToArray()));
                            if (!string.IsNullOrEmpty(this.hfLatitude.Value))
                            {
                                storesInfo.Latitude = double.Parse(this.hfLatitude.Value);
                            }
                            if (!string.IsNullOrEmpty(this.hfLongitude.Value))
                            {
                                storesInfo.Longitude = double.Parse(this.hfLongitude.Value);
                            }
                            storesInfo.FullRegionPath = RegionHelper.GetFullPath(storesInfo.RegionId, true);
                            storeId = StoresHelper.AddStore(storesInfo);
                            if (storeId > 0)
                            {
                                HiCache.Remove("DataCache-StoreInfoDataKey");
                                managerInfo.StoreId = storeId;
                                Hidistro.SaleSystem.Store.ManagerHelper.Create(managerInfo);
                                if (dictionary.Count > 0 && this.chkIsStoreDelive.Checked)
                                {
                                    StoresHelper.AddDeliveryScope(storeId, dictionary);
                                }
                                if (!string.IsNullOrEmpty(this.txtStoreTag.Text.Trim()))
                                {
                                    IList <int> list3  = new List <int>();
                                    string      text13 = this.txtStoreTag.Text.Trim();
                                    string[]    array4 = null;
                                    array4 = ((!text13.Contains(",")) ? new string[1]
                                    {
                                        text13
                                    } : text13.Split(','));
                                    string[] array5 = array4;
                                    foreach (string value in array5)
                                    {
                                        list3.Add(Convert.ToInt32(value));
                                    }
                                    StoresHelper.BindStoreTags(storeId, list3);
                                }
                                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                                if (masterSettings.OpenDadaLogistics)
                                {
                                    DataTable dataTable = DepotHelper.SynchroDadaStoreList(storeId);
                                    if (dataTable != null && dataTable.Rows.Count > 0)
                                    {
                                        for (int l = 0; l < dataTable.Rows.Count; l++)
                                        {
                                            string station_name    = dataTable.Rows[l]["StoreName"].ToNullString();
                                            int    business        = 5;
                                            string city_name       = dataTable.Rows[l]["CityName"].ToNullString().Replace("市", "");
                                            string area_name       = dataTable.Rows[l]["RegionName"].ToNullString();
                                            string station_address = dataTable.Rows[l]["Address"].ToNullString();
                                            double lng             = dataTable.Rows[l]["Longitude"].ToDouble(0);
                                            double lat             = dataTable.Rows[l]["Latitude"].ToDouble(0);
                                            string contact_name    = dataTable.Rows[l]["ContactMan"].ToNullString();
                                            string phone           = dataTable.Rows[l]["Tel"].ToNullString();
                                            string origin_shop_id  = dataTable.Rows[l]["StoreId"].ToNullString();
                                            string text14          = DadaHelper.shopAdd(masterSettings.DadaSourceID, station_name, business, city_name, area_name, station_address, lng, lat, contact_name, phone, origin_shop_id, "", "", "");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 14
0
 public static WxJsonResult CreateWXStore(CreateStoreData createStoreData)
 {
     return(PoiApi.AddPoi(WXStoreHelper.siteSettings.WeixinAppId, createStoreData, 10000));
 }