Exemple #1
0
        public static bool DeleteLoginGroup(SecureWindow oSecWin, LoginGroup oGroup, AccessType oAccessTyp)
        {
            bool     isSuccess = false;
            DBHelper Data      = new DBHelper();

            Data.Command.CommandType = CommandType.StoredProcedure;
            Data.Command.CommandText = "bvLoginGroupAccessDelete";

            Data.Command.Parameters.Add(new SqlParameter("@a_vcLoginGroupID", oGroup.ID));
            Data.Command.Parameters.Add(new SqlParameter("@a_vcSecureWindowID", oSecWin.ID));
            Data.Command.Parameters.Add(new SqlParameter("@a_vcAccessTypeId", oAccessTyp.ID));


            try
            {
                int rowsEffected = Data.ExecuteNonQuery();
                isSuccess = rowsEffected > 0;
            }
            catch (Exception ex)
            {
                isSuccess = false;
                throw ex;
            }
            return(isSuccess);
        }
Exemple #2
0
        public static LoginGroup Get(string ID)
        {
            LoginGroup    oEntity = null;
            DBHelper      Data    = new DBHelper();
            SqlDataReader dr      = null;

            Data.Command.CommandType = CommandType.StoredProcedure;
            Data.Command.CommandText = "bvLoginGroupGetDetail";
            Data.Command.Parameters.Add(new SqlParameter("@a_vcUniqueID", ID));

            try
            {
                dr = Data.ExecuteReader();
                if (dr != null)
                {
                    while (dr.Read())
                    {
                        oEntity = initialize(dr, ObjectInitializationTypes.KeyFields);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dr.Close();
            }
            return(oEntity);
        }
        public void LoadView(ViewType typeView)
        {
            switch (typeView)
            {
            case ViewType.MainMenu:
                MainMenu          view      = new MainMenu();
                MainMenuViewModel viewModel = new MainMenuViewModel(this);
                //связываем их с собой
                view.DataContext = viewModel;
                //отображаем
                this.Page.Content = view;
                break;

            case ViewType.CreateGroup:
                CreateGroup          CreateGroupView      = new CreateGroup();
                CreateGroupViewModel CreateGroupViewModel = new CreateGroupViewModel(this, weeksDataBase);
                CreateGroupView.DataContext = CreateGroupViewModel;
                this.Page.Content           = CreateGroupView;
                break;

            case ViewType.LoginGroup:
                LoginGroup          LoginGroupView      = new LoginGroup();
                LoginGroupViewModel LoginGroupViewModel = new LoginGroupViewModel(this, weeksDataBase);
                LoginGroupView.DataContext = LoginGroupViewModel;
                this.Page.Content          = LoginGroupView;
                break;

            case ViewType.WeekList:
                WeekList          WeekListView      = new WeekList();
                WeekListViewModel WeekListViewModel = new WeekListViewModel(this, weeksDataBase);
                WeekListView.DataContext = WeekListViewModel;
                this.Page.Content        = WeekListView;
                break;

            case ViewType.TimeTable:
                TimeTable          TimeTableView      = new TimeTable();
                TimeTableViewModel TimeTableViewModel = new TimeTableViewModel(this, weeksDataBase, disciplinesDataBase, TimeTableView);
                TimeTableView.DataContext = TimeTableViewModel;
                this.Page.Content         = TimeTableView;
                break;
            }
        }
Exemple #4
0
        private static LoginGroup initialize(SqlDataReader dr, ObjectInitializationTypes initializationType)
        {
            LoginGroup oEntity = new LoginGroup();

            oEntity.ID          = Convert.ToString(dr["LoginGroupID"]);
            oEntity.Name        = Convert.ToString(dr["LoginGroupName"]);
            oEntity.Description = Convert.ToString(dr["LoginGroupDescr"]);

            switch (initializationType)
            {
            case ObjectInitializationTypes.CompleteAndNoChild:
                break;

            case ObjectInitializationTypes.CompleteAndKeyFieldsOfChild:
                break;

            case ObjectInitializationTypes.Full:
                break;
            }

            return(oEntity);
        }
Exemple #5
0
        public static bool Delete(LoginGroup oEntity)
        {
            bool     isSuccess = false;
            DBHelper Data      = new DBHelper();

            Data.Command.CommandType = CommandType.StoredProcedure;
            Data.Command.CommandText = "bvLoginGroupDelete";


            Data.Command.Parameters.Add(new SqlParameter("@a_vcLoginGroupID", oEntity.ID));

            try
            {
                int rowsEffected = Data.ExecuteNonQuery();
                isSuccess = rowsEffected > 0;
            }
            catch (Exception ex)
            {
                isSuccess = false;
                throw ex;
            }
            return(isSuccess);
        }
Exemple #6
0
        public static List <AccessType> GetAccessTypesByLoginGroupAndWindow(LoginGroup oLoginGroup, SecureWindow oSecWindow)
        {
            List <AccessType> accessTypes = new List <AccessType>();
            DBHelper          Data        = new DBHelper();
            SqlDataReader     dr          = null;

            Data.Command.CommandType = CommandType.StoredProcedure;
            Data.Command.CommandText = "bvLoginGroupAccessGetDoubleKeyedList";
            Data.Command.Parameters.Add(new SqlParameter("@a_vcKeyOne", oLoginGroup.ID));
            Data.Command.Parameters.Add(new SqlParameter("@a_vcKeyTwo", oSecWindow.ID));

            try
            {
                dr = Data.ExecuteReader();
                if (dr != null)
                {
                    while (dr.Read())
                    {
                        AccessType oEntity = new AccessType();
                        oEntity.ID = Convert.ToString(dr["AccessTypeID"]); // Probably we need to add Null Check and if it is Null we should return empty string

                        oEntity.Name      = Convert.ToString(dr["AccessTypeName"]);
                        oEntity.IsGranted = Convert.ToString(dr["Granted"]);
                        accessTypes.Add(oEntity);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dr.Close();
            }
            return(accessTypes);
        }
Exemple #7
0
 public List <AccessType> GetAccessTypesByLoginGroupAndWindow(LoginGroup oLoginGroup, SecureWindow oSecWindow)
 {
     return(AccessTypeDAL.GetAccessTypesByLoginGroupAndWindow(oLoginGroup, oSecWindow));
 }
Exemple #8
0
 public bool UpdateLoginGroupAccess(LoginGroup oGroup, SecureWindow oWindow, AccessType oAccessType)
 {
     return(SecureWindowDAL.UpdateLoginGroup(oWindow, oGroup, oAccessType));
 }
Exemple #9
0
 public bool Delete(LoginGroup oEntity)
 {
     return(LoginGroupDAL.Delete(oEntity));
 }
Exemple #10
0
 public bool Update(LoginGroup oEntity)
 {
     return(LoginGroupDAL.Update(oEntity));
 }
Exemple #11
0
 public bool Add(LoginGroup oEntity)
 {
     oEntity.ID = DALUtility.GetUniqueId(DALConstants.UniqueIdLoginGroupType);
     return(LoginGroupDAL.Add(oEntity));
 }