public void ValidatePositions(int organizationID)
        {
            PhoneTypes phoneTypes = new PhoneTypes(LoginUser);

            phoneTypes.LoadAllPositions(organizationID);
            int i = 0;

            foreach (PhoneType phoneType in phoneTypes)
            {
                phoneType.Position = i;
                i++;
            }
            phoneTypes.Save();
        }
        public static PhoneType GetPhoneType(LoginUser loginUser, int phoneTypeID)
        {
            PhoneTypes phoneTypes = new PhoneTypes(loginUser);

            phoneTypes.LoadByPhoneTypeID(phoneTypeID);
            if (phoneTypes.IsEmpty)
            {
                return(null);
            }
            else
            {
                return(phoneTypes[0]);
            }
        }
Пример #3
0
        public static int?GetIDByName(LoginUser loginUser, string name, int?parentID)
        {
            PhoneTypes phoneTypes = new PhoneTypes(loginUser);

            phoneTypes.LoadByName(loginUser.OrganizationID, name);
            if (phoneTypes.IsEmpty)
            {
                return(null);
            }
            else
            {
                return(phoneTypes[0].PhoneTypeID);
            }
        }
        public void MovePositionUp(int phoneTypeID)
        {
            PhoneTypes types1 = new PhoneTypes(LoginUser);

            types1.LoadByPhoneTypeID(phoneTypeID);
            if (types1.IsEmpty || types1[0].Position < 1)
            {
                return;
            }

            PhoneTypes types2 = new PhoneTypes(LoginUser);

            types2.LoadByPosition(types1[0].OrganizationID, types1[0].Position - 1);
            if (!types2.IsEmpty)
            {
                types2[0].Position = types2[0].Position + 1;
                types2.Save();
            }

            types1[0].Position = types1[0].Position - 1;
            types1.Save();
            ValidatePositions(LoginUser.OrganizationID);
        }
 public PhoneType(DataRow row, PhoneTypes phoneTypes) : base(row, phoneTypes)
 {
     _phoneTypes = phoneTypes;
 }