Esempio n. 1
0
        //tested
        #region readIn userRightGroup
        /// <summary>
        /// collect the userRightGroups from DB - repostiory type - because spec. conversion is needed
        /// </summary>
        public void collectTheUserRightGroups()
        {
            List <string[]> rawRightDatasFromDB;

            try
            {
                modelRights         = new ServiceRightsModel(dbci, parent);
                rawRightDatasFromDB = modelRights.collectTheUserRightGroups();
                listOfRightGroups   = new List <SetOfUserRights>();
                foreach (string[] rec in rawRightDatasFromDB)
                {
                    conv = new TreeTenConverter(rec[1], true);
                    SetOfUserRights setRight = new SetOfUserRights(conv.rightsNumberInThree);
                    setRight.groupName = rec[0];
                    listOfRightGroups.Add(setRight);
                }
            }
            catch (ErrorServiceCreateDataList e)
            {
                throw new ErrorServiceRights(e.Message);
            }
            catch (Exception e)
            {
                throw new ErrorServiceRights("Hiba történt a jogok átalakításakor (ServReadRights) " + e.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// defines the process of case new and modify
        /// </summary>
        /// <param name="mode">true = new record setting / false = modify the old one</param>
        /// <param name="groupName">the groupname to define the record</param>
        /// <param name="rightContent">parameter of userRight of the group</param>
        private void mediateTheProperMethodNewModify(bool mode, string groupName, string rightContent)
        {
            int rightsIn10NS = 0;

            try
            {
                TreeTenConverter ttc = new TreeTenConverter(rightContent, false);
                rightsIn10NS = ttc.rightsNumberInTen;
                try
                {
                    modelRights = new ServiceRightsModel(dbci, parent);
                    if (mode)   //create new
                    {
                        modelRights.setNewOrModifyRecordOfRightGroup(groupName, rightsIn10NS.ToString(), mode);
                        SetOfUserRights newOne = new SetOfUserRights(rightContent);
                        newOne.groupName = groupName;
                        listOfRightGroups.Add(newOne);
                    }
                    else
                    {   //modofy
                        modelRights.setNewOrModifyRecordOfRightGroup(groupName, rightsIn10NS.ToString(), mode);
                        SetOfUserRights modifyList = new SetOfUserRights(rightContent);
                        modifyList.groupName = groupName;
                        listOfRightGroups[listOfRightGroups.FindIndex(ind => ind.groupName.Equals(groupName))] = modifyList;
                    }
                }
                catch (ErrorServiceUpdateRecord e)
                {
                    throw new ErrorServiceRights(e.Message);
                }
            }
            catch (ErrorUserRightFormat e)
            {
                throw new ErrorServiceRights(e.Message);
            }
            catch (ErrorUserRightLength e)
            {
                throw new ErrorServiceRights(e.Message);
            }
            catch (Exception e)
            {
                if (mode)
                {
                    throw new ErrorServiceRights("Ismeretlen hiba történt (ServRights_New) " + e.Message);
                }
                else
                {
                    throw new ErrorServiceRights("Ismeretlen hiba történt (ServRights_Modif) " + e.Message);
                }
            }
        }