コード例 #1
0
        private void SubmitBtn_Click(object sender, EventArgs e)
        {
            var rowindex = Table_Messages.CurrentCell.RowIndex;
            var IDTable  = Table_Messages.Rows[rowindex].Cells[4].Value.ToString();

            try
            {
                CnC_DatabaseDataContext DataBase = new CnC_DatabaseDataContext();
                var DeleteData = (from rows in DataBase.CaseMessages
                                  where rows.ID == Int32.Parse(IDTable)
                                  select rows).FirstOrDefault();

                DataBase.CaseMessages.DeleteOnSubmit(DeleteData);
                DataBase.SubmitChanges();
                var Data = from rows in DataBase.CaseMessages
                           select rows;
                Table_Messages.DataSource = Data;
                Table_Messages.AutoResizeRows();
                Table_Messages.AutoResizeColumns();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #2
0
        private void DeleteMessages_Load(object sender, EventArgs e)
        {
            CnC_DatabaseDataContext DataBase = new CnC_DatabaseDataContext();
            var Data = from rows in DataBase.CaseMessages
                       select rows;

            Table_Messages.DataSource = Data;
            Table_Messages.AutoResizeRows();
            Table_Messages.AutoResizeColumns();
        }
コード例 #3
0
        private static void Build(ref Structure s)
        {
            // Users - Manual build
            Table_Users = Structure_Main.AddTable("users");
            Table_Users.AddColumn(ColumnType.Int, "user_id", "ID", true);
            Table_Users.AddColumn(ColumnType.Text, "user_name", "UserName");
            Table_Users.AddColumn(ColumnType.Text, "email"); // same name for both code & database
            Table_Users.AddColumn(ColumnType.Float, "xp", "XP");
            Table_Users.AddColumn(ColumnType.Element, "level", "Level");
            Table_Users.AddColumn(ColumnType.Enum, "status", "Status");
            Table_Users.AddColumn(ColumnType.DateTime, "Registered"); // same name for both code & database
            Table_Users.AddColumn(ColumnType.Object, "PersonalDetails");
            // Groups - Manual build
            Table_Groups = Structure_Main.AddTable("groups");
            Table_Groups.AddColumn(ColumnType.Int, "id", "ID", true);
            Table_Groups.AddColumn(ColumnType.Text, "group_name", "Name");
            // GroupMembers - Manual build
            Table_GroupMembers = Structure_Main.AddTable("groupmembers");
            Table_GroupMembers.AddColumn(ColumnType.Int, "id", "ID", true);
            Table_GroupMembers.AddColumn(ColumnType.Int, "user_id", "User");
            Table_GroupMembers.AddColumn(ColumnType.Int, "group_id", "Group");
            // Levels - Build exactly as a class then setting the ID as AI
            Table_Levels = Structure_Main.AddTable("levels");
            Table_Levels.AddColumnsByClassProperties(typeof(Level));
            var id = Table_Levels.FindC("ID");

            if (id != null)
            {
                id.AutoInc = true;
            }
            // Messages - Build exactly as a class then setting the ID as AI
            Table_Messages = Structure_Main.AddTable("messages");
            Table_Messages.AddColumnsByClassProperties(typeof(Message));
            id = Table_Messages.FindC("ID");
            if (id != null)
            {
                id.AutoInc = true;
            }
            // Settings - Build exactly as a class then setting the ID as AI + adding default values to it
            Table_Settings = Structure_Main.AddTable("settings");
            Table_Settings.AddColumnsByClassProperties(typeof(Setting));
            id = Table_Settings.FindC("ID");
            if (id != null)
            {
                id.AutoInc = true;
            }
            // TestAtt - Build by attributes
            Table_TestAtt = Structure_Main.AddTable("testatt");
            Table_TestAtt.AddColumnsByAttributes(typeof(Att));
        }
コード例 #4
0
        private void ListClients_Load(object sender, EventArgs e)
        {
            CnC_DatabaseDataContext DataBase = new CnC_DatabaseDataContext();
            var StreamingIps = (from rows in DataBase.Streaming_IPs
                                select rows);

            Table_Messages.DataSource = StreamingIps;
            Table_Messages.AutoResizeRows();
            Table_Messages.AutoResizeColumns();
            if (Int32.Parse(Which_Form_Private) == 1)
            {
                DeleteIP.Visible = true;
            }
            if (Int32.Parse(Which_Form_Private) == 0)
            {
                DeleteIP.Visible = false;
            }
        }
コード例 #5
0
 private void Table_Messages_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     Table_Messages.AutoResizeRows();
     Table_Messages.AutoResizeColumns();
 }