Ejemplo n.º 1
0
 private void PhanQuyen()
 {
     foreach (var item in gridButtonMain.Children)
     {
         if (item is ControlLibrary.POSButtonMain)
         {
             ControlLibrary.POSButtonMain btn = (ControlLibrary.POSButtonMain)item;
             if (btn.Tag != null && btn.Tag is Data.TypeChucNang.ChucNangChinh)
             {
                 Data.TypeChucNang.ChucNangChinh type = (Data.TypeChucNang.ChucNangChinh)btn.Tag;
                 if (type != Data.TypeChucNang.ChucNangChinh.None)
                 {
                     Data.BOChiTietQuyen ctq = mTransit.BOChiTietQuyen.KiemTraNhomChucNang((int)type);
                     btn.Tag = ctq;
                     if (mTransit.KiemTraNhomChucNang((int)type) == true)
                     {
                         LookButton(btn, ctq.ChiTietQuyen.ChoPhep);
                     }
                     else
                     {
                         LookButton(btn, false);
                     }
                 }
             }
         }
     }
 }
 private void LookButton(ControlLibrary.POSButtonMain btn, bool value, int row, int col)
 {
     if (value == true)
     {
         btn.Visibility = System.Windows.Visibility.Visible;
         Grid.SetRow(btn, row);
         Grid.SetColumn(btn, col);
     }
     else
     {
         btn.Visibility = System.Windows.Visibility.Collapsed;
     }
 }
Ejemplo n.º 3
0
 private void LookButton(ControlLibrary.POSButtonMain btn, bool value)
 {
     if (value == true)
     {
         btn.IsEnabled = true;
         //btn.VisibilityMain = System.Windows.Visibility.Visible;
         btn.Opacity = 1;
     }
     else
     {
         btn.IsEnabled = false;
         //btn.VisibilityMain = System.Windows.Visibility.Hidden;
         btn.Opacity = 0.3;
     }
 }
Ejemplo n.º 4
0
        private void PhanQuyen()
        {
            int i = 1, j = 0;

            foreach (var item in gridButtonMain.Children)
            {
                if (item is ControlLibrary.POSButtonMain)
                {
                    ControlLibrary.POSButtonMain btn = (ControlLibrary.POSButtonMain)item;
                    if (btn.Tag != null && btn.Tag is Data.TypeChucNang.CaiDat)
                    {
                        Data.TypeChucNang.CaiDat type = (Data.TypeChucNang.CaiDat)btn.Tag;
                        if (type != Data.TypeChucNang.CaiDat.None)
                        {
                            Data.BOChiTietQuyen ctq = mTransit.BOChiTietQuyen.KiemTraQuyen((int)type);
                            btn.Tag = ctq;
                            if (mTransit.KiemTraChucNang((int)type) == true)
                            {
                                if (j > gridButtonMain.ColumnDefinitions.Count - 1)
                                {
                                    i++;
                                    j = 0;
                                }
                                if (type != Data.TypeChucNang.CaiDat.CaiDatChucNangHienThi)
                                {
                                    LookButton(btn, ctq.ChiTietQuyen.ChoPhep, i, j);
                                    if (ctq.ChiTietQuyen.ChoPhep)
                                    {
                                        j++;
                                    }
                                }
                                else
                                {
                                    LookButton(btn, false, i, j);
                                }
                            }
                            else
                            {
                                LookButton(btn, false, i, j);
                            }
                        }
                    }
                }
            }
        }