Esempio n. 1
0
        public void delete(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
        {
            try
            {
                Employee employee = (Employee)subject;

                SqlCommand command = new SqlCommand(
                    "DELETE FROM Employees WHERE EmployeeID = @EmployeeId AND VersionId = @VersionId",
                    connection, transaction);

                command.Parameters.Add("@VersionId", employee.Timestamp.Value);
                if(subject.isNull("EmployeeId"))
                {
                    command.Parameters.Add("@EmployeeId", DBNull.Value );
                }
                else
                {
                    command.Parameters.Add("@EmployeeId", employee.EmployeeId);
                }
                if(command.ExecuteNonQuery() <= 0)
                {
                    throw new ConcurrencyException();
                }
            }
            catch(SqlException sqle)
            {
                throw new ApplicationException(sqle.Message);
            }
            catch(Exception e)
            {
                throw new ApplicationException(e.Message);
            }
        }
Esempio n. 2
0
        public void delete(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
        {
            try
            {
                Person person = (Person)subject;

                SqlCommand command = new SqlCommand(
                    "DELETE FROM Persons WHERE PersonID = @PersonId AND chTimestamp = @chTimestamp",
                    connection, transaction);

                command.Parameters.Add("@chTimestamp", person.Timestamp.Value);
                if(subject.isNull("PersonId"))
                {
                    command.Parameters.Add("@PersonId", DBNull.Value );
                }
                else
                {
                    command.Parameters.Add("@PersonId", person.PersonId);
                }
                if(command.ExecuteNonQuery() <= 0)
                {
                    throw new ConcurrencyException();
                }
            }
            catch(SqlException sqle)
            {
                throw new ApplicationException(sqle.Message);
            }
            catch(Exception e)
            {
                throw new ApplicationException(e.Message);
            }
        }
Esempio n. 3
0
        protected override void deepCopy(DomainObject domainObject)
        {
            base.deepCopy(domainObject);

            File file = (File)domainObject;
            relFileNamePath = file.relFileNamePath;
        }
Esempio n. 4
0
		public void WithCustomizedTagNameAndIdentityProperty()
		{
			var id = string.Empty;
			using (var store = NewDocumentStore())
			{
				store.Conventions.AllowQueriesOnId = true;
				var defaultFindIdentityProperty = store.Conventions.FindIdentityProperty;
				store.Conventions.FindIdentityProperty = property =>
					typeof(IEntity).IsAssignableFrom(property.DeclaringType)
					  ? property.Name == "Id2"
					  : defaultFindIdentityProperty(property);

				store.Conventions.FindTypeTagName = type =>
				                                    typeof (IDomainObject).IsAssignableFrom(type)
				                                    	? "domainobjects"
				                                    	: DocumentConvention.DefaultTypeTagName(type);

				using (var session = store.OpenSession())
				{
					var domainObject = new DomainObject();
					session.Store(domainObject);
					var domainObject2 = new DomainObject();
					session.Store(domainObject2);
					session.SaveChanges();
					id = domainObject.Id2;
				}
				var matchingDomainObjects = store.OpenSession().Query<IDomainObject>().Where(_ => _.Id2 == id).ToList();
				Assert.Equal(matchingDomainObjects.Count, 1);
			}


		}
Esempio n. 5
0
        public void delete(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
        {
            try
            {
                Territory territory = (Territory)subject;

                SqlCommand command = new SqlCommand(
                    "DELETE FROM Territories WHERE TerritoryID = @TerritoryId AND VersionId = @VersionId",
                    connection, transaction);

                command.Parameters.Add("@VersionId", territory.Timestamp.Value);
                if(subject.isNull("TerritoryId"))
                {
                    command.Parameters.Add("@TerritoryId", DBNull.Value );
                }
                else
                {
                    command.Parameters.Add("@TerritoryId", territory.TerritoryId);
                }
                if(command.ExecuteNonQuery() <= 0)
                {
                    throw new ConcurrencyException();
                }
            }
            catch(SqlException sqle)
            {
                throw new ApplicationException(sqle.Message);
            }
            catch(Exception e)
            {
                throw new ApplicationException(e.Message);
            }
        }
Esempio n. 6
0
 public void RegisterDirty(DomainObject obj)
 {
     if (!(this.newObjects.Contains(obj) || this.dirtyObjects.Contains(obj)))
     {
         this.dirtyObjects.Add(obj);
         this.OnChanged();
     }
 }
Esempio n. 7
0
 public void unregisterDomainObject(DomainObject domainObject)
 {
     Hashtable typeMap = (Hashtable)m_typeMaps[domainObject.GetType().BaseType];
     if(typeMap == null)
         Debug.Assert(false);
     Debug.Assert(typeMap.Contains(domainObject.Id));
     typeMap.Remove(domainObject.Id);
 }
Esempio n. 8
0
 public static bool IsPersistent(DomainObject entity)
 {
     var keyAttributedProps =
         entity.GetType()
             .GetProperties()
             .FirstOrDefault(p => p.GetCustomAttributes(typeof (KeyAttribute), true).Length == 1);
     return (keyAttributedProps != null) && !keyAttributedProps.GetValue(entity, null).ToString().Equals("0");
 }
Esempio n. 9
0
 public override void SetInfoFieldFromObject(DomainObject pobj, DomainObjectInfo info, IPersistenceContext pctx)
 {
     Entity entity = (Entity)GetClassFieldValue(pobj);
     if (entity != null && pctx.IsProxyLoaded(entity))
     {
         SetInfoFieldValue(info, _entityConversion.GetInfoFromObject(entity, pctx));
     }
 }
Esempio n. 10
0
			public void Persist(DomainObject<Guid, DomainEvent> entity)
			{
				foreach (var @event in entity.GetEvents())
				{
					this.events.Add(@event);
					Console.WriteLine("Saved event {0} to the store.", @event);
				}

				entity.AcceptEvents();
			}
Esempio n. 11
0
        public void Remove(DomainObject item)
        {
            if(item == Person.None) return;
            if (_domainObjects.Contains(item) == false) return;  // Already exists

            IList bindingList = _bindingLists[item.GetType()];

            bindingList.Remove(item);
            _domainObjects.Remove(item);
        }
Esempio n. 12
0
 public override void SetObjectFieldFromInfo(DomainObject pobj, DomainObjectInfo info, IPersistenceContext pctx)
 {
     EntityInfo entityInfo = (EntityInfo)GetInfoFieldValue(info);
     if (entityInfo != null && entityInfo.GetEntityRef() != null)
     {
         // don't copy any information from the referenced EntityInfo
         // only take its reference
         Entity entity = pctx.Load(entityInfo.GetEntityRef(), EntityLoadFlags.Proxy);    // proxy, no version check!
         SetClassFieldValue(pobj, entity);
     }
 }
Esempio n. 13
0
 public List<Comment> GetAll(DomainObject<int> target)
 {
     return DbManager
         .ExecuteList(
             Query("projects_comments")
             .Select(columns)
             .Where("target_uniq_id", target.UniqID))
         .ConvertAll(r => ToComment(r))
         .OrderBy(c => c.CreateOn)
         .ToList();
 }
Esempio n. 14
0
 public override bool Validate(DomainObject domainObject)
 {
     try
     {
         return GetPropertyValue(domainObject).ToString().Length > 0;
     }
     catch
     {
         return false;
     }
 }
Esempio n. 15
0
 public override bool Validate(DomainObject domainObject)
 {
     try
     {
         int id = int.Parse(GetPropertyValue(domainObject).ToString());
         return id >= 0;
     }
     catch
     {
         return false;
     }
 }
Esempio n. 16
0
        protected override void checkBusinessRulesOnAdd(DomainObject entity)
        {
            Gimnasticar g = (Gimnasticar)entity;
            Notification notification = new Notification();

            GimnasticarDAO gimnasticarDAO = DAOFactoryFactory.DAOFactory.GetGimnasticarDAO();
            if (gimnasticarDAO.postojiGimnasticar(g.Ime, g.Prezime))
            {
                notification.RegisterMessage("Ime", "Gimnasticar sa datim imenom i prezimenom vec postoji.");
                throw new BusinessException(notification);
            }
        }
Esempio n. 17
0
 public void registerDomainObject(DomainObject domainObject)
 {
     Type type = domainObject.GetType().BaseType;
     Hashtable typeMap = (Hashtable)m_typeMaps[type];
     if(typeMap == null)
     {
         typeMap = new Hashtable();
         m_typeMaps[type] = typeMap;
     }
     Debug.Assert(typeMap.Contains(domainObject) == false);
     typeMap.Add(domainObject.Id, domainObject);
 }
Esempio n. 18
0
        protected override void checkBusinessRulesOnAdd(DomainObject entity)
        {
            PraviloOceneVezbe pravilo = (PraviloOceneVezbe)entity;
            Notification notification = new Notification();

            PraviloOceneVezbeDAO praviloOceneVezbeDAO = DAOFactoryFactory.DAOFactory.GetPraviloOceneVezbeDAO();
            if (praviloOceneVezbeDAO.postojiPravilo(pravilo.Naziv))
            {
                notification.RegisterMessage("Naziv", "Pravilo sa datim nazivom vec postoji.");
                throw new BusinessException(notification);
            }
        }
Esempio n. 19
0
 public Comment GetLast(DomainObject<Int32> target)
 {
     return DbManager
         .ExecuteList(
             Query("projects_comments")
             .Select(columns)
             .Where("target_uniq_id", target.UniqID)
             .Where("inactive", false)
             .OrderBy("create_on", false)
             .SetMaxResults(1))
         .ConvertAll(r => ToComment(r))
         .SingleOrDefault();
 }
Esempio n. 20
0
        protected override void checkBusinessRulesOnUpdate(DomainObject entity)
        {
            PraviloOceneVezbe pravilo = (PraviloOceneVezbe)entity;
            Notification notification = new Notification();

            PraviloOceneVezbeDAO praviloOceneVezbeDAO = DAOFactoryFactory.DAOFactory.GetPraviloOceneVezbeDAO();
            bool nazivChanged = (pravilo.Naziv.ToUpper() != oldNaziv.ToUpper()) ? true : false;
            if (nazivChanged && praviloOceneVezbeDAO.postojiPravilo(pravilo.Naziv))
            {
                notification.RegisterMessage("Naziv", "Pravilo sa datim nazivom vec postoji.");
                throw new BusinessException(notification);
            }
        }
Esempio n. 21
0
        public override bool Validate(DomainObject domainObject)
        {
            try
            {
                string value = GetPropertyValue(domainObject).ToString();

                switch (DataType)
                {
                    case ValidationDataType.Integer:

                        var imin = int.Parse(Min.ToString());
                        var imax = int.Parse(Max.ToString());
                        var ival = int.Parse(value);

                        return (ival >= imin && ival <= imax);

                    case ValidationDataType.Double:
                        var dmin = double.Parse(Min.ToString());
                        var dmax = double.Parse(Max.ToString());
                        var dval = double.Parse(value);

                        return (dval >= dmin && dval <= dmax);

                    case ValidationDataType.Decimal:
                        var cmin = decimal.Parse(Min.ToString());
                        var cmax = decimal.Parse(Max.ToString());
                        var cval = decimal.Parse(value);

                        return (cval >= cmin && cval <= cmax);

                    case ValidationDataType.Date:
                        var tmin = DateTime.Parse(Min.ToString());
                        var tmax = DateTime.Parse(Max.ToString());
                        var tval = DateTime.Parse(value);

                        return (tval >= tmin && tval <= tmax);

                    case ValidationDataType.String:

                        var smin = Min.ToString();
                        var smax = Max.ToString();

                        var result1 = String.CompareOrdinal(smin, value);
                        var result2 = String.CompareOrdinal(value, smax);

                        return result1 >= 0 && result2 <= 0;
                }
                return false;
            }
            catch { return false; }
        }
Esempio n. 22
0
        protected override void checkBusinessRulesOnUpdate(DomainObject entity)
        {
            Gimnasticar g = (Gimnasticar)entity;
            Notification notification = new Notification();

            GimnasticarDAO gimnasticarDAO = DAOFactoryFactory.DAOFactory.GetGimnasticarDAO();
            bool imeChanged = (g.Ime.ToUpper() != oldIme.ToUpper()) ? true : false;
            bool prezimeChanged = (g.Prezime.ToUpper() != oldPrezime.ToUpper()) ? true : false;
            if ((imeChanged || prezimeChanged) && gimnasticarDAO.postojiGimnasticar(g.Ime, g.Prezime))
            {
                notification.RegisterMessage("Ime", "Gimnasticar sa datim imenom i prezimenom vec postoji.");
                throw new BusinessException(notification);
            }
        }
Esempio n. 23
0
 public List<Comment> GetAll(DomainObject<int> target)
 {
     using (var db = new DbManager(DatabaseId))
     {
         return db
             .ExecuteList(
                 Query("projects_comments")
                     .Select(columns)
                     .Where("target_uniq_id", target.UniqID))
             .ConvertAll(ToComment)
             .OrderBy(c => c.CreateOn)
             .ToList();
     }
 }
Esempio n. 24
0
 public Comment GetLast(DomainObject<Int32> target)
 {
     using (var db = new DbManager(DatabaseId))
     {
         return db.ExecuteList(
             Query(CommentsTable)
                 .Select(columns)
                 .Where("target_uniq_id", target.UniqID)
                 .Where("inactive", false)
                 .OrderBy("create_on", false)
                 .SetMaxResults(1))
                  .ConvertAll(ToComment)
                  .SingleOrDefault();
     }
 }
Esempio n. 25
0
        public void Add(DomainObject item)
        {
            if(item == null) return;

            if (_domainObjects.Contains(item)) return;  // Already exists

            IList bindingList = _bindingLists[item.GetType()];

            Movie pet = item as Movie;
            if (pet != null)
            {
                Add(pet.Director);
            }

            bindingList.Add(item);
            _domainObjects.Add(item);
        }
        /// <summary>
        /// Validates that the rule has been followed.
        /// </summary>
        /// <param name="domainObject">The domain object to validate.</param>
        /// <returns>True if the rule has been followed, otherwise false.</returns>
        public override bool ValidateRule(DomainObject domainObject)
        {
            bool isValid = true;

            BindableCollection<Account> accounts = _workbook.FetchAccounts();
            accounts.Sort();

            string name = _account.Name.Trim().ToLower();
            foreach (Account account in accounts) {
                if (account != _account && account.Name.Trim().ToLower() == name) {
                    isValid = false;
                    this.Description = string.Format("Account names must be unique. The name '{0}' is already in use.", account.Name);
                    break;
                }
            }

            return isValid;
        }
Esempio n. 27
0
        protected override bool refIntegrityDeleteDlg(DomainObject entity)
        {
            Gimnasticar g = (Gimnasticar)entity;
            VezbaDAO vezbaDao = DAOFactoryFactory.DAOFactory.GetVezbaDAO();

            // TODO: Ovde prvo treba pitati sta treba raditi sa vezbama
            // za datog gimnasticara (da li ih brisati ili ih ostaviti
            // ali bez gimnasticara)

            if (vezbaDao.existsVezbaGimnasticar(g))
            {
                string msg = "Gimnasticara '{0}' nije moguce izbrisati zato sto postoje " +
                    "vezbe za datog gimnasticara. \nMorate najpre da izbrisete vezbe " +
                    "da biste mogli da izbrisete gimnsticara.";
                MessageDialogs.showMessage(String.Format(msg, g), this.Text);
                return false;
            }
            return true;
        }
Esempio n. 28
0
        public void delete(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
        {
            try
            {
                OrderDetail orderdetail = (OrderDetail)subject;

                SqlCommand command = new SqlCommand(
                    "DELETE FROM OrderDetails WHERE OrderID = @Order AND ProductID = @Product AND chTimestamp = @chTimestamp",
                    connection, transaction);

                command.Parameters.Add("@chTimestamp", orderdetail.Timestamp.Value);
                if(subject.isNull("Order") || orderdetail.Order.isNull("OrderId"))
                {
                    command.Parameters.Add("@Order", DBNull.Value );
                }
                else
                {
                    command.Parameters.Add("@Order", orderdetail.Order.Id[0]);
                }
                if(subject.isNull("Product") || orderdetail.Product.isNull("ProductId"))
                {
                    command.Parameters.Add("@Product", DBNull.Value );
                }
                else
                {
                    command.Parameters.Add("@Product", orderdetail.Product.Id[0]);
                }
                if(command.ExecuteNonQuery() <= 0)
                {
                    throw new ConcurrencyException();
                }
            }
            catch(SqlException sqle)
            {
                throw new ApplicationException(sqle.Message);
            }
            catch(Exception e)
            {
                throw new ApplicationException(e.Message);
            }
        }
 /// <summary>
 /// Validates the specified domain object, applying only "low-level" rules, subject to the specified filter.
 /// </summary>
 /// <remarks>
 /// Low-level rules are:
 /// 1. Required fields.
 /// 2. String field lengths.
 /// 3. Unique constraints.
 /// </remarks>
 /// <param name="obj"></param>
 /// <param name="ruleFilter"></param>
 public void ValidateLowLevel(DomainObject obj, Predicate <ISpecification> ruleFilter)
 {
     Validate(obj, RuleLevel.Low, ruleFilter);
 }
 public void ValidateLowLevel(DomainObject obj, Predicate <ISpecification> ruleFilter)
 {
 }
 public void Validate(DomainObject obj)
 {
 }
Esempio n. 32
0
 protected virtual void saveOriginalData(DomainObject entity)
 {
     // Empty
 }
Esempio n. 33
0
            public static DomainObject ConvertLDAPProperty(LdapEntry result)
            {
                DomainObject     obj          = new DomainObject();
                LdapAttributeSet attributeSet = result.getAttributeSet();

                System.Collections.IEnumerator ienum = attributeSet.GetEnumerator();
                while (ienum.MoveNext())
                {
                    LdapAttribute attr = (LdapAttribute)ienum.Current;
                    switch (attr.Name.ToLower())
                    {
                    case "objectsid":
                        //Will need to convert this to a string
                        obj.objectsid = attr.StringValue;
                        break;

                    case "sidhistory":
                        obj.sidhistory = attr.StringValueArray;
                        break;

                    case "grouptype":
                        obj.grouptype = (GroupTypeEnum)Enum.Parse(typeof(GroupTypeEnum), attr.StringValue);
                        break;

                    case "samaccounttype":
                        obj.samaccounttype = (SamAccountTypeEnum)Enum.Parse(typeof(SamAccountTypeEnum), attr.StringValue);
                        break;

                    case "objectguid":
                        //Will need to conver this to a string
                        obj.objectguid = attr.StringValue;
                        break;

                    case "useraccountcontrol":
                        //convertme
                        break;

                    case "ntsecuritydescriptor":
                        //convertme
                        break;

                    case "accountexpires":
                        if (long.Parse(attr.StringValue) >= DateTime.MaxValue.Ticks)
                        {
                            obj.accountexpires = DateTime.MaxValue;
                        }
                        try
                        {
                            obj.accountexpires = DateTime.FromFileTime(long.Parse(attr.StringValue));
                        }
                        catch (ArgumentOutOfRangeException)
                        {
                            obj.accountexpires = DateTime.MaxValue;
                        }
                        break;

                    case "lastlogon":
                        DateTime dateTime = DateTime.MinValue;
                        //Not sure if this syntax is right.
                        if (attr.StringValues.GetType().Name == "System.MarshalByRefObject")
                        {
                            var comobj = (MarshalByRefObject)attr.StringValues;
                            int high   = (int)comobj.GetType().InvokeMember("HighPart", System.Reflection.BindingFlags.GetProperty, null, comobj, null);
                            int low    = (int)comobj.GetType().InvokeMember("LowPart", System.Reflection.BindingFlags.GetProperty, null, comobj, null);
                            dateTime = DateTime.FromFileTime(int.Parse("0x" + high + "" + low, System.Globalization.NumberStyles.HexNumber));
                        }
                        else
                        {
                            dateTime = DateTime.FromFileTime(long.Parse(attr.StringValue));
                        }
                        obj.lastlogon = dateTime;
                        break;

                    case "pwdlastset":
                        if (attr.StringValues.GetType().Name == "System.MarshalByRefObject")
                        {
                            var comobj = (MarshalByRefObject)attr.StringValues;
                            int high   = (int)comobj.GetType().InvokeMember("HighPart", System.Reflection.BindingFlags.GetProperty, null, comobj, null);
                            int low    = (int)comobj.GetType().InvokeMember("LowPart", System.Reflection.BindingFlags.GetProperty, null, comobj, null);
                            dateTime = DateTime.FromFileTime(int.Parse("0x" + high + "" + low, System.Globalization.NumberStyles.HexNumber));
                        }
                        else
                        {
                            dateTime = DateTime.FromFileTime(long.Parse(attr.StringValue));
                        }
                        obj.pwdlastset = dateTime;
                        break;

                    case "lastlogoff":
                        if (attr.StringValues.GetType().Name == "System.MarshalByRefObject")
                        {
                            var comobj = (MarshalByRefObject)attr.StringValues;
                            int high   = (int)comobj.GetType().InvokeMember("HighPart", System.Reflection.BindingFlags.GetProperty, null, comobj, null);
                            int low    = (int)comobj.GetType().InvokeMember("LowPart", System.Reflection.BindingFlags.GetProperty, null, comobj, null);
                            dateTime = DateTime.FromFileTime(int.Parse("0x" + high + "" + low, System.Globalization.NumberStyles.HexNumber));
                        }
                        else
                        {
                            dateTime = DateTime.FromFileTime(long.Parse(attr.StringValue));
                        }
                        obj.lastlogoff = dateTime;
                        break;

                    case "badpasswordtime":
                        if (attr.StringValues.GetType().Name == "System.MarshalByRefObject")
                        {
                            var comobj = (MarshalByRefObject)attr.StringValues;
                            int high   = (int)comobj.GetType().InvokeMember("HighPart", System.Reflection.BindingFlags.GetProperty, null, comobj, null);
                            int low    = (int)comobj.GetType().InvokeMember("LowPart", System.Reflection.BindingFlags.GetProperty, null, comobj, null);
                            dateTime = DateTime.FromFileTime(int.Parse("0x" + high + "" + low, System.Globalization.NumberStyles.HexNumber));
                        }
                        else
                        {
                            dateTime = DateTime.FromFileTime(long.Parse(attr.StringValue));
                        }
                        obj.badpasswordtime = dateTime;
                        break;

                    default:
                    {
                        string property = "0";
                        if (attr.StringValue.GetType().Name == "System.MarshalByRefObject")
                        {
                            var comobj = (MarshalByRefObject)attr.StringValues;
                            int high   = (int)comobj.GetType().InvokeMember("HighPart", System.Reflection.BindingFlags.GetProperty, null, comobj, null);
                            int low    = (int)comobj.GetType().InvokeMember("LowPart", System.Reflection.BindingFlags.GetProperty, null, comobj, null);
                            property = int.Parse("0x" + high + "" + low, System.Globalization.NumberStyles.HexNumber).ToString();
                        }
                        else if (attr.StringValueArray.Length == 1)
                        {
                            property = attr.StringValueArray[0];
                        }
                        else
                        {
                            List <string> propertyList = new List <string>();
                            foreach (object prop in attr.StringValueArray)
                            {
                                propertyList.Add(prop.ToString());
                            }
                            property = String.Join(", ", propertyList.ToArray());
                        }
                        string attribName = attr.Name.ToLower();
                        if (attribName == "samaccountname")
                        {
                            obj.samaccountname = property;
                        }
                        else if (attribName == "distinguishedname")
                        {
                            obj.distinguishedname = property;
                        }
                        else if (attribName == "cn")
                        {
                            obj.cn = property;
                        }
                        else if (attribName == "admincount")
                        {
                            obj.admincount = property;
                        }
                        else if (attribName == "serviceprincipalname")
                        {
                            obj.serviceprincipalname = property;
                        }
                        else if (attribName == "name")
                        {
                            obj.name = property;
                        }
                        else if (attribName == "description")
                        {
                            obj.description = property;
                        }
                        else if (attribName == "memberof")
                        {
                            obj.memberof = property;
                        }
                        else if (attribName == "logoncount")
                        {
                            obj.logoncount = property;
                        }
                        else if (attribName == "badpwdcount")
                        {
                            obj.badpwdcount = property;
                        }
                        else if (attribName == "whencreated")
                        {
                            obj.whencreated = property;
                        }
                        else if (attribName == "whenchanged")
                        {
                            obj.whenchanged = property;
                        }
                        else if (attribName == "codepage")
                        {
                            obj.codepage = property;
                        }
                        else if (attribName == "objectcategory")
                        {
                            obj.objectcategory = property;
                        }
                        else if (attribName == "usnchanged")
                        {
                            obj.usnchanged = property;
                        }
                        else if (attribName == "instancetype")
                        {
                            obj.instancetype = property;
                        }
                        else if (attribName == "objectclass")
                        {
                            obj.objectclass = property;
                        }
                        else if (attribName == "iscriticalsystemobject")
                        {
                            obj.iscriticalsystemobject = property;
                        }
                        else if (attribName == "usncreated")
                        {
                            obj.usncreated = property;
                        }
                        else if (attribName == "dscorepropagationdata")
                        {
                            obj.dscorepropagationdata = property;
                        }
                        else if (attribName == "adspath")
                        {
                            obj.adspath = property;
                        }
                        else if (attribName == "countrycode")
                        {
                            obj.countrycode = property;
                        }
                        else if (attribName == "primarygroupid")
                        {
                            obj.primarygroupid = property;
                        }
                        else if (attribName == "msds_supportedencryptiontypes")
                        {
                            obj.msds_supportedencryptiontypes = property;
                        }
                        else if (attribName == "showinadvancedviewonly")
                        {
                            obj.showinadvancedviewonly = property;
                        }
                    }
                    break;
                    }
                }
                return(obj);
            }
 public virtual void ObjectDeleted(ClientTransaction clientTransaction, DomainObject domainObject)
 {
 }
Esempio n. 35
0
 protected virtual void checkBusinessRulesOnUpdate(DomainObject entity)
 {
     // Empty
 }
 public virtual void RelationChanged(ClientTransaction clientTransaction, DomainObject domainObject, IRelationEndPointDefinition relationEndPointDefinition, DomainObject oldRelatedObject, DomainObject newRelatedObject)
 {
 }
 public virtual void ObjectMarkedNotInvalid(ClientTransaction clientTransaction, DomainObject domainObject)
 {
 }
 public virtual void RelationRead(ClientTransaction clientTransaction, DomainObject domainObject, IRelationEndPointDefinition relationEndPointDefinition, ReadOnlyDomainObjectCollectionAdapter <DomainObject> relatedObjects, ValueAccess valueAccess)
 {
 }
Esempio n. 39
0
 public Comment GetLast(DomainObject <Int32> targetObject)
 {
     return(targetObject != null?_commentDao.GetLast(targetObject) : null);
 }
Esempio n. 40
0
 protected virtual string GetMessage(DomainObject obj)
 {
     return(string.Format(SR.RuleUniqueKey, TerminologyTranslator.Translate(obj.GetClass(), _logicalKeyName),
                          TerminologyTranslator.Translate(_entityClass)));
 }
Esempio n. 41
0
 protected override string deleteErrorMessage(DomainObject entity)
 {
     return "Greska prilikom brisanja gimnasticara.";
 }
 public virtual void PropertyValueRead(ClientTransaction clientTransaction, DomainObject domainObject, PropertyDefinition propertyDefinition, object value, ValueAccess valueAccess)
 {
 }
Esempio n. 43
0
 public void WriteDomainObject(DomainObject o)
 {
     new QuorunWrite().Write(o, replicas);
 }
Esempio n. 44
0
 public List <Comment> GetComments(DomainObject <Int32> targetObject)
 {
     return(targetObject != null?_commentDao.GetAll(targetObject) : new List <Comment>());
 }
Esempio n. 45
0
 protected virtual bool beforePersistDlg(DomainObject entity)
 {
     return(true);
 }
        public async Task <J <IAppEntity> > GetStateAsync()
        {
            await DomainObject.EnsureLoadedAsync();

            return(Snapshot);
        }
Esempio n. 47
0
        private string GetEntityTitle(EntityType entityType, int entityId, bool checkAccess, out DomainObject entity)
        {
            switch (entityType)
            {
            case EntityType.Contact:
            case EntityType.Company:
            case EntityType.Person:
                var conatct = (entity = DaoFactory.ContactDao.GetByID(entityId)) as Contact;
                if (conatct == null || (checkAccess && !CRMSecurity.CanAccessTo(conatct)))
                {
                    throw new ItemNotFoundException();
                }
                return(conatct.GetTitle());

            case EntityType.Opportunity:
                var deal = (entity = DaoFactory.DealDao.GetByID(entityId)) as Deal;
                if (deal == null || (checkAccess && !CRMSecurity.CanAccessTo(deal)))
                {
                    throw new ItemNotFoundException();
                }
                return(deal.Title);

            case EntityType.Case:
                var cases = (entity = DaoFactory.CasesDao.GetByID(entityId)) as Cases;
                if (cases == null || (checkAccess && !CRMSecurity.CanAccessTo(cases)))
                {
                    throw new ItemNotFoundException();
                }
                return(cases.Title);

            default:
                throw new ArgumentException("Invalid entityType: " + entityType);
            }
        }
Esempio n. 48
0
 protected void SetClassFieldValue(DomainObject pobj, object value)
 {
     _classFieldSetter(pobj, value);
 }
 public void ValidateHighLevel(DomainObject obj)
 {
 }
Esempio n. 50
0
 protected object GetClassFieldValue(DomainObject pobj)
 {
     return(_classFieldGetter(pobj));
 }
 public void ValidateRequiredFieldsPresent(DomainObject obj)
 {
 }
Esempio n. 52
0
 public abstract void SetObjectFieldFromInfo(DomainObject pobj, DomainObjectInfo info, IPersistenceContext pctx);
 /// <summary>
 /// Validates the specified domain object, applying only high-level rules.
 /// </summary>
 /// <remarks>
 /// High-level rules include any rules that are not low-level rules.
 /// </remarks>
 /// <param name="obj"></param>
 public void ValidateHighLevel(DomainObject obj)
 {
     Validate(obj, RuleLevel.High, r => true);
 }
Esempio n. 54
0
 public override void SetObjectFieldFromInfo(DomainObject pobj, DomainObjectInfo info, IPersistenceContext pctx)
 {
     SetClassFieldValue(pobj, _valueConversion.GetObjectFromInfo(GetInfoFieldValue(info), pctx));
 }
 /// <summary>
 /// Validates only that the specified object has required fields set.
 /// </summary>
 /// <param name="obj"></param>
 public void ValidateRequiredFieldsPresent(DomainObject obj)
 {
     ValidateLowLevel(obj, rule => rule is RequiredSpecification);
 }
Esempio n. 56
0
 protected virtual void initAddMode()
 {
     entity = createNewEntity();
     loadData();
     initUI();
 }
Esempio n. 57
0
 protected override string deleteConfirmationMessage(DomainObject entity)
 {
     return String.Format("Da li zelite da izbrisete gimnasticara \"{0}\"?", entity);
 }
Esempio n. 58
0
 protected virtual void updateEntity(DomainObject entity)
 {
     throw new Exception("Derived class should implement this method.");
 }
 public virtual void RelationRead(ClientTransaction clientTransaction, DomainObject domainObject, IRelationEndPointDefinition relationEndPointDefinition, DomainObject relatedObject, ValueAccess valueAccess)
 {
 }
Esempio n. 60
0
 public int Count(DomainObject <Int32> targetObject)
 {
     return(targetObject == null ? 0 : _commentDao.Count(targetObject));
 }