示例#1
0
        /// <summary>
        /// 修改
        /// </summary>
        private void update()
        {
            try
            {
                if (check())
                {
                    Area area = new Area();

                    area.A_Code   = A_Code.Text;
                    area.A_Name   = A_Name.Text;
                    area.A_Parent = A_Parent.SelectedIndex < 0 ? "" : A_Parent.SelectedValue.ToString();

                    AreaBLL areabll = new AreaBLL();
                    if (areabll.Edit(area) > 0)
                    {
                        frmParent.loadArea();
                        untCommon.InfoMsg("修改成功!");
                    }
                    else
                    {
                        untCommon.InfoMsg("修改失败!");
                    }
                }
            }
            catch (Exception ex)
            {
                untCommon.InfoMsg("区域管理更新数据异常:" + ex.Message);
            }
        }
示例#2
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                LoginUser loginUser = new LoginUser(context, "Area");
                if (!loginUser.Pass)//权限验证
                {
                    return;
                }

                AreaBLL bll = new AreaBLL(context, loginUser);
                if (context.Request["action"] == "treeLoad")
                {//加载树
                    bll.LoadTree();
                }
                else if (context.Request["action"] == "load")
                {//加载信息
                    bll.Load(context.Request["areaId"]);
                }
                else if (context.Request["action"] == "add")
                {//增加
                    TBArea area = new TBArea();
                    area.areaCode  = context.Request.Form["areaCode"];
                    area.areaName  = context.Request.Form["areaName"];
                    area.isUse     = context.Request.Form["isUse"];
                    area.parentId  = context.Request.Form["parentId"];
                    area.areaLayer = int.Parse(context.Request.Form["areaLayer"]);
                    area.areaIndex = int.Parse(context.Request.Form["areaIndex"]);
                    bll.Add(area);
                }
                else if (context.Request["action"] == "edit")
                {//修改
                    TBArea area = new TBArea();
                    area.areaId    = context.Request["areaId"];
                    area.areaCode  = context.Request.Form["areaCode"];
                    area.areaName  = context.Request.Form["areaName"];
                    area.parentId  = context.Request.Form["parentId"];
                    area.isUse     = context.Request.Form["isUse"];
                    area.areaIndex = int.Parse(context.Request.Form["areaIndex"]);
                    bll.Edit(area);
                }
                else if (context.Request["action"] == "delete")
                {//删除
                    string areaId = context.Request["areaId"];
                    bll.Delete(areaId);
                }
            }
            catch (Exception e)
            {
                Message.error(context, e.Message);
            }
        }