Exemple #1
0
 public LeaveRangeDialog(MainForm main_form, Users user_from, Users user_to, DateTime date_from, DateTime date_to)
     : this(main_form)
 {
     this.user_from = user_from;
     this.user_to = user_to;
     this.date_from = date_from;
     this.date_to = date_to;
 }
Exemple #2
0
 public TrainerNoteDialog(MainForm main_form, Users user, DateTime date, SupportNote support_note = null)
 {
     InitializeComponent();
     this.main_form = main_form;
     this.user = user;
     this.date = date;
     this.support_note = support_note;
 }
Exemple #3
0
        private int sorted_column = 5; // sort datagridview by 3rd column

        #endregion Fields

        #region Constructors

        public SupportStatWindow(MainForm main_form, Users user_from, Users user_to, DateTime date_from, DateTime date_to)
        {
            InitializeComponent();
            this.main_form = main_form;
            this.current_user_from = user_from;
            this.current_user_to = user_to;
            this.current_date_from = date_from;
            this.current_date_to = date_to;
        }
Exemple #4
0
        public void CrossingCall(Users user_from, Users user_to, DateTime date_from, DateTime date_to)
        {
            this.current_user_from = user_from;
            this.current_user_to = user_to;
            this.current_date_from = date_from;
            this.current_date_to = date_to;

            this.LoadEventAndFill();
        }
Exemple #5
0
        //public LeaveWindow()
        //{
        //    InitializeComponent();
        //}
        //public LeaveWindow(MainForm main_form)
        //    : this()
        //{
        //    this.main_form = main_form;
        //    this.main_form.leave_wind = this;
        //}
        public LeaveWindow(MainForm main_form, Users user_from, Users user_to, DateTime date_from, DateTime date_to)
        {
            InitializeComponent();

            this.main_form = main_form;
            this.main_form.leave_wind = this;

            this.current_user_from = user_from;
            this.current_user_to = user_to;
            this.current_date_from = date_from;
            this.current_date_to = date_to;
        }
Exemple #6
0
        private void FillDgvUngroup(Users selected_user = null)
        {
            this.dgvUnGroup.Rows.Clear();
            this.dgvUnGroup.Columns.Clear();
            this.dgvUnGroup.Tag = HelperClass.DGV_TAG.READ;

            this.dgvUnGroup.Columns.Add(new DataGridViewTextBoxColumn()
            {
                HeaderText = "ลำดับ",
                Width = 40
            });
            this.dgvUnGroup.Columns.Add(new DataGridViewTextBoxColumn()
            {
                HeaderText = "รหัส",
                Width = 120
            });
            this.dgvUnGroup.Columns.Add(new DataGridViewTextBoxColumn()
            {
                HeaderText = "ชื่อ",
                AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
            });
            this.dgvUnGroup.Columns.Add(new DataGridViewTextBoxColumn()
            {
                HeaderText = "ระดับผู้ใช้",
                Width = 120
            });
            this.dgvUnGroup.Columns.Add(new DataGridViewTextBoxColumn()
            {
                HeaderText = "สถานะผู้ใช้",
                Width = 120
            });

            int count = 0;
            foreach (Users u in this.list_users.Where(u => u.usergroup == string.Empty).ToList<Users>())
            {
                int r = this.dgvUnGroup.Rows.Add();
                this.dgvUnGroup.Rows[r].Tag = u;

                this.dgvUnGroup.Rows[r].Cells[0].ValueType = typeof(int);
                this.dgvUnGroup.Rows[r].Cells[0].Value = ++count;
                this.dgvUnGroup.Rows[r].Cells[0].Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                this.dgvUnGroup.Rows[r].Cells[0].Style.ForeColor = Color.Gray;
                this.dgvUnGroup.Rows[r].Cells[0].Style.SelectionForeColor = Color.Gray;

                this.dgvUnGroup.Rows[r].Cells[1].ValueType = typeof(string);
                this.dgvUnGroup.Rows[r].Cells[1].Value = u.username;

                this.dgvUnGroup.Rows[r].Cells[2].ValueType = typeof(string);
                this.dgvUnGroup.Rows[r].Cells[2].Value = u.name;

                this.dgvUnGroup.Rows[r].Cells[3].ValueType = typeof(string);
                this.dgvUnGroup.Rows[r].Cells[3].Value = GlobalVar.GetUserLevelString(u.level);

                this.dgvUnGroup.Rows[r].Cells[4].ValueType = typeof(string);
                this.dgvUnGroup.Rows[r].Cells[4].Value = (u.status == "N" ? "ปกติ" : (u.status == "X" ? "ห้ามใช้" : ""));
            }

            this.dgvUnGroup.FillLine(this.list_users.Where(u => u.usergroup == string.Empty).ToList<Users>().Count);
        }
