예제 #1
0
            public override global::System.Data.DataTable Clone()
            {
                BasicDataTable cln = ((BasicDataTable)(base.Clone()));

                cln.InitVars();
                return(cln);
            }
예제 #2
0
 private void InitClass()
 {
     this.DataSetName             = "BasicInformation";
     this.Prefix                  = "";
     this.Namespace               = "http://tempuri.org/BasicInformation.xsd";
     this.EnforceConstraints      = true;
     this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
     this.tableBasic              = new BasicDataTable();
     base.Tables.Add(this.tableBasic);
 }
예제 #3
0
 internal void InitVars(bool initTable)
 {
     this.tableBasic = ((BasicDataTable)(base.Tables["Basic"]));
     if ((initTable == true))
     {
         if ((this.tableBasic != null))
         {
             this.tableBasic.InitVars();
         }
     }
 }
예제 #4
0
        /// Sets the series number.
        /// </summary>
        /// <param name="table">The table.</param>
        public void SetSeriesNumber(BasicDataTableDataTable table)
        {
            foreach (DataRow row in table.Rows)
            {
                string seriesNumber = string.Empty;

                string[] series = row["Series"].ToString().Split(',');
                foreach (string serie in series)
                {
                    foreach (DataRow bd12row in BD12_BAUREIHE.Rows)
                    {
                        if (bd12row["Series"].ToString() == serie)
                        {
                            seriesNumber += bd12row["Name"] + ",";
                            break;
                        }
                    }
                }
                seriesNumber        = seriesNumber.Remove(seriesNumber.Length - 1);
                row["SeriesNumber"] = seriesNumber;
            }
            BasicDataTable.AcceptChanges();
        }
예제 #5
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>( );
        }
예제 #6
0
        private void DoubleOperateForUnionCLP(DataTable unionCLPTable)
        {
            bool flag;
            int  result;

            foreach (DataRow row in unionCLPTable.Rows)
            {
                flag   = false;
                result = 0;
                if (row["Double"].ToString( ).Trim( ).ToUpper( ) == "DOUBLE")
                {
                    string strSize = row["SIZE"].ToString( ).Trim( );
                    if (strSize.Contains("MONTHS"))
                    {
                        if (int.TryParse(strSize.Split(' ')[0], out result))
                        {
                            if (result > 24)
                            {
                                flag = true;
                            }
                        }
                    }
                    if (strSize.Contains("AGE"))
                    {
                        if (int.TryParse(strSize.Split(' ')[1], out result))
                        {
                            if (result >= 3)
                            {
                                flag = true;
                            }
                        }
                    }
                    if (flag)
                    {
                        if (row["申报要素"].ToString( ).Contains("类别:婴儿"))
                        {
                            string strfilter = "ModelCode=" + "'" + row["MODEL_CODE"].ToString( ) + "'" + " AND SentialFactor<>" + "'" + row["申报要素"].ToString( ) + "'";
                            //DataTable dttemp=DataTableHelper.GetNewTableByDataView(BasicDataTable,strfilter);
                            DataRow[] drs = BasicDataTable.Select(strfilter);
                            row["UNIT"]    = drs[0]["QuanitityUnit"];
                            row["HS_CODE"] = drs[0]["HSCode"];
                            row["中文品名"]    = drs[0]["LocalProdectName"];
                            row["英文品名"]    = drs[0]["EnglishProductName"];
                            row["申报要素"]    = drs[0]["SentialFactor"];
                            row["监管条件"]    = drs[0]["SupervisionCondition"];
                            row["Double"]  = "N";
                            unionCLPTable.AcceptChanges( );
                        }
                        else
                        {
                            row["Double"] = "N";
                            unionCLPTable.AcceptChanges( );
                        }
                    }
                    else
                    {
                        if (!row["申报要素"].ToString( ).Contains("类别:婴儿"))
                        {
                            string strfilter = "ModelCode=" + "'" + row["MODEL_CODE"].ToString( ) + "'" + " AND SentialFactor<>" + "'" + row["申报要素"].ToString( ) + "'";
                            //DataTable dttemp=DataTableHelper.GetNewTableByDataView(BasicDataTable,strfilter);
                            DataRow[] drs = BasicDataTable.Select(strfilter);
                            row["UNIT"]    = drs[0]["QuanitityUnit"];
                            row["HS_CODE"] = drs[0]["HSCode"];
                            row["中文品名"]    = drs[0]["LocalProdectName"];
                            row["英文品名"]    = drs[0]["EnglishProductName"];
                            row["申报要素"]    = drs[0]["SentialFactor"];
                            row["监管条件"]    = drs[0]["SupervisionCondition"];
                            row["Double"]  = "N";
                            unionCLPTable.AcceptChanges( );
                        }
                        else
                        {
                            row["Double"] = "N";
                            unionCLPTable.AcceptChanges( );
                        }
                    }
                    unionCLPTable.AcceptChanges( );
                }
            }
        }
 internal BasicRow(global::System.Data.DataRowBuilder rb) : 
         base(rb) {
     this.tableBasic = ((BasicDataTable)(this.Table));
 }
 private void InitClass() {
     this.DataSetName = "Preferences";
     this.Prefix = "";
     this.Namespace = "http://dol.oecken.net/ItemCreator/schemas/Preferences.xsd";
     this.EnforceConstraints = true;
     this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
     this.tableBasic = new BasicDataTable();
     base.Tables.Add(this.tableBasic);
     this.tableMySQL = new MySQLDataTable();
     base.Tables.Add(this.tableMySQL);
 }
 internal void InitVars(bool initTable) {
     this.tableBasic = ((BasicDataTable)(base.Tables["Basic"]));
     if ((initTable == true)) {
         if ((this.tableBasic != null)) {
             this.tableBasic.InitVars();
         }
     }
     this.tableMySQL = ((MySQLDataTable)(base.Tables["MySQL"]));
     if ((initTable == true)) {
         if ((this.tableMySQL != null)) {
             this.tableMySQL.InitVars();
         }
     }
 }
