예제 #1
0
        public override void RefreshData()
        {
            //lv.MultiSelect = !Modal;

            this.Text = "File Groups - " + this.AdminProxy.Connection.ServerName + (Toolkit.IsProcessElevated() ? " - Administrator " : "");
            var tags = rememberSelectedTags(lv);

            // this form has multiple uses, as does the underlying ListTableMappings method.
            // it can:
            // List all TableMappings (0,[0])
            // List permission info for a single permission (37,[0])
            // List TableMappings that are NOT in a list (0, [2,3,4,5,6])

            var ds = AdminProxy.ListFileGroups(-1);

            var dt = ds.Tables["list_file_groups"];

            initHooksForMdiParent(dt, "group_name", "sys_file_group_id");
            lv.Items.Clear();
            foreach (DataRow dr in DataTable.Rows)
            {
                var lvi = new ListViewItem(dr["group_name"].ToString(), 0);
                lvi.SubItems.Add(dr["version_name"].ToString());
                lvi.SubItems.Add(dr["is_enabled"].ToString());
                var sizeInMB = Toolkit.ToDecimal(dr["total_size"], 0.0M) / 1024.0M / 1024.0M;
                lvi.SubItems.Add(sizeInMB.ToString("###,###,##0.00"));
                var lastTouched = dr["modified_date"] == DBNull.Value ? dr["created_date"] : dr["modified_date"];
                lvi.SubItems.Add(((DateTime)lastTouched).ToString());
                lvi.UseItemStyleForSubItems = false;

                lvi.Tag = dr["sys_file_group_id"].ToString();

                lv.Items.Add(lvi);
            }

            selectRememberedTags(lv, tags);

            MainFormUpdateStatus(getDisplayMember("RefreshData{done}", "Refreshed file groups"), false);
        }
예제 #2
0
        public override void RefreshData()
        {
            this.Text = "File Group - " + MainFormCurrentNodeText("") + " - " + this.AdminProxy.Connection.ServerName + (Toolkit.IsProcessElevated() ? " - Administrator " : "");

            if (ID > 0)
            {
                var dtGroup = AdminProxy.ListFileGroups(ID).Tables["list_file_groups"];
                if (dtGroup != null && dtGroup.Rows.Count > 0)
                {
                    var drG = dtGroup.Rows[0];
                    txtName.Text       = drG["group_name"].ToString();
                    txtVersion.Text    = drG["version_name"].ToString();
                    chkEnabled.Checked = drG["is_enabled"].ToString().Trim().ToUpper() == "Y";

                    var dtFiles = AdminProxy.ListFilesByGroup(ID, true).Tables["files_by_group"];
                    lv.Items.Clear();
                    foreach (DataRow fld in dtFiles.Rows)
                    {
                        var lvi = new ListViewItem(fld["display_name"].ToString());
                        lvi.Tag = Toolkit.ToInt32(fld["sys_file_id"], -1);

                        lvi.SubItems.Add(fld["file_name"].ToString());
                        lvi.SubItems.Add(fld["file_version"].ToString());
                        lvi.SubItems.Add((Toolkit.ToDecimal(fld["file_size"], 0.0M) / 1024.0M / 1024.0M).ToString("###,###,##0.00"));

                        lvi.SubItems.Add(fld["is_enabled"].ToString());
                        lvi.SubItems.Add(fld["virtual_file_path"].ToString());

                        var lastTouched = fld["modified_date"] == DBNull.Value ? fld["created_date"] : fld["modified_date"];
                        lvi.SubItems.Add(((DateTime)lastTouched).ToString());

                        lv.Items.Add(lvi);
                    }
                }
            }

            MarkClean();
        }