예제 #1
0
        private void GetListOfPopup(String name)
        {
            DatabaseHandle dbHandle = new DatabaseHandle();

            DataTable dt   = new DataTable();
            string    json = dbHandle.ListOfPopupFilter(name);

            List <PopupModel> lstPopupModel = JsonConvert.DeserializeObject <List <PopupModel> >(json);

            DataTable table = new DataTable();

            table.Columns.Add("ID", typeof(int));
            table.Columns.Add("Name", typeof(string));

            List <string> lstName = lstPopupModel.Select(x => x.Name).ToList();
            List <int>    lstID   = lstPopupModel.Select(x => x.PopupID).ToList();

            for (int i = 0; i < lstName.Count; i++)
            {
                table.Rows.Add(lstID[i], lstName[i]);
            }

            dgvPopup.SetBinding(ItemsControl.ItemsSourceProperty, new Binding {
                Source = table
            });
            dgvPopup.IsReadOnly = true;
            dgvPopup.Items.Refresh();
        }
예제 #2
0
        private void BtnCO_Click(object sender, RoutedEventArgs e)
        {
            EmployeeModel  employeeModel = new EmployeeModel();
            DatabaseHandle dbHandle      = new DatabaseHandle();

            if (pwBox.Password == "")
            {
                MessageBox.Show("Please Fill Password!");
                return;
            }

            string employeeDetail = dbHandle.GetStaffDetailByPassword(pwBox.Password);

            if (employeeDetail != null)
            {
                GlobalHelper.CurrentEmployee = JsonConvert.DeserializeObject <EmployeeModel>(employeeDetail);

                //2 = Out
                if (GlobalHelper.CurrentEmployee.StatusID == (int)ClockStatus.Out)
                {
                    MessageBox.Show("Please Clock In!");
                    return;
                }

                if (dbHandle.UpdateStaffStatus(GlobalHelper.CurrentEmployee.EmployeeID, 2) > 0)
                {
                    pwBox.Password = "";
                    MessageBox.Show(String.Format("Good bye {0} \nYou've logouted at {1}", GlobalHelper.CurrentEmployee.FirstName, DateTime.Now.ToShortTimeString()));
                }
            }
            else
            {
                MessageBox.Show("Incorrect Password");
            }
        }
예제 #3
0
        private void GenerateTabItem()
        {
            DatabaseHandle      dbHandle        = new DatabaseHandle();
            string              tabJson         = dbHandle.GetListOfSection();
            List <SectionModel> lstSectionModel = JsonConvert.DeserializeObject <List <SectionModel> >(tabJson);

            for (int i = 0; i < lstSectionModel.Count; i++)
            {
                TabItem ti = new TabItem();
                ti.Header = lstSectionModel[i].Name;
                ti.Name   = lstSectionModel[i].Name + lstSectionModel[i].SectionID.ToString();
                ti.Width  = 100;
                ti.Height = 50;

                Grid grid = new Grid();
                grid.Name      = "section" + lstSectionModel[i].Name;
                grid.AllowDrop = true;

                Button btnTest = new Button();
                btnTest.Name   = "btnTest3";
                btnTest.Margin = new Thickness(195, 113, 0, 0);
                btnTest.Width  = 100;
                btnTest.Height = 100;
                grid.Children.Add(btnTest);
                ti.Content = grid;

                tcTable.Items.Insert(tcTable.Items.Count - 1, ti);
            }
        }
예제 #4
0
        private void InitializeGlobalHelper()
        {
            DatabaseHandle dbHandle = new DatabaseHandle();

            GlobalHelper.SectionDetail      = JsonConvert.DeserializeObject <List <SectionModel> >(dbHandle.GetListOfSection());
            GlobalHelper.TableDetail        = JsonConvert.DeserializeObject <List <TableModal> >(dbHandle.GetListTable());
            GlobalHelper.LocationMenuDetail = JsonConvert.DeserializeObject <List <LocationMenuModel> >(dbHandle.GetListLocationMenu());
            GlobalHelper.LocationTabDetail  = JsonConvert.DeserializeObject <List <LocationTabModel> >(dbHandle.GetListOfLocationTab());
        }
예제 #5
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            DatabaseHandle dbHandle = new DatabaseHandle();

            if (dbHandle.GetStaffDetailByPassword(pwBox.Password) != null)
            {
                this.Close();
            }
            else
            {
                MessageBox.Show("Password is incorrect!", "Error", MessageBoxButton.OK, MessageBoxImage.Asterisk);
            }
        }
예제 #6
0
        private void Row_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Do you want to delete?", "Confirm", MessageBoxButton.YesNo);

            switch (result)
            {
            case MessageBoxResult.Yes:
                DatabaseHandle dbHandle = new DatabaseHandle();
                DataRowView    row      = (DataRowView)dgvPopup.SelectedItems[0];
                dbHandle.RemovePopup((int)row["ID"]);
                break;

            case MessageBoxResult.No:
                break;
            }
        }