void Read_Restrictions()
        {
            string query3 = " SELECT * FROM Restriction WHERE RKey=1";
            string query2 = " SELECT * FROM Restriction WHERE RKey=1 ";

            string[]      col  = new string[36];
            SqlCommand    cmd2 = new SqlCommand(query2, conn);
            SqlCommand    cmd3 = new SqlCommand(query3, conn);
            SqlDataReader dr2  = cmd2.ExecuteReader(CommandBehavior.KeyInfo);

            dr2.Read();
            //Retrieve column schema into a DataTable.
            schemaTable = dr2.GetSchemaTable();
            int loop = 0;

            foreach (DataRow myField in schemaTable.Rows)
            {
                col[loop] = myField[0].ToString();
                loop++;
            }
            dr2.Dispose();
            dr2.Close();


            SqlDataReader dr3 = cmd3.ExecuteReader();

            dr3.Read();
            int index;

            for (index = 0; index < 35; index++)
            {
                Restrictions.Add(col[index], dr3[index].ToString());
            }
            dr3.Dispose();
            dr3.Close();

            string        query1 = " SELECT * FROM Hide_Unhide WHERE RKey=1";
            SqlCommand    cmd1   = new SqlCommand(query1, conn);
            SqlDataReader dr1    = cmd1.ExecuteReader();

            dr1.Read();

            if (dr1[1].ToString() == "1")
            {
                GoldShiftGb.Show();
            }
            else
            {
                GoldShiftGb.Hide();
            }

            if (dr1[2].ToString() == "1")
            {
                S_XAU_Label.Show(); S_XAU.Show(); S_XAU_Sign.Show();
            }
            else
            {
                S_XAU_Label.Hide(); S_XAU.Hide(); S_XAU_Sign.Hide();
            }

            if (dr1[3].ToString() == "1")
            {
                MG_XAU_Gbox.Show();
            }
            else
            {
                MG_XAU_Gbox.Hide();
            }

            if (dr1[4].ToString() == "1")
            {
                MasterSliverXAG.Show();
            }
            else
            {
                MasterSliverXAG.Hide();
            }

            if (dr1[5].ToString() == "1")
            {
                SilverShift.Show();
            }
            else
            {
                SilverShift.Hide();
            }

            if (dr1[6].ToString() == "1")
            {
                S_XAG_Label.Show(); S_XAG.Show();
            }
            else
            {
                S_XAG_Label.Hide(); S_XAG.Hide();
            }

            if (dr1[7].ToString() == "1")
            {
                T10_Gbox.Show();
            }
            else
            {
                T10_Gbox.Hide();
            }

            if (dr1[8].ToString() == "1")
            {
                T5_Gbox.Show();
            }
            else
            {
                T5_Gbox.Hide();
            }

            if (dr1[9].ToString() == "1")
            {
                KGB_995_Label.Show(); KGB_995.Show(); KGB_995_Sign.Show();
            }
            else
            {
                KGB_995_Label.Hide(); KGB_995.Hide(); KGB_995_Sign.Hide();
            }

            if (dr1[10].ToString() == "1")
            {
                TTB_Label.Show(); TTB.Show(); TTB_Sign.Show();
            }
            else
            {
                TTB_Label.Hide(); TTB.Hide(); TTB_Sign.Hide();
            }

            if (dr1[11].ToString() == "1")
            {
                AED_PG_Label.Show(); AED_PG.Show();
            }
            else
            {
                AED_PG_Label.Hide(); AED_PG.Hide();
            }

            dr1.Dispose();
            dr1.Close();
        }
