Beispiel #1
0
        public static dsConfig.dtNotesRow LoadNode(int id)
        {
            dsConfig ds = new dsConfig();
            //HUYNC:Đọc từ database lên.
            LoadTableNoteBook(ds);
            //ds.ReadXml(GlobalVars.ConfigFile);

            dsConfig.dtNotesRow dr = ds.dtNotes.FindByIdMsg(id);

            return dr;
        }
Beispiel #2
0
        public static List<int> GetNoteIDs()
        {
            dsConfig ds = new dsConfig();
            //HUYNC:Đọc từ database lên.
            LoadTableNoteBook(ds);
            //ds.ReadXml(GlobalVars.ConfigFile);

            List<int> ret = new List<int>();

            foreach (dsConfig.dtNotesRow dr in ds.dtNotes.Rows)
                ret.Add(dr.IdMsg);

            return ret;
        }
Beispiel #3
0
        public static void Delete(int id)
        {
            dsConfig ds = new dsConfig();
            //HUYNC:Đọc từ database lên.
            LoadTableNoteBook(ds);
            //ds.ReadXml(GlobalVars.ConfigFile);

            dsConfig.dtNotesRow dr = ds.dtNotes.FindByIdMsg(id);

            if (dr != null)
            {
                dr.Delete();
                //HUYNC:Lưu xuống database
                SaveTableNoteBook(ds);
                //ds.WriteXml(GlobalVars.ConfigFile, System.Data.XmlWriteMode.WriteSchema);
            }
        }
Beispiel #4
0
        public static void SaveNode(dsConfig.dtNotesRow dr)
        {
            dsConfig ds = new dsConfig();
            //HUYNC:Đọc từ database lên.
            LoadTableNoteBook(ds);
            //ds.ReadXml(GlobalVars.ConfigFile);

            dsConfig.dtNotesRow dr_orig = ds.dtNotes.FindByIdMsg(dr.IdMsg);

            if (dr_orig != null)
            {
                foreach ( DataColumn col in ds.dtNotes.Columns)
                    dr_orig[col.ColumnName] = dr[col.ColumnName];
                //HUYNC:Lưu xuông database
                SaveTableNoteBook(ds);
                //ds.WriteXml(GlobalVars.ConfigFile, System.Data.XmlWriteMode.WriteSchema);
            }
        }
Beispiel #5
0
        public static int AddNode(dsConfig.dtNotesRow dr)
        {
            dsConfig ds = new dsConfig();
            //HUYNC:Đọc từ database lên.
            LoadTableNoteBook(ds);
            //ds.ReadXml(GlobalVars.ConfigFile);

            dsConfig.dtNotesRow dr_new = ds.dtNotes.NewdtNotesRow();
            foreach (DataColumn col in ds.dtNotes.Columns)
                if(!col.AutoIncrement) dr_new[col.ColumnName] = dr[col.ColumnName];

            ds.dtNotes.Rows.Add(dr_new);
            //HUYNC:Lưu xuống database
            SaveTableNoteBook(ds);
            //ds.WriteXml(GlobalVars.ConfigFile, System.Data.XmlWriteMode.WriteSchema);

            return dr_new.IdMsg;
        }
Beispiel #6
0
 private static void LoadTableNoteBook(dsConfig config)
 {
     DbCommand command = DABase.getDatabase().GetSQLStringCommand("SELECT * FROM FW_NOTE_BOOK WHERE USERID=" + FrameworkParams.currentUser.id);
     DataSet ds = DABase.getDatabase().LoadDataSet(command, "FW_NOTE_BOOK");
     if (ds != null)
     {
         foreach (DataRow dr in ds.Tables[0].Rows)
             config.Tables[0].ImportRow(dr);
     }
     else
     {
         throw new Exception("Thiếu bảng FW_NOTE_BOOK");
     }
 }
Beispiel #7
0
 private static void SaveTableNoteBook(dsConfig config)
 {
     config.Tables[0].TableName = "FW_NOTE_BOOK";
     DABase.getDatabase().UpdateTable(config.Tables[0].DataSet, "FW_NOTE_BOOK");
 }
Beispiel #8
0
 private void UpdateUIFromDR(dsConfig.dtNotesRow dr)
 {
     try
     {
         richTextBox1.Rtf = dr.Message;
         Opacity = dr.Opacity;
         Location = new Point(dr.X, dr.Y);
         Size = new Size(dr.Width, dr.Height);
         BackColor = Color.FromArgb(dr.TitlebarColor);
         richTextBox1.BackColor = Color.FromArgb(dr.BgColor);
         richTextBox1.ForeColor = Color.FromArgb(dr.FontColor);
         richTextBox1.Font = DeserializeFont(dr.Font);
         txtTitle.ForeColor = Color.FromArgb(dr.TitleFontColor);
         txtTitle.Font = DeserializeFont(dr.TitleFont);
         switch (dr.FlagImage)
         {
             case "BlueFlag":
                 picFlag.Image = global::ProtocolVN.Framework.Win.Properties.Resources.BlueFlag;
                 break;
             case "RedFlag":
                 picFlag.Image = global::ProtocolVN.Framework.Win.Properties.Resources.RedFlag;
                 break;
             case "GreenFlag":
                 picFlag.Image = global::ProtocolVN.Framework.Win.Properties.Resources.GreenFlag;
                 break;
             case "GoalFlag":
                 picFlag.Image = global::ProtocolVN.Framework.Win.Properties.Resources.GoalFlag;
                 break;
             case "Bulb":
                 picFlag.Image = global::ProtocolVN.Framework.Win.Properties.Resources.Bulb;
                 break;
             default:
                 picFlag.Image = global::ProtocolVN.Framework.Win.Properties.Resources.BlueFlag;
                 break;
         }
         txtTitle.Text = dr.Title;
     }
     catch { }
 }
Beispiel #9
0
 private void UpdateDRFromUI(dsConfig.dtNotesRow dr)
 {
     dr.Message = richTextBox1.Rtf;
     dr.Opacity = Opacity;
     dr.X = Location.X;
     dr.Y = Location.Y;
     dr.Width = Size.Width;
     dr.Height = Size.Height;
     dr.TitlebarColor = BackColor.ToArgb();
     dr.BgColor = richTextBox1.BackColor.ToArgb();
     dr.FontColor = richTextBox1.ForeColor.ToArgb();
     dr.Font = SerializeFont(richTextBox1.Font);
     dr.FlagImage = picFlag.Tag.ToString();
     dr.TitleFontColor = txtTitle.ForeColor.ToArgb();
     dr.TitleFont = SerializeFont(txtTitle.Font);
     dr.Title = txtTitle.Text;
     dr.UserId = FrameworkParams.currentUser.id;
     dr.id = DABase.getDatabase().GetID("G_FW_ID");
 }