public List <EquipmentForRbi> getListEQForRBI(String path) { List <EquipmentForRbi> list = new List <EquipmentForRbi>(); OleDbConnection conn = getConnect(path); try { conn.Open(); String cmd = "select * from [Totals$]"; OleDbCommand command = new OleDbCommand(cmd, conn); OleDbDataReader reader = command.ExecuteReader(); while (reader.Read()) { String data = reader[0].ToString(); if ((data != "") && (data.All(char.IsDigit))) { eq = new EquipmentForRbi(); eq.UnitCode = data; eq.UnitName = reader[1].ToString(); eq.ProcessSystem = reader[2].ToString(); list.Add(eq); } } } catch { MessageBox.Show("Please Check Version Excel File Or Fomat", "Error rbi", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { conn.Close(); conn.Dispose(); } return(list); }
public List <EquipmentForRbi> loads() { List <EquipmentForRbi> listEq = new List <EquipmentForRbi>(); MySqlConnection conn = DBUtils.getDBConnection(); conn.Open(); String sql = "SELECT * FROM tbl_equipmentforrbi"; try { EquipmentConnUtils eqcon = new EquipmentConnUtils(); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { eqRbi = new EquipmentForRbi(); eqRbi.UnitCode = reader.GetString(0); eqRbi.UnitName = reader.GetString(1); eqRbi.ProcessSystem = reader.GetString(2); eqRbi.Qty = eqcon.getTotalQty(eqRbi.UnitCode); eqRbi.Semi = eqcon.getTotalSemi(eqRbi.UnitCode); eqRbi.QuanTyTative = eqRbi.Qty - eqRbi.Semi; listEq.Add(eqRbi); } } } } catch { MessageBox.Show("Load data failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { conn.Close(); conn.Dispose(); } return(listEq); }
public bool checkExist(EquipmentForRbi eq) { return(eqUtils.checkExist(eq.UnitCode)); }
public void edit(EquipmentForRbi eq, String olderUnitCode) { eqUtils.edit(eq.UnitCode, eq.UnitName, eq.ProcessSystem, olderUnitCode); }
public void add(EquipmentForRbi eq) { eqUtils.add(eq.UnitCode, eq.UnitName, eq.ProcessSystem); }