Exemplo n.º 1
0
        private void SupervisionConditionForUnionCLP( )
        {
            SupervisionConditionBLL           scbll = new SupervisionConditionBLL( );
            SupervisionConditionEntity        currenyRntity;
            List <SupervisionConditionEntity> scList = scbll.GetModelList("");

            foreach (DataRow row in DoubleOrSetTable.Rows)
            {
                currenyRntity = scList.Find(delegate(SupervisionConditionEntity entity)
                {
                    return(entity.SupervisionConditionName == row["监管条件"].ToString());
                });
                if (currenyRntity != null)
                {
                    row["监管条件"] = "N";
                }
            }
            DoubleOrSetTable.AcceptChanges( );
        }
Exemplo n.º 2
0
        private void SetOperateForUnionCLP(DataTable unionCLPTable)
        {
            IEnumerable <DataRow> queryforSet = from uclp in unionCLPTable.AsEnumerable( )
                                                where uclp.Field <String>("Double") == "SET"
                                                select uclp;


            DataTable dtSET     = queryforSet.CopyToDataTable <DataRow>( );
            DataTable dtNEW     = dtSET.Copy( );
            DataTable dtsetCopy = dtSET.Clone( );

            dtsetCopy = dtSET.AsEnumerable( ).Distinct(new DataTableRowCompare("MODEL_CODE")).CopyToDataTable( );
            int i = 0;

            foreach (DataRow row in dtsetCopy.Rows)
            {
                try
                {
                    int indexlast = dtSET.Rows.IndexOf(dtSET.AsEnumerable( ).Last(e => e.Field <String>("MODEL_CODE") == row["MODEL_CODE"].ToString()));
                    foreach (DataRow dr1 in BasicDataTable.Select("ModelCode=" + "'" + row["MODEL_CODE"].ToString( ) + "'").Skip <DataRow>(1))
                    {
                        i++;
                        DataRow dr = dtNEW.NewRow( );
                        dr["UNIT"]    = dr1["QuanitityUnit"];
                        dr["HS_CODE"] = dr1["HSCode"];
                        dr["中文品名"]    = dr1["LocalProdectName"];
                        dr["英文品名"]    = dr1["EnglishProductName"];
                        dr["申报要素"]    = dr1["SentialFactor"];
                        dr["监管条件"]    = dr1["SupervisionCondition"];
                        dtNEW.Rows.InsertAt(dr, indexlast + i);
                    }
                    i++;
                    //DataTable temp=BasicDataTable.Select( "ModelCode="+"'"+row["MODEL CODE"].ToString( )+"'" ).Skip<DataRow>( 1 ).CopyToDataTable( );
                }
                catch (ArgumentNullException ex)
                {
                    MessageBox.Show("原始资料表中SET操作" + row["MODEL_CODE"].ToString( ) + "无对应的记录!");
                    return;
                }
            }

            //添加DataTable2的数据
            foreach (DataRow dr in unionCLPTable.AsEnumerable( ).Except(dtSET.AsEnumerable( ), DataRowComparer.Default).CopyToDataTable( ).Rows)
            {
                dtNEW.ImportRow(dr);
            }
            DoubleOrSetTable.Clear( );
            DoubleOrSetTable = dtNEW;
            DoubleOrSetTable.AcceptChanges( );

            //unionCLPTable=dtNEW;

            //MODEL CODE
            //var query1 =
            //    from basicdata in BasicDataTable.AsEnumerable( )
            //    join setdata in dtSET.AsEnumerable( )
            //    on basicdata.Field<String>( "ModelCode" ) equals setdata.Field<String>( "MODEL CODE" )
            //    select basicdata;

            //DataTable dtBasicData = query1.Distinct().CopyToDataTable<DataRow>( );
        }