using DevComponents.DotNetBar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Setting
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btn_info_Click(object sender, EventArgs e)
        {
            frmInfo info = new frmInfo();
            info.ShowDialog();
        }

        private void btn_setting_Click(object sender, EventArgs e)
        {
            frmsetting set = new frmsetting();
            set.ShowDialog();
        }
        SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=DBSetting;Integrated Security=True");
        SqlCommand cmd;

        public void SetSetting()
        {

            cmd = new SqlCommand();
            cmd.CommandType = CommandType.Text;
            cmd.Connection = con;
            SqlDataReader Myreader;
            cmd.CommandText = "select * from tblStoreInfo where  ID=@ID";
            cmd.Parameters.Add("@ID", SqlDbType.NVarChar).Value = "1";
            con.Open();
            Myreader = cmd.ExecuteReader();
            if (Myreader.Read())
            {
                lbl_code.Text = Myreader[1].ToString();
                lbl_shopname.Text = Myreader[2].ToString();
                lbl_owner.Text = Myreader[3].ToString();
                lbl_tel.Text = Myreader[4].ToString();
                lbl_address.Text = Myreader[5].ToString();
                Myreader.Close();

            }








            cmd = new SqlCommand();
            cmd.CommandType = CommandType.Text;
            cmd.Connection = con;
            SqlDataReader Myreader2;
            cmd.CommandText = "select * from tblSetting where  ID=@ID";
            cmd.Parameters.Add("@ID", SqlDbType.NVarChar).Value = "1";
            Myreader2 = cmd.ExecuteReader();
            if (Myreader2.Read())
            {
                switch (Myreader2[1].ToString())
                {
                    case "0":
                        {
                            styleManager1.ManagerStyle = eStyle.Office2007Blue;
                            break;
                        }
                    case "1":
                        {
                            styleManager1.ManagerStyle = eStyle.Office2007Silver;
                            break;
                        }

                    case "2":
                        {
                            styleManager1.ManagerStyle = eStyle.Office2007Black;
                            break;
                        }

                    case "3":
                        {
                            styleManager1.ManagerStyle = eStyle.Office2010Blue;
                            break;
                        }

                    case "4":
                        {
                            styleManager1.ManagerStyle = eStyle.Office2010Silver;
                            break;
                        }

                    case "5":
                        {
                            styleManager1.ManagerStyle = eStyle.Office2010Black;
                            break;
                        }

                    case "6":
                        {
                            styleManager1.ManagerStyle = eStyle.Office2013;
                            break;
                        }

                    case "7":
                        {
                            styleManager1.ManagerStyle = eStyle.OfficeMobile2014;
                            break;
                        }

                    case "8":
                        {
                            styleManager1.ManagerStyle = eStyle.Office2007VistaGlass;
                            break;
                        }

                    case "9":
                        {
                            styleManager1.ManagerStyle = eStyle.VisualStudio2010Blue;
                            break;
                        }

                    case "10":
                        {
                            styleManager1.ManagerStyle = eStyle.VisualStudio2012Light;
                            break;
                        }

                    case "11":
                        {
                            styleManager1.ManagerStyle = eStyle.VisualStudio2012Dark;
                            break;
                        }

                    case "12":
                        {
                            styleManager1.ManagerStyle = eStyle.Windows7Blue;
                            break;
                        }
                }
                ////////////
                switch (Myreader2[2].ToString())
                {
                    case "0":
                        {
                            vistaClock1.Style = VistaClockPersian.Controls.VistaClock.VistaClockStyle.Black;
                            break;
                        }
                    case "1":
                        {
                            vistaClock1.Style = VistaClockPersian.Controls.VistaClock.VistaClockStyle.Silver;
                            break;
                        }

                    case "2":
                        {
                            vistaClock1.Style = VistaClockPersian.Controls.VistaClock.VistaClockStyle.Red;
                            break;
                        }

                    case "3":
                        {
                            vistaClock1.Style = VistaClockPersian.Controls.VistaClock.VistaClockStyle.Flower;
                            break;
                        }
                }
                ////////////
                switch (Myreader2[3].ToString())
                {
                    case "0":
                        {
                            gp_time.BackColor = Color.Blue;
                            break;
                        }
                    case "1":
                        {
                            gp_time.BackColor = Color.Green;
                            break;
                        }

                    case "2":
                        {
                            gp_time.BackColor = Color.Red;
                            break;
                        }

                    case "3":
                        {
                            gp_time.BackColor = Color.Yellow;
                            break;
                        }
                    case "4":
                        {
                            gp_time.BackColor = Color.Orange;
                            break;
                        }

                    case "5":
                        {
                            gp_time.BackColor = Color.Violet;
                            break;
                        }
                }
                ////////////
                switch (Myreader2[4].ToString())
                {
                    case "0":
                        {
                            gp_date_time.BackColor = Color.Blue;
                            break;
                        }
                    case "1":
                        {
                            gp_date_time.BackColor = Color.Green;
                            break;
                        }

                    case "2":
                        {
                            gp_date_time.BackColor = Color.Red;
                            break;
                        }

                    case "3":
                        {
                            gp_date_time.BackColor = Color.Yellow;
                            break;
                        }
                    case "4":
                        {
                            gp_date_time.BackColor = Color.Orange;
                            break;
                        }

                    case "5":
                        {
                            gp_date_time.BackColor = Color.Violet;
                            break;
                        }
                }
                ////////////
                switch (Myreader2[5].ToString())
                {
                    case "0":
                        {
                            gp_about.BackColor = Color.Blue;
                            break;
                        }
                    case "1":
                        {
                            gp_about.BackColor = Color.Green;
                            break;
                        }

                    case "2":
                        {
                            gp_about.BackColor = Color.Red;
                            break;
                        }

                    case "3":
                        {
                            gp_about.BackColor = Color.Yellow;
                            break;
                        }
                    case "4":
                        {
                            gp_about.BackColor = Color.Orange;
                            break;
                        }

                    case "5":
                        {
                            gp_about.BackColor = Color.Violet;
                            break;
                        }
                }
                ////////////
                switch (Myreader2[6].ToString())
                {
                    case "0":
                        {
                            gp_info.BackColor = Color.Blue;
                            break;
                        }
                    case "1":
                        {
                            gp_info.BackColor = Color.Green;
                            break;
                        }

                    case "2":
                        {
                            gp_info.BackColor = Color.Red;
                            break;
                        }

                    case "3":
                        {
                            gp_info.BackColor = Color.Yellow;
                            break;
                        }
                    case "4":
                        {
                            gp_info.BackColor = Color.Orange;
                            break;
                        }

                    case "5":
                        {
                            gp_info.BackColor = Color.Violet;
                            break;
                        }
                }
                /////
                gp_time.Visible = Myreader2[7].ToString() == "True" ? true : false;
                gp_date_time.Visible = Myreader2[8].ToString() == "True" ? true : false;
                gp_about.Visible = Myreader2[9].ToString() == "True" ? true : false;
                gp_info.Visible = Myreader2[10].ToString() == "True" ? true : false;

                Myreader2.Close();

            }
            con.Close();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            SetSetting();


        }
    }
}
