Exemplo n.º 1
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            string name = ((Button)sender).Tag.ToString();

            BUS_EmployeeType busEmp = new BUS_EmployeeType();
            string           id     = busEmp.GetIDByName(name);

            if (id == "ET001")
            {
                MessageBox.Show("Đây là nhóm tài khoản gốc, không thể sửa!");
                return;
            }

            GroupAccountInfo editGrAcc = new GroupAccountInfo();

            for (int i = 0; i < dataGridGroupAccount.Items.Count; i++)
            {
                if (name == ((GroupAccountInfo)dataGridGroupAccount.Items[i]).name)
                {
                    editGrAcc = (GroupAccountInfo)dataGridGroupAccount.Items[i];
                }
            }

            System.Windows.Media.Effects.BlurEffect objBlur = new System.Windows.Media.Effects.BlurEffect();
            ((MainWindow)App.Current.MainWindow).Opacity = 0.5;
            ((MainWindow)App.Current.MainWindow).Effect  = objBlur;
            Window window = new Window
            {
                ResizeMode            = ResizeMode.NoResize,
                WindowStyle           = WindowStyle.None,
                Title                 = "Sửa nhóm tài khoản",
                Content               = new PopupEditGroupAccount(editGrAcc),
                Width                 = 460,
                Height                = 540,
                WindowStartupLocation = WindowStartupLocation.CenterScreen
            };

            window.ShowDialog();
            LoadData();
            ((MainWindow)App.Current.MainWindow).Opacity = 1;
            ((MainWindow)App.Current.MainWindow).Effect  = null;
        }
Exemplo n.º 2
0
        public override bool CollectReportData()
        {
            Boolean result = false;

            try
            {
                // productInfoItems.Clear();



                //List<String> test = InputConnectionInfo.DatabaseFields;

                foreach (ManagementObject mo in searcher.Get().AsParallel())
                {
                    GroupAccountInfo productInfo = new GroupAccountInfo()
                    {
                    };
                    foreach (String itemProp in InputConnectionInfo.WMIFields)
                    {
                        productInfo.GetType().GetProperty(itemProp).SetValue(productInfo, (WMIQueryBuilder.GetValue(mo, itemProp)), null);
                    }
                    //   base.MachineInfo.backgroundWorker.ReportProgress(1, "Collecting details... " + productInfo.Name);
                    productInfo.TimeStamp  = InputConnectionInfo.TimeStamp;
                    productInfo.SystemName = MachineDetails.ServerName;
                    UpdateStatus(productInfo.Name);
                    productInfoItems.Add(productInfo);
                    if (IsCancelRequested)
                    {
                        break;
                    }
                }

                result = true;
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }

            return(result);
        }
Exemplo n.º 3
0
        void ReloadDGGroupAccount()
        {
            List <GroupAccountInfo> groupAccountInfos = new List <GroupAccountInfo>();
            BUS_AccessPermission    bus_accper        = new BUS_AccessPermission();
            DataTable temp = bus_accper.GetAccessInfo(limitRow, limitRow * (currentPage - 1));

            foreach (DataRow row in temp.Rows)
            {
                GroupAccountInfo newGrAccInfo = new GroupAccountInfo();

                newGrAccInfo.name = row["EmployeeTypeName"].ToString();

                if (row[columnName: Constants.CASHIER].ToString() == "0")
                {
                    newGrAccInfo.cashier = false;
                }
                else
                {
                    newGrAccInfo.cashier = true;
                }

                if (row[columnName: Constants.ACCOUNT].ToString() == "0")
                {
                    newGrAccInfo.account = false;
                }
                else
                {
                    newGrAccInfo.account = true;
                }

                if (row[columnName: Constants.ACCOUNTTYPE].ToString() == "0")
                {
                    newGrAccInfo.accountType = false;
                }
                else
                {
                    newGrAccInfo.accountType = true;
                }

                if (row[columnName: Constants.INVENTORY].ToString() == "0")
                {
                    newGrAccInfo.inventory = false;
                }
                else
                {
                    newGrAccInfo.inventory = true;
                }

                if (row[columnName: Constants.COST].ToString() == "0")
                {
                    newGrAccInfo.cost = false;
                }
                else
                {
                    newGrAccInfo.cost = true;
                }

                if (row[columnName: Constants.MENU].ToString() == "0")
                {
                    newGrAccInfo.menu = false;
                }
                else
                {
                    newGrAccInfo.menu = true;
                }

                if (row[columnName: Constants.DISCOUNT].ToString() == "0")
                {
                    newGrAccInfo.discount = false;
                }
                else
                {
                    newGrAccInfo.discount = true;
                }

                if (row[columnName: Constants.REPORT].ToString() == "0")
                {
                    newGrAccInfo.report = false;
                }
                else
                {
                    newGrAccInfo.report = true;
                }

                if (row[columnName: Constants.RULE].ToString() == "0")
                {
                    newGrAccInfo.rule = false;
                }
                else
                {
                    newGrAccInfo.rule = true;
                }

                groupAccountInfos.Add(item: newGrAccInfo);
            }

            this.dataGridGroupAccount.ItemsSource = groupAccountInfos;
            this.dataGridGroupAccount.Items.Refresh();
        }
