Example #1
0
        private string getListCount(HttpContext context)
        {
            StringBuilder sb       = new StringBuilder();
            StringBuilder strWhere = new StringBuilder();

            WK.BLL.bus_market bll = new WK.BLL.bus_market();
            Record            r   = new Record();

            r.RecordCount = bll.GetListCount(strWhere.ToString());
            return(Newtonsoft.Json.JsonConvert.SerializeObject(r));
        }
Example #2
0
        private string deleteData(HttpContext context)
        {
            ReturnInfo returnInfo = new ReturnInfo();

            returnInfo.isSuccess = false;
            WK.BLL.bus_market bll = new WK.BLL.bus_market();
            int id = int.Parse(context.Request.Params["id"]);

            if (id > 0)
            {
                WK.Model.bus_market model = bll.GetModel(id);
                model.is_delete      = 1;
                returnInfo.isSuccess = bll.Update(model);
            }

            return(Newtonsoft.Json.JsonConvert.SerializeObject(returnInfo));
        }
Example #3
0
        private string getDataDetail(HttpContext context)
        {
            string id = "";

            if (context.Request.Params["id"] != null)
            {
                id = context.Request.Params["id"];
            }
            WK.BLL.bus_market   bll   = new WK.BLL.bus_market();
            WK.Model.bus_market model = bll.GetModel(int.Parse(id));

            #region 自提点
            WK.BLL.bus_pickup_market marketBll = new BLL.bus_pickup_market();
            StringBuilder            strWhere  = new StringBuilder();
            strWhere.Append(" is_delete != 1");
            strWhere.AppendFormat(" and market_id = {0}", id);
            DataSet ds = new DataSet();
            ds = marketBll.GetList(strWhere.ToString());
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                model.pickup_address_id = int.Parse(ds.Tables[0].Rows[0]["pickup_address_id"].ToString());
            }
            #endregion

            #region 图片
            WK.BLL.bus_image imageBll   = new BLL.bus_image();
            StringBuilder    imageWhere = new StringBuilder();
            imageWhere.Append(" is_delete != 1");
            imageWhere.AppendFormat(" and correlation_id  = {0}", id);
            imageWhere.AppendFormat(" and bus_type   = {0}", 1);
            DataSet dsImage = new DataSet();
            dsImage = imageBll.GetList(imageWhere.ToString());
            string imageList = string.Empty;
            if (dsImage != null && dsImage.Tables.Count > 0 && dsImage.Tables[0].Rows.Count > 0)
            {
                int imageCount = dsImage.Tables[0].Rows.Count;
                for (int i = 0; i < imageCount; i++)
                {
                    imageList += dsImage.Tables[0].Rows[i]["url"] + "||" + dsImage.Tables[0].Rows[i]["img_type"] + ";";
                }
            }
            model.imageList = imageList;
            #endregion

            return(Newtonsoft.Json.JsonConvert.SerializeObject(model));
        }
Example #4
0
        private string getDataList(HttpContext context)
        {
            StringBuilder sb       = new StringBuilder();
            DataSet       ds       = new DataSet();
            StringBuilder strWhere = new StringBuilder();

            strWhere.Append(" is_delete != 1");
            StringBuilder orderby = new StringBuilder();

            int pageIndex  = int.Parse(context.Request.Params["pageIndex"]);
            int pageSize   = int.Parse(context.Request.Params["pageSize"]);
            int startIndex = 0;

            if (pageIndex >= 0)
            {
                startIndex = pageSize * pageIndex;
            }

            WK.BLL.bus_market bll = new WK.BLL.bus_market();
            ds = bll.GetListByPageInfo(strWhere.ToString(), orderby.ToString(), startIndex, pageSize);
            return(Newtonsoft.Json.JsonConvert.SerializeObject(ds.Tables[0]));
        }
