Example #1
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Maticsoft.Model.T_LandBlock model)
 {
     return(dal.Update(model));
 }
        private void AddOrModify(HttpContext context)
        {
            string batchId, name, area, des;
            batchId = name = area  = des = "";
            if (null != context.Request.QueryString["batchId"])
            {
                batchId = context.Request.QueryString["batchId"].ToString().Trim();
            }
            if (null != context.Request.QueryString["name"])
            {
                name = context.Request.QueryString["name"].ToString().Trim();
            }
            if (null != context.Request.QueryString["area"])
            {
                area = context.Request.QueryString["area"].ToString().Trim();
            }
            if (null != context.Request.QueryString["des"])
            {
                des = context.Request.QueryString["des"].ToString().Trim();
            }

            Model.T_LandBlock model = new T_LandBlock();
            model.name = name;
            if (batchId != "")
            {
                model.batchId = Convert.ToInt32(batchId);
            }
            else
            {
                model.batchId = 0;
            }
            if (area != "")
            {
                model.area = Convert.ToDecimal(area);
            }
            else
            {
                model.area = 0;
            }
            if (context.Session["user_id"] != null && context.Session["user_id"].ToString() != "")
            {
                model.userId = Convert.ToInt32(context.Session["user_id"].ToString());
            }
            model.createTime = System.DateTime.Now;
            model.isDeleted = 0; model.isSubmited = 0;
            model.des = des;

            int n = bll_land_block.Add(model);
            if (n > 0)
            {
                message.flag = true;
                message.msg = "添加成功";
            }
            else
            {
                message.flag = false;
                message.msg = "添加失败";
            }
            context.Response.Write(JsonHelper.Object2Json<Message>(message));
        }
Example #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Maticsoft.Model.T_LandBlock model)
 {
     return(dal.Add(model));
 }
 private void GetModelById(HttpContext context)
 {
     //获取id
     string id = "";
     Model.T_LandBlock t_landblock = new T_LandBlock();
     if (null != context.Request.QueryString["id"])
     {
         id = context.Request.QueryString["id"].ToString().Trim();
         t_landblock = bll_land_block.GetModel(Convert.ToInt32(id));
     }
     context.Response.Write(JsonHelper.Object2Json<T_LandBlock>(t_landblock));
 }