Exemple #1
0
        public static DataTable GenerateConstructProgressRiskTable(string ProgressCode, bool IsDefault)
        {
            DataTable table3;

            try
            {
                EntityData data        = new EntityData("ConstructProgressRisk");
                EntityData allRiskType = ConstructDAO.GetAllRiskType();
                EntityData constructProgressRiskByProgressCode = ConstructDAO.GetConstructProgressRiskByProgressCode(ProgressCode);
                DataTable  currentTable = data.CurrentTable;
                DataTable  table2       = constructProgressRiskByProgressCode.CurrentTable;
                currentTable.Columns.Add("RiskIndexName", typeof(string));
                int num   = 0;
                int count = allRiskType.CurrentTable.Rows.Count;
                for (int i = 0; i < count; i++)
                {
                    allRiskType.SetCurrentRow(i);
                    string  text = allRiskType.GetString("TypeName");
                    DataRow row  = currentTable.NewRow();
                    row["RiskTypeName"] = text;
                    DataRow[] rowArray = table2.Select("RiskTypeName='" + text + "'");
                    if (rowArray.Length > 0)
                    {
                        row["ProgressRiskCode"] = ConvertRule.ToString(rowArray[0]["ProgressRiskCode"]);
                        row["RiskIndexCode"]    = rowArray[0]["RiskIndexCode"];
                    }
                    else
                    {
                        num--;
                        row["ProgressRiskCode"] = num.ToString();
                    }
                    if ((ConvertRule.ToString(row["RiskIndexCode"]) == "") && IsDefault)
                    {
                        EntityData defaultRiskIndex = ConstructDAO.GetDefaultRiskIndex();
                        if (defaultRiskIndex.HasRecord())
                        {
                            row["RiskIndexCode"] = defaultRiskIndex.GetString("IndexCode");
                            row["RiskIndexName"] = defaultRiskIndex.GetString("IndexName");
                        }
                        defaultRiskIndex.Dispose();
                    }
                    if (ConvertRule.ToString(row["RiskIndexName"]) == "")
                    {
                        row["RiskIndexName"] = GetRiskIndexName(row["RiskIndexCode"]);
                    }
                    currentTable.Rows.Add(row);
                }
                constructProgressRiskByProgressCode.Dispose();
                allRiskType.Dispose();
                data.Dispose();
                table3 = currentTable;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(table3);
        }