Beispiel #1
0
    /// <summary>
    /// 绑定货位分类下拉框
    /// </summary>
    public void BindWareSort(DropDownList ddlWareSort)
    {
        using (LWareSortBB wareSortBB = new LWareSortBB())
        {
            DataSet ds = new DataSet();
            ds = wareSortBB.GetList("isDel=0");

            ddlWareSort.DataTextField = "wareSortNm";
            ddlWareSort.DataValueField = "wareSortNo";
            ddlWareSort.DataSource = ds.Tables[0];
            ddlWareSort.DataBind();
            ddlWareSort.Items.Insert(0, new ListItem("-请选择-", ""));
        }
    }
    /// <summary>
    /// 验证页面信息
    /// </summary>
    /// <param name="strErrorInfo">错误提示信息</param>
    /// <returns></returns>
    private bool ValidateData(out string strErrorInfo)
    {
        LWareSortBB wareSortBB = new LWareSortBB();

        try
        {
            strErrorInfo = "";
            DataSet ds = new DataSet();

            if (this.tbWareSortNo.Text.Trim() == "")
            {
                strErrorInfo = "请首先填写货位分类编码!";
                this.tbWareSortNo.Focus();
                return false;
            }

            //判断货位分类编码是否重复
            ds = wareSortBB.GetList("wareSortNo='" + this.tbWareSortNo.Text.Trim().Replace("'", "''") + "' and id<>" + this.IdValue.ToString());
            if (ds.Tables[0].Rows.Count > 0)
            {
                strErrorInfo = "货位分类编码重复!";
                this.tbWareSortNo.Focus();
                return false;
            }

            if (this.tbWareSortNm.Text.Trim() == "")
            {
                strErrorInfo = "请首先填写货位分类名称!";
                this.tbWareSortNm.Focus();
                return false;
            }

            return true;
        }
        finally
        {
            wareSortBB.Dispose();
        }
    }