Example #1
0
        public void SetCurProperty(string cfgId, string propertyName, int branchIndex, string value)
        {
            config cfg = GetTableRow(cfgId, branchIndex);

            if (cfg == null)
            {
                currentLuaTableData.tables[branchIndex].Apply(DifferController.STATUS_ADDED, new config(cfgId));
                cfg = GetTableRow(cfgId, branchIndex);
            }
            property property = GetCurProperty(cfg, propertyName);

            if (property == null)
            {
                property newProperty = new property();
                newProperty.value4Show = value;
                newProperty.name       = propertyName;
                newProperty.isServer   = GetParsedExcel(currentExcelpath).PropertyDic[propertyName].isServerProperty;
                newProperty.type       = GetParsedExcel(currentExcelpath).PropertyDic[propertyName].type;
                if (newProperty.type == PROPERTY_TYPE_STRING)
                {
                    newProperty.value = String.Format("'{0}'", newProperty.value4Show);
                }
                else if (newProperty.type == PROPERTY_TYPE_TABLE)
                {
                    newProperty.value = String.Format("{{0}}", newProperty.value4Show);
                }
                else
                {
                    newProperty.value = newProperty.value4Show;
                }
                cfg.Apply(DifferController.STATUS_ADDED, newProperty);
            }
        }
Example #2
0
        public List <string> GetDistinctValues(property p)
        {
            var list = build();
            IEnumerable <string> query = new List <string>();

            switch (p.name)
            {
            case "health": query = list.Select(x => x.Value.health.ToString()); break;

            case "name": query = list.Select(x => x.Value.name); break;

            case "classs": query = list.Select(x => x.Value.classs); break;

            case "role": query = list.Select(x => x.Value.role); break;

            case "target": query = list.Select(x => x.Value.target); break;

            case "targetHealth": query = list.Select(x => x.Value.targetHealth.ToString()); break;

            case "points": query = list.Select(x => x.Value.points.ToString()); break;

            case "onCD": query = list.Select(x => x.Value.onCD.ToString()); break;

            case "energy": query = list.Select(x => x.Value.energy.ToString()); break;

            case "mana": query = list.Select(x => x.Value.mana.ToString()); break;

            case "inCombat": query = list.Select(x => x.Value.inCombat.ToString()); break;
            }
            return(query.Distinct().ToList());;
        }
        private void AddExtraInfoToProperty(property xmlProp, Property originalProp)
        {
            xmlProp.insert = originalProp.GetPropertyInsert();
            xmlProp.update = originalProp.GetPropertyUpdate();

            string formula = originalProp.GetPropertyFormula();

            if (!string.IsNullOrWhiteSpace(formula))
            {
                xmlProp.formula = formula;
            }

            xmlProp.optimisticlock = originalProp.GetPropertyOptimisticLock();
            xmlProp.generated      = (propertyGeneration)Enum.Parse(typeof(propertyGeneration), originalProp.GetPropertyGenerated().ToString());

            var access = originalProp.GetPropertyAccess();

            if (access != Interfaces.NHibernateEnums.PropertyAccessTypes.inherit_default)
            {
                xmlProp.access = access.ToString().Replace("_", "-");
            }

            if (!originalProp.GetPropertyInsert())
            {
                xmlProp.insertSpecified = true;
                xmlProp.insert          = false;
            }
            if (!originalProp.GetPropertyUpdate())
            {
                xmlProp.updateSpecified = true;
                xmlProp.update          = false;
            }
        }
Example #4
0
        /// <summary>
        /// Add property object to the Database
        /// </summary>
        /// <param name="prop"></param>
        public void AddProperty(property prop)
        {
            context.properties.Add(prop);
            context.SaveChanges();

            _mw.LoadPropertyList();
        }
