Exemple #1
0
 private void BindChild()
 {
     if (Session["child"] != null)
     {
         DataTable dtchild = Session["child"] as DataTable;
         if (!dtchild.Columns.Contains("cnnBaseQtyN"))
         {
             dtchild.Columns.Add("cnnBaseQtyN");
         }
         if (Session["bom"] != null)
         {
             DataTable dtbom = Session["bom"] as DataTable;
             foreach (DataRow dr in dtchild.Rows)
             {
                 Entity.Inventory inv = new AMSApp.zhenghua.Entity.Inventory(dr);
                 DataRow[]        drs = dtbom.Select("cnvcComponentInvCode='" + inv.cnvcInvCode + "'");
                 if (drs.Length > 0)
                 {
                     Entity.BillOfMaterials bom = new BillOfMaterials(drs[0]);
                     dr["cnnBaseQtyN"] = bom.cnnBaseQtyN;
                 }
             }
         }
         this.DataTableConvert(dtchild, "cnvcProduceUnitCode", "cnvcProduceUnitCodeName", "tbComputationUnit", "cnvcComUnitCode", "cnvcComUnitName", "");
         this.dgBOM.DataSource = dtchild;
         this.dgBOM.DataBind();
     }
     else
     {
         Entity.Inventory inv     = new Entity.Inventory();
         DataTable        dtchild = inv.ToTable().Clone();
         dtchild.Columns.Add("cnnBaseQtyN");
         this.dgBOM.DataSource = dtchild;
         this.dgBOM.DataBind();
     }
 }