예제 #10
0
    static bool ReadExcelFile(string excelPath, string prefabPath)
    {
        GameObject basicTableInstance = null;

        lastMsg = string.Empty;

        try
        {
            Excel itemData = ExcelHelper.LoadExcel(excelPath);

            if (itemData == null)
            {
                return(false);
            }

            List <ExcelTable> itemDataTable = itemData.Tables;

            string     prefabFilePath   = prefabPath + "/BasicDataTable.prefab";
            GameObject basicTablePrefab = (GameObject)AssetDatabase.LoadAssetAtPath(prefabFilePath, typeof(GameObject));
            if (basicTablePrefab == null)
            {
                basicTableInstance = new GameObject("BasicDataTable");
                basicTableInstance.AddComponent <BasicDataTable>();
                basicTablePrefab = PrefabUtility.CreatePrefab(prefabFilePath, basicTableInstance);
            }

            basicTableInstance = (GameObject)PrefabUtility.InstantiatePrefab(basicTablePrefab);

            BasicDataTable basicDataTable = basicTableInstance.GetComponent <BasicDataTable>();

            BasicInfo[] childObj = basicDataTable.GetComponentsInChildren <BasicInfo>();
            for (int i = 0; i < childObj.Length; i++)
            {
                DestroyImmediate(childObj[i].gameObject);
            }

            basicDataTable.basicInfoList1.Clear();
            basicDataTable.basicInfoList2.Clear();

            if (itemDataTable.Count > 0)
            {
                for (int i = 0; i < itemDataTable.Count; i++)
                {
                    if (itemDataTable[i].TableName == "Sheet1")
                    {
                        int indexColumn          = 0;
                        int stringValueColumn    = 0;
                        int intValueColumnColumn = 0;
                        int floatValueColumn     = 0;

                        for (int column = 1; column <= itemDataTable[i].NumberOfColumns; column++)
                        {
                            if (Convert.ToString(itemDataTable[i].GetValue(1, column)) == "Index")
                            {
                                indexColumn = column;
                            }
                            if (Convert.ToString(itemDataTable[i].GetValue(1, column)) == "StringValue")
                            {
                                stringValueColumn = column;
                            }
                            if (Convert.ToString(itemDataTable[i].GetValue(1, column)) == "IntValue")
                            {
                                intValueColumnColumn = column;
                            }
                            if (Convert.ToString(itemDataTable[i].GetValue(1, column)) == "FloatValue")
                            {
                                floatValueColumn = column;
                            }
                        }

                        for (int row = 2; row <= itemDataTable[i].NumberOfRows; row++)
                        {
                            if (Convert.ToString(itemDataTable[i].GetValue(row, indexColumn)).Equals(""))
                            {
                                continue;
                            }

                            int    index       = Convert.ToInt32(itemDataTable[i].GetValue(row, indexColumn));
                            string stringValue = Convert.ToString(itemDataTable[i].GetValue(row, stringValueColumn));
                            int    intValue    = Convert.ToInt32(itemDataTable[i].GetValue(row, intValueColumnColumn));
                            float  floatValue  = Convert.ToSingle(itemDataTable[i].GetValue(row, floatValueColumn));

                            GameObject basicInfoObj = new GameObject(string.Format("BasicInfo {0}", index));
                            basicInfoObj.transform.parent = basicTableInstance.transform;
                            BasicInfo basicInfo = basicInfoObj.AddComponent <BasicInfo>();

                            basicInfo.index       = index;
                            basicInfo.stringValue = stringValue;
                            basicInfo.intValue    = intValue;
                            basicInfo.floatValue  = floatValue;

                            basicDataTable.basicInfoList1.Add(basicInfo);
                        }
                    }
                    else if (itemDataTable[i].TableName == "Sheet2")
                    {
                        int indexColumn          = 0;
                        int stringValueColumn    = 0;
                        int intValueColumnColumn = 0;
                        int floatValueColumn     = 0;

                        for (int column = 1; column <= itemDataTable[i].NumberOfColumns; column++)
                        {
                            if (Convert.ToString(itemDataTable[i].GetValue(1, column)) == "Index")
                            {
                                indexColumn = column;
                            }
                            if (Convert.ToString(itemDataTable[i].GetValue(1, column)) == "StringValue")
                            {
                                stringValueColumn = column;
                            }
                            if (Convert.ToString(itemDataTable[i].GetValue(1, column)) == "IntValue")
                            {
                                intValueColumnColumn = column;
                            }
                            if (Convert.ToString(itemDataTable[i].GetValue(1, column)) == "FloatValue")
                            {
                                floatValueColumn = column;
                            }
                        }

                        for (int row = 2; row <= itemDataTable[i].NumberOfRows; row++)
                        {
                            if (Convert.ToString(itemDataTable[i].GetValue(row, indexColumn)).Equals(""))
                            {
                                continue;
                            }

                            int    index       = Convert.ToInt32(itemDataTable[i].GetValue(row, indexColumn));
                            string stringValue = Convert.ToString(itemDataTable[i].GetValue(row, stringValueColumn));
                            int    intValue    = Convert.ToInt32(itemDataTable[i].GetValue(row, intValueColumnColumn));
                            float  floatValue  = Convert.ToSingle(itemDataTable[i].GetValue(row, floatValueColumn));

                            GameObject basicInfoObj = new GameObject(string.Format("BasicInfo {0}", index));
                            basicInfoObj.transform.parent = basicTableInstance.transform;
                            BasicInfo basicInfo = basicInfoObj.AddComponent <BasicInfo>();

                            basicInfo.index       = index;
                            basicInfo.stringValue = stringValue;
                            basicInfo.intValue    = intValue;
                            basicInfo.floatValue  = floatValue;

                            basicDataTable.basicInfoList2.Add(basicInfo);
                        }
                    }
                }

                //GameObject newPrefab;

                //newPrefab = PrefabUtility.ReplacePrefab(basicTableInstance, basicTablePrefab, ReplacePrefabOptions.ConnectToPrefab);
                PrefabUtility.ReplacePrefab(basicTableInstance, basicTablePrefab, ReplacePrefabOptions.ConnectToPrefab);

                DestroyImmediate(basicTableInstance);
                basicTableInstance = null;

                lastMsg = "Succeeded import data to prefab file : " + prefabFilePath;
            }
            else
            {
                lastMsg = "Result : Fail. Reason : Data was not found.";
            }

            return(true);
        } catch (Exception e)
        {
            UnityEngine.Debug.Log(e.Message);
            lastMsg = "Result : fail\nMessage : " + e.Message;
            return(false);
        } finally {
            if (basicTableInstance != null)
            {
                DestroyImmediate(basicTableInstance);
            }
        }
    }
예제 #11
0
 internal BasicRow(global::System.Data.DataRowBuilder rb) :
     base(rb)
 {
     this.tableBasic = ((BasicDataTable)(this.Table));
 }