Example #5
0
        public static bool PeriodSeparationIsSharp(Archive archive)
        {
            bool inboundSeparationIsSharp;
            bool outboundSeparationIsSharp;

            addml archiveExtraction = GetAddmlObject(ArkadeConstants.ArkivuttrekkXmlFileName, archive);

            try
            {
                dataObject archiveExtractionElement = archiveExtraction.dataset[0].dataObjects.dataObject[0];
                property   infoElement           = archiveExtractionElement.properties[0];
                property   additionalInfoElement = infoElement.properties[1];
                property   periodProperty        =
                    additionalInfoElement.properties.FirstOrDefault(p => p.name == "periode");

                property inboundSeparationProperty  = periodProperty.properties[0];
                property outboundSeparationProperty = periodProperty.properties[1];

                inboundSeparationIsSharp  = inboundSeparationProperty.value.Equals("skarp");
                outboundSeparationIsSharp = outboundSeparationProperty.value.Equals("skarp");
            }
            catch
            {
                string exceptionMessage = string.Format(Resources.ExceptionMessages.PeriodSeparationParseError, ArkadeConstants.ArkivuttrekkXmlFileName);

                throw new ArkadeException(exceptionMessage);
            }

            return(inboundSeparationIsSharp && outboundSeparationIsSharp);
        }
        public PropertyViewModel(int PropertyId)
        {
            RealEntities db   = new RealEntities();
            property     prop = db.properties.Where(p => p.property_id == PropertyId).FirstOrDefault();

            InitialiseProperty(prop);
        }
Example #7
0
        public ActionResult DeleteConfirmed(int PropertyID)
        {
            property property = PropertyRepository.GetPropertyByID(PropertyID);

            PropertyRepository.DeleteRecord(property);
            return(RedirectToAction("List"));
        }
Example #8
0
        public IHttpActionResult Putproperty(int id, property property)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != property.ID)
            {
                return(BadRequest());
            }

            db.Entry(property).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!propertyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #9
0
    public void ChangeNodeProperty()
    {
        int randomNum = Random.Range(0, 3);

        NodeProperty = (property)randomNum;
        SetColor();
    }
Example #10
0
        public void CovertToDomain_MapsCorrectly()
        {
            //Arrange
            var propertyMapper = new PropertyMapper();
            var xmlSource      = new property()
            {
                @class    = "class",
                name      = "name",
                param1    = "param",
                value     = "value",
                property1 = new property[1] {
                    new property()
                    {
                        name = "subname"
                    }
                }
            };

            //Act
            var domainProperty = propertyMapper.Convert(xmlSource);

            //Assert
            Assert.IsInstanceOfType(domainProperty, typeof(Property));
            Assert.AreEqual("class", domainProperty.Class);
            Assert.AreEqual("name", domainProperty.Name);
            Assert.AreEqual("param", domainProperty.Param);
            Assert.AreEqual("value", domainProperty.Value);
            Assert.AreEqual(1, domainProperty.Properties.Count);
            Assert.AreEqual("subname", domainProperty.Properties.First().Name);
        }
Example #11
0
        private void ProcessEntityTablePerSubClass(Entity entity, joinedsubclass joinedSubClassNode)
        {
            foreach (var childEntity in entity.Children)
            {
                var mappedTable = childEntity.MappedTables().First();

                var subclassNode = new joinedsubclass();
                subclassNode.table  = mappedTable.Name.BackTick();
                subclassNode.schema = mappedTable.Schema.BackTick();
                subclassNode.name   = childEntity.Name;

                key keyNode = GetKeyNode(mappedTable);
                subclassNode.key = keyNode;

                foreach (var property in childEntity.ConcreteProperties)
                {
                    IColumn column = property.MappedColumn();
                    if (column == null)
                    {
                        continue;
                    }

                    property propNode = ProcessProperty(property, column);
                    subclassNode.AddProperty(propNode);
                }
                joinedSubClassNode.AddJoinedSubclass(subclassNode);

                var referenceMapper = new ReferenceMapper();
                referenceMapper.ProcessReferences(childEntity, item => subclassNode.AddItem(item));
            }
        }
