Ejemplo n.º 1
0
 public static string[] BuildArrayFieldByYm(string StartYm, string EndYm, string FieldPre)
 {
     string[] textArray2;
     try
     {
         string[] textArray = new string[0];
         if (StartYm != "")
         {
             int monthsBetween = StringRule.GetMonthsBetween(StartYm, EndYm);
             textArray = new string[monthsBetween];
             int index = -1;
             for (int i = 0; i < monthsBetween; i++)
             {
                 index++;
                 string text = StringRule.YmAddMonths(StartYm, i);
                 textArray[index] = FieldPre + text;
             }
         }
         textArray2 = textArray;
     }
     catch (Exception exception)
     {
         throw exception;
     }
     return(textArray2);
 }
Ejemplo n.º 2
0
 private void ResetContractDateRange()
 {
     try
     {
         DropDateRangeColumn(this.tbContract);
         DropDateRangeColumn(this.tb);
         if ((this.StartYm != "") && (this.EndYm != ""))
         {
             string text;
             string text2;
             string text3;
             string name;
             AddDateRangeColumn(this.tbContract, this.StartYm, this.EndYm);
             AddDateRangeColumn(this.tb, this.StartYm, this.EndYm);
             int monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm);
             foreach (DataRow row in this.tbContract.Rows)
             {
                 text  = ConvertRule.ToString(row["ContractCode"]);
                 text2 = ConvertRule.ToString(row["CostCode"]);
                 DataRow[] rowArray = this.tbPlan.Select("ContractCode = '" + text + "' and CostCode='" + text2 + "'");
                 foreach (DataRow row2 in rowArray)
                 {
                     text3 = ConvertRule.ToString(row2["PlanYm"]);
                     name  = "PlanMoneyYm_" + text3;
                     if (this.tbContract.Columns.Contains(name))
                     {
                         row[name] = ConvertRule.ToDecimal(row[name]) + ConvertRule.ToDecimal(row2["PlanMoney"]);
                     }
                 }
             }
             foreach (DataRow row in this.tbContract.Rows)
             {
                 text  = ConvertRule.ToString(row["ContractCode"]);
                 text2 = ConvertRule.ToString(row["CostCode"]);
                 DataRow   row3      = null;
                 DataRow[] rowArray2 = this.tb.Select("ContractCode = '" + text + "' and CostCode = '" + text2 + "' and RecordType <> ''");
                 if (rowArray2.Length > 0)
                 {
                     row3 = rowArray2[0];
                 }
                 if (row3 != null)
                 {
                     for (int i = 0; i < monthsBetween; i++)
                     {
                         text3      = StringRule.YmAddMonths(this.StartYm, i);
                         name       = "PlanMoneyYm_" + text3;
                         row3[name] = row[name];
                     }
                 }
             }
             this.ReCalcByRelation(this.StartYm, this.EndYm);
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Ejemplo n.º 3
0
 public void RefreshDateRange()
 {
     try
     {
         this.ResetDateTitleHtml();
         this.ResetContractDateRange();
         CostBudgetPageRule.ClearFieldValue(this.tb, new string[] { "PlanDataHtml" });
         if ((this.StartYm != "") && (this.EndYm != ""))
         {
             foreach (DataRow row in this.tb.Rows)
             {
                 string text          = "";
                 string text2         = row["RecordType"].ToString();
                 string contractCode  = ConvertRule.ToString(row["ContractCode"]);
                 string costCode      = ConvertRule.ToString(row["CostCode"]);
                 string text5         = ConvertRule.ToString(row["FullCode"]);
                 string pBSCode       = ConvertRule.ToString(row["PBSCode"]);
                 int    monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm);
                 for (int i = 0; i < monthsBetween; i++)
                 {
                     string text12;
                     string text7         = StringRule.YmAddMonths(this.StartYm, i);
                     string s             = string.Format("{0}-{1}-01", text7.Substring(0, 4), text7.Substring(4, 2));
                     string payoutDateEnd = DateTime.Parse(s).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
                     string text10        = "PayoutMoneyYm_" + text7;
                     string money         = StringRule.BuildShowNumberString(row[text10]);
                     if (pBSCode == "")
                     {
                         text12 = CostBudgetPageRule.GetContractPayRealHref(money, costCode, contractCode, "", s, payoutDateEnd, this.PBSType, pBSCode);
                     }
                     else
                     {
                         text12 = money;
                     }
                     if (text12 == "")
                     {
                         text = text + string.Format("<td>{0}</td>", text12);
                     }
                     else
                     {
                         text = text + string.Format("<td align=right nowrap>{0}</td>", text12);
                     }
                 }
                 row["PlanDataHtml"] = text;
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Ejemplo n.º 4
0
        public static string GetDecimalShowString(DataRowView dr, string columnName)
        {
            if (dr[columnName] == DBNull.Value)
            {
                return("");
            }
            decimal num = (decimal)dr[columnName];

            if (CheckDecimalEqual(num, 0M))
            {
                return("");
            }
            return(StringRule.BuildShowNumberString(num));
        }
Ejemplo n.º 5
0
        public static string GetWanDecimalShowString(DataRow dr, string columnName)
        {
            if (dr[columnName] == DBNull.Value)
            {
                return("");
            }
            decimal num = (decimal)dr[columnName];

            if (CheckDecimalEqual(num, 0M))
            {
                return("");
            }
            return(StringRule.BuildMoneyWanFormatString(num));
        }
Ejemplo n.º 6
0
 private static void AddDateRangeColumn(DataTable tb, string StartYm, string EndYm)
 {
     try
     {
         int monthsBetween = StringRule.GetMonthsBetween(StartYm, EndYm);
         for (int i = 0; i < monthsBetween; i++)
         {
             string text = StringRule.YmAddMonths(StartYm, i);
             tb.Columns.Add("PayoutMoneyYm_" + text, typeof(decimal));
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Ejemplo n.º 7
0
 public void RefreshDateRange()
 {
     try
     {
         this.ResetDateTitleHtml();
         this.ResetContractDateRange();
         CostBudgetPageRule.ClearFieldValue(this.tb, new string[] { "PlanDataHtml" });
         int num = -1;
         if ((this.StartYm != "") && (this.EndYm != ""))
         {
             foreach (DataRow row in this.tb.Rows)
             {
                 num++;
                 string text          = "";
                 string text2         = row["RecordType"].ToString();
                 string text3         = ConvertRule.ToString(row["ContractCode"]);
                 string text4         = ConvertRule.ToString(row["CostCode"]);
                 string text5         = ConvertRule.ToString(row["FullCode"]);
                 string text6         = ConvertRule.ToString(row["ParentCode"]);
                 string text7         = ConvertRule.ToString(row["ClassTd"]);
                 int    monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm);
                 for (int i = 0; i < monthsBetween; i++)
                 {
                     string text8  = StringRule.YmAddMonths(this.StartYm, i);
                     string text10 = DateTime.Parse(string.Format("{0}-{1}-01", text8.Substring(0, 4), text8.Substring(4, 2))).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
                     string text11 = "PlanMoneyYm_" + text8;
                     string text12 = StringRule.BuildShowNumberString(row[text11]);
                     if (this.ReadOnly)
                     {
                         text = text + string.Format("<td align=right nowrap class=\"{1}\">{0}</td>", text12, text7);
                     }
                 }
                 row["PlanDataHtml"] = text;
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Ejemplo n.º 8
0
        public static string GetWanDecimalShowString(object val, int decimals)
        {
            if ((val == DBNull.Value) || (val == null))
            {
                return("");
            }
            decimal num = 0M;

            try
            {
                num = decimal.Parse(val.ToString());
            }
            catch
            {
            }
            if (CheckDecimalEqual(num, 0M))
            {
                return("");
            }
            return(StringRule.BuildMoneyWanFormatString(num, 0, decimals));
        }
Ejemplo n.º 9
0
        public static string GetDecimalShowString(object val, string format, bool ShowZero)
        {
            if ((val == DBNull.Value) || (val == null))
            {
                return("");
            }
            decimal num = 0M;

            try
            {
                num = decimal.Parse(val.ToString());
            }
            catch
            {
            }
            if (!(!CheckDecimalEqual(num, 0M) || ShowZero))
            {
                return("");
            }
            return(StringRule.BuildShowNumberString(num, format, ShowZero));
        }
Ejemplo n.º 10
0
        public static string GetMoneyShowString(object money, m_MoneyUnit unit, string MoneyType)
        {
            string text2;

            try
            {
                string wanDecimalShowString = "";
                switch (unit)
                {
                case m_MoneyUnit.yuan:
                    wanDecimalShowString = StringRule.BuildShowNumberString(money, "#,##0");
                    break;

                case m_MoneyUnit.fen:
                    wanDecimalShowString = StringRule.BuildShowNumberString(money, "#,##0.00");
                    break;

                default:
                    if (MoneyType.ToLower() == "price")
                    {
                        wanDecimalShowString = MathRule.GetWanDecimalShowString(money);
                    }
                    else if (m_IsRoundWanMoney)
                    {
                        wanDecimalShowString = StringRule.BuildMoneyWanFormatString(ConvertRule.ToDecimal(money), -1, 0);
                    }
                    else
                    {
                        wanDecimalShowString = MathRule.GetWanDecimalShowString(money);
                    }
                    break;
                }
                text2 = wanDecimalShowString;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
Ejemplo n.º 11
0
 public void ResetDateTitleHtml()
 {
     try
     {
         this.m_DateTitleHtml1 = "";
         this.m_DateTitleHtml2 = "";
         if ((this.StartYm != "") && (this.EndYm != ""))
         {
             int monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm);
             for (int i = 0; i < monthsBetween; i++)
             {
                 string text = StringRule.YmAddMonths(this.StartYm, i);
                 this.m_DateTitleHtml2 = this.m_DateTitleHtml2 + string.Format("<th align=center nowrap>{0}年{1}月</th>", text.Substring(0, 4), text.Substring(4, 2));
             }
             this.m_DateTitleHtml1 = string.Format("<th colspan=\"{0}\">预计发生</th>", monthsBetween);
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Ejemplo n.º 12
0
 public void RefreshDateRange()
 {
     try
     {
         this.ResetDateTitleHtml();
         CostBudgetPageRule.ClearFieldValue(this.tb, new string[] { "PlanDataHtml" });
         if ((this.StartYm != "") && (this.EndYm != ""))
         {
             foreach (DataRow row in this.tb.Rows)
             {
                 string costCode      = ConvertRule.ToString(row["CostCode"]);
                 string text2         = "";
                 int    monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm);
                 for (int i = 0; i < monthsBetween; i++)
                 {
                     string text3         = StringRule.YmAddMonths(this.StartYm, i);
                     string s             = string.Format("{0}-{1}-01", text3.Substring(0, 4), text3.Substring(4, 2));
                     string payoutDateEnd = DateTime.Parse(s).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
                     string text6         = "PayoutMoneyYm_" + text3;
                     string text8         = GetPayoutHref(StringRule.BuildShowNumberString(row[text6]), costCode, s, payoutDateEnd);
                     if (text8 == "")
                     {
                         text2 = text2 + string.Format("<td>{0}</td>", text8);
                     }
                     else
                     {
                         text2 = text2 + string.Format("<td align=right nowrap>{0}</td>", text8);
                     }
                 }
                 row["PlanDataHtml"] = text2;
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Ejemplo n.º 13
0
        public static string GetWanDecimalShowString(object money)
        {
            string text2;

            try
            {
                string wanDecimalShowString = "";
                if (m_IsRoundWanMoney)
                {
                    wanDecimalShowString = StringRule.BuildMoneyWanFormatString(ConvertRule.ToDecimal(money), -1, 0);
                }
                else
                {
                    wanDecimalShowString = MathRule.GetWanDecimalShowString(money);
                }
                text2 = wanDecimalShowString;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
Ejemplo n.º 14
0
 private void ReCalcByRelation()
 {
     try
     {
         DataView view = new DataView(this.tb, "", "", DataViewRowState.CurrentRows);
         foreach (DataRowView view2 in view)
         {
             DataRow row = view2.Row;
             if (ConvertRule.ToString(row["FullCode"]) != "")
             {
                 DataRow[] drs           = this.tbPayout.Select("FullCode like '" + ConvertRule.ToString(row["FullCode"]) + "%'");
                 string[]  arrColumnName = new string[] { "PayoutMoney" };
                 decimal[] numArray      = MathRule.SumColumn(drs, arrColumnName);
                 int       index         = -1;
                 foreach (string text in arrColumnName)
                 {
                     index++;
                     row[text] = numArray[index];
                 }
                 if ((this.StartYm != "") && (this.EndYm != ""))
                 {
                     int monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm);
                     for (int i = 0; i < monthsBetween; i++)
                     {
                         string  text2 = StringRule.YmAddMonths(this.StartYm, i);
                         decimal num4  = MathRule.SumColumn(this.tbPayoutYm.Select("FullCode like '" + ConvertRule.ToString(row["FullCode"]) + "%' and PayoutYm = '" + text2 + "'"), "PayoutMoney");
                         row["PayoutMoneyYm_" + text2] = num4;
                     }
                 }
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Ejemplo n.º 15
0
 private void ResetContractDateRange()
 {
     try
     {
         DropDateRangeColumn(this.tbContract);
         DropDateRangeColumn(this.tb);
         DropDateRangeColumn(this.tbApportion);
         if ((this.StartYm != "") && (this.EndYm != ""))
         {
             string    contractCode;
             string    costCode;
             string    text3;
             string    name;
             DataRow   row3;
             DataRow[] rowArray2;
             int       monthsBetween;
             int       monthCount;
             AddDateRangeColumn(this.tbContract, this.StartYm, this.EndYm);
             AddDateRangeColumn(this.tb, this.StartYm, this.EndYm);
             AddDateRangeColumn(this.tbApportion, this.StartYm, this.EndYm);
             foreach (DataRow row in this.tbContract.Rows)
             {
                 contractCode = ConvertRule.ToString(row["ContractCode"]);
                 costCode     = ConvertRule.ToString(row["CostCode"]);
                 DataRow[] rowArray = this.tbPayout.Select("ContractCode = '" + contractCode + "' and CostCode='" + costCode + "'");
                 foreach (DataRow row2 in rowArray)
                 {
                     text3 = ConvertRule.ToString(row2["PayoutYm"]);
                     name  = "PayoutMoneyYm_" + text3;
                     if (this.tbContract.Columns.Contains(name))
                     {
                         decimal totalMoney = ConvertRule.ToDecimal(row2["PayoutMoney"]);
                         row[name] = ConvertRule.ToDecimal(row[name]) + totalMoney;
                         this.DoApportion(contractCode, costCode, ConvertRule.ToString(row2["CostBudgetSetCode"]), ConvertRule.ToString(row["RecordType"]), name, totalMoney);
                     }
                 }
             }
             foreach (DataRow row in this.tbContract.Rows)
             {
                 contractCode = ConvertRule.ToString(row["ContractCode"]);
                 costCode     = ConvertRule.ToString(row["CostCode"]);
                 row3         = null;
                 rowArray2    = this.tb.Select("ContractCode = '" + contractCode + "' and CostCode = '" + costCode + "' and RecordType <> '' and RecordType <> 'Apportion'");
                 if (rowArray2.Length > 0)
                 {
                     row3 = rowArray2[0];
                 }
                 if (row3 != null)
                 {
                     monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm);
                     for (monthCount = 0; monthCount < monthsBetween; monthCount++)
                     {
                         text3      = StringRule.YmAddMonths(this.StartYm, monthCount);
                         name       = "PayoutMoneyYm_" + text3;
                         row3[name] = row[name];
                     }
                 }
             }
             foreach (DataRow row4 in this.tbApportion.Rows)
             {
                 contractCode = ConvertRule.ToString(row4["ContractCode"]);
                 costCode     = ConvertRule.ToString(row4["CostCode"]);
                 string text5 = ConvertRule.ToString(row4["PBSCode"]);
                 row3      = null;
                 rowArray2 = this.tb.Select("ContractCode = '" + contractCode + "' and CostCode = '" + costCode + "' and PBSCode = '" + text5 + "' and RecordType <> ''");
                 if (rowArray2.Length > 0)
                 {
                     row3 = rowArray2[0];
                 }
                 if (row3 != null)
                 {
                     monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm);
                     for (monthCount = 0; monthCount < monthsBetween; monthCount++)
                     {
                         text3      = StringRule.YmAddMonths(this.StartYm, monthCount);
                         name       = "PayoutMoneyYm_" + text3;
                         row3[name] = row4[name];
                     }
                 }
             }
             this.ReCalcByRelation(this.StartYm, this.EndYm);
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Ejemplo n.º 16
0
        public DataRow ImportSupplierMaterialSingle(string val, EntityData entity, ref string hint, ref string SupplierName, ref string GroupFullName, bool isTest, DataTable tbAllSystemGroup)
        {
            Exception exception;

            hint = "";
            DataRow row = null;

            try
            {
                int        index;
                DataRow    row2;
                string     text4;
                DataColumn column;
                string     s;
                string[]   arr = ImportRule.SplitCsvLine(val);
                if (arr.Length < base.MinColCount)
                {
                    hint = string.Format("列不足{0}个", base.MinColCount);
                    return(null);
                }
                SupplierName  = arr[1].Trim();
                GroupFullName = "";
                if (SupplierName == "")
                {
                    hint = "厂商为空";
                    return(null);
                }
                string text  = arr[0].Trim();
                string text2 = "";
                if (text != "")
                {
                    DataRow[] rowArray = tbAllSystemGroup.Select("FullName = '" + text + "'");
                    if (rowArray.Length > 0)
                    {
                        text2         = rowArray[0]["GroupCode"].ToString();
                        GroupFullName = text;
                    }
                }
                if (text2 == "")
                {
                    hint = string.Format("未知的类型“{0}”", text);
                    return(null);
                }
                string supplierCodeByName = "";
                if (SupplierName != "")
                {
                    supplierCodeByName = ProjectRule.GetSupplierCodeByName(SupplierName);
                }
                if (supplierCodeByName == "")
                {
                    hint = string.Format("厂商信息中找不到厂商“{0}”", SupplierName);
                    return(null);
                }
                int count = base.tbDefine.Rows.Count;
                for (index = 0; index < count; index++)
                {
                    row2  = base.tbDefine.Rows[index];
                    text4 = row2["FieldName"].ToString();
                    string text5 = row2["FieldDesc"].ToString();
                    column = entity.CurrentTable.Columns[text4];
                    if ((text4 != "") && (text4 != "GroupCode"))
                    {
                        s = ConvertRule.ToString(ConvertRule.GetArrayItem(arr, index)).Trim();
                        if ((column.DataType == typeof(string)) && (StringRule.LenB(s) > column.MaxLength))
                        {
                            hint = string.Format("{0}({1})长度超过{2}位(现为{3}位)", new object[] { text5, s, column.MaxLength, s.Length });
                            return(null);
                        }
                    }
                }
                row = entity.CurrentTable.NewRow();
                try
                {
                    if (isTest)
                    {
                        row["SupplierMaterialCode"] = Guid.NewGuid().ToString();
                    }
                    else
                    {
                        row["SupplierMaterialCode"] = SystemManageDAO.GetNewSysCode("SupplierMaterialCode").ToString();
                    }
                    count = base.tbDefine.Rows.Count;
                    for (index = 0; index < count; index++)
                    {
                        row2   = base.tbDefine.Rows[index];
                        text4  = row2["FieldName"].ToString();
                        column = entity.CurrentTable.Columns[text4];
                        if (text4 != "")
                        {
                            string text7 = text4;
                            if (text7 == null)
                            {
                                goto Label_03AE;
                            }
                            if (text7 != "GroupCode")
                            {
                                if (text7 == "SupplierCode")
                                {
                                    goto Label_03A1;
                                }
                                goto Label_03AE;
                            }
                            row[text4] = text2;
                        }
                        continue;
Label_03A1:
                        row[text4] = supplierCodeByName;
                        continue;
Label_03AE:
                        s = ConvertRule.ToString(ConvertRule.GetArrayItem(arr, index)).Trim();
                        if (s == "")
                        {
                            try
                            {
                                row[text4] = s;
                            }
                            catch
                            {
                                row[text4] = DBNull.Value;
                            }
                        }
                        else
                        {
                            row[text4] = s;
                        }
                    }
                    entity.CurrentTable.Rows.Add(row);
                }
                catch (Exception exception1)
                {
                    exception = exception1;
                    row       = null;
                    throw exception;
                }
            }
            catch (Exception exception2)
            {
                exception = exception2;
                hint      = "异常出错:" + exception.Message;
            }
            return(row);
        }
Ejemplo n.º 17
0
 public void ResetTitleHtml()
 {
     try
     {
         this.m_TitleHtml1           = "";
         this.m_TitleHtmlArea        = "";
         this.m_TitleHtmlAreaPercent = "";
         foreach (DataRow row in this.tbPBS.Rows)
         {
             if (ConvertRule.ToString(row["PBSType"]) == "B")
             {
                 this.m_TitleHtml1 = this.m_TitleHtml1 + string.Format("<th align=center nowrap>{0}</th>", CostBudgetPageRule.GetBuildingHref(ConvertRule.ToString(row["PBSCode"]), ConvertRule.ToString(row["PBSName"])) + "&nbsp;");
             }
             else
             {
                 this.m_TitleHtml1 = this.m_TitleHtml1 + string.Format("<th align=center nowrap>{0}</th>", ConvertRule.ToString(row["PBSName"]) + "&nbsp;");
             }
             this.m_TitleHtmlArea        = this.m_TitleHtmlArea + string.Format("<th align=center nowrap style='border-top:0'>{0}</th>", StringRule.BuildShowNumberString(row["Area"], "#,##0.##") + "&nbsp;");
             this.m_TitleHtmlAreaPercent = this.m_TitleHtmlAreaPercent + string.Format("<th align=center nowrap style='border-top:0'>{0}</th>", StringRule.BuildShowPercentString(row["AreaPercent"]) + "&nbsp;");
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Ejemplo n.º 18
0
        public DataRow ImportMaterialCostSingle(string val, EntityData entity, ref string hint, ref string Description, ref string GroupFullName, bool isTest, DataTable tbAllSystemGroup)
        {
            Exception exception;

            hint = "";
            DataRow row = null;

            try
            {
                int        index;
                DataRow    row2;
                string     text3;
                DataColumn column;
                string     s;
                string[]   arr = ImportRule.SplitCsvLine(val);
                if (arr.Length < base.MinColCount)
                {
                    hint = "列不足3个";
                    return(null);
                }
                Description   = arr[6].Trim();
                GroupFullName = "";
                if (Description == "")
                {
                    hint = "描述为空";
                    return(null);
                }
                string text  = arr[0].Trim();
                string text2 = "";
                if (text != "")
                {
                    DataRow[] rowArray = tbAllSystemGroup.Select("FullName = '" + text + "'");
                    if (rowArray.Length > 0)
                    {
                        text2         = rowArray[0]["GroupCode"].ToString();
                        GroupFullName = text;
                    }
                }
                if (text2 == "")
                {
                    hint = string.Format("未知的类型“{0}”", text);
                    return(null);
                }
                int count = base.tbDefine.Rows.Count;
                for (index = 0; index < count; index++)
                {
                    row2  = base.tbDefine.Rows[index];
                    text3 = row2["FieldName"].ToString();
                    string text4 = row2["FieldDesc"].ToString();
                    column = entity.CurrentTable.Columns[text3];
                    if ((text3 != "") && (text3 != "GroupCode"))
                    {
                        s = ConvertRule.ToString(ConvertRule.GetArrayItem(arr, index)).Trim();
                        if ((column.DataType == typeof(string)) && (StringRule.LenB(s) > column.MaxLength))
                        {
                            hint = string.Format("{0}({1})长度超过{2}位(现为{3}位)", new object[] { text4, s, column.MaxLength, s.Length });
                            return(null);
                        }
                    }
                }
                row = entity.CurrentTable.NewRow();
                try
                {
                    if (isTest)
                    {
                        row["MaterialCostCode"] = Guid.NewGuid().ToString();
                    }
                    else
                    {
                        row["MaterialCostCode"] = SystemManageDAO.GetNewSysCode("MaterialCostCode").ToString();
                    }
                    count = base.tbDefine.Rows.Count;
                    for (index = 0; index < count; index++)
                    {
                        row2   = base.tbDefine.Rows[index];
                        text3  = row2["FieldName"].ToString();
                        column = entity.CurrentTable.Columns[text3];
                        if (text3 != "")
                        {
                            string text6 = text3;
                            if ((text6 != null) && (text6 == "GroupCode"))
                            {
                                row[text3] = text2;
                            }
                            else
                            {
                                s = ConvertRule.ToString(ConvertRule.GetArrayItem(arr, index)).Trim();
                                if (s == "")
                                {
                                    try
                                    {
                                        row[text3] = s;
                                    }
                                    catch
                                    {
                                        row[text3] = DBNull.Value;
                                    }
                                }
                                else
                                {
                                    row[text3] = s;
                                }
                            }
                        }
                    }
                    entity.CurrentTable.Rows.Add(row);
                }
                catch (Exception exception1)
                {
                    exception = exception1;
                    row       = null;
                    throw exception;
                }
            }
            catch (Exception exception2)
            {
                exception = exception2;
                hint      = "异常出错:" + exception.Message;
            }
            return(row);
        }