Exemple #1
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);
            }
        }
Exemple #2
0
        /// <summary>
        /// 添加
        /// </summary>
        private void add()
        {
            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.Exists(area.A_Code))
                    {
                        untCommon.InfoMsg("区域编码已存在!");
                    }
                    else
                    {
                        if (areabll.Add(area) > 0)
                        {
                            frmParent.loadArea();
                            untCommon.InfoMsg("添加成功!");
                        }
                        else
                        {
                            untCommon.InfoMsg("添加失败!");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                untCommon.InfoMsg("区域管理添加数据异常:" + ex.Message);
            }
        }