private void Lock(HttpContext context)
        {
            bool flag = false;
            string id = "";
            string opt = "";

            if (null != context.Request.QueryString["id"])
            {
                id = context.Request.QueryString["id"].ToString().Trim();
            }

            Model.T_DemandSupplyBalance t_balance = new T_DemandSupplyBalance();
            t_balance = bll_demand_supply_balance.GetModel(Convert.ToInt32(id));
            if (t_balance.isDeleted == 1)
            {
                t_balance.isDeleted = 0;
                opt = "开启";
            }
            else
            {
                t_balance.isDeleted = 1;
                opt = "关闭";
            }
            flag = bll_demand_supply_balance.Update(t_balance);

            message = new Message();
            if (flag)
            {
                message.flag = true;
                message.msg = opt + "成功";
            }
            else
            {
                message.flag = false;
                message.msg = opt + "失败";
            }
            context.Response.Write(JsonHelper.Object2Json<Message>(message));//返回给前台页面
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Maticsoft.Model.T_DemandSupplyBalance model)
 {
     return(dal.Update(model));
 }
        /// <summary>
        /// 添加占补平衡到批次中
        /// </summary>
        /// <param name="context"></param>
        private void AddDemandSupplyBalanceToBatch(HttpContext context)
        {
            string batchId, dsBalanceId, consArea, agriArea, arabArea;
            batchId = dsBalanceId = consArea = agriArea = arabArea = "";
            if (null != context.Request.QueryString["batchId"])
            {
                batchId = context.Request.QueryString["batchId"].ToString().Trim();
            }
            if (null != context.Request.QueryString["dsBalanceId"])
            {
                dsBalanceId = context.Request.QueryString["dsBalanceId"].ToString().Trim();
            }
            if (null != context.Request.QueryString["consArea"])
            {
                consArea = context.Request.QueryString["consArea"].ToString().Trim();
            }
            if (null != context.Request.QueryString["agriArea"])
            {
                agriArea = context.Request.QueryString["agriArea"].ToString().Trim();
            }
            if (null != context.Request.QueryString["arabArea"])
            {
                arabArea = context.Request.QueryString["arabArea"].ToString().Trim();
            }

            Model.T_Batch_Demand_Supply_Balance t_batch_balance = new T_Batch_Demand_Supply_Balance();
            if (dsBalanceId != "")
            {
                t_batch_balance.dsBalanceId = Convert.ToInt32(dsBalanceId);
            }
            else
            {
                t_batch_balance.dsBalanceId = 0;
            }
            if (batchId != "")
            {
                t_batch_balance.batchId = Convert.ToInt32(batchId);
            }
            else
            {
                t_batch_balance.batchId = 0;
            }
            if (consArea != "")
            {
                t_batch_balance.consArea = Convert.ToDecimal(consArea);
            }
            else
            {
                t_batch_balance.consArea = 0;
            }
            if (agriArea != "")
            {
                t_batch_balance.agriArea = Convert.ToDecimal(agriArea);
            }
            else
            {
                t_batch_balance.agriArea = 0;
            }
            if (arabArea != "")
            {
                t_batch_balance.arabArea = Convert.ToDecimal(arabArea);
            }
            else
            {
                t_batch_balance.arabArea = 0;
            }
            t_batch_balance.createTime = System.DateTime.Now;
            int n = bll_batch_ds_balance.Add(t_batch_balance);

            bool flag = true;

            if (t_batch_balance.batchId == 4)
            { //增减挂钩拆旧
                //农用地面积=0,耕地面积>0时,补充至耕地面积=剩余的耕地面积
                RemainArea1 remainAera = BusinessHelper.GetRemainAreaByBalanceId(t_batch_balance.dsBalanceId);
                if (Convert.ToInt32(remainAera.agriArea) == 0&&Convert.ToInt32(remainAera.arabArea) > 0)
                {
                    flag = false;

                     Model.T_DemandSupplyBalance t_balance = bll_ds_balance.GetModel(t_batch_balance.dsBalanceId);

                    //1、修改拆旧信息
                    t_balance.adjustArea = remainAera.arabArea;
                    t_balance.des = "xxx";
                    bll_ds_balance.Update(t_balance);

                    //2、插入复垦信息
                    Model.T_DemandSupplyBalance t_balance_new = new T_DemandSupplyBalance();
                    t_balance_new.typeId = 1;
                    t_balance_new.year = t_balance.year;
                    t_balance_new.administratorArea = t_balance.administratorArea;
                    t_balance_new.name = t_balance.name + " 【转为复垦】";
                    t_balance_new.no = t_balance.no + " 【转为复垦】";

                    t_balance_new.agriArea = 0;
                    t_balance_new.arabArea = remainAera.arabArea;
                    t_balance_new.scale = remainAera.arabArea;
                    t_balance_new.adjustArea = 0;
                    t_balance_new.des = t_balance.no +"耕地"+remainAera.arabArea+ " 【转为复垦】";
                    t_balance_new.isDeleted = 0;
                    t_balance_new.isSubmited = 1;
                    t_balance_new.createTime = System.DateTime.Now;
                    t_balance_new.batchId = t_batch_balance.batchId;
                    bll_ds_balance.Add(t_balance_new);

                    message.flag = true;
                    message.msg = "添加成功,该拆旧剩余农用地=0,耕地>0,耕地自动转为复垦.";
                }
            }

            if (flag){
                if (n > 0)
                {
                    message.flag = true;
                    message.msg = "添加成功";
                }
                else
                {
                    message.flag = false;
                    message.msg = "添加失败";
                }
            }

            context.Response.Write(JsonHelper.Object2Json<Message>(message));
        }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Maticsoft.Model.T_DemandSupplyBalance model)
 {
     return(dal.Add(model));
 }