Exemplo n.º 4
0
        public void LoadData(GroupAccountInfo grAccInfo)
        {
            BUS_AccessPermission busAccPer = new BUS_AccessPermission();

            AccPersData      = busAccPer.GetAccessPermission();
            dgUnselectedList = new List <AccessPermissionName>();
            dgSelectedList   = new List <AccessPermissionName>();
            foreach (DataRow row in AccPersData.Rows)
            {
                string name = row["AccessPermissionName"].ToString();
                dgUnselectedList.Add(new AccessPermissionName(name));
            }

            editGrAccInfo = grAccInfo;
            tbName.Text   = editGrAccInfo.name;


            #region change list item
            if (grAccInfo.cashier == true)
            {
                dgSelectedList.Add(new AccessPermissionName(Constants.CASHIER));
                AccessPermissionName item = dgUnselectedList.Find(x => x.name == Constants.CASHIER);
                dgUnselectedList.Remove(item);
            }

            if (grAccInfo.account == true)
            {
                dgSelectedList.Add(new AccessPermissionName(Constants.ACCOUNT));
                AccessPermissionName item = dgUnselectedList.Find(x => x.name == Constants.ACCOUNT);
                dgUnselectedList.Remove(item);
            }

            if (grAccInfo.accountType == true)
            {
                dgSelectedList.Add(new AccessPermissionName(Constants.ACCOUNTTYPE));
                AccessPermissionName item = dgUnselectedList.Find(x => x.name == Constants.ACCOUNTTYPE);
                dgUnselectedList.Remove(item);
            }

            if (grAccInfo.inventory == true)
            {
                dgSelectedList.Add(new AccessPermissionName(Constants.INVENTORY));
                AccessPermissionName item = dgUnselectedList.Find(x => x.name == Constants.INVENTORY);
                dgUnselectedList.Remove(item);
            }

            if (grAccInfo.cost == true)
            {
                dgSelectedList.Add(new AccessPermissionName(Constants.COST));
                AccessPermissionName item = dgUnselectedList.Find(x => x.name == Constants.COST);
                dgUnselectedList.Remove(item);
            }

            if (grAccInfo.menu == true)
            {
                dgSelectedList.Add(new AccessPermissionName(Constants.MENU));
                AccessPermissionName item = dgUnselectedList.Find(x => x.name == Constants.MENU);
                dgUnselectedList.Remove(item);
            }

            if (grAccInfo.discount == true)
            {
                dgSelectedList.Add(new AccessPermissionName(Constants.DISCOUNT));
                AccessPermissionName item = dgUnselectedList.Find(x => x.name == Constants.DISCOUNT);
                dgUnselectedList.Remove(item);
            }

            if (grAccInfo.report == true)
            {
                dgSelectedList.Add(new AccessPermissionName(Constants.REPORT));
                AccessPermissionName item = dgUnselectedList.Find(x => x.name == Constants.REPORT);
                dgUnselectedList.Remove(item);
            }

            if (grAccInfo.rule == true)
            {
                dgSelectedList.Add(new AccessPermissionName(Constants.RULE));
                AccessPermissionName item = dgUnselectedList.Find(x => x.name == Constants.RULE);
                dgUnselectedList.Remove(item);
            }
            #endregion

            this.dgUnselected.ItemsSource = dgUnselectedList;
            this.dgSelected.ItemsSource   = dgSelectedList;
            this.dgUnselected.Items.Refresh();
            this.dgSelected.Items.Refresh();
        }
Exemplo n.º 5
0
 public PopupEditGroupAccount(GroupAccountInfo grAccInfo)
 {
     InitializeComponent();
     LoadData(grAccInfo);
 }