public List <ManagerCheck> GetMCheckList() { ManagerCheck MC = new ManagerCheck(); return(MC.ReadList()); //return null; }
void OnLevelWasLoaded() { if (manager == null) { manager = this; } else if (manager != this) { Destroy(gameObject); } }
public List <ManagerCheck> ReadList() { List <ManagerCheck> SRL = new List <ManagerCheck>(); SqlConnection con = null; try { con = Connect("DBConnectionString"); // create a connection to the database using the connection String defined in the web config file String selectSTR = "SELECT DISTINCT GLN_ICheckDetailes.NumMaterial,GLN_ICheckDetailes.ProductionID,GLN_Inventory.AmountInventory,GLN_ICheckDetailes.AmountCheck,GLN_ICheckDetailes.CheckNumber from GLN_ICheckDetailes inner join GLN_Inventory ON((GLN_Inventory.NumMaterial = GLN_ICheckDetailes.NumMaterial) AND(GLN_Inventory.ProductionID = GLN_ICheckDetailes.ProductionID))"; SqlCommand cmd = new SqlCommand(selectSTR, con); // get a reader SqlDataReader dr = cmd.ExecuteReader();//(CommandBehavior.CloseConnection); // CommandBehavior.CloseConnection: the connection will be closed after reading has reached the end while (dr.Read()) { // Read till the end of the data into a row ManagerCheck a = new ManagerCheck(); a.MaterialId = (string)(dr["NumMaterial"]); a.ProductionId = (string)(dr["ProductionID"]); a.InventoryAmount = Convert.ToInt32(dr["AmountInventory"]); a.CheckAmount = Convert.ToInt32(dr["AmountCheck"]); a.CheckNumber = Convert.ToInt32(dr["CheckNumber"]); SRL.Add(a); } dr.Close(); } catch (Exception ex) { // write to log throw (ex); } finally { if (con != null) { con.Close(); } } return(SRL); }