public void LoadData(int MuduleID)
        {
            dhModule objMod = new dhModule();

            objMod.IModuleID = MuduleID;
            //          if (objUser != null)
            //       {
            //#region "Allowed Menu"
            objMod.AllowdModule    = Globalized.objAppPreference.VEnableModules;
            objMod.IModuleParentID = 0;
            dsGeneral.dtPosModuleDataTable  dtm      = iFacede.GetModule(Globalized.ObjDbName, objMod);
            ObservableCollection <dhModule> sequence = ReflectionUtility.DataTableToObservableCollection <dhModule>(dtm);

            if (sequence.Count > 0)
            {
                objModule = sequence[0];
                if ((objModule.VIconName == null) || (objModule.VIconName == ""))
                {
                    this.Img1.Source = new BitmapImage(new Uri("/SublimeCareCloud;component/images/DumyIcon.png", UriKind.Relative));
                }
                else
                {
                    BitmapImage image = new BitmapImage(new Uri("/SublimeCareCloud;component/Images/" + objModule.VIconName, UriKind.Relative));
                    this.Img1.Source = image;
                }
            }
        }
Beispiel #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);
        }
Beispiel #3
0
        public dsGeneral.dtPosModuleDataTable GetModule(dhDBnames objDBNames, dhModule ObjModule)
        {
            dsGeneral ds       = new dsGeneral();
            DataSet   dsreturn = objDatabase.GetDataSet(objDBNames, ObjModule, "xmlGetModule", (DataSet)ds, "dtPosModule");

            dsGeneral.dtPosModuleDataTable retdt = ((dsGeneral)dsreturn).dtPosModule;
            return(retdt);
        }
Beispiel #4
0
        private void UserControl_Loaded_1(object sender, RoutedEventArgs e)
        {
            dhModule objMod = new dhModule();

            //objMod.IModuleID = MuduleID;
            //          if (objUser != null)
            //       {
            //#region "Allowed Menu"
            objMod.AllowdModule    = Globalized.objAppPreference.VEnableModules;
            objMod.IModuleParentID = 0;
            dsGeneral.dtPosModuleDataTable  dtm      = iFacede.GetModule(Globalized.ObjDbName, objMod);
            ObservableCollection <dhModule> sequence = ReflectionUtility.DataTableToObservableCollection <dhModule>(dtm);
            List <string> Ids = Globalized.ObjCurrentUser.VAllowdModule.Split(',').ToList <string>();

            ModuleControl objModuleToadd = new ModuleControl();

            MControls.Children.Clear();
            foreach (dhModule item in sequence)
            {
                string Contian = Ids.Distinct <string>().Cast <string>().Where(i => i.Equals(item.IModuleID.ToString())).SingleOrDefault();
                if ((Contian == null) || (item.IModuleParentID != 0))
                {
                    continue;
                }
                else
                {
                    MControls.Children.Add(objModuleToadd = new ModuleControl(item.IModuleID));
                }
            }

            //int length = 7;
            ////MControls
            //ModuleControl Test = new ModuleControl();
            //for (int i = 0; i < length; i++)
            //{

            //}
        }
