private void InsertDetail(int i, DataView dv, string pModule)
        {
            HtmlTableRow htr = this.tablea.FindControl(dv.Table.Rows[i]["TYPENAME"].ToString()+pModule.Substring(3)) as HtmlTableRow;
            if (htr != null)
            {
                Detail_RP_BOXMONTHYEARDETAIL detail = new Detail_RP_BOXMONTHYEARDETAIL();
                detail.BOXMONTHYEARID = ViewState["Guid"] as string;
                detail.LINEHAS = pModule;
                detail.LINENAME = htr.ID.Substring(0, htr.ID.Length - 2) ;
                detail.ID = Guid.NewGuid().ToString();

                string EMTTEU = (htr.FindControl("EmtTEU" + htr.ID) as NumericTextBox).Value;
                detail.EMTTEU = string.IsNullOrEmpty(EMTTEU) ? 0 : Convert.ToInt32(EMTTEU);

                string EMT45 = (htr.FindControl("EMT45" + htr.ID) as NumericTextBox).Value;
                detail.EMT45 = string.IsNullOrEmpty(EMT45) ? 0 : Convert.ToInt32(EMT45);

                string EMT40 = (htr.FindControl("EMT40" + htr.ID) as NumericTextBox).Value;
                detail.EMT40 = string.IsNullOrEmpty(EMT40) ? 0 : Convert.ToInt32(EMT40);

                string EMT20 = (htr.FindControl("EMT20" + htr.ID) as NumericTextBox).Value;
                detail.EMT20 = string.IsNullOrEmpty(EMT20) ? 0 : Convert.ToInt32(EMT20);

                string EMTOTHER = (htr.FindControl("EMTOTHER" + htr.ID) as NumericTextBox).Value;
                detail.EMTOTHER = string.IsNullOrEmpty(EMTOTHER) ? 0 : Convert.ToInt32(EMTOTHER);

                string HAVENTEU = (htr.FindControl("HAVENTEU" + htr.ID) as NumericTextBox).Value;
                detail.HAVENTEU = string.IsNullOrEmpty(HAVENTEU) ? 0 : Convert.ToInt32(HAVENTEU);

                string HAVEN45 = (htr.FindControl("HAVEN45" + htr.ID) as NumericTextBox).Value;
                detail.HAVEN45 = string.IsNullOrEmpty(HAVEN45) ? 0 : Convert.ToInt32(HAVEN45);

                string HAVEN40 = (htr.FindControl("HAVEN40" + htr.ID) as NumericTextBox).Value;
                detail.HAVEN40 = string.IsNullOrEmpty(HAVEN40) ? 0 : Convert.ToInt32(HAVEN40);

                string HAVEN20 = (htr.FindControl("HAVEN20" + htr.ID) as NumericTextBox).Value;
                detail.HAVEN20 = string.IsNullOrEmpty(HAVEN20) ? 0 : Convert.ToInt32(HAVEN20);

                string HAVENOTHER = (htr.FindControl("HAVENOTHER" + htr.ID) as NumericTextBox).Value;
                detail.HAVENOTHER = string.IsNullOrEmpty(HAVENOTHER) ? 0 : Convert.ToInt32(HAVENOTHER);

                string TOTALWEIGHT = (htr.FindControl("HavTotle" + htr.ID) as TextBox).Text;
                detail.TOTALWEIGHT = string.IsNullOrEmpty(TOTALWEIGHT) ? 0 : Convert.ToDecimal(TOTALWEIGHT);

                string GOODSWEIGHT = (htr.FindControl("HavgoodsWeight" + htr.ID) as TextBox).Text;
                detail.GOODSWEIGHT = string.IsNullOrEmpty(GOODSWEIGHT) ? 0 : Convert.ToDecimal(GOODSWEIGHT);
                new Rp_BoxMonthYearDetail().Insert(detail.ID, detail.BOXMONTHYEARID, detail.LINEHAS, detail.LINENAME, detail.EMTTEU, detail.EMT45, detail.EMT40,
                         detail.EMT20, detail.EMTOTHER, detail.HAVENTEU, detail.HAVEN45, detail.HAVEN40, detail.HAVEN20, detail.HAVENOTHER, detail.TOTALWEIGHT, detail.GOODSWEIGHT);

            }
        }
        /// <summary>
        /// 
        /// 编写日期:2010-4-21
        /// 编写人:GWF
        /// </summary>
        /// <param name="ID"></param>
        public Detail_RP_BOXMONTHYEAR GetDetail(string ID)
        {
            Database db = DatabaseFactory.CreateDatabase(CawConnStr);
             string strSql = (db.DbProviderFactory.ToString() != "System.Data.OracleClient.OracleClientFactory") ?
                 "SELECT A.*, B.DATASTATUS,B.DATASTATUS_NAME FROM RP_BOXMONTHYEAR A,CAW_DATESTATUS B WHERE A.ID=B.KEYGUID and A.ID=@ID " :
                 "SELECT A.*, B.DATASTATUS,B.DATASTATUS_NAME FROM RP_BOXMONTHYEAR A,CAW_DATESTATUS B WHERE A.ID=B.KEYGUID and A.ID=:ID ";
             DbCommand cmd = db.GetSqlStringCommand(strSql);

             db.AddInParameter(cmd, "ID", DbType.String, ID);

             Detail_RP_BOXMONTHYEAR myDetail = new Detail_RP_BOXMONTHYEAR();

             using (IDataReader myReader = db.ExecuteReader(cmd))
             {
                 if (myReader.Read())
                 {
                     if (!Convert.IsDBNull(myReader["ID"]))
                     {
                         myDetail.ID = Convert.ToString(myReader["ID"]);
                     }
                     if (!Convert.IsDBNull(myReader["CMPID"]))
                     {
                         myDetail.CMPID = Convert.ToString(myReader["CMPID"]);
                     }
                     if (!Convert.IsDBNull(myReader["CMPNAME"]))
                     {
                         myDetail.CMPNAME = Convert.ToString(myReader["CMPNAME"]);
                     }
                     if (!Convert.IsDBNull(myReader["YEAR"]))
                     {
                         myDetail.YEAR = Convert.ToInt32(myReader["YEAR"]);
                     }
                     if (!Convert.IsDBNull(myReader["MONTH"]))
                     {
                         myDetail.MONTH = Convert.ToInt32(myReader["MONTH"]);
                     }
                     if (!Convert.IsDBNull(myReader["DATETIME"]))
                     {
                         myDetail.DATETIME = Convert.ToDateTime(myReader["DATETIME"]);
                     }
                     if (!Convert.IsDBNull(myReader["ISMONTH"]))
                     {
                         myDetail.ISMONTH = Convert.ToInt32(myReader["ISMONTH"]);
                     }
                     if (!Convert.IsDBNull(myReader["INOUT"]))
                     {
                         myDetail.INOUT = Convert.ToInt32(myReader["INOUT"]);
                     }
                     if (!Convert.IsDBNull(myReader["UPDATETIME"]))
                     {
                         myDetail.UPDATETIME = Convert.ToDateTime(myReader["UPDATETIME"]);
                     }

                     if (!Convert.IsDBNull(myReader["DATASTATUS"]))
                     {
                         myDetail.DATASTATUS = Convert.ToString(myReader["DATASTATUS"]);
                     }

                     if (!Convert.IsDBNull(myReader["DATASTATUS_NAME"]))
                     {
                         myDetail.DATASTATUS_NAME = Convert.ToString(myReader["DATASTATUS_NAME"]);
                     }
                 }
             }
             string strdetail = string.Format("select * from RP_BOXMONTHYEARDETAIL where BOXMONTHYEARID='{0}'", ID);
             DbCommand cmd1 = db.GetSqlStringCommand(strdetail);
             DataView dv= db.ExecuteDataView(cmd1);
             IList<Detail_RP_BOXMONTHYEARDETAIL> dlist = new List<Detail_RP_BOXMONTHYEARDETAIL>();
             foreach (DataRow dr in dv.Table.Rows)
             {
                 Detail_RP_BOXMONTHYEARDETAIL p = new Detail_RP_BOXMONTHYEARDETAIL();
                 p.ID = dr["ID"].ToString();
                 p.BOXMONTHYEARID = myDetail.ID;
                 p.LINEHAS = dr["LINEHAS"].ToString();
                 p.LINENAME = dr["LINENAME"].ToString();

                 p.EMTTEU = Convert.ToInt32(dr["EMTTEU"]);
                 p.EMT45 = Convert.ToInt32(dr["EMT45"]);
                 p.EMT40 = Convert.ToInt32(dr["EMT40"]);
                 p.EMT20 = Convert.ToInt32(dr["EMT20"]);
                 p.EMTOTHER = Convert.ToInt32(dr["EMTOTHER"]);

                 p.HAVENTEU = Convert.ToInt32(dr["HAVENTEU"]);
                 p.HAVEN45 = Convert.ToInt32(dr["HAVEN45"]);
                 p.HAVEN40 = Convert.ToInt32(dr["HAVEN40"]);
                 p.HAVEN20 = Convert.ToInt32(dr["HAVEN20"]);
                 p.HAVENOTHER = Convert.ToInt32(dr["HAVENOTHER"]);

                 p.TOTALWEIGHT = Convert.ToDecimal(dr["TOTALWEIGHT"]);
                 p.GOODSWEIGHT = Convert.ToDecimal(dr["GOODSWEIGHT"]);
                 dlist.Add(p);
             }
             myDetail.Detail_RP_BOXMONTHYEARDETAIL = dlist;
             return myDetail;
        }
        /// <summary>
        /// 
        /// 编写日期:2010-4-21
        /// 编写人:GWF
        /// </summary>
        /// <param name="ID"></param>
        public Detail_RP_BOXMONTHYEARDETAIL GetDetail(string ID)
        {
            Database db = DatabaseFactory.CreateDatabase(CawConnStr);
            string strSql = (db.DbProviderFactory.ToString() != "System.Data.OracleClient.OracleClientFactory") ?
                "SELECT * FROM RP_BOXMONTHYEARDETAIL WHERE  ID=@ID " :
                "SELECT * FROM RP_BOXMONTHYEARDETAIL WHERE  ID=:ID ";
            DbCommand cmd = db.GetSqlStringCommand(strSql);

            db.AddInParameter(cmd, "ID", DbType.String, ID);

            Detail_RP_BOXMONTHYEARDETAIL myDetail = new Detail_RP_BOXMONTHYEARDETAIL();

            using (IDataReader myReader = db.ExecuteReader(cmd))
            {
                if (myReader.Read())
                {
                    if (!Convert.IsDBNull(myReader["ID"]))
                    {
                        myDetail.ID = Convert.ToString(myReader["ID"]);
                    }
                    if (!Convert.IsDBNull(myReader["BOXMONTHYEARID"]))
                    {
                        myDetail.BOXMONTHYEARID = Convert.ToString(myReader["BOXMONTHYEARID"]);
                    }
                    if (!Convert.IsDBNull(myReader["LINEHAS"]))
                    {
                        myDetail.LINEHAS = Convert.ToString(myReader["LINEHAS"]);
                    }
                    if (!Convert.IsDBNull(myReader["LINENAME"]))
                    {
                        myDetail.LINENAME = Convert.ToString(myReader["LINENAME"]);
                    }
                    if (!Convert.IsDBNull(myReader["EMTTEU"]))
                    {
                        myDetail.EMTTEU = Convert.ToInt32(myReader["EMTTEU"]);
                    }
                    if (!Convert.IsDBNull(myReader["EMT45"]))
                    {
                        myDetail.EMT45 = Convert.ToInt32(myReader["EMT45"]);
                    }
                    if (!Convert.IsDBNull(myReader["EMT40"]))
                    {
                        myDetail.EMT40 = Convert.ToInt32(myReader["EMT40"]);
                    }
                    if (!Convert.IsDBNull(myReader["EMT20"]))
                    {
                        myDetail.EMT20 = Convert.ToInt32(myReader["EMT20"]);
                    }
                    if (!Convert.IsDBNull(myReader["EMTOTHER"]))
                    {
                        myDetail.EMTOTHER = Convert.ToInt32(myReader["EMTOTHER"]);
                    }
                    if (!Convert.IsDBNull(myReader["HAVENTEU"]))
                    {
                        myDetail.HAVENTEU = Convert.ToInt32(myReader["HAVENTEU"]);
                    }
                    if (!Convert.IsDBNull(myReader["HAVEN45"]))
                    {
                        myDetail.HAVEN45 = Convert.ToInt32(myReader["HAVEN45"]);
                    }
                    if (!Convert.IsDBNull(myReader["HAVEN40"]))
                    {
                        myDetail.HAVEN40 = Convert.ToInt32(myReader["HAVEN40"]);
                    }
                    if (!Convert.IsDBNull(myReader["HAVEN20"]))
                    {
                        myDetail.HAVEN20 = Convert.ToInt32(myReader["HAVEN20"]);
                    }
                    if (!Convert.IsDBNull(myReader["HAVENOTHER"]))
                    {
                        myDetail.HAVENOTHER = Convert.ToInt32(myReader["HAVENOTHER"]);
                    }
                    if (!Convert.IsDBNull(myReader["TOTALWEIGHT"]))
                    {
                        myDetail.TOTALWEIGHT = Convert.ToDecimal(myReader["TOTALWEIGHT"]);
                    }
                    if (!Convert.IsDBNull(myReader["GOODSWEIGHT"]))
                    {
                        myDetail.GOODSWEIGHT = Convert.ToDecimal(myReader["GOODSWEIGHT"]);
                    }
                }
            }
            return myDetail;
        }