/// <summary> /// Gets count of machines assigned to a lincese /// </summary> /// <param name="idOfLicense"></param> /// <param name="DBDir_Name"></param> public static void GetMachineCount_toLabel(int idOfLicense, string DBDir_Name, Label Label) { // Get Machine Count for Label List <LicensedMachines> LM = DataAccess_LicensedMachinesTable.GetByLicenseID(idOfLicense, DBDir_Name); Label.Text = LM.Count.ToString(); }
public void RefreshDataGridViewTable() { // Get Data from Database List <LicensedMachines> LM = DataAccess_LicensedMachinesTable.GetByLicenseID(InputLicense.Id, Config.DBDir_Name); BindingListView <LicensedMachines> SortableLM = new BindingListView <LicensedMachines>(LM); aDataGridViewMachines.DataSource = SortableLM; Utilities.CloseSQLConnection(); }
public static void GetMachineCount_UpdateDB(int idOfLicense, string DBDir_Name) { // get license License SourceLicense = DataAccess_GDataTable.GetByID(idOfLicense, DBDir_Name); // get license machines List <LicensedMachines> sourceLicenseMachines = DataAccess_LicensedMachinesTable.GetByLicenseID(SourceLicense.Id, DBDir_Name); // count license machines SourceLicense.PCCount = sourceLicenseMachines.Count(); // update License in database with new count DataAccess_GDataTable.UpdateLicenseData(SourceLicense, DBDir_Name); }
private void ManagePCsForm_FormClosing(object sender, FormClosingEventArgs e) { //ConfigClass Updated_Config = Utilities.GetConfigData(); // Get Machine Count for Label List <LicensedMachines> LM = DataAccess_LicensedMachinesTable.GetByLicenseID(InputLicense.Id, Config.DBDir_Name); License ChangedLicense = new License(); InputLicense.CopyDataTo(ChangedLicense); ChangedLicense.PCCount = LM.Count; DataAccess_GDataTable.UpdateLicenseData(ChangedLicense, Config.DBDir_Name); }
private void ADataGridViewLicenses_CellEnter(object sender, DataGridViewCellEventArgs e) { try { // GET LICENSED MACHINES OF SELECTED LICENSE int IDOfSelectedLicense = (Convert.ToInt32(aDataGridViewLicenses[0, aDataGridViewLicenses.CurrentCell.RowIndex].FormattedValue)); LicensedMachinesDGV = DataAccess_LicensedMachinesTable.GetByLicenseID(IDOfSelectedLicense, Config.DBDir_Name); BindingListView <LicensedMachines> SortableLicensedMachinesDGV = new BindingListView <LicensedMachines>(LicensedMachinesDGV); aDataGridViewMachines.DataSource = SortableLicensedMachinesDGV; DGVUtilities.SetSortationDefault(2, SortOrder.Ascending, aDataGridViewMachines); Utilities.CloseSQLConnection(); } catch { } }