private void tabControlsetting_Selected(object sender, TabControlEventArgs e) { // MessageBox.Show("Outside if"); if (e.TabPage.Text.ToString().ToLower() == "incoming popup") { // MessageBox.Show("Inside evnet"); string query = "select TaskDock from computerpref where computerName='" + Environment.MachineName + "_hrdsq_service'"; DentalPlugin.Connection connection = new DentalPlugin.Connection(); this.command = query; tbxIncomingTimer.Text = Convert.ToString(connection.ExecuteScalar(this.command, CommandType.Text, (MySqlParameter[])null)); } else if (e.TabPage.Text.ToString().ToLower() == "database") { try { EnCryptDecryptEngine _objED = new EnCryptDecryptEngine(); if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\config.txt")) { fcontent = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "\\config.txt"); using (StreamReader sr = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + "\\config.txt")) { string line; int i = 1; while ((line = sr.ReadLine()) != null) { if (i == 1) { dbname = line.ToString().Trim(); } else if (i == 2) { dbhost = line.ToString().Trim(); } else if (i == 3) { dbusername = line.ToString().Trim(); } else if (i == 4) { dbpass = line.ToString().Trim(); } else if (i == 5) { dbport = line.ToString().Trim(); } i++; string Server = _objED.Decrypt(dbhost, true); string port = _objED.Decrypt(dbport, true); txtserver.Text = Server + ":" + port; txtdatabase.Text = _objED.Decrypt(dbname, true); txtpass.Text = _objED.Decrypt(dbpass, true); txtusername.Text = _objED.Decrypt(dbusername, true); } } } } catch (Exception ex) { Library.WriteErrorLog(ex.Message); } } else if (e.TabPage.Text.ToString().ToLower() == "exclude operatory") { if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\config.txt")) { if (radCheckedDropDownList1.DataSource == null) { Connection conn = new Connection(); string Qry = "SELECT operatorynum , OpName from operatory"; DataTable dtLang = conn.GetDataSet(Qry.ToString().Trim(), CommandType.Text, null).Tables[0]; if (dtLang.Rows.Count > 0) { foreach (DataRow dr in dtLang.Rows) { if (!string.IsNullOrEmpty(Convert.ToString(dr["OpName"].ToString()))) { OpList.Add(new Operatory { operatorynum = Convert.ToInt64(dr["OperatoryNum"].ToString()), OpName = Convert.ToString(dr["OpName"].ToString()), }); } } } radCheckedDropDownList1.DataSource = null; radCheckedDropDownList1.DisplayMember = "OpName"; radCheckedDropDownList1.ValueMember = "operatorynum"; radCheckedDropDownList1.DataSource = OpList.ToList(); //================================================================================================= string command = "select valuestring from preference where prefname ='px_exclude_op_confirmation&remainder' "; string data = Convert.ToString(conn.ExecuteScalar(command.ToString().Trim(), CommandType.Text, null)); if (data != null && data != "") { //Checking all the Default form items string[] fff = data.Split(','); for (int i = 0; i < fff.Count(); i++) { int index = radCheckedDropDownList1.Items.Where(a => a.Value.ToString().Equals(fff[i])).Select(a => a.Index).FirstOrDefault(); this.radCheckedDropDownList1.Items[index].Checked = true; } } } } } }
private void AutoClose(int turn) { DentalPlugin.Connection connection = new DentalPlugin.Connection(); try { this.Cursor = Cursors.WaitCursor; if (this.tbxIncomingTimer.Text.ToString().Trim() == "") { int num = (int)MessageBox.Show("Incoming popup timer field can not be left blank. Please enter time in seconds.", "PatientXpress", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.tbxIncomingTimer.Focus(); } else { int result; if (!int.TryParse(this.tbxIncomingTimer.Text.ToString().Trim(), out result)) { int num = (int)MessageBox.Show("Invalid incoming popup timer value. Please enter valid value for time in seconds.", "PatientXpress", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.tbxIncomingTimer.Focus(); } else { if (Convert.ToInt32(this.tbxIncomingTimer.Text.ToString().Trim()) < 1) { if (Convert.ToInt32(this.tbxIncomingTimer.Text.ToString().Trim()) == 0 && MessageBox.Show("'0' Means no popup, Are you ok with that?", "PatientXpress", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No) { this.tbxIncomingTimer.Focus(); return; } if (Convert.ToInt32(this.tbxIncomingTimer.Text.ToString().Trim()) < 0) { int num = (int)MessageBox.Show("Popup timer value should not be less then 0. Please enter valid value for time in seconds.", "PatientXpress", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.tbxIncomingTimer.Focus(); return; } } string str = Environment.MachineName + "_hrdsq_service"; //if (Convert.ToInt32(this.tbxIncomingTimer.Text.ToString().Trim()) == 0) //{ //} //else //{ this.command = "SELECT count(*) as totPref FROM computerpref where ComputerName='" + str + "'"; if (Convert.ToInt64(connection.ExecuteScalar(this.command, CommandType.Text, (MySqlParameter[])null)) == 0) { this.command = ""; this.command = "insert into computerpref (ComputerName,TaskDock) values ('" + str + "','" + MySqlHelper.EscapeString(Convert.ToString(this.tbxIncomingTimer.Text).Trim()) + "')"; if (connection.ExecuteNonQuery(this.command.ToString(), CommandType.Text, (MySqlParameter[])null) == 0) { if (turn == 1) { int num = (int)MessageBox.Show("There is problem in saving the incoming popup timer. Please try again.", "PatientXpress", MessageBoxButtons.OK, MessageBoxIcon.Hand); } this.tbxIncomingTimer.Focus(); } else { if (turn == 1) { int num = (int)MessageBox.Show("Incoming popup timer has been inserted successfully.", "PatientXpress", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } this.tbxIncomingTimer.Focus(); } } else { this.command = ""; this.command = "update computerpref set TaskDock='" + MySqlHelper.EscapeString(Convert.ToString(this.tbxIncomingTimer.Text).Trim()) + "' where ComputerName='" + str + "';"; if (connection.ExecuteNonQuery(this.command.ToString(), CommandType.Text, (MySqlParameter[])null) == 0) { if (turn == 1) { int num = (int)MessageBox.Show("There is problem in modifying the incoming popup timer. Please try again.", "PatientXpress", MessageBoxButtons.OK, MessageBoxIcon.Hand); } this.tbxIncomingTimer.Focus(); } else { if (turn == 1) { int num = (int)MessageBox.Show("Incoming popup timer has been modified successfully.", "PatientXpress", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } this.tbxIncomingTimer.Focus(); } } this.button1.Enabled = false; } } } catch (Exception ex) { ExtractErrorLog.CatchExceptionWithoutMSG(ex.Message.ToString(), ex.StackTrace.ToString(), ex.HelpLink != null ? ex.HelpLink.ToString() : "", ex.InnerException != null ? ex.InnerException.ToString() : "", ex.Source.ToString(), ex.TargetSite.ToString()); } finally { this.Cursor = Cursors.Default; } }