Beispiel #1
0
        private void LoadPreferences(Control CurrentControl)
        {
            DBPreferences dbp = new DBPreferences(UserID);
            string        t   = CurrentControl.GetType().Name.ToString();

            switch (t)
            {
            case "RefreshTimeSelectControl":
                RefreshTimeSelectControl rtsc = (RefreshTimeSelectControl)CurrentControl;
                if (dbp.RefreshTime == 10 * 60000)
                {
                    rtsc.radioButton1.Checked = true;
                }
                if (dbp.RefreshTime == 30 * 60000)
                {
                    rtsc.radioButton2.Checked = true;
                }
                if (dbp.RefreshTime == 60 * 60000)
                {
                    rtsc.radioButton3.Checked = true;
                }
                if (dbp.RefreshTime == 120 * 60000)
                {
                    rtsc.radioButton4.Checked = true;
                }
                if (dbp.RefreshTime == 180 * 60000)
                {
                    rtsc.radioButton5.Checked = true;
                }
                if (dbp.RefreshTime == 240 * 60000)
                {
                    rtsc.radioButton6.Checked = true;
                }
                break;

            case "ColorSelectControl":
                ColorSelectControl csc = (ColorSelectControl)CurrentControl;
                if (dbp.NoteColor == csc.panel1.BackColor.ToArgb())
                {
                    csc.radioButton1.Checked = true;
                }
                if (dbp.NoteColor == csc.panel2.BackColor.ToArgb())
                {
                    csc.radioButton2.Checked = true;
                }
                if (dbp.NoteColor == csc.panel3.BackColor.ToArgb())
                {
                    csc.radioButton3.Checked = true;
                }
                if (dbp.NoteColor == csc.panel4.BackColor.ToArgb())
                {
                    csc.radioButton4.Checked = true;
                }
                if (dbp.NoteColor == csc.panel5.BackColor.ToArgb())
                {
                    csc.radioButton5.Checked = true;
                }
                break;
            }
        }
Beispiel #2
0
        public DBPreferences(int UID)
        {
            DA.SelectCommand.CommandText = "select * from " + Base.BaseName + "..PREFERENCES where IDUSER = "******"t") == 0)
            {
                int color = new ColorSelectControl().panel1.BackColor.ToArgb();
                int rtime = 10 * (60000);//10 minutes in miliseconds

                DA.InsertCommand.CommandText = "insert into " + Base.BaseName + "..PREFERENCES (IDUSER,REFRESHTIME,COLOR) " +
                                               " values (" + UID + "," + rtime + "," + color + ")";
                DA.InsertCommand.Connection.Open();
                DA.InsertCommand.ExecuteNonQuery();
                DA.InsertCommand.Connection.Close();

                this.RefreshTime = rtime;
                this.NoteColor   = color;
            }
            else
            {
                this.RefreshTime = (int)DS.Tables["t"].Rows[0]["REFRESHTIME"];
                this.NoteColor   = (int)DS.Tables["t"].Rows[0]["COLOR"];
            }
        }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            DBPreferences dbp = new DBPreferences(this.UserID);

            switch (CurrentControl.GetType().Name)
            {
            case "RefreshTimeSelectControl":
                RefreshTimeSelectControl rtsc = (RefreshTimeSelectControl)CurrentControl;
                if (rtsc.radioButton1.Checked)
                {
                    dbp.SaveRefreshTime(UserID.ToString(), 10 * 60000);
                    mf.SetRefreshTime(10 * 60000);
                }
                if (rtsc.radioButton2.Checked)
                {
                    dbp.SaveRefreshTime(UserID.ToString(), 30 * 60000);
                    mf.SetRefreshTime(30 * 60000);
                }
                if (rtsc.radioButton3.Checked)
                {
                    dbp.SaveRefreshTime(UserID.ToString(), 60 * 60000);
                    mf.SetRefreshTime(60 * 60000);
                }
                if (rtsc.radioButton4.Checked)
                {
                    dbp.SaveRefreshTime(UserID.ToString(), 120 * 60000);
                    mf.SetRefreshTime(120 * 60000);
                }
                if (rtsc.radioButton5.Checked)
                {
                    dbp.SaveRefreshTime(UserID.ToString(), 180 * 60000);
                    mf.SetRefreshTime(180 * 60000);
                }
                if (rtsc.radioButton6.Checked)
                {
                    dbp.SaveRefreshTime(UserID.ToString(), 240 * 60000);
                    mf.SetRefreshTime(240 * 60000);
                }
                break;

            case "ColorSelectControl":
                ColorSelectControl csc = (ColorSelectControl)CurrentControl;
                if (csc.radioButton1.Checked)
                {
                    dbp.SaveNoteColor(UserID.ToString(), csc.panel1.BackColor.ToArgb());
                    mf.SetNoteColor(csc.panel1.BackColor.ToArgb());
                }
                if (csc.radioButton2.Checked)
                {
                    dbp.SaveNoteColor(UserID.ToString(), csc.panel2.BackColor.ToArgb());
                    mf.SetNoteColor(csc.panel2.BackColor.ToArgb());
                }
                if (csc.radioButton3.Checked)
                {
                    dbp.SaveNoteColor(UserID.ToString(), csc.panel3.BackColor.ToArgb());
                    mf.SetNoteColor(csc.panel3.BackColor.ToArgb());
                }
                if (csc.radioButton4.Checked)
                {
                    dbp.SaveNoteColor(UserID.ToString(), csc.panel4.BackColor.ToArgb());
                    mf.SetNoteColor(csc.panel4.BackColor.ToArgb());
                }
                if (csc.radioButton5.Checked)
                {
                    dbp.SaveNoteColor(UserID.ToString(), csc.panel5.BackColor.ToArgb());
                    mf.SetNoteColor(csc.panel5.BackColor.ToArgb());
                }
                break;
            }
            button1.Enabled = false;
        }