using LYFZ.ComponentLibrary; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Windows.Forms; using System.Data; using System.Data.OleDb; namespace LYFZ.Software.MainBusiness.Customers { public class Customer { //public DataGridViewEx dgv2 = null; //public DataGridViewEx dgv = null; #region Excel操作 public bool istime(string str) { return LYFZ.WinAPI.CustomPublicMethod.IsTime(str); } ///// ///// 创建列标题 ///// ///// //public void Pu_column(DataGridViewEx dgvCurrent, ref DataGridViewEx dgvNew) //{ // if (dgvNew == null) // { dgvNew = new DataGridViewEx(); } // if (dgvCurrent != null) // { // dgvNew.Columns.Clear(); // for (int dg = 0; dg < dgvCurrent.Columns.Count; dg++) // { // DataGridViewTextBoxColumn com = new DataGridViewTextBoxColumn(); // com.HeaderText = dgvCurrent.Columns[dg].HeaderText; // dgvNew.Columns.Add(com); // } // } //} ///// ///// 检查手机在Excel是否重复 ///// ///// 手机号 ///// dgv ///// 列名 ///// 本行索引 //public bool Pu_check(string sj, DataGridViewEx dgvCurrent, DataGridViewEx dgvNew, string lie, int index) //{ // bool Isok = false; // if (dgvNew != null) // { // List shouji = new List(); // bool Is = false; // for (int i = dgvCurrent.Rows.Count - 1; i >= 0; i--) // { // if (i != index) // { // if (dgvCurrent.Rows[i].Cells[lie].Value.ToString().Trim() == sj) // { // shouji.Add(i); // Is = true; // } // } // } if (Is) // { shouji.Add(index); } // if (shouji.Count > 0) // { // foreach (int i in shouji) // { // DataGridViewCell cell = null; // DataGridViewRow dgvr = new DataGridViewRow(); // foreach (DataGridViewColumn item in dgvCurrent.Columns) // { // cell = new DataGridViewTextBoxCell(); // cell.Value = dgvCurrent.Rows[i].Cells[item.HeaderText].Value.ToString().Trim(); // dgvr.Cells.Add(cell); // } // dgvNew.Rows.Add(dgvr); // dgvCurrent.Rows.RemoveAt(i); // } // Isok = true; // } // } // return Isok; //} ///// ///// 检查到错误数据判断 ///// ///// ///// //public void Pu_delete(int index, DataGridViewEx dgvCurrent, DataGridViewEx dgvNew) //{ // if (dgvNew != null) // { // DataGridViewCell cell = null; // DataGridViewRow dgvr = new DataGridViewRow(); // foreach (DataGridViewColumn item in dgvNew.Columns) // { // cell = new DataGridViewTextBoxCell(); // cell.Value = dgvCurrent.Rows[index].Cells[item.HeaderText].Value.ToString().Trim(); // dgvr.Cells.Add(cell); // } // dgvNew.Rows.Add(dgvr); // dgvCurrent.Rows.RemoveAt(index); // } //} /// /// 导出Excel /// /// public void DataToExcel(DataGridView dgvNew, string type, string Url) { if (dgvNew.Rows.Count > 0) { string FileName = Url + type + "错误资料.xls"; LYFZ.WinAPI.CustomPublicMethod.DataGridViewToExcel(FileName,dgvNew); } } /// /// 导出Excel /// /// public void DataToExcel(System.Data.DataTable dtError, string type, string Url) { if (dtError.Rows.Count > 0) { string FileName = Url + type + "错误资料.xls"; LYFZ.WinAPI.CustomPublicMethod.DataGridViewToExcel(FileName, dtError); } } } #endregion }