Beispiel #1
0
        public ActionResult AddShop(string keyValue, POS_ShopEntity entity)
        {
            //微信火星转百度
            double Lon = double.Parse(entity.wxLon);
            double Lat = double.Parse(entity.wxLat);
            double bdLat, bdLon;

            MapConverter.GCJ02ToBD09(Lat, Lon, out bdLat, out bdLon);
            entity.bdLat    = bdLat.ToString();
            entity.bdLon    = bdLon.ToString();
            entity.OpenId   = CurrentWxUser.OpenId;
            entity.NickName = CurrentWxUser.NickName;

            //根据坐标获取省市县信息
            string       url          = @"http://restapi.amap.com/v3/geocode/regeo?location=" + Lon + "," + Lat + "&key=cf3dd05a8192fd1839628b39e589c89e&radius=1000&extensions=all";//output=XML&
            string       responseJson = HttpClientHelper.Get(url);
            RestLocation restLocation = JsonConvert.DeserializeObject <RestLocation>(responseJson.Replace("[]", "\"\""));

            entity.Province = restLocation.regeocode.addressComponent.province;
            entity.City     = restLocation.regeocode.addressComponent.city;
            entity.CityCode = restLocation.regeocode.addressComponent.citycode;
            entity.District = restLocation.regeocode.addressComponent.district;

            //插入店铺表
            posShopBll.SaveForm(keyValue, entity);

            return(Content("true"));
        }
Beispiel #2
0
        /// <summary>
        /// 店铺详情
        /// </summary>
        /// <returns></returns>
        public ActionResult ShopDetail(string keyValue)
        {
            POS_ShopEntity entity = posShopBll.GetEntity(keyValue);

            ViewBag.model = entity;
            return(View());
        }
Beispiel #3
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, TrailRecordEntity entity)
        {
            IRepository db = new RepositoryFactory().BaseRepository().BeginTrans();

            try
            {
                switch (entity.ObjectSort)
                {
                case 1:             //商机
                    ChanceEntity chanceEntity = new ChanceEntity();
                    chanceEntity.Modify(entity.ObjectId);
                    db.Update <ChanceEntity>(chanceEntity);
                    break;

                case 2:             //客户
                    CustomerEntity customerEntity = new CustomerEntity();
                    customerEntity.Modify(entity.ObjectId);
                    db.Update <CustomerEntity>(customerEntity);
                    break;

                case 3:             //手机号
                    TelphoneSourceEntity telEntity = new TelphoneSourceEntity();
                    telEntity.Modify(int.Parse(entity.ObjectId));
                    db.Update <TelphoneSourceEntity>(telEntity);
                    break;

                case 4:             //店铺
                    POS_ShopEntity shopEntity = new POS_ShopEntity();
                    shopEntity.Modify(entity.ObjectId);
                    db.Update <POS_ShopEntity>(shopEntity);
                    break;

                case 5:             //公司
                    POS_OfficeCompanyEntity officeCompanyEntity = new POS_OfficeCompanyEntity();
                    officeCompanyEntity.Modify(entity.ObjectId);
                    db.Update <POS_OfficeCompanyEntity>(officeCompanyEntity);
                    break;

                case 6:             //私池
                    Ku_CompanyEntity companyEntity = new Ku_CompanyEntity();
                    companyEntity.Modify(Convert.ToInt32(entity.ObjectId));
                    db.Update <Ku_CompanyEntity>(companyEntity);
                    break;

                default:
                    break;
                }
                entity.Create();
                db.Insert(entity);

                db.Commit();
            }
            catch (Exception)
            {
                db.Rollback();
                throw;
            }
        }
Beispiel #4
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, POS_ShopEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #5
0
        /// <summary>
        /// 店铺详情
        /// </summary>
        /// <returns></returns>
        public ActionResult GetFormJson(string keyValue)
        {
            string         returnUrl = Request.Url.ToString();
            POS_ShopEntity entity    = posShopBll.GetEntity(keyValue);

            if (string.IsNullOrEmpty(entity.SellerId))
            {
                entity.SellerName = Code.OperatorProvider.Provider.Current().UserName;
                entity.SellerId   = Code.OperatorProvider.Provider.Current().UserId;
            }
            return(Content(entity.ToJson()));
        }
Beispiel #6
0
 public ActionResult SaveForm(string keyValue, POS_ShopEntity entity)
 {
     pos_shopbll.SaveForm(keyValue, entity);
     return(Success("操作成功。"));
 }