Example #5
0
        private string editData(HttpContext context)
        {
            WK.Model.bus_market model = new Model.bus_market();

            model.id = 0;
            if (context.Request.Params["id"] != null && context.Request.Params["id"].ToString() != "")
            {
                model.id = int.Parse(context.Request.Params["id"]);
            }
            model.address = context.Request.Params["address"];
            model.area_id = 0;
            if (context.Request.Params["area_id"] != null &&
                context.Request.Params["area_id"].ToString() != "")
            {
                model.area_id = int.Parse(context.Request.Params["area_id"]);
            }
            model.description_cn = context.Request.Params["description_cn"];
            model.description_en = context.Request.Params["description_en"];
            model.lat            = decimal.Parse(context.Request.Params["lat"]);
            model.lon            = decimal.Parse(context.Request.Params["lon"]);
            model.market_type    = context.Request.Params["market_type"];
            model.markket_code   = context.Request.Params["markket_code"];
            model.name_cn        = context.Request.Params["name_cn"];
            model.name_en        = context.Request.Params["name_en"];
            model.remark         = context.Request.Params["remark"];
            model.sort           = int.Parse(context.Request.Params["sort"]);
            model.status         = int.Parse(context.Request.Params["status"]);
            model.address        = context.Request.Params["address"];


            WK.BLL.bus_market bll = new WK.BLL.bus_market();
            int market_id         = 0;

            if (model.id > 0)
            {
                market_id = model.id;
            }
            else
            {
                market_id = bll.GetMaxId();
            }
            ReturnInfo returnInfo = new ReturnInfo();

            returnInfo.isSuccess = model.id > 0 ? bll.Update(model) : bll.Add(model);

            #region 自提点列表
            int pickup_address_id = 0;
            if (context.Request.Params["pickup_address_id"] != null &&
                context.Request.Params["pickup_address_id"].ToString() != "")
            {
                pickup_address_id = int.Parse(context.Request.Params["pickup_address_id"]);
            }
            if (pickup_address_id > 0)
            {
                WK.BLL.bus_pickup_market marketBll = new BLL.bus_pickup_market();
                StringBuilder            strWhere  = new StringBuilder();
                strWhere.Append(" is_delete != 1");
                strWhere.AppendFormat(" and market_id = {0}", market_id);
                DataSet ds = new DataSet();
                ds = marketBll.GetList(strWhere.ToString());
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                }
                else
                {
                    WK.Model.bus_pickup_market marketModel = new Model.bus_pickup_market();
                    marketModel.is_delete         = 0;
                    marketModel.market_id         = market_id;
                    marketModel.pickup_address_id = pickup_address_id;
                    marketBll.Add(marketModel);
                }
            }
            #endregion

            #region 图片列表

            WK.BLL.bus_image imageBll   = new BLL.bus_image();
            StringBuilder    imageWhere = new StringBuilder();
            imageWhere.Append(" is_delete != 1");
            imageWhere.AppendFormat(" and correlation_id  = {0}", market_id);
            imageWhere.AppendFormat(" and bus_type   = {0}", 1);
            DataSet dsImage = new DataSet();
            dsImage = imageBll.GetList(imageWhere.ToString());

            if (dsImage != null && dsImage.Tables.Count > 0 && dsImage.Tables[0].Rows.Count > 0)
            {
                int imageCount = dsImage.Tables[0].Rows.Count;
                for (int i = 0; i < imageCount; i++)
                {
                    int imageId = int.Parse(dsImage.Tables[0].Rows[i]["id"].ToString());
                    imageBll.Delete(imageId);
                }
            }

            string imageList      = context.Request.Params["imageList"].ToString();
            Object anArray        = Newtonsoft.Json.JsonConvert.DeserializeObject(imageList);
            int    imageListCount = ((Newtonsoft.Json.Linq.JContainer)(anArray)).Count;
            for (int i = 0; i < imageListCount; i++)
            {
                string             imageKey   = ((Newtonsoft.Json.Linq.JContainer)(anArray))[i]["imageKey"].ToString();
                WK.Model.bus_image imageModel = new Model.bus_image();
                imageModel.bus_type       = 1; //业务类型(商户/菜)
                imageModel.correlation_id = market_id;
                imageModel.img_type       = 1; //图片类型(详情图/缩略图)
                imageModel.is_delete      = 0;
                imageModel.url            = imageKey;
                imageBll.Add(imageModel);
            }
            #endregion

            return(Newtonsoft.Json.JsonConvert.SerializeObject(returnInfo));
        }