private bool CheckandInjectCode(clsVariableSettings cvs) { bool result = false; try { string SQLSelectSystemInfo = "select Count(*) from tbl_system_info where isEnabled = 1 and ProgramCode='" + cv.Crypt(programname) + "' and LicenseCode = '" + cvs.LicenseCode + "' and ActivationCode = '" + cvs.ActivationCode + "'"; cdt = new clsDatabaseTransactions(); DataTable dtResult = cdt.SelectData(SQLSelectSystemInfo); int RowAffected = dtResult.Rows.Count; RowAffected = RowAffected == 1 ? int.Parse(dtResult.Rows[0][0].ToString()) : 0; if (RowAffected == 0) { string SQLInsertSystemInfo = "Insert into tbl_system_info(ProgramCode,LicenseCode,ActivationCode)" + " Values ('" + cv.Crypt(programname) + "','" + cvs.LicenseCode + "','" + cvs.ActivationCode + "')"; result = cdt.InsertData(SQLInsertSystemInfo); } else { result = true; } } catch { } return(result); }
private void frm_FloorInformation_Load(object sender, EventArgs e) { dtrans = new clsDatabaseTransactions(); dtData = new DataTable(); ConstructDataTable(); dataGridView1.DataSource = dtData; if (isUpdate) { if (SelectedDG.SelectedRows.Count == 1) { tbFloorName.Text = SelectedDG.SelectedRows[0].Cells["Floor"].Value.ToString(); tbDescription.Text = SelectedDG.SelectedRows[0].Cells["Description"].Value.ToString(); button2.Enabled = false; } } if (dataGridView1.Rows.Count == 0) { LoadRecords(); } }