Exemplo n.º 1
0
        private string getAreaList(HttpContext context)
        {
            StringBuilder sb       = new StringBuilder();
            DataSet       ds       = new DataSet();
            StringBuilder strWhere = new StringBuilder();

            strWhere.Append(" is_delete != 1");

            WK.BLL.bus_area bll = new WK.BLL.bus_area();
            ds = bll.GetList(strWhere.ToString());
            DataTable dt = new DataTable();

            dt.Columns.Add("data", typeof(System.Int32));
            dt.Columns.Add("value", typeof(System.String));
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                int l = ds.Tables[0].Rows.Count;
                for (int i = 0; i < l; i++)
                {
                    DataRow row = dt.NewRow();
                    row["data"]  = ds.Tables[0].Rows[i]["id"];
                    row["value"] = ds.Tables[0].Rows[i]["name"];
                    dt.Rows.Add(row);
                }
            }
            return(Newtonsoft.Json.JsonConvert.SerializeObject(dt));
        }
Exemplo n.º 2
0
        private string getListCount(HttpContext context)
        {
            StringBuilder strWhere = new StringBuilder();

            strWhere.Append(" is_delete != 1");
            WK.BLL.bus_area bll = new WK.BLL.bus_area();
            Record          r   = new Record();

            r.RecordCount = bll.GetListCount(strWhere.ToString());
            return(Newtonsoft.Json.JsonConvert.SerializeObject(r));
        }
Exemplo n.º 3
0
        private string getDataList0(HttpContext context)
        {
            StringBuilder strWhere = new StringBuilder();

            strWhere.Append(" is_delete != 1");
            strWhere.AppendFormat(" and parent_id  = 0");
            WK.BLL.bus_area bll = new WK.BLL.bus_area();
            DataSet         ds  = new DataSet();

            ds = bll.GetListByPageInfo(strWhere.ToString(), "", 0, 100);
            return(Newtonsoft.Json.JsonConvert.SerializeObject(ds.Tables[0]));
        }
Exemplo n.º 4
0
        private string getDataDetail(HttpContext context)
        {
            string id = "";

            if (context.Request.Params["id"] != null)
            {
                id = context.Request.Params["id"];
            }
            WK.BLL.bus_area   bll   = new WK.BLL.bus_area();
            WK.Model.bus_area model = bll.GetModel(int.Parse(id));
            return(Newtonsoft.Json.JsonConvert.SerializeObject(model));
        }
Exemplo n.º 5
0
        private string deleteData(HttpContext context)
        {
            ReturnInfo returnInfo = new ReturnInfo();

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

            if (id > 0)
            {
                WK.Model.bus_area model = bll.GetModel(id);
                model.is_delete      = 1;
                returnInfo.isSuccess = bll.Update(model);
            }
            return(Newtonsoft.Json.JsonConvert.SerializeObject(returnInfo));
        }
Exemplo n.º 6
0
        private string editData(HttpContext context)
        {
            WK.Model.bus_area model = new Model.bus_area();
            model.id = 0;
            if (context.Request.Params["id"].ToString() != "")
            {
                model.id = int.Parse(context.Request.Params["id"]);
            }
            model.area_type = 1;// int.Parse(context.Request.Params["area_type"]);
            model.lat       = decimal.Parse(context.Request.Params["lat"]);
            model.lon       = decimal.Parse(context.Request.Params["lon"]);
            model.name      = context.Request.Params["name"];
            model.parent_id = int.Parse(context.Request.Params["parent_id"]);
            //model.remark = context.Request.Params["remark"];

            WK.BLL.bus_area bll        = new WK.BLL.bus_area();
            ReturnInfo      returnInfo = new ReturnInfo();

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

            return(Newtonsoft.Json.JsonConvert.SerializeObject(returnInfo));
        }
Exemplo n.º 7
0
        private string getDataList(HttpContext context)
        {
            StringBuilder strWhere = new StringBuilder();

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

            orderby.Append("parent_id,id");

            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_area bll = new WK.BLL.bus_area();
            DataSet         ds  = new DataSet();

            ds = bll.GetListByPageInfo(strWhere.ToString(), orderby.ToString(), startIndex, pageSize);
            return(Newtonsoft.Json.JsonConvert.SerializeObject(ds.Tables[0]));
        }