Esempio n. 2
0
        private void Refresh_form()
        {
            string        query = " SELECT * FROM Hide_Unhide WHERE RKey=1";
            SqlCommand    cmd   = new SqlCommand(query, conn);
            SqlDataReader dr    = cmd.ExecuteReader();

            dr.Read();

            if (dr[1].ToString() == "1")
            {
                GoldShift.Text = "Gold Shift ON"; GoldShift.BackColor = Color.Green; GoldShiftGb.Show();
            }
            else
            {
                GoldShift.Text = "Gold Shift OFF"; GoldShift.BackColor = Color.Red; GoldShiftGb.Hide();
            }

            if (dr[2].ToString() == "1")
            {
                GoldSpreadShift.Text = "Gold Spread Shift ON"; GoldSpreadShift.BackColor = Color.Green; S_XAU_Label.Show();
            }
            else
            {
                GoldSpreadShift.Text = "Gold Spread Shift OFF"; GoldSpreadShift.BackColor = Color.Red; S_XAU_Label.Hide();
            }

            if (dr[3].ToString() == "1")
            {
                MasterGoldXAU.Text = "Master Gold XAU ON"; MasterGoldXAU.BackColor = Color.Green; MG_XAU_Gbox.Show();
            }
            else
            {
                MasterGoldXAU.Text = "Master Gold XAU OFF"; MasterGoldXAU.BackColor = Color.Red; MG_XAU_Gbox.Hide();
            }

            if (dr[4].ToString() == "1")
            {
                MasterSilverXAG.Text = "Master Silver XAG ON"; MasterSilverXAG.BackColor = Color.Green; MasterSliverXAG.Show();
            }
            else
            {
                MasterSilverXAG.Text = "Master Silver XAG OFF"; MasterSilverXAG.BackColor = Color.Red; MasterSliverXAG.Hide();
            }

            if (dr[5].ToString() == "1")
            {
                SilverShift.Text = "Silver Shift ON"; SilverShift.BackColor = Color.Green; SilverShiftGb.Show();
            }
            else
            {
                SilverShift.Text = "Silver Shift OFF"; SilverShift.BackColor = Color.Red; SilverShiftGb.Hide();
            }

            if (dr[6].ToString() == "1")
            {
                SilverSpreadShift.Text = "Silver Spread Shift ON"; SilverSpreadShift.BackColor = Color.Green; S_XAG_Label.Show();
            }
            else
            {
                SilverSpreadShift.Text = "Silver Spread Shift OFF"; SilverSpreadShift.BackColor = Color.Red; S_XAG_Label.Hide();
            }

            if (dr[7].ToString() == "1")
            {
                T10.Text = "10 Tola Chain ON"; T10.BackColor = Color.Green; T10_Gbox.Show();
            }
            else
            {
                T10.Text = "10 Tola Chain OFF"; T10.BackColor = Color.Red; T10_Gbox.Hide();
            }

            if (dr[8].ToString() == "1")
            {
                T5.Text = "5 Tola Chain ON"; T5.BackColor = Color.Green; T5_Gbox.Show();
            }
            else
            {
                T5.Text = "5 Tola Chain OFF"; T5.BackColor = Color.Red; T5_Gbox.Hide();
            }

            if (dr[9].ToString() == "1")
            {
                KGBar.Text = "KG Bar ON"; KGBar.BackColor = Color.Green; KGB_995_Label.Show();
            }
            else
            {
                KGBar.Text = "KG Bar OFF"; KGBar.BackColor = Color.Red; KGB_995_Label.Hide();
            }

            if (dr[10].ToString() == "1")
            {
                TTBar.Text = "TT Bar ON"; TTBar.BackColor = Color.Green; TTB_Label.Show();
            }
            else
            {
                TTBar.Text = "TT Bar OFF"; TTBar.BackColor = Color.Red; TTB_Label.Hide();
            }

            if (dr[11].ToString() == "1")
            {
                AED.Text = "AED Per Gram ON"; AED.BackColor = Color.Green; AED_PG_Label.Show();
            }
            else
            {
                AED.Text = "AED Per Gram OFF"; AED.BackColor = Color.Red; AED_PG_Label.Hide();
            }

            dr.Dispose();
            dr.Close();



            //if (Properties.Settings.Default.GoldShift == true)
            //{ GoldShift.Text = "Gold Shift ON"; GoldShift.BackColor = Color.Green; GoldShiftGb.Show(); }
            //else
            //{ GoldShift.Text = "Gold Shift OFF"; GoldShift.BackColor = Color.Red; GoldShiftGb.Hide(); }

            //if (Properties.Settings.Default.GoldSpreadShift == true)
            //{ GoldSpreadShift.Text = "Gold Spread Shift ON"; GoldSpreadShift.BackColor = Color.Green;  S_XAU_Label.Show(); }
            //else
            //{ GoldSpreadShift.Text = "Gold Spread Shift OFF"; GoldSpreadShift.BackColor = Color.Red; S_XAU_Label.Hide(); }

            //if (Properties.Settings.Default.MasterGoldXAU == true)
            //{ MasterGoldXAU.Text = "Master Gold XAU ON"; MasterGoldXAU.BackColor = Color.Green; MG_XAU_Gbox.Show(); }
            //else
            //{ MasterGoldXAU.Text = "Master Gold XAU OFF"; MasterGoldXAU.BackColor = Color.Red; MG_XAU_Gbox.Hide(); }

            //if (Properties.Settings.Default.MasterSilverXAG == true)
            //{ MasterSilverXAG.Text = "Master Silver XAG ON"; MasterSilverXAG.BackColor = Color.Green; MasterSliverXAG.Show(); }
            //else
            //{ MasterSilverXAG.Text = "Master Silver XAG OFF"; MasterSilverXAG.BackColor = Color.Red; MasterSliverXAG.Hide(); }

            //if (Properties.Settings.Default.SilverShift == true)
            //{ SilverShift.Text = "Silver Shift ON"; SilverShift.BackColor = Color.Green; SilverShiftGb.Show(); }
            //else
            //{ SilverShift.Text = "Silver Shift OFF"; SilverShift.BackColor = Color.Red; SilverShiftGb.Hide(); }

            //if (Properties.Settings.Default.SilverSpreadShift == true)
            //{ SilverSpreadShift.Text = "Silver Spread Shift ON"; SilverSpreadShift.BackColor = Color.Green; S_XAG_Label.Show(); }
            //else
            //{ SilverSpreadShift.Text = "Silver Spread Shift OFF"; SilverSpreadShift.BackColor = Color.Red; S_XAG_Label.Hide(); }

            //if (Properties.Settings.Default.T10 == true)
            //{ T10.Text = "10 Tola Chain ON"; T10.BackColor = Color.Green; T10_Gbox.Show(); }
            //else
            //{ T10.Text = "10 Tola Chain OFF"; T10.BackColor = Color.Red; T10_Gbox.Hide(); }

            //if (Properties.Settings.Default.T5 == true)
            //{ T5.Text = "5 Tola Chain ON"; T5.BackColor = Color.Green; T5_Gbox.Show(); }
            //else
            //{ T5.Text = "5 Tola Chain OFF"; T5.BackColor = Color.Red; T5_Gbox.Hide(); }

            //if (Properties.Settings.Default.KGbar == true)
            //{ KGBar.Text = "KG Bar ON"; KGBar.BackColor = Color.Green;  KGB_995_Label.Show(); }
            //else
            //{ KGBar.Text = "KG Bar OFF"; KGBar.BackColor = Color.Red;  KGB_995_Label.Hide(); }

            //if (Properties.Settings.Default.TTbar == true)
            //{ TTBar.Text = "TT Bar ON"; TTBar.BackColor = Color.Green; TTB_Label.Show(); }
            //else
            //{ TTBar.Text = "TT Bar OFF"; TTBar.BackColor = Color.Red;  TTB_Label.Hide(); }

            //if (Properties.Settings.Default.AED == true)
            //{ AED.Text = "AED Per Gram ON"; AED.BackColor = Color.Green;  AED_PG_Label.Show(); }
            //else
            //{ AED.Text = "AED Per Gram OFF"; AED.BackColor = Color.Red;  AED_PG_Label.Hide(); }
        }