Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 public bool checkExist(EquipmentForRbi eq)
 {
     return(eqUtils.checkExist(eq.UnitCode));
 }
Exemple #4
0
 public void edit(EquipmentForRbi eq, String olderUnitCode)
 {
     eqUtils.edit(eq.UnitCode, eq.UnitName, eq.ProcessSystem, olderUnitCode);
 }
Exemple #5
0
 public void add(EquipmentForRbi eq)
 {
     eqUtils.add(eq.UnitCode, eq.UnitName, eq.ProcessSystem);
 }