Exemple #7
0
        private void BindingControlEventHandler()
        {
            this.cbUsersFrom.Leave += new EventHandler(this.OnComboboxUsersLeave);

            this.cbUsersFrom.SelectedIndexChanged += delegate
            {
                this.user_from = (Users)((ComboboxItem)this.cbUsersFrom.SelectedItem).Tag;
            };

            this.cbUsersTo.SelectedIndexChanged += delegate
            {
                this.user_to = (Users)((ComboboxItem)this.cbUsersTo.SelectedItem).Tag;
            };

            this.cbUsersTo.Leave += new EventHandler(this.OnComboboxUsersLeave);

            this.dtFrom.ValueChanged += new EventHandler(this.OnDatetimeLeave);

            this.dtTo.ValueChanged += new EventHandler(this.OnDatetimeLeave);
        }
Exemple #8
0
        private void UsersEditForm_Load(object sender, EventArgs e)
        {
            // Adding users level selection
            this.cbUserLevel.Items.Add(new ComboboxItem("ADMIN", 9, ""));
            this.cbUserLevel.Items.Add(new ComboboxItem("SUPERVISOR", 8, ""));
            this.cbUserLevel.Items.Add(new ComboboxItem("SUPPORT", 0, ""));
            this.cbUserLevel.Items.Add(new ComboboxItem("SALES", 1, ""));
            this.cbUserLevel.Items.Add(new ComboboxItem("ACCOUNT", 2, ""));
            this.cbUserLevel.SelectedItem = this.cbUserLevel.Items[2];

            // Adding users status selection
            this.cbUserStatus.Items.Add(new ComboboxItem("ปกติ", 0, "N"));
            this.cbUserStatus.Items.Add(new ComboboxItem("ห้ามใช้", 0, "X"));
            this.cbUserStatus.SelectedItem = this.cbUserStatus.Items[0];

            // Adding allow web login selection
            this.cbWebLogin.Items.Add(new ComboboxItem("No", 0, "N"));
            this.cbWebLogin.Items.Add(new ComboboxItem("Yes", 0, "Y"));
            this.cbWebLogin.SelectedItem = this.cbWebLogin.Items[0];

            CRUDResult get = ApiActions.GET(PreferenceForm.API_MAIN_URL() + "users/get_at&id=" + this.id);
            ServerResult sr = JsonConvert.DeserializeObject<ServerResult>(get.data);
            if (sr.result == ServerResult.SERVER_RESULT_SUCCESS)
            {
                this.current_user = sr.users.First<Users>();
                Users user = sr.users.First<Users>();

                this.txtUserName.Text = user.username;
                this.txtName.Text = user.name;
                this.txtEmail.Text = user.email;
                this.cbUserLevel.SelectedItem = this.cbUserLevel.Items[ComboboxItem.GetItemIndex(this.cbUserLevel, user.level)];
                this.cbUserStatus.SelectedItem = this.cbUserStatus.Items[ComboboxItem.GetItemIndex(this.cbUserStatus, user.status)];
                this.cbWebLogin.SelectedItem = this.cbWebLogin.Items[ComboboxItem.GetItemIndex(this.cbWebLogin, user.allowed_web_login)];
                this.chTrainingExpert.CheckState = (user.training_expert == "Y" ? CheckState.Checked : CheckState.Unchecked);
                this.numMaxAbsent.Value = user.max_absent;
            }
            else
            {
                MessageAlert.Show(sr.message, "Error", MessageAlertButtons.OK, MessageAlertIcons.ERROR);
                this.DialogResult = DialogResult.Cancel;
                this.Close();
            }
            this.txtEmail.Focus();

            foreach (Control ct in this.groupBox1.Controls)
            {
                ct.GotFocus += delegate
                {
                    this.current_focused_control = ct;
                };
            }
            this.btnSubmitChangeUser.GotFocus += delegate
            {
                this.current_focused_control = this.btnSubmitChangeUser;
            };
            this.btnCancelSubmitChangeUser.GotFocus += delegate
            {
                this.current_focused_control = this.btnCancelSubmitChangeUser;
            };
            this.numMaxAbsent.GotFocus += delegate
            {
                this.numMaxAbsent.Select(0, this.numMaxAbsent.Text.Length);
            };
        }
Exemple #9
0
        private void toolStripRange_Click(object sender, EventArgs e)
        {
            LeaveRangeDialog dlg = new LeaveRangeDialog(this.main_form);
            dlg.Text = "กำหนดขอบเขตการแสดงข้อมูลการปฏิบัติงาน(Support)";
            dlg.user_from = this.current_user_from;
            dlg.user_to = this.current_user_to;
            dlg.date_from = this.current_date_from;
            dlg.date_to = this.current_date_to;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                this.current_user_from = dlg.user_from;
                this.current_user_to = dlg.user_to;
                this.current_date_from = dlg.date_from;
                this.current_date_to = dlg.date_to;
                this.GetNote();
            }
        }
Exemple #10
0
        private void toolStripRange_Click(object sender, EventArgs e)
        {
            LeaveRangeDialog dlg = new LeaveRangeDialog(this.main_form, this.current_user_from, this.current_user_to, this.current_date_from, this.current_date_to);
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                this.current_user_from = dlg.user_from;
                this.current_user_to = dlg.user_to;
                this.current_date_from = dlg.date_from;
                this.current_date_to = dlg.date_to;

                this.LoadEventAndFill();
            }
        }