=============================================================asp.net========================================
num = Convert.ToInt32(ini.IniReadValue("Record", "Num").ToString());
num++;
Random random = new Random();
//保存文件的虚拟路径
string path = "UploadFile/";
//获取选择的文件名
string fileName = FileUpload1.FileName;
///文件名称判断
if (true)
{
}
//获取文件扩展名称
string fileExt = Path.GetExtension(fileName);
//生成新文件名
//string newName ="Mes"+ DateTime.Now.ToString("yyyyMMddHHmmssfff") + random.Next(0, 9999).ToString();
string NewName = "MES" + DateTime.Now.ToString("yyyyMMdd") + num.ToString();
ini.IniWriteValue("Record", "Num", num.ToString());
//获取指定虚机路径的物理路径
string fullPath = HttpContext.Current.Server.MapPath(path);
//上传文件保存路径
string savePath = fullPath + NewName + fileExt;
//保存文件到服务器
FileUpload1.SaveAs(savePath);
==================================================================Winform=================================================
///
/// 浏览
///
///
///
private void bn_MConfig_Click(object sender, EventArgs e)
{
this.openFileDialog1.Filter = "所有文件(*.*)|*.*";
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
/*
string PicFileName = this.openFileDialog1.FileName;
this.imgList.Add(PicFileName);
this.imageList1.Images.Add(Image.FromFile(PicFileName));
*/
string FileName = this.openFileDialog1.FileName;
tb_file.Text = FileName;
}
}
///
/// 文件上传
///
///
///
public static void FileUp(OpenFileDialog openFileDialog, string FileTypeName)
{
try
{
//FileTypeName = "Models";
Random random = new Random();
//保存文件的虚拟路径
string path = "UploadFile//" + FileTypeName + "//";
//获取选择的文件名
string fileName = openFileDialog.FileName;
///文件名称判断
if (true)
{
}
//获取文件扩展名称
string fileExt = Path.GetExtension(fileName);
//生成新文件名
//string newName ="Mes"+ DateTime.Now.ToString("yyyyMMddHHmmssfff") + random.Next(0, 9999).ToString();
string NewName = FileTypeName + DateTime.Now.ToString("yyyyMMddHHmmssfff");
//获取指定虚机路径的物理路径
string fullPath = Path.GetDirectoryName(path);
fullPath = Path.GetFullPath(path);
//上传文件保存路径
string savePath = fullPath + NewName + fileExt;
//DBHelpter.MsgBox(savePath);
//保存文件到本地
File.Copy(fileName, savePath);
///获取execl数据
//返回指定目录中的文件的名称(绝对路径)
string[] files = System.IO.Directory.GetFiles(fullPath);
//获取Test文件夹下所有文件名称
string[] files2 = System.IO.Directory.GetFiles(@fullPath, "*", System.IO.SearchOption.AllDirectories);
////获取指定目录下面指定格式的所有文件
//DirectoryInfo di = new DirectoryInfo(@fullPath.TrimEnd('\\'));
//FileInfo[] files1 = new string[] { "*.xlsx", "*.csv", "*.xls" }.SelectMany(i => di.GetFiles(i, SearchOption.AllDirectories)).Distinct().ToArray();
List
List
for (int i = 0; i < FilePathlist.Count(); i++)
{
string str = FilePathlist[i].Split('.')[0];
string[] sArray = str.Split(new string[] { FileTypeName }, StringSplitOptions.RemoveEmptyEntries);
long NO = Convert.ToInt64(sArray[2]);
MESNO.Add(NO);
}
long max = 0;
for (int i = 0; i < MESNO.Count(); i++)
{
max = MESNO[0];
if (MESNO[i] > max)
{
max = MESNO[i];
}
}
string LastFileName = fullPath + FileTypeName + max + fileExt;
FileSvr fileSvr = new FileSvr();
///有Office配置文件
//DataTable dt = fileSvr.GetExcelDatatable(LastFileName, "mapTable");
///引用NPIO
string msgstr = "";
DataSet ds = NPIOClass.ExcelToDataSet(LastFileName, msgstr);
string name = "";
for (int i = 0; i < ds.Tables.Count; i++)
{
name += ds.Tables[i].TableName + ",";
int num= InsertDatas(ds.Tables[i]);
if (num>0)
{
MessageBox.Show("上传成功!");
}
else
{
MessageBox.Show("上传失败!");
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Physical_planning_system.UploadClass
{
public class NPIOClass
{
///
/// Excel转换成DataTable(.xls)
///
/// Excel文件路径
///
public static DataTable ExcelToDataTable(string filePath)
{
var dt = new DataTable();
using (var file = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
var hssfworkbook = new XSSFWorkbook(file);
var sheet = hssfworkbook.GetSheetAt(0);
for (var j = 0; j < 5; j++)
{
dt.Columns.Add(Convert.ToChar(((int)'A') + j).ToString());
}
var rows = sheet.GetRowEnumerator();
while (rows.MoveNext())
{
var row = (HSSFRow)rows.Current;
var dr = dt.NewRow();
for (var i = 0; i < row.LastCellNum; i++)
{
var cell = row.GetCell(i);
if (cell == null)
{
dr[i] = null;
}
else
{
switch (cell.CellType)
{
case CellType.Blank:
dr[i] = "[null]";
break;
case CellType.Boolean:
dr[i] = cell.BooleanCellValue;
break;
case CellType.Numeric:
dr[i] = cell.ToString();
break;
case CellType.String:
dr[i] = cell.StringCellValue;
break;
case CellType.Error:
dr[i] = cell.ErrorCellValue;
break;
case CellType.Formula:
try
{
dr[i] = cell.NumericCellValue;
}
catch
{
dr[i] = cell.StringCellValue;
}
break;
default:
dr[i] = "=" + cell.CellFormula;
break;
}
}
}
dt.Rows.Add(dr);
}
}
return dt;
}
///
/// Excel转换成DataSet(.xlsx/.xls)
///
/// Excel文件路径
///
///
public static DataSet ExcelToDataSet(string filePath, string strMsg)
{
strMsg = "";
DataSet ds = new DataSet();
DataTable dt = new DataTable();
string fileType = Path.GetExtension(filePath).ToLower();
string fileName = Path.GetFileName(filePath).ToLower();
try
{
ISheet sheet = null;
int sheetNumber = 0;
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
if (fileType == ".xlsx")
{
// 2007版本
XSSFWorkbook workbook = new XSSFWorkbook(fs);
sheetNumber = workbook.NumberOfSheets;
for (int i = 0; i < sheetNumber; i++)
{
string sheetName = workbook.GetSheetName(i);
sheet = workbook.GetSheet(sheetName);
if (sheet != null)
{
dt = GetSheetDataTable(sheet, strMsg);
if (dt != null)
{
dt.TableName = sheetName.Trim();
ds.Tables.Add(dt);
}
else
{
//MessageBox.Show("Sheet数据获取失败,原因:" + strMsg);
}
}
}
}
else if (fileType == ".xls")
{
// 2003版本
HSSFWorkbook workbook = new HSSFWorkbook(fs);
sheetNumber = workbook.NumberOfSheets;
for (int i = 0; i < sheetNumber; i++)
{
string sheetName = workbook.GetSheetName(i);
sheet = workbook.GetSheet(sheetName);
if (sheet != null)
{
dt = GetSheetDataTable(sheet, strMsg);
if (dt != null)
{
dt.TableName = sheetName.Trim();
ds.Tables.Add(dt);
}
else
{
// MessageBox.Show("Sheet数据获取失败,原因:" + strMsg);
}
}
}
}
return ds;
}
catch (Exception ex)
{
strMsg = ex.Message;
return null;
}
}
///
/// 获取sheet表对应的DataTable
///
/// Excel工作表
///
///
private static DataTable GetSheetDataTable(ISheet sheet, string strMsg)
{
strMsg = "";
DataTable dt = new DataTable();
string sheetName = sheet.SheetName;
int startIndex = 0;// sheet.FirstRowNum;
int lastIndex = sheet.LastRowNum;
//最大列数
int cellCount = 0;
IRow maxRow = sheet.GetRow(0);
for (int i = startIndex; i <= lastIndex; i++)
{
IRow row = sheet.GetRow(i);
if (row != null && cellCount < row.LastCellNum)
{
cellCount = row.LastCellNum;
maxRow = row;
}
}
//列名设置
try
{
for (int i = 0; i < maxRow.LastCellNum; i++)//maxRow.FirstCellNum
{
//dt.Columns.Add(Convert.ToChar(((int)'A') + i).ToString());
dt.Columns.Add(maxRow.Cells[i].ToString());
//DataColumn column = new DataColumn("Column" + (i + 1).ToString());
//dt.Columns.Add(column);
}
}
catch
{
strMsg = "工作表" + sheetName + "中无数据";
return null;
}
//数据填充
for (int i = startIndex + 1; i <= lastIndex; i++)
{
IRow row = sheet.GetRow(i);
DataRow drNew = dt.NewRow();
if (row != null)
{
for (int j = row.FirstCellNum; j < row.LastCellNum; ++j)
{
if (row.GetCell(j) != null)
{
ICell cell = row.GetCell(j);
switch (cell.CellType)
{
case CellType.Blank:
drNew[j] = "";
break;
case CellType.Numeric:
short format = cell.CellStyle.DataFormat;
//对时间格式(2015.12.5、2015/12/5、2015-12-5等)的处理
if (format == 14 || format == 31 || format == 57 || format == 58)
drNew[j] = cell.DateCellValue;
else
drNew[j] = cell.NumericCellValue;
if (cell.CellStyle.DataFormat == 177 || cell.CellStyle.DataFormat == 178 || cell.CellStyle.DataFormat == 188)
drNew[j] = cell.NumericCellValue.ToString("#0.00");
break;
case CellType.String:
drNew[j] = cell.StringCellValue;
break;
case CellType.Formula:
try
{
drNew[j] = cell.NumericCellValue;
if (cell.CellStyle.DataFormat == 177 || cell.CellStyle.DataFormat == 178 || cell.CellStyle.DataFormat == 188)
drNew[j] = cell.NumericCellValue.ToString("#0.00");
}
catch
{
try
{
drNew[j] = cell.StringCellValue;
}
catch { }
}
break;
default:
drNew[j] = cell.StringCellValue;
break;
}
}
}
}
dt.Rows.Add(drNew);
}
return dt;
}
}
}
///
/// 获取某种类型文件
///
///
///
///
public static List
{
List
if (directory.Exists || pattern.Trim() != string.Empty)
{
string[] ext = pattern.Split(',');
for (int i = 0; i < ext.Count(); i++)
{
foreach (FileInfo info in directory.GetFiles(ext[i]))
{
if (Filelist.Contains(info.FullName.ToString()))
{
continue;
}
Filelist.Add(info.FullName.ToString());
}
foreach (DirectoryInfo info in directory.GetDirectories())
{
GetFiles(info, pattern);
}
}
}
return Filelist;
}
///
/// 把table数据添加到数据库
///
///
///
public static int InsertDatas(DataTable dt)
{
try
{
string tablename = dt.TableName;
if (tablename == "L5标配清单")
{
}
else if (tablename == "BE标配清单")
{
}
else if (tablename == "CFC标配清单")
{
foreach (DataRow dr in dt.Rows)
{
string Process_section = "0"; string classification = "0"; string classes_name = "0"; string name = "0"; string IBIS = "0"; string Houdini = "0"; string Andy_NA = "0";
string Golden_Eagle = "0"; string George_NA = "0"; string Zap = "0"; string Heart = "0"; string STINGRAY = "0"; string Quattro = "0"; string Zippo = "0"; string RIO_H = "0";
string RIO_H_TMO = "0"; string RIO_M = "0"; string George_Row = "0"; string Zach = "0"; string D52_Row = "0"; string D52PRC = "0"; string Andy_Row = "0"; string Dante = "0";
string P3G = "0"; string P4G = "0"; string Teller = "0"; string Blaine = "0"; string K9_note = "0"; string K9_S = "0"; string Robusta_2 = "0"; string Troika = "0"; string Oslo_M_Row = "0";
string DOHA = "0";
string Oslo_M_NA = "0";
string Oslo_M_IMT = "0";
string Oslo_H_Row = "0";
string Oslo_H_NA = "0";
string Rugby = "0";
string Rugby_GO = "0";
string Golf_Lite = "0";
string Surf_NA = "0";
string Ashley_lite = "0";
string Poker = "0";
string JIMNY_ROW = "0";
string JIMNY = "0";
string Ashley_NA = "0";
string Andy_4 = "0";
string Auqa = "0";
string A600X = "0";
string Q6003 = "0";
string Q6005 = "0";
string Q6006 = "0";
string Q6008 = "0";
string A6090 = "0";
string A6095 = "0";
string A6505 = "0";
string A6096 = "0";
string A6093 = "0";
string A6097 = "0";
string A6072 = "0";
string Q6070 = "0";
string Q6071 = "0";
string P3588 = "0";
string P400 = "0";
string P407 = "0";
string M7 = "0";
string V7 = "0";
string M8 = "0";
string SPARROW = "0";
string T400 = "0";
string Rossion = "0";
string Yeti2 = "0";
string ACHILLES_5_PLUS_BUNDLE = "0";
string ACHILLES_5_PLUS = "0";
string Achilles_5_L = "0";
string P2I = "0";
object a;
for (int i = 0; i < dr.ItemArray.Count(); i++)
{
a= dr.ItemArray[i];
}
if (dr["Process section"].ToString()!=string.Empty|| dr["Process section"].ToString()!="")
{
Process_section = dr["Process section"].ToString();
}
if (dr["classification "].ToString() != string.Empty || dr["classification "].ToString() != "")
{
classification = dr["classification "].ToString();
}
if (dr["classes"].ToString() != string.Empty || dr["classes"].ToString() != "")
{
classes_name = dr["classes"].ToString();
}
if (dr["name"].ToString() != string.Empty || dr["name"].ToString() != "")
{
name = dr["name"].ToString();
}
if (dr["IBIS"].ToString() != string.Empty || dr["IBIS"].ToString() != "")
{
IBIS = dr["IBIS"].ToString();
}
if (dr["Houdini"].ToString() != string.Empty || dr["Houdini"].ToString() != "")
{
Houdini = dr["Houdini"].ToString();
}
if (dr["Andy NA"].ToString() != string.Empty || dr["Andy NA"].ToString() != "")
{
Andy_NA = dr["Andy NA"].ToString();
}
if (dr["Golden Eagle"].ToString() != string.Empty || dr["Golden Eagle"].ToString() != "")
{
Golden_Eagle = dr["Golden Eagle"].ToString();
}
if (dr["George NA"].ToString() != string.Empty || dr["George NA"].ToString() != "")
{
George_NA = dr["George NA"].ToString();
}
if (dr["Zap"].ToString() != string.Empty || dr["Zap"].ToString() != "")
{
Zap = dr["Zap"].ToString();
}
if (dr["Heart"].ToString() != string.Empty || dr["Heart"].ToString() != "")
{
Heart = dr["Heart"].ToString();
}
if (dr["STINGRAY"].ToString() != string.Empty || dr["STINGRAY"].ToString() != "")
{
STINGRAY = dr["STINGRAY"].ToString();
}
if (dr["Quattro "].ToString() != string.Empty || dr["Quattro "].ToString() != "")
{
Quattro = dr["Quattro "].ToString();
}
if (dr["Zippo"].ToString() != string.Empty || dr["Zippo"].ToString() != "")
{
Zippo = dr["Zippo"].ToString();
}
if (dr["RIO H"].ToString() != string.Empty || dr["RIO H"].ToString() != "")
{
RIO_H = dr["RIO H"].ToString();
}
if (dr["RIO H TMO"].ToString() != string.Empty || dr["RIO H TMO"].ToString() != "")
{
RIO_H_TMO = dr["RIO H TMO"].ToString();
}
if (dr["RIO M"].ToString() != string.Empty || dr["RIO M"].ToString() != "")
{
RIO_M = dr["RIO M"].ToString();
}
if (dr["George Row"].ToString() != string.Empty || dr["George Row"].ToString() != "")
{
George_Row = dr["George Row"].ToString();
}
if (dr["Zach"].ToString() != string.Empty || dr["Zach"].ToString() != "")
{
Zach = dr["Zach"].ToString();
}
if (dr["D52 Row"].ToString() != string.Empty || dr["D52 Row"].ToString() != "")
{
D52_Row = dr["D52 Row"].ToString();
}
if (dr["D52PRC "].ToString() != string.Empty || dr["D52PRC "].ToString() != "")
{
D52PRC = dr["D52PRC "].ToString();
}
if (dr["Andy Row"].ToString() != string.Empty || dr["Andy Row"].ToString() != "")
{
Andy_Row = dr["Andy Row"].ToString();
}
if (dr["Dante"].ToString() != string.Empty || dr["Dante"].ToString() != "")
{
Dante = dr["Dante"].ToString();
}
if (dr["P3G"].ToString() != string.Empty || dr["P3G"].ToString() != "")
{
P3G = dr["P3G"].ToString();
}
if (dr["P4G"].ToString() != string.Empty || dr["P4G"].ToString() != "")
{
P4G = dr["P4G"].ToString();
}
if (dr["Teller"].ToString() != string.Empty || dr["Teller"].ToString() != "")
{
Teller = dr["Teller"].ToString();
}
if (dr["Blaine"].ToString() != string.Empty || dr["Blaine"].ToString() != "")
{
Blaine = dr["Blaine"].ToString();
}
if (dr["K9 note"].ToString() != string.Empty || dr["K9 note"].ToString() != "")
{
K9_note = dr["K9 note"].ToString();
}
if (dr["K9 S "].ToString() != string.Empty || dr["K9 S "].ToString() != "")
{
K9_S = dr["K9 S "].ToString();
}
if (dr["Robusta 2"].ToString() != string.Empty || dr["Robusta 2"].ToString() != "")
{
Robusta_2 = dr["Robusta 2"].ToString();
}
if (dr["Troika"].ToString() != string.Empty || dr["Troika"].ToString() != "")
{
Troika = dr["Troika"].ToString();
}
if (dr["Oslo M Row"].ToString() != string.Empty || dr["Oslo M Row"].ToString() != "")
{
Oslo_M_Row = dr["Oslo M Row"].ToString();
}
if (dr["DOHA"].ToString() != string.Empty || dr["DOHA"].ToString() != "")
{
DOHA = dr["DOHA"].ToString();
}
if (dr["Oslo M NA"].ToString() != string.Empty || dr["Oslo M NA"].ToString() != "")
{
Oslo_M_NA = dr["Oslo M NA"].ToString();
}
if (dr["Oslo M IMT"].ToString() != string.Empty || dr["Oslo M IMT"].ToString() != "")
{
Oslo_M_IMT = dr["Oslo M IMT"].ToString();
}
if (dr["Oslo H Row"].ToString() != string.Empty || dr["Oslo H Row"].ToString() != "")
{
Oslo_H_Row = dr["Oslo H Row"].ToString();
}
if (dr["Oslo H NA"].ToString() != string.Empty || dr["Oslo H NA"].ToString() != "")
{
Oslo_H_NA = dr["Oslo H NA"].ToString();
}
if (dr["Rugby"].ToString() != string.Empty || dr["Rugby"].ToString() != "")
{
Rugby = dr["Rugby"].ToString();
}
if (dr["Rugby GO"].ToString() != string.Empty || dr["Rugby GO"].ToString() != "")
{
Rugby_GO = dr["Rugby GO"].ToString();
}
if (dr["Golf Lite"].ToString() != string.Empty || dr["Golf Lite"].ToString() != "")
{
Golf_Lite = dr["Golf Lite"].ToString();
}
if (dr["Surf NA"].ToString() != string.Empty || dr["Surf NA"].ToString() != "")
{
Surf_NA = dr["Surf NA"].ToString();
}
if (dr["Ashley lite"].ToString() != string.Empty || dr["Ashley lite"].ToString() != "")
{
Ashley_lite = dr["Ashley lite"].ToString();
}
if (dr["Poker+"].ToString() != string.Empty || dr["Poker+"].ToString() != "")
{
Poker = dr["Poker+"].ToString();
}
if (dr["JIMNY ROW"].ToString() != string.Empty || dr["JIMNY ROW"].ToString() != "")
{
JIMNY_ROW = dr["JIMNY ROW"].ToString();
}
if (dr["JIMNY+"].ToString() != string.Empty || dr["JIMNY+"].ToString() != "")
{
JIMNY = dr["JIMNY+"].ToString();
}
if (dr["Ashley NA"].ToString() != string.Empty || dr["Ashley NA"].ToString() != "")
{ Ashley_NA = dr["Ashley NA"].ToString();
}
if (dr["Andy 4"].ToString() != string.Empty || dr["Andy 4"].ToString() != "")
{
Andy_4 = dr["Andy 4"].ToString();
}
if (dr["Auqa"].ToString() != string.Empty || dr["Auqa"].ToString() != "")
{
Auqa = dr["Auqa"].ToString();
}
if (dr["A600X"].ToString() != string.Empty || dr["A600X"].ToString() != "")
{
A600X = dr["A600X"].ToString();
}
if (dr["Q6003"].ToString() != string.Empty || dr["Q6003"].ToString() != "")
{
Q6003 = dr["Q6003"].ToString();
}
if (dr["Q6005"].ToString() != string.Empty || dr["Q6005"].ToString() != "")
{
Q6005 = dr["Q6005"].ToString();
}
if (dr["Q6006"].ToString() != string.Empty || dr["Q6006"].ToString() != "")
{
Q6006 = dr["Q6006"].ToString();
}
if (dr["Q6008"].ToString() != string.Empty || dr["Q6008"].ToString() != "")
{
Q6008 = dr["Q6008"].ToString();
}
if (dr["A6090"].ToString() != string.Empty || dr["A6090"].ToString() != "")
{
A6090 = dr["A6090"].ToString();
}
if (dr["A6095"].ToString() != string.Empty || dr["A6095"].ToString() != "")
{
A6095 = dr["A6095"].ToString();
}
if (dr["A6505"].ToString() != string.Empty || dr["A6505"].ToString() != "")
{
A6505 = dr["A6505"].ToString();
}
if (dr["A6096"].ToString() != string.Empty || dr["A6096"].ToString() != "")
{
A6096 = dr["A6096"].ToString();
}
if (dr["A6093"].ToString() != string.Empty || dr["A6093"].ToString() != "")
{
A6093 = dr["A6093"].ToString();
}
if (dr["A6097"].ToString() != string.Empty || dr["A6097"].ToString() != "")
{
A6097 = dr["A6097"].ToString();
}
if (dr["A6072"].ToString() != string.Empty || dr["A6072"].ToString() != "")
{
A6072 = dr["A6072"].ToString();
}
if (dr["Q6070"].ToString() != string.Empty || dr["Q6070"].ToString() != "")
{
Q6070 = dr["Q6070"].ToString();
}
if (dr["Q6071"].ToString() != string.Empty || dr["Q6071"].ToString() != "")
{
Q6071 = dr["Q6071"].ToString();
}
if (dr["P3588"].ToString() != string.Empty || dr["P3588"].ToString() != "")
{
P3588 = dr["P3588"].ToString();
}
if (dr["P400"].ToString() != string.Empty || dr["P400"].ToString() != "")
{
P400 = dr["P400"].ToString();
}
if (dr["P407"].ToString() != string.Empty || dr["P407"].ToString() != "")
{
P407 = dr["P407"].ToString();
}
if (dr["M7"].ToString() != string.Empty || dr["M7"].ToString() != "")
{
M7 = dr["M7"].ToString();
}
if (dr["V7"].ToString() != string.Empty || dr["V7"].ToString() != "")
{
V7 = dr["V7"].ToString();
}
if (dr["M8"].ToString() != string.Empty || dr["M8"].ToString() != "")
{
M8 = dr["M8"].ToString();
}
if (dr["SPARROW"].ToString() != string.Empty || dr["SPARROW"].ToString() != "")
{
SPARROW = dr["SPARROW"].ToString();
}
if (dr["T400"].ToString() != string.Empty || dr["T400"].ToString() != "")
{
T400 = dr["T400"].ToString();
}
if (dr["Rossion"].ToString() != string.Empty || dr["Rossion"].ToString() != "")
{
Rossion = dr["Rossion"].ToString();
}
if (dr["Yeti2"].ToString() != string.Empty || dr["Yeti2"].ToString() != "")
{
Yeti2 = dr["Yeti2"].ToString();
}
if (dr["ACHILLES 5 PLUS BUNDLE"].ToString() != string.Empty || dr["ACHILLES 5 PLUS BUNDLE"].ToString() != "")
{
ACHILLES_5_PLUS_BUNDLE = dr["ACHILLES 5 PLUS BUNDLE"].ToString();
}
if (dr["ACHILLES 5 PLUS BUNDLE"].ToString() != string.Empty || dr["ACHILLES 5 PLUS BUNDLE"].ToString() != "")
{
ACHILLES_5_PLUS = dr["ACHILLES 5 PLUS BUNDLE"].ToString();
}
if (dr["Achilles 5 L"].ToString() != string.Empty || dr["Achilles 5 L"].ToString() != "")
{
Achilles_5_L = dr["Achilles 5 L"].ToString();
}
if (dr["P2I"].ToString() != string.Empty || dr["P2I"].ToString() != "")
{
P2I = dr["P2I"].ToString();
}
string insertsql = string.Format("insert into M_config values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}'," +
"'{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}','{24}','{25}','{26}','{27}','{28}','{29}','{30}','{31}','{32}','{33}','{34}'," +
"'{35}','{36}','{37}','{38}','{39}','{40}','{41}','{42}','{43}','{44}','{45}','{46}','{47}','{48}','{49}','{50}','{51}','{52}','{53}','{54}','{55}','{56}','{57}','{58}'," +
"'{59}','{60}','{61}','{62}','{63}','{64}','{65}','{66}','{67}','{68}','{69}','{70}','{71}','{72}','{73}','{74}')", Process_section, classification, classes_name, name, IBIS, Houdini, Andy_NA, Golden_Eagle, George_NA,
Zap, Heart, STINGRAY, Quattro, Zippo, RIO_H, RIO_H_TMO, RIO_M, George_Row, Zach, D52_Row, D52PRC, Andy_Row, Dante, P3G, P4G, Teller,
Blaine, K9_note, K9_S, Robusta_2, Troika, Oslo_M_Row, DOHA, Oslo_M_NA, Oslo_M_IMT, Oslo_H_Row, Oslo_H_NA, Rugby, Rugby_GO, Golf_Lite,
Surf_NA, Ashley_lite, Poker, JIMNY_ROW, JIMNY, Ashley_NA, Andy_4, Auqa, A600X, Q6003, Q6005, Q6006, Q6008, A6090, A6095, A6505, A6096, A6093,
A6097, A6072, Q6070, Q6071, P3588, P400, P407, M7, V7, M8, SPARROW, T400, Rossion, Yeti2, ACHILLES_5_PLUS_BUNDLE, ACHILLES_5_PLUS, Achilles_5_L, P2I
);
int num = DBHlpter.GetNum(insertsql);
}
}
else if (tablename == "BE维修标配清单")
{
}
else if (tablename=="机型开线数量")
{
foreach (DataRow dr in dt.Rows)
{
string model = "";
double OneWeek = 0;
double TwoWeek = 0;
double ThressWeek = 0;
double FourWeek = 0;
double FiveWeek = 0;
double SixWeek = 0;
double ServenWeek = 0;
double EightWeek = 0;
model = dr["机型"].ToString();
OneWeek = Convert.ToDouble(dr["第一周"].ToString());
TwoWeek = Convert.ToDouble(dr["第二周"].ToString());
ThressWeek = Convert.ToDouble(dr["第三周"].ToString());
FourWeek = Convert.ToDouble(dr["第四周"].ToString());
FiveWeek = Convert.ToDouble(dr["第五周"].ToString());
SixWeek = Convert.ToDouble(dr["第六周"].ToString());
ServenWeek = Convert.ToDouble(dr["第七周"].ToString());
EightWeek = Convert.ToDouble(dr["第八周"].ToString());
string insertsqlLine = string.Format("insert into ProductionLine(model,OneProductionLineSum," +
"TwoProductionLineSum,ThreeProductionLineSum," +
"FourProductionLineSum,FiveProductionLineSum,SixProductionLineSum," +
"SenvenProductionLineSum,EightProductionLineSum)values('{0}',{1},{2},{3},{4},{5},{6},{7},{8})", model,OneWeek,TwoWeek,ThressWeek,FourWeek,
FiveWeek,SixWeek,ServenWeek,EightWeek);
int linesum= DBHlpter.GetNum(insertsqlLine);
}
}
else
{
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
return 0;
}
return 1;
}