Example #12
0
 public void ClearSlot()
 {
     ItemProperty = t_Slot.property.empty;
     displayImage = "";
     transform.GetChild(0).GetComponent <Image>().sprite =
         Resources.Load <Sprite>("Inventory Items/empty_item");
 }
        public async Task <ActionResult <property> > PostProperty(property @property)
        {
            _context.property.Add(@property);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getproperty", new { id = @property.propertyId }, @property));
        }
Example #14
0
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     panelControl1.Focus();
     if (IsCreate)
     {
         foreach (DataRow row2 in dt.Rows)
         {
             property _property = new property();
             _property        = Itop.Common.DataConverter.RowToObject <property>(row2);
             _property.UID    = Guid.NewGuid().ToString();
             _property.UseUID = _prop.UseUID;
             Services.BaseService.Create <property>(_property);
         }
     }
     else
     {
         foreach (DataRow row2 in dt.Rows)
         {
             if (row2.RowState == DataRowState.Modified)
             {
                 Services.BaseService.Update <property>(Itop.Common.DataConverter.RowToObject <property>(row2));
             }
         }
     }
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
        public async Task <IActionResult> PutProperty(int id, property @property)
        {
            if (id != @property.propertyId)
            {
                return(BadRequest());
            }

            _context.Entry(@property).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!propertyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        private static string GetChecksumAlgorithmFromProperty(property fileProperty)
        {
            var checksumProperty          = fileProperty.properties.FirstOrDefault(p => p.name == "checksum");
            var checksumAlgorithmProperty = checksumProperty?.properties.FirstOrDefault(p => p.name == "algorithm");

            return(checksumAlgorithmProperty?.value);
        }
Example #17
0
        static property read_property(StreamReader sr, string sourceExlPath)
        {
            property p         = new property();
            Excel    sourceExl = GlobalCfg.Instance.GetParsedExcel(sourceExlPath, false);

            p.name = llex_lite.buff2str();/* read key */
            if (sourceExl.PropertyDic.ContainsKey(p.name))
            {
                p.isServer = sourceExl.PropertyDic[p.name].isServerProperty;
                p.type     = sourceExl.PropertyDic[p.name].type;
            }
            try /*可能会有lua table 语法错误*/
            {
                llex_lite.llex(sr);
            }
            catch (LuaTableException ex)
            {
                string message = p.name + " : " + ex.Message;
                throw new LuaTableException(message);
            }
            p.value = llex_lite.buff2str();/* read true val */
            if ((p.value[0] == '\'' && p.value[p.value.Length - 1] == '\'') ||
                (p.value[0] == '{' && p.value[p.value.Length - 1] == '}'))
            {
                p.value4Show = p.value.Substring(1, p.value.Length - 2);
            }
            else
            {
                p.value4Show = p.value;
            }
            return(p);
        }
Example #18
0
        private void AddProperties(@class clazz, string entity, ITableMetadata tableMetaData)
        {
            var columnSet   = currentContext.Schema.GetColumns(tableMetaData.Catalog, tableMetaData.Schema, tableMetaData.Name, null);
            int nameOrdinal = columnSet.Columns.IndexOf(COLUMN_NAME);
            int typeOrdinal = columnSet.Columns.IndexOf(DATA_TYPE);

            foreach (DataRow row in columnSet.Rows)
            {
                var      cInfo = tableMetaData.GetColumnMetadata(row.ItemArray[nameOrdinal].ToString());
                property p     = currentContext.Model.AddPropertyToEntity(entity
                                                                          , currentContext.NamingStrategy.GetPropertyNameFromColumnName(cInfo.Name));
                p.notnull          = !true.ParseFromDb(cInfo.Nullable);
                p.notnullSpecified = !true.ParseFromDb(cInfo.Nullable);
                p.column           = 0 == string.Compare(p.name, cInfo.Name, true)?null:cInfo.Name;
                p.type1            = typeConverter.GetNHType(cInfo);
                if (p.type1 == null)
                {
                    logger.Warn(string.Format("No NHibernate type defined for dbtype:{0} len:{1}", cInfo.TypeName, cInfo.ColumnSize));
                }
                if (cInfo.ColumnSize > 0)
                {
                    p.length = cInfo.ColumnSize.ToString();
                }
                if (cInfo.NumericalPrecision > 0)
                {
                    p.precision = cInfo.NumericalPrecision.ToString();
                }
            }
        }
Example #19
0
        //
        // GET: /Property/Delete/5

        public ActionResult Delete(int PropertyID)
        {
            ViewBag.PropertyID = PropertyID;
            property property = PropertyRepository.GetPropertyByID(PropertyID);

            return(PartialView(property));
        }
        public static relationship NewRelationship(PropertyAndValue pavcIn)
        {
            relationship r = null;

            if (pavcIn.pValues[(int)CecilConst.PropertyName.Name] == null)
            {
                throw new ArgumentNullException(CecilConst.PropertyName.Name.ToString());
            }
            if (pavcIn.pValues[(int)CecilConst.PropertyName.FullName] == null)
            {
                throw new ArgumentNullException(CecilConst.PropertyName.FQName.ToString());
            }
            if (pavcIn.pValues[(int)CecilConst.PropertyName.ArchiMateElementType] == null)
            {
                throw new ArgumentNullException(CecilConst.PropertyName.ArchiMateElementType.ToString());
            }
            if (pavcIn.pValues[(int)CecilConst.PropertyName.APIType] == null)
            {
                throw new ArgumentNullException(CecilConst.PropertyName.APIType.ToString());
            }
            if (pavcIn.pValues[(int)CecilConst.PropertyName.SourceIdentifier] == null)
            {
                throw new ArgumentNullException(CecilConst.PropertyName.SourceIdentifier.ToString());
            }
            if (pavcIn.pValues[(int)CecilConst.PropertyName.TargetIdentifier] == null)
            {
                throw new ArgumentNullException(CecilConst.PropertyName.TargetIdentifier.ToString());
            }

            string label             = pavcIn.pValues[(int)CecilConst.PropertyName.Name];
            string fullname          = pavcIn.pValues[(int)CecilConst.PropertyName.FullName];
            string type              = pavcIn.pValues[(int)CecilConst.PropertyName.ArchiMateElementType];
            string eSourceIdentifier = pavcIn.pValues[(int)CecilConst.PropertyName.SourceIdentifier];
            string eTargetIdentifier = pavcIn.pValues[(int)CecilConst.PropertyName.TargetIdentifier];

            properties ps = ModelFactory.NewProperties();

            foreach (CecilConst.PropertyName pn in Enum.GetValues(typeof(CecilConst.PropertyName)))
            {
                if (pn == CecilConst.PropertyName.NumberOfItems)
                {
                    break;
                }

                int ipn = (int)pn;
                if (pavcIn.pValues[ipn] != null)
                {
                    property p = ModelFactory.NewProperty(ModelFactory.NewValue(pavcIn.pValues[ipn]), pdc[ipn]);
                    ps.property.Add(p);
                }
            }

            ModelConst.RelationshipType eType = (ModelConst.RelationshipType)Enum.Parse(typeof(ModelConst.RelationshipType), type);
            r = ModelFactory.NewRelationship(fullname, eType, eSourceIdentifier, eTargetIdentifier, ps);

            r.label.ElementAt(0).label_text = label; // short name for display; fullname to compute unique identifier

            return(r);
        }
Example #21
0
 void RemoveProperty(property p)
 {
     if (propertiesDic.ContainsKey(p.name))
     {
         properties.Remove(propertiesDic[p.name]);
         propertiesDic.Remove(p.name);
     }
 }
        public ActionResult DeleteConfirmed(string id)
        {
            property property = db.properties.Find(id);

            db.properties.Remove(property);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #23
0
 void AddProperty(property p)
 {
     if (!propertiesDic.ContainsKey(p.name))
     {
         propertiesDic[p.name] = p;
         properties.Add(p);
     }
 }
Example #24
0
        static property read_property(StreamReader sr)
        {
            property p = new property();

            p.name = llex_lite.buff2str();                      /* read key */
            llex_lite.llex(sr); p.value = llex_lite.buff2str(); /* read val */
            return(p);
        }
Example #25
0
 public property(property property)
 {
     name       = property.name;
     value      = property.value;
     value4Show = property.value4Show;
     isServer   = property.isServer;
     type       = property.type;
 }
 public property AddPropertyToEntity(string entityName, string propertyName)
 {
     property p = new property();
     p.name = propertyName;
     if (!propertiesMapByEntity.ContainsKey(entityName))
         propertiesMapByEntity[entityName] = new List<property>();
     propertiesMapByEntity[entityName].Add(p);
     return p;
 }
Example #27
0
 void AddProperty(property p)
 {
     if (!propertiesDic.ContainsKey(p.name))
     {
         propertiesDic[p.name] = p;
         properties.Add(p);
         IsNeedGenDic.Add(p.name, true);
     }
 }
Example #28
0
 void ModifyProperty(property p)
 {
     if (propertiesDic.ContainsKey(p.name))
     {
         int index = properties.IndexOf(propertiesDic[p.name]);
         properties[index]     = p;
         propertiesDic[p.name] = p;
     }
 }
        internal static property GetProperty(MemberInfo memberInfo, string prefix = "", Func <MemberInfo, bool> notNull = null)
        {
            if (memberInfo.IsReadOnlyProperty())
            {
                return(null);
            }
            if (memberInfo.DeclaringType.GetSettableFieldsAndProperties().Any(memberInfo.IsBackingFieldFor))
            {
                return(null);
            }

            notNull = notNull ?? (mi => !mi.IsNullable());
            var returnType = memberInfo.ReturnType();
            var type       = GetTypeForPropertyRules.Rules.Select(r => r(memberInfo)).FirstOrDefault(t => t != null);

            if (type == null || type == typeof(void))
            {
                return(null);                                      //not for mapping, this one
            }
            var property = new property()
            {
                name    = memberInfo.Name,
                access  = memberInfo.Access(),
                notnull = notNull(memberInfo),
            };

            property.column.Add(new column().Setup(memberInfo, columnPrefix: prefix, notnull: property.notnull));

            property.type1 = type.AssemblyQualifiedName;

            UniqueAttribute.SetUniqueProperties(memberInfo, property);

            //this if statement could be happily replaced by some nifty lookup table or something
            if (returnType == typeof(DateTimeOffset) || returnType == typeof(DateTimeOffset?))
            {
                property.type1 = "datetimeoffset";
            }
            if (returnType == typeof(DateTime) || returnType == typeof(DateTime?))
            {
                property.type1 = "UtcDateTime";
            }
            if (returnType.IsEnum)
            {
                property.type1 =
                    typeof(EnumStringType <>).MakeGenericType(returnType).AssemblyQualifiedName;
            }
            // check nullable enum
            if (returnType.IsGenericType &&
                returnType.GetGenericTypeDefinition() == typeof(Nullable <>) &&
                returnType.GetGenericArguments()[0].IsEnum)
            {
                property.type1 =
                    typeof(EnumStringType <>).MakeGenericType(returnType.GetGenericArguments()[0]).AssemblyQualifiedName;
            }
            return(property);
        }
Example #30
0
 public JsonResult Create(property _property)
 {
     if (ModelState.IsValid)
     {
         model = new ModelResultado();
         model.save(_property);
         return(Json("add successufully", JsonRequestBehavior.AllowGet));
     }
     return(Json("Error", JsonRequestBehavior.AllowGet));
 }
 public ActionResult Edit([Bind(Include = "propNo,propName")] property property)
 {
     if (ModelState.IsValid)
     {
         db.Entry(property).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(property));
 }
 // returns true if property was consumed.
 internal bool setFromProperty(property p)
 {
     switch (p.name)
     {
         case Constants.NUMBER:
             number = p.Value;
             return true;
         case Constants.ACTIVE:
             active = Utilities.CheckedParseBoolean(p.Value, Constants.ACTIVE);
             return true;
     }
     return false;
 }
 public property Insert_property_select(int ID)
 {
     property = property.Select(ID);
     Insert_approx_mrkt_value_txt.Text = Convert.ToString(property.approx_mrkt_value);
     Insert_address_id_txt.Text = Convert.ToString(property.address_id);
     Insert_case_id_txt.Text = Convert.ToString(property.case_id);
     Insert_client_id_txt.Text = Convert.ToString(property.client_id);
     Insert_Homeowners_Insurance_Payment_txt.Text = Convert.ToString(property.Homeowners_Insurance_Payment);
     Insert_monthly_property_payment_txt.Text = Convert.ToString(property.monthly_property_payment);
     Insert_mortg_comp_txt.Text = Convert.ToString(property.mortg_comp);
     Insert_Property_Tax_Payment_txt.Text = Convert.ToString(property.Property_Tax_Payment);
     Insert_own_prop_txt.Text = Convert.ToString(property.own_prop);
     Insert_rent_prop_txt.Text = Convert.ToString(property.rent_prop);
     Insert_date_purchased_txt.Text = Convert.ToString(property.date_purchased);
     return property;
 }
Example #34
0
 // returns true if property was consumed.
 internal bool setFromProperty(property p)
 {
     switch (p.name)
     {
         case Constants.NUMBER:
             number = p.Value;
             return true;
         case Constants.ACTIVE:
             bool tactive;
             if (Boolean.TryParse(p.Value, out tactive))
             {
                 active = tactive;
             }
             else
             {
                 throw new LmBoxException(String.Format("Expected value representing boolean for property '{0}', got '{1}'", Constants.ACTIVE, p.Value));
             }
             return true;
     }
     return false;
 }
 public void RemoveProperty(string entityName, property property)
 {
     propertiesMapByEntity[entityName].Remove(property);
 }
 public property property_insert()
 {
     property.approx_mrkt_value = Convert.ToDecimal(Insert_approx_mrkt_value_txt.Text);
     property.address_id = Convert.ToInt32(Insert_address_id_txt.Text);
     property.case_id = Convert.ToInt32(Insert_case_id_txt.Text);
     property.client_id = Convert.ToInt32(Insert_client_id_txt.Text);
     property.Homeowners_Insurance_Payment = Convert.ToDecimal(Insert_Homeowners_Insurance_Payment_txt.Text);
     property.monthly_property_payment = Convert.ToDecimal(Insert_monthly_property_payment_txt.Text);
     property.mortg_comp = Insert_mortg_comp_txt.Text;
     property.Property_Tax_Payment = Convert.ToDecimal(Insert_Property_Tax_Payment_txt.Text);
     property.own_prop = Insert_own_prop_txt.Text;
     property.rent_prop = Insert_rent_prop_txt.Text;
     property.date_purchased = Convert.ToInt32(Insert_date_purchased_txt.Text);
     property = property.Insert(property);
     Insert_property_GridView.DataBind();
     Update_property_GridView.DataBind();
     Delete_property_GridView.DataBind();
     return property;
 }
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     property = Update_property_select(Convert.ToInt32(Update_property_GridView.SelectedValue));
 }
 protected void UPDATE(object sender, EventArgs e)
 {
     property = property_update(Convert.ToInt32(Update_property_GridView.SelectedValue));
 }
 protected void Insert_Select_Record(object sender, EventArgs e)
 {
     property = Insert_property_select(Convert.ToInt32(Insert_property_GridView.SelectedValue));
 }
 protected void INSERT(object sender, EventArgs e)
 {
     property = property_insert();
 }