/// <summary> /// RESET DATA FROM TABLE SETTINGSCOPY /// </summary> public void FillDefaultSettings() { SettingsBll BllSettings = new SettingsBll(); List<DataTable> listObj = new List<DataTable>(); try { listObj = BllSettings.SettingsToCopyViewAll(); foreach (Control ctrl in this.Controls) { if (ctrl is CheckBox) { CheckBox cb = (CheckBox)ctrl; strControlls = cb.Text.Replace(" ", string.Empty); foreach (DataRow dr in listObj[0].Rows) { if (dr["settingsName"].ToString() == strControlls) { if (strControlls == "AllowGoDown") { if (dr["status"].ToString() == "Yes") { cb.Checked = true; if (BllSettings.SettingsStatusCheck("AllowRack") == "Yes") { cbxAllowRack.Checked = true; } else { cbxAllowRack.Checked = false; } } else if (dr["status"].ToString() == "No") { cb.Checked = false; cbxAllowRack.Visible = false; cbxAllowRack.Checked = false; } } else if (strControlls == "AddConfirmationFor") { if (dr["status"].ToString() == "Yes") { cb.Checked = true; foreach (Control c in this.Controls) { if (c is CheckBox) { CheckBox cbx = (CheckBox)c; string str = cbx.Text.Replace(" ", string.Empty); if (str == "Add" || str == "Edit" || str == "Delete" || str == "Close") { foreach (DataRow dr1 in listObj[0].Rows) { if (dr1["settingsName"].ToString() == str) { if (dr1["status"].ToString() == "Yes") { cbx.Checked = true; } else if (dr1["status"].ToString() == "No") { cbx.Checked = false; } } } } } } } else { cb.Checked = false; cbxAdd.Visible = false; cbxDelete.Visible = false; cbxEdit.Visible = false; cbxClose.Visible = false; } } else { if (dr["status"].ToString() == "Yes") { cb.Checked = true; } else if (dr["status"].ToString() == "No") { cb.Checked = false; } } } } } else if (ctrl is ComboBox) { ComboBox cmb = (ComboBox)ctrl; strControlls = ctrl.Name.Replace("cmb", string.Empty); foreach (DataRow dr in listObj[0].Rows) { if (dr["settingsName"].ToString() == strControlls) { cmb.SelectedItem = dr["status"].ToString(); } } } } } catch (Exception ex) { MessageBox.Show("ST7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }