using OTSIncAReportApp.DataOperation.DataAccess;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static OTSIncAReportApp.OTSReport_Export;
namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
{
///
/// 颗粒分析
///
class ParticleAnalysis
{
///
/// 大分类
///
///
public DataTable GetLargeClassification(BasicData basicData)
{
DataTable data = basicData.GetDBData();
//获取粒级表
List colid = basicData.GetParticlesizeTable();
DataTable ls_partsize_dt = new DataTable();
ls_partsize_dt.TableName = "PartSize";
for (int i = 0; i < colid.Count; i++)
{
ls_partsize_dt.Columns.Add("c" + (i + 1).ToString());
}
DataTable ls_Particel_dt = new DataTable();
ls_Particel_dt.TableName = "Particel";
DataRow dr = ls_partsize_dt.NewRow();
int colidCount = 1;
for (int i = 0; i < colid.Count; i++)
{
if (colid.Count < i)
{
dr["c" + (i + 1).ToString()] = "";
}
else
{
dr["c" + (i + 1).ToString()] = colid[i];
ls_Particel_dt.Columns.Add("c" + (i + 1).ToString(), typeof(double));
colidCount++;
}
}
ls_partsize_dt.Rows.Add(dr);
ls_Particel_dt.Columns.Add("Name");
ls_Particel_dt.Columns.Add("total", typeof(double));
ls_Particel_dt.Columns.Add("TypeId");
ls_Particel_dt.Columns.Add("Class");
for (int i = 0; i < data.Rows.Count; i++)
{
DataRow dr2 = ls_Particel_dt.NewRow();
dr2["Name"] = data.Rows[i]["TypeName"].ToString();
dr2["Class"] = data.Rows[i]["Class"].ToString();
dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
for (int j = 1; j < colidCount; j++)
{
if (colid.Count >= j)
{
dr2["c" + j.ToString()] = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
}
}
if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
{
dr2["total"] = "0"; //求合
double d_total = 0;
for (int j = 1; j < colidCount; j++)
{
if (colid.Count >= j)
{
d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
}
}
dr2["total"] = d_total.ToString();
}
ls_Particel_dt.Rows.Add(dr2);
}
//按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
List ClassName = new List();
DataTable getClass_dt = basicData.GetAllClass();
for (int i = 0; i < getClass_dt.Rows.Count; i++)
{
if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid")
if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
ClassName.Add("NULL");
else
ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
}
//获取大分类信息
DataTable dt = QuantityOfIntegratedSubstances(ls_Particel_dt, ClassName);
return dt;
}
///
/// 小分类
///
///
public DataTable GetSubClassification(BasicData basicData)
{
DataTable data = basicData.GetDBData();
//获取粒级表
List colid = new List();
colid = basicData.GetParticlesizeTable();
//------------------------------------------------
DataTable ls_partsize_dt = new DataTable();
ls_partsize_dt.TableName = "PartSize";
for (int i=0;i< colid.Count;i++)
{
ls_partsize_dt.Columns.Add("c"+(i+1).ToString());
}
DataRow dr = ls_partsize_dt.NewRow();
DataTable ls_Particel_dt = new DataTable();
ls_Particel_dt.TableName = "Particel";
int colidCount = 1;
for (int i = 0; i < colid.Count; i++)
{
if (colid.Count < i)
{
dr["c" + (i + 1).ToString()] = "";
}
else
{
dr["c" + (i + 1).ToString()] = colid[i];
ls_Particel_dt.Columns.Add("c" + (i + 1).ToString(), typeof(double));
colidCount++;
}
}
ls_Particel_dt.Columns.Add("Name");
ls_Particel_dt.Columns.Add("total", typeof(double));
ls_Particel_dt.Columns.Add("TypeId");
ls_Particel_dt.Columns.Add("Class");
for (int i = 0; i < data.Rows.Count; i++)
{
DataRow dr2 = ls_Particel_dt.NewRow();
dr2["Name"] = data.Rows[i]["TypeName"].ToString();
dr2["Class"] = data.Rows[i]["Class"].ToString();
dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
for (int j = 1; j < colidCount; j++)
{
if (colid.Count >= j)
{
dr2["c" + j.ToString()] = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
}
}
if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
{
dr2["total"] = "0"; //求合
double d_total = 0;
for (int j = 1; j < colidCount; j++)
{
if (colid.Count >= j)
{
d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
}
}
dr2["total"] = d_total.ToString();
}
ls_Particel_dt.Rows.Add(dr2);
}
return ls_Particel_dt;
}
///
/// 分类整合大小分类都有
///
///
public List GetClassificationConsolidationTable(BasicData basicData)
{
List datas = new List();
DataTable data = basicData.GetDBData();
//获取粒级表
List colid = new List();
colid = basicData.GetParticlesizeTable();
//------------------------------------------------
DataTable ls_partsize_dt = new DataTable();
ls_partsize_dt.TableName = "PartSize";
for(int i=0;i< colid.Count;i++)
{
ls_partsize_dt.Columns.Add("c"+(i+1).ToString());
}
DataRow dr = ls_partsize_dt.NewRow();
DataTable ls_Particel_dt = new DataTable();
ls_Particel_dt.TableName = "Particel";
int colidCount = 1;
for (int i = 0; i < colid.Count; i++)
{
if (colid.Count < i)
{
dr["c" + (i+1).ToString()] = "";
}
else
{
dr["c" + (i + 1).ToString()] = colid[i];
ls_Particel_dt.Columns.Add("c" + (i + 1).ToString(), typeof(double));
colidCount++;
}
}
ls_partsize_dt.Rows.Add(dr);
ls_Particel_dt.Columns.Add("Name");
ls_Particel_dt.Columns.Add("total", typeof(double));
ls_Particel_dt.Columns.Add("TypeId");
ls_Particel_dt.Columns.Add("Class");
for (int i = 0; i < data.Rows.Count; i++)
{
DataRow dr2 = ls_Particel_dt.NewRow();
dr2["Name"] = data.Rows[i]["TypeName"].ToString();
dr2["Class"] = data.Rows[i]["Class"].ToString();
dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
for (int j = 1; j < colidCount; j++)
{
if (colid.Count >= j)
{
dr2["c" + j.ToString()] = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
}
}
if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
{
dr2["total"] = "0"; //求合
double d_total = 0;
for (int j = 1; j < colidCount; j++)
{
if (colid.Count >= j)
{
d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
}
}
dr2["total"] = d_total.ToString();
}
ls_Particel_dt.Rows.Add(dr2);
}
//按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
List ClassName = new List();
DataTable getClass_dt = basicData.GetAllClass();
bool bl = false;
for (int i = 0; i < getClass_dt.Rows.Count; i++)
{
if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid"
&& getClass_dt.Rows[i]["GroupName"].ToString() != "Not Identified")
if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
{
if (!bl)
{
ClassName.Add("Default");
bl = true;
}
}
else
{
ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
}
}
//获取大分类信息
DataTable dt = QuantityOfIntegratedSubstances(ls_Particel_dt, ClassName);
DataTable data2 = classIfIcationSort(ls_Particel_dt, ClassName, dt, colidCount);
datas.Add(ls_partsize_dt.Copy());
datas.Add(data2.Copy());
return datas;
}
///
/// 大分类chart数据
///
///
///
///
public DataTable GetChartDataCalss(BasicData basicData)
{
DataTable data =basicData.GetDBData();
//获取粒级表
List colid = basicData.GetParticlesizeTable();
//------------------------------------------------
DataTable ls_partsize_dt = new DataTable();
ls_partsize_dt.TableName = "PartSize";
for (int i = 0; i < colid.Count; i++)
{
ls_partsize_dt.Columns.Add("c"+(i+1).ToString());
}
DataTable ls_Particel_dt = new DataTable();
ls_Particel_dt.TableName = "Particel";
DataRow dr = ls_partsize_dt.NewRow();
int colidCount = 1;
for (int i = 0; i < colid.Count; i++)
{
if (colid.Count < i)
{
dr["c" + (i + 1).ToString()] = "";
}
else
{
dr["c" + (i + 1).ToString()] = colid[i];
ls_Particel_dt.Columns.Add("c" + (i + 1).ToString(), typeof(double));
colidCount++;
}
}
ls_partsize_dt.Rows.Add(dr);
ls_Particel_dt.Columns.Add("Name");
ls_Particel_dt.Columns.Add("total", typeof(double));
ls_Particel_dt.Columns.Add("TypeId");
ls_Particel_dt.Columns.Add("Class");
for (int i = 0; i < data.Rows.Count; i++)
{
DataRow dr2 = ls_Particel_dt.NewRow();
dr2["Name"] = data.Rows[i]["TypeName"].ToString();
dr2["Class"] = data.Rows[i]["Class"].ToString();
dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
for (int j = 1; j < colidCount; j++)
{
if (colid.Count >= j)
{
dr2["c" + j.ToString()] = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
}
}
if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
{
dr2["total"] = "0"; //求合
double d_total = 0;
for (int j = 1; j < colidCount; j++)
{
if (colid.Count >= j)
{
d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
}
}
dr2["total"] = d_total.ToString();
}
ls_Particel_dt.Rows.Add(dr2);
}
//按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
List ClassName = new List();
DataTable getClass_dt = basicData.GetAllClass();
for (int i = 0; i < getClass_dt.Rows.Count; i++)
{
if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid")
if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
ClassName.Add("NULL");
else
ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
}
//颗粒尺寸数据(例 1.5有多少,2.0有多少)
DataTable colid_data = new DataTable();
colid_data.Columns.Add("name");
colid_data.Columns.Add("quantity", typeof(double));
for (int i = 0; i < ls_Particel_dt.Columns.Count; i++)
{
if (ls_Particel_dt.Columns[i].ColumnName == "c" + (i + 1).ToString())
{
if (i < colid.Count)
{
DataRow dr1 = colid_data.NewRow();
dr1["name"] = colid[i].ToString();
int quantity = 0;
for (int a = 0; a < ls_Particel_dt.Rows.Count; a++)
{
quantity = quantity + Convert.ToInt32(ls_Particel_dt.Rows[a][i].ToString());
}
dr1["quantity"] = quantity.ToString();
colid_data.Rows.Add(dr1);
}
}
}
return colid_data;
}
public DataTable ParticleResults(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export, string ComputeMode)
{
DataTable data = GetDBData(m_mbszclass, m_otsreport_export, ComputeMode);
List colid = new List();
//获取粒级表
string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
for (int i = 0; i < sizestr.Split(',').Length; i++)
{
if (sizestr.Split(',')[i].Length > 0)
{
double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
colid.Add("≥" + d1.ToString() );
}
}
ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResultId()].FilePath);
//------------------------------------------------
DataTable ls_partsize_dt = new DataTable();
ls_partsize_dt.TableName = "PartSize";
for(int i=0;i< colid.Count;i++)
{
ls_partsize_dt.Columns.Add("c"+(i+1).ToString());
}
DataRow dr = ls_partsize_dt.NewRow();
DataTable ls_Particel_dt = new DataTable();
ls_Particel_dt.TableName = "Particel";
int colidCount = 1;
for (int i = 0; i < colid.Count; i++)
{
dr["c" + (i+1).ToString()] = colid[i];
ls_Particel_dt.Columns.Add("c"+ (i + 1).ToString());
colidCount++;
}
ls_partsize_dt.Rows.Add(dr);
ls_Particel_dt.Columns.Add("Name");
ls_Particel_dt.Columns.Add("total");
ls_Particel_dt.Columns.Add("TypeId");
for (int i = 0; i < data.Rows.Count; i++)
{
DataRow dr2 = ls_Particel_dt.NewRow();
dr2["Name"] = data.Rows[i]["TypeName"].ToString();
dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
for (int j = 1; j < colidCount; j++)
{
if (colid.Count >= j)
{
double de = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
if (de == 0)
dr2["c" + j.ToString()] = " ";
else
dr2["c" + j.ToString()] = de.ToString();
}
}
if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
{
dr2["total"] = " "; //求合
double d_total = 0;
for (int j = 1; j < colidCount; j++)
{
if (colid.Count >= j)
{
d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
}
}
if (d_total == 0)
{
continue;
dr2["total"] = " ";
}
else
dr2["total"] = d_total.ToString();
}
ls_Particel_dt.Rows.Add(dr2);
}
return ls_Particel_dt;
}
public DataTable TypeRange(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export)
{
List colid = new List();
//获取粒级表
string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
for (int i = 0; i < sizestr.Split(',').Length; i++)
{
if (sizestr.Split(',')[i].Length > 0)
{
double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
colid.Add("≥" + d1.ToString());
}
}
DataTable ls_partsize_dt = new DataTable();
ls_partsize_dt.TableName = "PartSize";
for (int i=0;i< colid.Count;i++)
{
ls_partsize_dt.Columns.Add("c"+(i+1).ToString());
}
DataRow dr = ls_partsize_dt.NewRow();
for (int i = 0; i < colid.Count; i++)
{
dr["c" + (i+1).ToString()] = colid[i];
}
ls_partsize_dt.Rows.Add(dr);
return ls_partsize_dt;
}
private DataTable QuantityOfIntegratedSubstances(DataTable dataTable, List ClassName)
{
DataTable dt_Class = dataTable.Copy();
dt_Class.Clear();
dt_Class.TableName = "Particel";
dt_Class.Columns.Remove("Name");
for (int i = 0; i < ClassName.Count; i++)
{
//保留当前循环中大类物质,去除其他物质
DataTable dt = dataTable.Copy();
dt.Clear();
for (int a = 0; a < dataTable.Rows.Count; a++)
{
if (dataTable.Rows[a]["Class"].ToString() == ClassName[i].ToString())
{
dt.Rows.Add(dataTable.Rows[a].ItemArray);
}
}
if (dt.Rows.Count == 0)
continue;
DataTable dt_2 = new DataTable();
dt_2 = dataTable.Copy();
dt_2.Clear();
DataRow row = dt_2.NewRow();
dt_2.Rows.Add(row);
for (int a = 0; a < dt.Columns.Count; a++)
{
if (dt.Columns[a].ToString() != "Name" && dt.Columns[a].ToString() != "Class" && dt.Columns[a].ToString() != "TypeId")
{
bool bl = false;
for (int b = 0; b < dt.Rows.Count; b++)
{
if (!dt.Rows[b].IsNull(dt.Columns[a].ToString()))
{
bl = true;
}
}
if (bl)
{
dt_2.Rows[0][dt.Columns[a].ToString()] = decimal.Parse(dt.Compute("sum(" + dt.Columns[a].ToString() + ")", "").ToString());
}
}
}
dt_2.Columns.Remove("Name");
dt_2.Rows[0]["Class"] = ClassName[i];
dt_Class.Rows.Add(dt_2.Rows[0].ItemArray);
}
return dt_Class;
}
private DataTable classIfIcationSort(DataTable dataTable, List ClassName, DataTable data,int colidCount)
{
DataTable dt = new DataTable();
dt = dataTable.Copy();
dt.Clear();
dt.TableName = "Particel_subdivision";
//循环list中每个类型
for (int i = 0; i < ClassName.Count(); i++)
{
DataTable data1 = dt.Copy();
data1.Clear();
data1.Rows.Add();
for (int a = 0; a < data.Rows.Count; a++)
{
if (data.Rows[a]["Class"].ToString() == ClassName[i].ToString())
{
for (int b = 1; b < colidCount; b++)
{
data1.Rows[0]["c" + b.ToString()] = data.Rows[a]["c" + b.ToString()];
}
data1.Rows[0]["total"] = data.Rows[a]["total"];
data1.Rows[0]["Class"] = data.Rows[a]["Class"];
dt.Rows.Add(data1.Rows[0].ItemArray);
}
}
DataTable dt_1 = new DataTable();
dt_1 = dt.Copy();
dt_1.Clear();
//循环DataTable中每个分类的数据
for (int a = 0; a < dataTable.Rows.Count; a++)
{
if (!string.IsNullOrWhiteSpace(ClassName[i].ToString()))
if (dataTable.Rows[a]["Class"].ToString() == ClassName[i].ToString())
{
dataTable.Rows[a]["Class"] = "";
dt_1.Rows.Add(dataTable.Rows[a].ItemArray);
}
}
//将颗粒数量排序(从大到小)
DataView dv = dt_1.DefaultView;
dv.Sort = "total DESC";
DataTable dt_1_sort = dv.ToTable();
for (int a = 0; a < dt_1_sort.Rows.Count; a++)
{
dt.Rows.Add(dt_1_sort.Rows[a].ItemArray);
}
}
return dt;
}
private DataTable InvalidRemoval(DataTable dt)
{
DataTable dataTable = dt.Copy();
dataTable.Clear();
for (int i = 0; i < dt.Rows.Count; i++)
{
if (Convert.ToInt32(dt.Rows[i]["TypeId"])>10 )
{
dataTable.Rows.Add(dt.Rows[i].ItemArray);
}
}
return dataTable;
}
private string getWhere(string max, string min, string col, string partic)
{
return col + ">=" + min + " and " + col + "<" + max + " and TypeId=" + partic;
}
private DataTable GetDBData(c_TemplateClass m_mbszclass , OTSReport_Export m_otsreport_export,string ComputeMode)
{
DataTable m_bt_DBData = new DataTable();
ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResultId()].FilePath);
List colid = new List() { "TypeName", "ar", "TypeId", "Largest", "Class", "con" };
//获取粒级表
string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
for (int i = 0; i < sizestr.Split(',').Length ; i++)
{
if (sizestr.Split(',')[i].Length > 0)
{
double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
colid.Add("≥" + d1.ToString() );
}
}
for (int i = 0; i < colid.Count; i++)
{
m_bt_DBData.Columns.Add(colid[i].ToString());
}
DataTable dt = InvalidRemoval(fielddata.GetParticleListForParticlSize("area", ""));
DataTable AreaInformationOfAllElements = InvalidRemoval(fielddata.GetAreaByAllIncA(""));
DataTable dtp = InvalidRemoval(fielddata.GetParticleAll(""));
string po = ComputeMode;
switch (po)
{
case "DMAX":
po = "DMAX";
break;
case "DMIN":
po = "DMIN";
break;
case "ECD":
po = "Area";
break;
case "FERET":
po = "DFERET";
break;
}
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = m_bt_DBData.NewRow();
dr["TypeName"] = dt.Rows[i]["TypeName"].ToString();
dr["TypeId"] = dt.Rows[i]["TypeId"].ToString();
dr["con"] = dt.Rows[i]["con"].ToString();
if (dt.Rows[i]["GroupName"].ToString() == "")
dr["Class"] = "Default";
else
dr["Class"] = dt.Rows[i]["GroupName"].ToString();
//continue;
dr["Largest"] = Math.Round(Convert.ToDouble(dt.Rows[i]["max"]), 2);
for (int a = 6; a < colid.Count; a++)
{
string d2;
if (a== colid.Count-1)
{
d2 = "999";
}
else
{
d2 = colid[a+1].Split('≥')[1];
}
string d1 = colid[a].Split('≥')[1];
DataRow[] datas = dtp.Select(getWhere(d2, d1, po, dt.Rows[i]["TypeId"].ToString()));
dr[colid[a]] = datas.Count();
}
for (int a = 0; a < AreaInformationOfAllElements.Rows.Count; a++)
{
if (dt.Rows[i]["TypeId"].ToString() == AreaInformationOfAllElements.Rows[a]["TypeId"].ToString())
{
dr["ar"] = AreaInformationOfAllElements.Rows[a]["ar"];
}
}
m_bt_DBData.Rows.Add(dr);
}
//去除物质分类(非夹杂物分类)
for (int a = 0; a < m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass_Serial.Count; a++)
{
for (int i = m_bt_DBData.Rows.Count - 1; i >= 0; i--)
{
if (m_bt_DBData.Rows[i]["TypeId"].ToString() == m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass_Serial[a].ToString())
{
m_bt_DBData.Rows.RemoveAt(i);
}
}
}
if (m_mbszclass.list_str_MainPriority_Serial.Count==0)
{
return m_bt_DBData;
}
DataTable datass = m_bt_DBData.Clone();
for (int i=0;i< m_mbszclass.list_str_MainPriority_Serial.Count;i++)
{
bool bl = false;
for (int a = 0; a < m_bt_DBData.Rows.Count; a++)
{
if (m_bt_DBData.Rows[a]["TypeId"].ToString() == m_mbszclass.list_str_MainPriority_Serial[i])
{
datass.Rows.Add(m_bt_DBData.Rows[a].ItemArray);
bl = true;
continue;
}
}
if(!bl)
{
DataTable dta= m_bt_DBData.Clone();
if (m_bt_DBData.Rows.Count != 0)
{
dta.Rows.Add(m_bt_DBData.Rows[0].ItemArray);
for (int b = 0; b < dta.Columns.Count; b++)
{
if (dta.Columns[b].ColumnName == "TypeName")
{
dta.Rows[0][b] = m_mbszclass.list_str_MainPriority[i];
}
else if (dta.Columns[b].ColumnName == "Class")
{
dta.Rows[0][b] = "Default";
}
else
{
dta.Rows[0][b] = 0;
}
}
datass.Rows.Add(dta.Rows[0].ItemArray);
}
}
}
return datass;
}
}
}