public SelectedObjectChooser(User user, List<ViewModelBase> items, LookupType objectType)
        {
            InitializeComponent();

            GridView view = new GridView();

            var m = new RDESiteVisit();

            switch (objectType) {
                case LookupType.Site:
                    AddColumn(view, "Site Name", "SiteName", 300);
                    AddColumn(view, "Site ID", "SiteID");
                    AddColumn(view, "Longitude","Longitude");
                    AddColumn(view, "Latitude","Latitude");
                    break;
                case LookupType.SiteVisit:
                    AddColumn(view, "Site Visit Name", "VisitName", 300);
                    AddColumn(view, "Site Name", "Site.SiteName", 300);
                    AddColumn(view, "Site Visit ID", "SiteVisitID");
                    AddColumn(view, "Site ID", "Site.SiteID");
                    AddColumn(view, "Longitude","Site.Longitude");
                    AddColumn(view, "Latitude","Site.Latitude");
                    break;
                case LookupType.Material:
                    AddColumn(view, "Material Name", "MaterialName", 100);
                    AddColumn(view, "BiotaID", "BiotaID");
                    AddColumn(view, "Site Visit Name", "SiteVisit.VisitName", 300);
                    AddColumn(view, "Site Name", "SiteVisit.Site.SiteName", 300);
                    AddColumn(view, "Material ID", "MaterialID");
                    AddColumn(view, "Site Visit ID", "SiteVisit.SiteVisitID");
                    AddColumn(view, "Site ID", "SiteVisit.Site.SiteID");
                    AddColumn(view, "Longitude","SiteVisit.Site.Longitude");
                    AddColumn(view, "Latitude","SiteVisit.Site.Latitude");
                    break;

            }

            lvw.View = view;
            lvw.ItemsSource = items;

            lvw.AddHandler(GridViewColumnHeader.ClickEvent, new RoutedEventHandler(GridViewColumnHeaderClickedHandler));

            lblStatus.Content = string.Format("{0} items listed.", items.Count);

            lvw.MouseRightButtonUp += new MouseButtonEventHandler(lvw_MouseRightButtonUp);

            this.Title = string.Format("Multiple {0} records found at this location", objectType.ToString());
        }
示例#2
0
 public void UpdateSiteVisitRDE(RDESiteVisit siteVisit)
 {
     StoredProcUpdate("spSiteVisitUpdateRDE",
         _P("intSiteVisitID", siteVisit.SiteVisitID),
         _P("vchrSiteVisitName", siteVisit.VisitName),
         _P("vchrCollector", siteVisit.Collector),
         _P("intStartDate", siteVisit.DateStart),
         _P("intEndDate", siteVisit.DateEnd)
     );
 }
示例#3
0
 public static string FormatSiteVisitName(RDESiteVisit visit)
 {
     return Format(Config.GetProfile<string>(PluginManager.Instance.User, "Material.SiteVisitNameFormat", DEFAULT_SITE_VISIT_NAME_FORMAT), visit);
 }
示例#4
0
 private RDESiteVisitViewModel CreateSiteVisitViewModel(RDESiteVisit visit, RDESiteViewModel site)
 {
     var vm = new RDESiteVisitViewModel(visit);
     vm.DataChanged += SiteVisitViewModelDataChanged;
     vm.Site = site;
     vm.SiteID = site.SiteID;
     vm.Locked = !User.HasPermission(PermissionCategory.SPARC_SITEVISIT, PERMISSION_MASK.UPDATE) || _startLockMode;
     site.SiteVisits.Add(vm);
     return vm;
 }
示例#5
0
        private RDESiteVisit CreateNewSiteVisit()
        {
            RDESiteVisitViewModel copyFrom = null;
            switch (_autoFillMode) {
                case AutoFillMode.CopyCurrentData:
                    copyFrom = grpSiteVisits.SelectedItem as RDESiteVisitViewModel;
                    break;
                case AutoFillMode.TemplateData:
                    copyFrom = _siteVisitTemplate;
                    break;
            }

            RDESiteVisit ret;
            if (copyFrom != null) {
                ret = ReflectionUtils.Clone(copyFrom.Model);
                ret.SiteVisitID = -1;
                ret.VisitName = null;
            } else {
                ret = new RDESiteVisit();
            }

            ret.Locked = false;

            return ret;
        }