Exemplo n.º 1
0
        /**
         *
         * 查询区域表信息*
         *
         ***/
        protected void Select(object sender, EventArgs e)
        {
            //获取前台数据
            string REGION_NAME = region_name.Value;

            Re_Leng(REGION_NAME, "区域名");
            string SUBINVENTORY_KEY = Request.Form["subinventory_name"];

            if (SUBINVENTORY_KEY == "ALL")
            {
                SUBINVENTORY_KEY = "";
            }
            string CREATE_BY = create_by.Value;
            string ENABLED   = enabled.Value;

            if (ENABLED == "ALL")
            {
                ENABLED = "";
            }

            //查询区域表数据
            RegionDC regionDC = new RegionDC();
            DataSet  ds       = new DataSet();

            ds = regionDC.searchRegionByFourParameters(REGION_NAME, SUBINVENTORY_KEY, CREATE_BY, ENABLED);
            if (ds == null)
            {
                if (REGION_NAME == string.Empty && SUBINVENTORY_KEY == string.Empty && CREATE_BY == string.Empty && ENABLED == string.Empty)
                {
                    PageUtil.showToast(this, "区域表中无任何数据!");
                }
                else
                {
                    PageUtil.showToast(this, "区域表中无符合条件的数据!");
                }
            }
            else
            {
                Line_Repeater.DataSource = ds;
                Line_Repeater.DataBind();
            }
        }
Exemplo n.º 2
0
        /**
         *
         * 新增区域表信息*
         *
         ***/
        protected void Insert(object sender, EventArgs e)
        {
            //获取输入的数据
            string REGION_NAME1 = region_name1.Value;

            Re_Leng(REGION_NAME1, "区域名");
            string SUBINVENTORY_KEY1 = Request.Form["subinventory_name1"];
            string ENABLED1          = enabled1.Value;
            string DESCRIPTION1      = description1.Value;

            Des_Leng(DESCRIPTION1, "描述");
            string CREATE_BY1 = Session["LoginName"].ToString();

            //选择库别
            if (SUBINVENTORY_KEY1 == "-----请选择库别-----")
            {
                PageUtil.showToast(this, "请选择库别!");
                return;
            }

            //判断区域名是否全为空
            if (REGION_NAME1 == string.Empty)
            {
                PageUtil.showToast(this, "区域名不能为空!");
                return;
            }

            //判断创建者是否为空
            if (Session["LoginId"] == null)
            {
                PageUtil.showToast(this, "创建者为空!");
                return;
            }



            //将数据插入数据表
            RegionDC regionDC1 = new RegionDC();
            DataSet  ds        = new DataSet();

            ds = regionDC1.searchRegionByFourParameters(REGION_NAME1, "", "", "");
            if (ds != null)
            {
                PageUtil.showToast(this, "该区域已存在!");
            }
            else
            {
                try
                {
                    ds = regionDC1.insertRegion(REGION_NAME1, SUBINVENTORY_KEY1, CREATE_BY1, ENABLED1, DESCRIPTION1);
                    Line_Repeater.DataSource = ds;
                    Line_Repeater.DataBind();
                }
                catch
                {
                    PageUtil.showAlert(this, "新增区域表信息失败!");
                }
            }
            region_name1.Value = String.Empty;
            description1.Value = String.Empty;
        }