Example #1
0
        private void BandData()
        {
            var pageIndex = WebUtility.GetRequestLong("page", 1);
            var pageSize = Utility.GetLong(Request["pagesize"], 20, 5, 40);
            var BID = WebUtility.GetRequestInt("bid", -1);

            if (BID == -1)
            {
                WebUtility.ShowAndGoBack(this, "参数错误!");
                return;
            }

            var businessCircleDAL = new DAL.Key_BusinessCircle();
            var businessCircle = businessCircleDAL.GetEntity(BID);
            if (businessCircle == null) return;
            litBName.Text = businessCircle.BName;
            litBName2.Text = businessCircle.BName;

            var db = DataBase.Create();
            db.EnableRecordCount = true;
            db.Parameters.Append("bid", BID);
            var keys = db.Select(pageSize, pageIndex, "vw_Key_BusinessCircle", "kid", "bid=@bid", "kcreatetime desc");

            rpResult.DataSource = keys;
            rpResult.DataBind();

            this.Pager1.AppendUrlParam("bid", BID.ToString());
            this.Pager1.PageSize = (int)pageSize;
            this.Pager1.PageIndex = (int)pageIndex;
            this.Pager1.TotalRecords = (int)db.RecordCount;
        }
Example #2
0
        private string AddBusinessCircle()
        {
            var lng = WebUtility.GetRequestFloat("lng", -1);
            var lat = WebUtility.GetRequestFloat("lat", -1);
            var name = WebUtility.GetRequestStr("name", "");

            if (lng == -1 || lat == -1) return "";

            DAL.Key_BusinessCircle businessCircleDAL = new DAL.Key_BusinessCircle();

            if (businessCircleDAL.Exist(string.Format("bname='{0}' and lng={1} and lat={2}", name, lng, lat)))
            {
                return JsonConvert.SerializeObject(new { statue = false, msg = "商圈已存在!" });
            }

            var key = new Model.Key_BusinessCircle
            {
                CreateTime = DateTime.Now,
                Lng = lng,
                Lat = lat,
                BName = name,
            };
            var bid = businessCircleDAL.Add(key);
            if (bid > 0)
            {
                return JsonConvert.SerializeObject(new { statue = true, bid = bid });
            }
            else
            {
                return JsonConvert.SerializeObject(new { statue = false });
            }
        }