Beispiel #5
0
        private void BuildAllowdModuleCheckBox()
        {
            StackPanel OuterStock = new StackPanel();
            //OuterStock. = new Thickness(0, 5, 15, -25);
            dhModule objModule = new dhModule();

            //          if (objUser != null)
            //       {

            #region "Allowed Menu"

            // objModule.AllowdModule = Globalized.objAppPreference.VEnableModules;
            dsGeneral.dtPosModuleDataTable dtm = iFacede.GetModule(Globalized.ObjDbName, objModule);
            EnumerableRowCollection <dsGeneral.dtPosModuleRow> result2 = from r in dtm.AsEnumerable()
                                                                         where (r.Field <int>("iModuleParentID") == 0)
                                                                         select r;
            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)
                    {
                        GroupBox objGroup = new GroupBox();
                        objGroup.Header = Module.VDisplayName;
                        objGroup.Margin = new Thickness(0, 0, 0, 15);

                        #region "Grid"

                        Grid grid = new Grid();
                        //  grid.Width = 400;
                        // Create column definitions.
                        ColumnDefinition columnDefinition1 = new ColumnDefinition();
                        ColumnDefinition columnDefinition2 = new ColumnDefinition();
                        columnDefinition1.Width = new GridLength(200);
                        columnDefinition2.Width = new GridLength(200);
                        // Attached definitions to grid.
                        grid.ColumnDefinitions.Add(columnDefinition1);
                        grid.ColumnDefinitions.Add(columnDefinition2);

                        CheckBox cb = new CheckBox();
                        cb.Name    = Module.VModuleName.ToString() + Module.IModuleID.ToString();
                        cb.Content = Module.VDisplayName.ToString();
                        //   cb.Width = 100;
                        cb.Margin      = new Thickness(5, 5, 5, 5);
                        cb.DataContext = Module;
                        Binding myBinding = new Binding("BIsActive");
                        myBinding.Source = Module;
                        cb.SetBinding(CheckBox.IsCheckedProperty, myBinding);
                        cb.Tag = Module;

                        cb.AddHandler(CheckBox.CheckedEvent, new RoutedEventHandler(DynamicCheckBox_Checked));
                        cb.AddHandler(CheckBox.UncheckedEvent, new RoutedEventHandler(DynamicCheckBox_Unchecked));

                        RowDefinition rowDefinition1 = new RowDefinition();
                        rowDefinition1.Height = new GridLength(30);
                        grid.RowDefinitions.Add(rowDefinition1);

                        grid.Children.Add(cb);
                        Grid.SetColumn(cb, 0);
                        Grid.SetRow(cb, 0);

                        #endregion "Grid"

                        EnumerableRowCollection <dsGeneral.dtPosModuleRow> Filter = from r2 in dtm.AsEnumerable()
                                                                                    where (r2.Field <int>("iModuleParentID") == Module.IModuleID)
                                                                                    select r2;
                        int CountRowInner = result2.Count <dsGeneral.dtPosModuleRow>();
                        if (CountRowInner > 0)
                        {
                            DataTable dtFilter;
                            if (Filter.Count() > 0)
                            {
                                dtFilter = Filter.CopyToDataTable();
                            }
                            else
                            {
                                dtFilter = new DataTable();
                            }


                            ObservableCollection <dhModule> sequencefilter = ReflectionUtility.DataTableToObservableCollection <dhModule>(dtFilter);
                            if (sequencefilter.Count > 0)
                            {
                                // int Bool = 1;

                                int           row           = 1;
                                int           col           = 0;
                                RowDefinition rowDefinition = new RowDefinition();
                                rowDefinition.Height = new GridLength(30);
                                grid.RowDefinitions.Add(rowDefinition);

                                #region "Child Module"

                                foreach (dhModule SubModule in sequencefilter)
                                {
                                    //for (int i = 0; i < sequencefilter.Count ; i++)
                                    //{
                                    CheckBox NestedCb = new CheckBox();
                                    //NestedStp.Orientation = Orientation.Horizontal;
                                    NestedCb.Name    = "Sub" + SubModule.VModuleName.ToString() + SubModule.IModuleID.ToString();
                                    NestedCb.Content = SubModule.VDisplayName.ToString();
                                    NestedCb.Margin  = new Thickness(35, 5, 5, 5);
                                    if (col == 2)
                                    {
                                        row = row + 1;
                                        col = 0;
                                        RowDefinition rowDefinition3 = new RowDefinition();
                                        rowDefinition3.Height = new GridLength(30);
                                        grid.RowDefinitions.Add(rowDefinition3);
                                    }

                                    NestedCb.DataContext = Module;
                                    Binding mySubBinding = new Binding("BIsActive");
                                    mySubBinding.Source = SubModule;
                                    NestedCb.SetBinding(CheckBox.IsCheckedProperty, mySubBinding);
                                    NestedCb.Tag = SubModule;

                                    grid.Children.Add(NestedCb);
                                    Grid.SetColumn(NestedCb, col);
                                    Grid.SetRow(NestedCb, row);
                                    col += 1;
                                }

                                #endregion "Child Module"

                                objGroup.Content = grid;
                            }
                            OuterStock.Children.Add(objGroup);
                        }
                    }
                    RightsGrid.Children.Add(OuterStock);
                }
            }

            #endregion "Allowed Menu"

            //            }
        }
Beispiel #6
0
 public dsGeneral.dtPosModuleDataTable GetModule(dhDBnames objDBNames, dhModule ObjModule)
 {
     dsGeneral.dtPosModuleDataTable dt = objDALGeneral.GetModule(objDBNames, ObjModule);
     return(dt);
 }