/// <summary>
    /// 展示数据
    /// </summary>
    /// <param name="id">记录Id</param>
    private void ShowInfo(int id)
    {
        LMaterialBB materialBB = new LMaterialBB();
        vLMaterialData model = new vLMaterialData();

        try
        {
            model = materialBB.GetVModel(id);

            this.lbMaterialNo.Text = model.materialNo;//物料编码
            this.lbMaterialDesc.Text = model.materialDesc;//物料描述
            this.lbIsRoutinePackageDesc.Text = model.isRoutinePackageDesc;//是否常规包装
            this.lbIsStandardBoxDesc.Text = model.isStandardBoxDesc;//是否标准箱
            this.lbInvntryUom.Text = model.invntryUom;//计量单位
            this.lbU_CNSize.Text = model.U_CNSize;//规格型号
            this.lbU_UintQty.Text = model.U_UintQty.ToString();//单体数量
            this.lbU_BoxQty.Text = model.U_BoxQty.ToString();//整箱数量
            this.lbU_Material.Text = model.U_Material.ToString();//材质
            this.lbU_StanWiht.Text = model.U_StanWiht.ToString();//标准重量
            this.tbSystemWeight.Text = model.systemWeight.ToString();
            this.tbWeightDiffWaring.Text = model.weightDiffWaring.ToString();//单个称重差异预警值(KG)
            this.ddlWareSort.SelectedValue = model.wareSortNo;//库位分类
        }
        finally
        {
            materialBB.Dispose();
        }
    }
    /// <summary>
    /// 展示数据
    /// </summary>
    /// <param name="id">记录Id</param>
    private void ShowInfo(int id)
    {
        LMaterialBB materialBB = new LMaterialBB();
        vLMaterialData model = new vLMaterialData();
        try
        {
            model = materialBB.GetVModel(id);
            this.id.Text = model.id.ToString();
            this.materialNo.Text = model.materialNo;
            this.materialDesc.Text = model.materialDesc;
            this.materialGroup.Text = model.materialGroup.ToString();
            this.invntItem.Text = model.invntItem;
            this.buyUnitMsr.Text = model.buyUnitMsr;
            this.numInBuy.Text = model.numInBuy.ToString();
            this.salUnitMsr.Text = model.salUnitMsr;
            this.numInSale.Text = model.numInSale.ToString();
            this.isStocked.Text = model.isStocked;
            this.isRoutinePackage.Text = model.isRoutinePackage;
            this.isStandardBox.Text = model.isStandardBox;
            this.manBtchNum.Text = model.manBtchNum;
            this.validFor.Text = model.validFor;

            if (model.validFrom != string.Empty && model.validFrom != null)
            {
                DateTime validFrom = Convert.ToDateTime(model.validFrom);
                this.validFrom.Text = validFrom.ToShortDateString();
            }

            if (model.validTo != string.Empty && model.validTo != null)
            {
                DateTime validTo = Convert.ToDateTime(model.validTo);
                this.validTo.Text = validTo.ToShortDateString();
            }

            this.frozenFor.Text = model.frozenFor;

            if (model.frozenFrom != string.Empty && model.frozenFrom != null)
            {
                DateTime frozenFrom = Convert.ToDateTime(model.frozenFrom);
                this.frozenFrom.Text = frozenFrom.ToShortDateString();
            }

            if (model.frozenTo != string.Empty && model.frozenTo != null)
            {
                DateTime frozenTo = Convert.ToDateTime(model.frozenTo);
                this.frozenTo.Text = frozenTo.ToShortDateString();
            }

            this.invntryUom.Text = model.invntryUom;
            this.U_CNSize.Text = model.U_CNSize;
            this.U_ENSize.Text = model.U_ENSize;
            this.U_StanWiht.Text = model.U_StanWiht.ToString();
            this.U_PullStan.Text = model.U_PullStan;
            this.U_DrawHlink.Text = model.U_DrawHlink;
            this.U_LablHlink.Text = model.U_LablHlink;
            this.U_CCVOHlink.Text = model.U_CCVOHlink;
            this.U_UintQty.Text = model.U_UintQty.ToString();
            this.U_BoxQty.Text = model.U_BoxQty.ToString();
            this.U_CodeNo.Text = model.U_CodeNo;
            this.U_BoxSize.Text = model.U_BoxSize;
            this.materialNm_CH.Text = model.materialNm_CH;
            this.materialNm_EN.Text = model.materialNm_EN;
            this.U_PackWay.Text = model.U_PackWay;
            this.wareSortNo.Text = model.wareSortNo;
            this.weightDiffWaring.Text = model.weightDiffWaring.ToString();
        }
        finally
        {
            materialBB.Dispose();
        }
    }
        /// <summary>
        /// 得到一个视图model
        /// </summary>
        /// <param name="id">主键值</param>
        /// <returns>model</returns>
        public vLMaterialData GetVModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(@"select id,materialNo,materialDesc,materialFrgnDesc,materialGroup,invntItem,buyUnitMsr,numInBuy,salUnitMsr,numInSale,isStocked,
                            isRoutinePackage,isStandardBox,manBtchNum,validFor,validFrom,validTo,frozenFor,frozenFrom,frozenTo,invntryUom,
                            U_CNSize,U_ENSize,U_StanWiht,U_PullStan,U_DrawHlink,U_LablHlink,U_CCVOHlink,U_UintQty,U_BoxQty,U_CodeNo,
                            U_BoxSize,materialNm_CH,materialNm_EN,U_PackWay,wareSortNo,weightDiffWaring,systemWeight,isrtEmpId,isrtDt,updtEmpId,
                            updtDt,isrtEmpNm,updtEmpNm,wareSortNm,isStockedDesc,isRoutinePackageDesc,isStandardBoxDesc,U_Material,DEType,DETypeDesc from vLMaterial");
            strSql.Append(" where id = @id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int)
                };
            parameters[0].Value = id;

            vLMaterialData model = new vLMaterialData();
            DataSet ds = SqlHelper.ExecuteDataset(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow row = ds.Tables[0].Rows[0];
                if (row["id"] != DBNull.Value)
                {
                    model.id = Convert.ToInt32(row["id"]);
                }
                if (row["materialNo"] != DBNull.Value)
                {
                    model.materialNo = Convert.ToString(row["materialNo"]);
                }
                if (row["materialDesc"] != DBNull.Value)
                {
                    model.materialDesc = Convert.ToString(row["materialDesc"]);
                }
                if (row["materialFrgnDesc"] != DBNull.Value)
                {
                    model.materialFrgnDesc = Convert.ToString(row["materialFrgnDesc"]);
                }
                if (row["materialGroup"] != DBNull.Value)
                {
                    model.materialGroup = Convert.ToInt16(row["materialGroup"]);
                }
                if (row["invntItem"] != DBNull.Value)
                {
                    model.invntItem = Convert.ToString(row["invntItem"]);
                }
                if (row["buyUnitMsr"] != DBNull.Value)
                {
                    model.buyUnitMsr = Convert.ToString(row["buyUnitMsr"]);
                }
                if (row["numInBuy"] != DBNull.Value)
                {
                    model.numInBuy = Convert.ToDecimal(row["numInBuy"]);
                }
                if (row["salUnitMsr"] != DBNull.Value)
                {
                    model.salUnitMsr = Convert.ToString(row["salUnitMsr"]);
                }
                if (row["numInSale"] != DBNull.Value)
                {
                    model.numInSale = Convert.ToDecimal(row["numInSale"]);
                }
                if (row["isStocked"] != DBNull.Value)
                {
                    model.isStocked = Convert.ToString(row["isStocked"]);
                }
                if (row["isRoutinePackage"] != DBNull.Value)
                {
                    model.isRoutinePackage = Convert.ToString(row["isRoutinePackage"]);
                }
                if (row["isStandardBox"] != DBNull.Value)
                {
                    model.isStandardBox = Convert.ToString(row["isStandardBox"]);
                }
                if (row["manBtchNum"] != DBNull.Value)
                {
                    model.manBtchNum = Convert.ToString(row["manBtchNum"]);
                }
                if (row["validFor"] != DBNull.Value)
                {
                    model.validFor = Convert.ToString(row["validFor"]);
                }
                if (row["validFrom"] != DBNull.Value)
                {
                    model.validFrom = Convert.ToString(row["validFrom"]);
                }
                if (row["validTo"] != DBNull.Value)
                {
                    model.validTo = Convert.ToString(row["validTo"]);
                }
                if (row["frozenFor"] != DBNull.Value)
                {
                    model.frozenFor = Convert.ToString(row["frozenFor"]);
                }
                if (row["frozenFrom"] != DBNull.Value)
                {
                    model.frozenFrom = Convert.ToString(row["frozenFrom"]);
                }
                if (row["frozenTo"] != DBNull.Value)
                {
                    model.frozenTo = Convert.ToString(row["frozenTo"]);
                }
                if (row["invntryUom"] != DBNull.Value)
                {
                    model.invntryUom = Convert.ToString(row["invntryUom"]);
                }
                if (row["U_CNSize"] != DBNull.Value)
                {
                    model.U_CNSize = Convert.ToString(row["U_CNSize"]);
                }
                if (row["U_ENSize"] != DBNull.Value)
                {
                    model.U_ENSize = Convert.ToString(row["U_ENSize"]);
                }
                if (row["U_StanWiht"] != DBNull.Value)
                {
                    model.U_StanWiht = Convert.ToDecimal(row["U_StanWiht"]);
                }
                if (row["U_PullStan"] != DBNull.Value)
                {
                    model.U_PullStan = Convert.ToString(row["U_PullStan"]);
                }
                if (row["U_DrawHlink"] != DBNull.Value)
                {
                    model.U_DrawHlink = Convert.ToString(row["U_DrawHlink"]);
                }
                if (row["U_LablHlink"] != DBNull.Value)
                {
                    model.U_LablHlink = Convert.ToString(row["U_LablHlink"]);
                }
                if (row["U_CCVOHlink"] != DBNull.Value)
                {
                    model.U_CCVOHlink = Convert.ToString(row["U_CCVOHlink"]);
                }
                if (row["U_UintQty"] != DBNull.Value)
                {
                    model.U_UintQty = Convert.ToDecimal(row["U_UintQty"]);
                }
                if (row["U_BoxQty"] != DBNull.Value)
                {
                    model.U_BoxQty = Convert.ToDecimal(row["U_BoxQty"]);
                }
                if (row["U_CodeNo"] != DBNull.Value)
                {
                    model.U_CodeNo = Convert.ToString(row["U_CodeNo"]);
                }
                if (row["U_BoxSize"] != DBNull.Value)
                {
                    model.U_BoxSize = Convert.ToString(row["U_BoxSize"]);
                }
                if (row["materialNm_CH"] != DBNull.Value)
                {
                    model.materialNm_CH = Convert.ToString(row["materialNm_CH"]);
                }
                if (row["materialNm_EN"] != DBNull.Value)
                {
                    model.materialNm_EN = Convert.ToString(row["materialNm_EN"]);
                }
                if (row["U_PackWay"] != DBNull.Value)
                {
                    model.U_PackWay = Convert.ToString(row["U_PackWay"]);
                }
                if (row["wareSortNo"] != DBNull.Value)
                {
                    model.wareSortNo = Convert.ToString(row["wareSortNo"]);
                }
                if (row["weightDiffWaring"] != DBNull.Value)
                {
                    model.weightDiffWaring = Convert.ToDouble(row["weightDiffWaring"]);
                }
                if (row["systemWeight"] != DBNull.Value)
                {
                    model.systemWeight = Convert.ToDouble(row["systemWeight"]);
                }
                if (row["isrtEmpId"] != DBNull.Value)
                {
                    model.isrtEmpId = Convert.ToInt32(row["isrtEmpId"]);
                }
                if (row["isrtDt"] != DBNull.Value)
                {
                    model.isrtDt = Convert.ToString(row["isrtDt"]);
                }
                if (row["updtEmpId"] != DBNull.Value)
                {
                    model.updtEmpId = Convert.ToInt32(row["updtEmpId"]);
                }
                if (row["updtDt"] != DBNull.Value)
                {
                    model.updtDt = Convert.ToString(row["updtDt"]);
                }
                if (row["isrtEmpNm"] != DBNull.Value)
                {
                    model.isrtEmpNm = Convert.ToString(row["isrtEmpNm"]);
                }
                if (row["updtEmpNm"] != DBNull.Value)
                {
                    model.updtEmpNm = Convert.ToString(row["updtEmpNm"]);
                }
                if (row["wareSortNm"] != DBNull.Value)
                {
                    model.wareSortNm = Convert.ToString(row["wareSortNm"]);
                }
                if (row["isStockedDesc"] != DBNull.Value)
                {
                    model.isStockedDesc = Convert.ToString(row["isStockedDesc"]);
                }
                if (row["isRoutinePackageDesc"] != DBNull.Value)
                {
                    model.isRoutinePackageDesc = Convert.ToString(row["isRoutinePackageDesc"]);
                }
                if (row["isStandardBoxDesc"] != DBNull.Value)
                {
                    model.isStandardBoxDesc = Convert.ToString(row["isStandardBoxDesc"]);
                }
                if (row["U_Material"] != DBNull.Value)
                {
                    model.U_Material = Convert.ToString(row["U_Material"]);
                }
                if (row["DEType"] != DBNull.Value)
                {
                    model.DEType = Convert.ToBoolean(row["DEType"]);
                }
                if (row["DETypeDesc"] != DBNull.Value)
                {
                    model.DETypeDesc = Convert.ToString(row["DETypeDesc"]);
                }
                return model;
            }
            else
            {
                return null;
            }
        }