Ejemplo n.º 1
0
 //constructors
 public BlPatient()
 {
     this.MyModuleName = "Patients";
     MyModuleObj       = new blModule(MyModuleName);
     MyActiveModule    = MyModuleObj.ActiveModule();
     this.db           = new AppDbContext();
 }
Ejemplo n.º 2
0
        internal ObservableCollection <dhModule> GetUserSubMenu(dhDBnames objDBNames, dhAppPreference objAppPreference, dhUsers objuser, dhModule objdhModule)
        {
            DataTable temp        = new DataTable();
            blModule  ObjblModule = new blModule();
            dhModule  objModule   = new dhModule();
            ObservableCollection <dhModule> MenuModule = new ObservableCollection <dhModule>();

            if ((objAppPreference != null) && (objAppPreference.VEnableModules != "") && (objuser != null))
            {
                #region "Allowed Menu"

                objModule.AllowdModule = objAppPreference.VEnableModules;
                dsGeneral.dtPosModuleDataTable dtm = ObjblModule.GetModule(objDBNames, objModule);
                EnumerableRowCollection <dsGeneral.dtPosModuleRow> result2 = from r in dtm.AsEnumerable()
                                                                             where (r.Field <int>("iModuleParentID") == objdhModule.IModuleID) && (r.Field <bool>("bIsActive") == true)
                                                                             select r;
                // if there are any allowed
                int CountRow = result2.Count <dsGeneral.dtPosModuleRow>();
                if (CountRow > 0)
                {
                    DataTable dtResult2 = result2.CopyToDataTable();
                    ObservableCollection <dhModule> sequence = ReflectionUtility.DataTableToObservableCollection <dhModule>(dtResult2);
                    if (sequence.Count > 0)
                    {
                        foreach (dhModule Module in sequence)
                        {
                            string strDisplayName = Module.VDisplayName;
                            if (objuser.VAllowdModule == null)
                            {
                                if (objuser.VUserType == "Super")
                                {
                                    objuser.VAllowdModule = objAppPreference.VEnableModules;
                                }
                                else
                                {
                                    throw new ApplicationException("Disable User or have no rights.");
                                }
                            }

                            List <string> RootIds          = objuser.VAllowdModule.Split(',').ToList <string>();
                            string        RootAllowdUserID = RootIds.Distinct <string>().Cast <string>().Where(i => i.Equals(Module.IModuleID.ToString())).SingleOrDefault();

                            List <string> RootEnableModulesIds   = objAppPreference.VEnableModules.Split(',').ToList <string>();
                            string        RootAppEnableModulesId = RootEnableModulesIds.Distinct <string>().Cast <string>().Where(i => i.Equals(Module.IModuleID.ToString())).SingleOrDefault();
                            if ((RootAllowdUserID == null) || (RootAppEnableModulesId == null))
                            {
                                continue;
                            }
                            MenuModule.Add(Module);
                        }
                    }// end of dhModule sequence
                }



                #endregion
            }
            return(MenuModule);
        }
Ejemplo n.º 3
0
 public blAccount()
 {
     objDALGeneral     = new dalGeneral();
     this.MyModuleName = "Account";
     MyModuleObj       = new blModule(MyModuleName);
     MyActiveModule    = MyModuleObj.ActiveModule();
     this.db           = new AppDbContext();
 }