예제 #1
0
        //edit
        public bool UpdateFeature(FeatureDetails edit)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var feat = ctx.Features.SingleOrDefault(e => e.OwnerID == _userId && e.FeatureID == edit.FeatureID);
                if (feat != null)
                {
                    feat.GameType      = edit.GameType;
                    feat.RacePointCost = edit.RacePointCost;
                    feat.FeatureName   = edit.FeatureName;
                    feat.Description   = edit.Description;
                    feat.Benefits      = edit.Benefits;
                    feat.Special       = edit.Special;
                    //feat.RaceIDPrerequisites;
                    //feat.ClassIDPrerequisites;
                    //feat.FeatureIDPrerequisites;
                    feat.StatPrerequisite     = String.Join("|", edit.StatPrerequisite.Select(s => s.Key + " " + s.Value).ToArray());
                    feat.LvlPrerequisite      = edit.LvlPrerequisite;
                    feat.StrengthModifier     = edit.StrengthModifier;
                    feat.DexterityModifier    = edit.DexterityModifier;
                    feat.ConstitutionModifier = edit.ConstitutionModifier;
                    feat.IntelligenceModifier = edit.IntelligenceModifier;
                    feat.WisdomModifier       = edit.WisdomModifier;
                    feat.CharismaModifier     = edit.CharismaModifier;
                    feat.DateOfModification   = DateTimeOffset.UtcNow;

                    return(ctx.SaveChanges() == 1);
                }
                else
                {
                    return(false);
                }
            }
        }
예제 #2
0
        public void MergeFeaturesWithConfiguration(IDictionary <string, Common.FeatureUsageData.Feature> featureReport)
        {
            FeatureDetails featureDetails = new FeatureDetails();

            if (_configuration != null && _configuration.FeatureDetails != null)
            {
                IDictionary <string, Common.FeatureUsageData.Dom.Feature> features = new Dictionary <string, Common.FeatureUsageData.Dom.Feature>();

                if (_configuration.FeatureDetails.Features != null)
                {
                    foreach (Common.FeatureUsageData.Dom.Feature configFeature in _configuration.FeatureDetails.Features)
                    {
                        Common.FeatureUsageData.Dom.Feature feature = configFeature;

                        if (featureReport != null && featureReport.ContainsKey(configFeature.Name))
                        {
                            feature = MergeFeatures(configFeature, featureReport[configFeature.Name]);
                        }

                        features.Add(feature.Name, feature);
                    }
                }

                if (featureReport != null && featureReport.Count > 0)
                {
                    foreach (var reportedFeature in featureReport)
                    {
                        if (!features.ContainsKey(reportedFeature.Key))
                        {
                            features.Add(reportedFeature.Key, new Feature
                            {
                                Name         = reportedFeature.Value.Name,
                                LastUsedOn   = reportedFeature.Value.LastUsageTime.Date.ToString("d"),
                                CreationTime = reportedFeature.Value.CreationTime.ToString("d"),
                                Subfeatures  = Common.FeatureUsageData.Feature.ConvertFeatures(reportedFeature.Value.Features())
                            });
                        }
                    }
                }

                featureDetails.Features = features.Values.ToArray();
            }
            else
            {
                Common.FeatureUsageData.Dom.Feature[] features = Alachisoft.NCache.Common.FeatureUsageData.Feature.ConvertFeatures(featureReport);
                featureDetails.Features = features;
            }

            _finalConfiguration.FeatureDetails = featureDetails;
        }
예제 #3
0
        public ActionResult Edit(FeatureDetails feat)
        {
            if (!ModelState.IsValid)
            {
                return(View(feat));
            }
            var service = CreateFeatService();

            if (service.UpdateFeature(feat))
            {
                TempData["SaveResult"] = "Feature Updated";
                return(RedirectToAction("Index"));
            }
            return(View(feat));
        }
        public void add(int ClassID, string ClassName, ESRI.ArcGIS.Geometry.IGeometry Geo, int OID, int EID,IFeature pFeat)
        {
            FeatureDetails pFD = new FeatureDetails();
            FieldPairs[] fps = new FieldPairs[pFeat.Fields.FieldCount - 1];
            int fldIdx = 0;
            for (int i = 0; i < pFeat.Fields.FieldCount ; i++)
            {
                if (pFeat.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeGeometry)
                { }
                else
                {
                    FieldPairs fp = new FieldPairs();
                    fp.FieldAlias = pFeat.Fields.get_Field(i).AliasName;
                    fp.FieldName = pFeat.Fields.get_Field(i).Name;
                    if (pFeat.get_Value(i) == null)
                    {
                        fp.FieldValue = "";

                    }
                    else
                    {
                        fp.FieldValue = pFeat.get_Value(i).ToString();
                    }
                    fps[fldIdx] = fp;

                    fldIdx++;
                }

            }
            pFD.Fields = fps;

            pFD.Geo = Geo;
            pFD.OID = OID;
            pFD.EID = EID;
            TraceResultsClass trRes = TraceResultClassItem(ClassID);
            if (trRes == null)
            {
                trRes = new TraceResultsClass();
                trRes.ClassID = ClassID;
                trRes.ClassName = ClassName;
                if (trRes.Features == null)
                {
                    trRes.Features = new ArrayList();
                }

                trRes.Features.Add(pFD);
                m_TraceResultItems.Add(trRes);

            }
            else
            {
                if (trRes.Features == null)
                {
                    trRes.Features = new ArrayList();
                }
                trRes.Features.Add(pFD);
            }
        }