コード例 #1
0
ファイル: DealerWindow.cs プロジェクト: wee2tee/SN_Net
        private void EditFormMsg(int column_index)
        {
            if (this.dgvMsg.Rows[this.dgvMsg.CurrentCell.RowIndex].Tag is D_msg)
            {
                this.FormEditItemF8();
                int row_index = this.dgvMsg.CurrentCell.RowIndex;

                CustomDateTimePicker inline_date = new CustomDateTimePicker();
                inline_date.Name = "inline_date";
                inline_date.BorderStyle = BorderStyle.None;
                inline_date.Read_Only = false;
                inline_date.textBox1.GotFocus += delegate
                {
                    this.current_focused_control = inline_date;
                };
                CustomTextBox inline_name = new CustomTextBox();
                inline_name.Name = "inline_name";
                inline_name.BorderStyle = BorderStyle.None;
                inline_name.Read_Only = false;
                inline_name.MaxChar = 3;
                inline_name.textBox1.GotFocus += delegate
                {
                    this.current_focused_control = inline_name;
                };
                CustomTextBox inline_desc = new CustomTextBox();
                inline_desc.Name = "inline_desc";
                inline_desc.BorderStyle = BorderStyle.None;
                inline_desc.Read_Only = false;
                inline_desc.MaxChar = 100;
                inline_desc.textBox1.GotFocus += delegate
                {
                    this.current_focused_control = inline_desc;
                };
                inline_desc.textBox1.KeyDown += delegate(object sender, KeyEventArgs e)
                {
                    if (e.KeyCode == Keys.Enter)
                    {
                        this.toolStripSave.PerformClick();
                    }
                };

                this.dgvMsg.Parent.Controls.Add(inline_date);
                this.dgvMsg.Parent.Controls.Add(inline_name);
                this.dgvMsg.Parent.Controls.Add(inline_desc);
                inline_date.TextsMysql = ((D_msg)this.dgvMsg.Rows[row_index].Tag).date;
                inline_name.Texts = ((D_msg)this.dgvMsg.Rows[row_index].Tag).name;
                inline_desc.Texts = ((D_msg)this.dgvMsg.Rows[row_index].Tag).description;

                this.AdjustInlineForm();

                this.dgvMsg.Enabled = false;
                this.dgvMsg.SendToBack();
                inline_date.BringToFront();
                inline_name.BringToFront();
                inline_desc.BringToFront();

                if (this.dgvMsg.Rows[row_index].Cells[column_index] != null)
                {
                    if (column_index == 1)
                    {
                        inline_date.Focus();
                    }
                    else if (column_index == 2)
                    {
                        inline_name.Focus();
                    }
                    else if (column_index == 3)
                    {
                        inline_desc.Focus();
                    }
                }
                else
                {
                    inline_date.Focus();
                }
            }
        }
コード例 #2
0
ファイル: DealerWindow.cs プロジェクト: wee2tee/SN_Net
        private void AddFormMsg()
        {
            this.FormAddItemF8();
            this.dgvMsg.Rows[this.d_msg.Count].Cells[1].Selected = true;

            CustomDateTimePicker inline_date = new CustomDateTimePicker();
            inline_date.Name = "inline_date";
            inline_date.BorderStyle = BorderStyle.None;
            inline_date.Read_Only = false;
            inline_date.textBox1.GotFocus += delegate
            {
                this.current_focused_control = inline_date;
            };
            CustomTextBox inline_name = new CustomTextBox();
            inline_name.Name = "inline_name";
            inline_name.BorderStyle = BorderStyle.None;
            inline_name.Read_Only = false;
            inline_name.MaxChar = 3;
            inline_name.textBox1.GotFocus += delegate
            {
                this.current_focused_control = inline_name;
            };
            CustomTextBox inline_desc = new CustomTextBox();
            inline_desc.Name = "inline_desc";
            inline_desc.BorderStyle = BorderStyle.None;
            inline_desc.Read_Only = false;
            inline_desc.MaxChar = 100;
            inline_desc.textBox1.GotFocus += delegate
            {
                this.current_focused_control = inline_desc;
            };
            inline_desc.textBox1.KeyDown += delegate(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter)
                {
                    this.toolStripSave.PerformClick();
                }
            };

            this.dgvMsg.Parent.Controls.Add(inline_date);
            this.dgvMsg.Parent.Controls.Add(inline_name);
            this.dgvMsg.Parent.Controls.Add(inline_desc);

            this.AdjustInlineForm();

            this.dgvMsg.Enabled = false;
            this.dgvMsg.SendToBack();
            inline_date.BringToFront();
            inline_date.dateTimePicker1.Value = DateTime.Now;
            inline_name.BringToFront();
            inline_desc.BringToFront();

            inline_date.Focus();
        }
コード例 #3
0
ファイル: SnWindow.cs プロジェクト: wee2tee/SN_Net
        private void showInlineProblemForm(DataGridViewRow row, int column_index = 1, Problem pattern = null)
        {
            this.dgvProblem.Enabled = false;

            Problem prob = new Problem();

            CustomDateTimePicker date = new CustomDateTimePicker();
            date.Name = "inline_problem_date";
            date.BringToFront();
            date.Read_Only = false;
            date.BorderStyle = BorderStyle.None;
            date.textBox1.GotFocus += delegate
            {
                this.current_focused_control = date;
                this.toolStripInfo.Text = this.toolTip1.GetToolTip(date);
            };
            toolTip1.SetToolTip(date, "<F6> = Show Calendar");
            CustomTextBox name = new CustomTextBox();
            name.Name = "inline_problem_name";
            name.BringToFront();
            name.Read_Only = false;
            name.BorderStyle = BorderStyle.None;
            name.textBox1.GotFocus += delegate
            {
                this.current_focused_control = name;
                this.toolStripInfo.Text = this.toolTip1.GetToolTip(name);
            };
            CustomBrowseField probcod = new CustomBrowseField();
            probcod.Name = "inline_problem_probcod";
            probcod.BringToFront();
            probcod._ReadOnly = false;
            probcod._MaxLength = 2;
            probcod.BorderStyle = BorderStyle.None;
            toolTip1.SetToolTip(probcod, "<F6> = Show Problem Code");
            probcod._btnBrowse.Click += delegate
            {
                IstabList co = new IstabList(this.main_form, probcod._Text, Istab.TABTYP.PROBLEM_CODE);
                if (co.ShowDialog() == DialogResult.OK)
                {
                    probcod._Text = co.istab.typcod;
                }
            };
            CustomTextBoxMaskedWithLabel probdesc = new CustomTextBoxMaskedWithLabel();
            probdesc.Name = "inline_problem_probdesc";
            probdesc.BringToFront();
            probdesc.BorderStyle = BorderStyle.None;
            probdesc.txtEdit.Enter += delegate
            {

            };
            probdesc.txtEdit.GotFocus += delegate
            {
                if (this.main_form.data_resource.LIST_PROBLEM_CODE.Find(t => t.typcod == probcod._Text) == null)
                {
                    SendKeys.Send("+{TAB}");
                    SendKeys.Send("{F6}");
                    return;
                }
                this.current_focused_control = probdesc;
                this.toolStripInfo.Text = this.toolTip1.GetToolTip(probdesc);
            };

            if (row.Tag is Problem) // edit existing problem
            {
                this.FormEditItem();
                prob = (Problem)row.Tag;
            }
            else // add new problem
            {
                this.FormAddItem();
                if (pattern != null)
                    prob = (pattern.probcod == "RG" && this.G.loged_in_user_level < GlobalVar.USER_LEVEL_ADMIN ? prob : pattern);
            }

            this.dgvProblem.Parent.Controls.Add(date);
            this.dgvProblem.Parent.Controls.Add(name);
            this.dgvProblem.Parent.Controls.Add(probcod);
            this.dgvProblem.Parent.Controls.Add(probdesc);
            this.dgvProblem.SendToBack();

            this.setPositionInlineProblemForm(row);

            // specify value in each field
            date.TextsMysql = (row.Tag is Problem ? prob.date : DateTime.Now.ToMysqlDate());
            name.Texts = prob.name;
            probcod._Text = prob.probcod;
            if (prob.probcod == "RG" && this.main_form.G.loged_in_user_level < GlobalVar.USER_LEVEL_ADMIN)
            {
                probcod.Visible = false;
                probdesc.StaticText = this.GetMachineCode(prob.probdesc);
                probdesc.EditableText = prob.probdesc.Substring(probdesc.StaticText.Length, prob.probdesc.Length - (probdesc.StaticText.Length)).Trim();
            }
            else
            {
                probdesc.StaticText = "";
                probdesc.EditableText = prob.probdesc;
            }

            if (column_index == 1)
            {
                date.Focus();
            }
            else if (column_index == 2)
            {
                name.Focus();
            }
            else if (column_index == 3)
            {
                if (probcod.Visible)
                    probcod.Focus();

                if (!probcod.Visible)
                    probdesc.Focus();
            }
            else if (column_index == 4)
            {
                probdesc.Focus();
            }
        }
コード例 #4
0
ファイル: DateEventWindow.cs プロジェクト: wee2tee/SN_Net
        private void ShowInlineForm()
        {
            int row_index = this.dgv.CurrentCell.RowIndex;

            CustomComboBox inline_users_name = new CustomComboBox();
            inline_users_name.Name = "inline_users_name";
            inline_users_name.comboBox1.DropDownStyle = ComboBoxStyle.DropDown;
            inline_users_name.Read_Only = false;
            inline_users_name.BorderStyle = BorderStyle.None;
            foreach (Users u in this.users_list)
            {
                ComboboxItem item = new ComboboxItem(u.username + " : " + u.name, u.id, u.username);
                inline_users_name.AddItem(item);
                if (this.form_mode == FORM_MODE.EDIT_ITEM)
                {
                    if (u.username == ((EventCalendar)this.dgv.Rows[this.dgv.CurrentCell.RowIndex].Tag).users_name)
                    {
                        inline_users_name.comboBox1.SelectedItem = item;
                    }
                }
            }
            inline_users_name.Leave += delegate
            {
                if (inline_users_name.comboBox1.Items.Cast<ComboboxItem>().Where(t => t.name.Length >= inline_users_name.comboBox1.Text.Length).Where(t => t.name.Substring(0, inline_users_name.comboBox1.Text.Length) == inline_users_name.comboBox1.Text).Count() > 0)
                {
                    inline_users_name.comboBox1.SelectedItem = inline_users_name.comboBox1.Items.Cast<ComboboxItem>().Where(t => t.name.Length >= inline_users_name.comboBox1.Text.Length).Where(t => t.name.Substring(0, inline_users_name.comboBox1.Text.Length) == inline_users_name.comboBox1.Text).First();
                }
                else
                {
                    inline_users_name.comboBox1.Focus();
                    SendKeys.Send("{F6}");
                }
            };
            inline_users_name.comboBox1.SelectedIndex = (this.form_mode == FORM_MODE.EDIT_ITEM ? this.users_list.FindIndex(t => t.username == ((EventCalendar)this.dgv.Rows[this.dgv.CurrentCell.RowIndex].Tag).users_name) : 0);
            this.dgv.Parent.Controls.Add(inline_users_name);

            CustomComboBox inline_leave_cause = new CustomComboBox();
            inline_leave_cause.Name = "inline_leave_cause";
            inline_leave_cause.Read_Only = false;
            inline_leave_cause.BorderStyle = BorderStyle.None;
            foreach (Istab i in this.leave_cause)
            {
                ComboboxItem item = new ComboboxItem(i.typdes_th, i.id, i.typcod);
                item.Tag = i;
                inline_leave_cause.AddItem(item);
                if (this.form_mode == FORM_MODE.EDIT_ITEM)
                {
                    if (i.tabtyp == ((EventCalendar)this.dgv.Rows[this.dgv.CurrentCell.RowIndex].Tag).event_type && i.typcod == ((EventCalendar)this.dgv.Rows[this.dgv.CurrentCell.RowIndex].Tag).event_code)
                    {
                        inline_leave_cause.comboBox1.SelectedItem = item;
                    }
                }
            }
            inline_leave_cause.comboBox1.SelectedIndex = (this.form_mode == FORM_MODE.EDIT_ITEM ? this.leave_cause.FindIndex(t => t.typcod == ((EventCalendar)this.dgv.Rows[this.dgv.CurrentCell.RowIndex].Tag).event_code) : 0);
            this.dgv.Parent.Controls.Add(inline_leave_cause);

            CustomTimePicker inline_from_time = new CustomTimePicker();
            inline_from_time.Name = "inline_from_time";
            inline_from_time.Read_Only = false;
            inline_from_time.BorderStyle = BorderStyle.None;
            inline_from_time.Show_Second = false;
            this.dgv.Parent.Controls.Add(inline_from_time);
            inline_from_time.Time = (this.form_mode == FORM_MODE.EDIT_ITEM ? ((EventCalendar)this.dgv.Rows[this.dgv.CurrentCell.RowIndex].Tag).from_time.TimeString2DateTime() : new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 8, 30, 0));

            CustomTimePicker inline_to_time = new CustomTimePicker();
            inline_to_time.Name = "inline_to_time";
            inline_to_time.Read_Only = false;
            inline_to_time.BorderStyle = BorderStyle.None;
            inline_to_time.Show_Second = false;
            this.dgv.Parent.Controls.Add(inline_to_time);
            inline_to_time.Time = (this.form_mode == FORM_MODE.EDIT_ITEM ? ((EventCalendar)this.dgv.Rows[this.dgv.CurrentCell.RowIndex].Tag).to_time.TimeString2DateTime() : (this.cde.date.Value.GetDayIntOfWeek() == 7 ? new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 12, 00, 0) : new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 17, 30, 0)));

            CustomComboBox inline_status = new CustomComboBox();
            inline_status.Name = "inline_status";
            inline_status.Read_Only = false;
            inline_status.BorderStyle = BorderStyle.None;
            inline_status.AddItem(new ComboboxItem("Wait", 0, "Wait"));
            inline_status.AddItem(new ComboboxItem("Confirmed", 1, "Confirmed"));
            inline_status.AddItem(new ComboboxItem("Canceled", 2, "Canceled"));
            this.dgv.Parent.Controls.Add(inline_status);
            inline_status.comboBox1.SelectedIndex = (this.form_mode == FORM_MODE.EDIT_ITEM ? ((EventCalendar)this.dgv.Rows[this.dgv.CurrentCell.RowIndex].Tag).status : 1);

            CustomTextBox inline_customer = new CustomTextBox();
            inline_customer.Name = "inline_customer";
            inline_customer.Read_Only = false;
            inline_customer.MaxChar = 40;
            inline_customer.BorderStyle = BorderStyle.None;
            this.dgv.Parent.Controls.Add(inline_customer);
            inline_customer.Texts = (this.form_mode == FORM_MODE.EDIT_ITEM ? ((EventCalendar)this.dgv.Rows[this.dgv.CurrentCell.RowIndex].Tag).customer : "");

            CustomComboBox inline_medcert = new CustomComboBox();
            inline_medcert.Name = "inline_medcert";
            inline_medcert.Read_Only = false;
            inline_medcert.BorderStyle = BorderStyle.None;
            inline_medcert.AddItem(new ComboboxItem("N/A (ไม่ระบุ)", 9, "X"));
            inline_medcert.AddItem(new ComboboxItem("ไม่มีเอกสาร", 0, "N"));
            inline_medcert.AddItem(new ComboboxItem("มีใบรับรองแพทย์", 1, "Y"));
            this.dgv.Parent.Controls.Add(inline_medcert);
            inline_medcert.comboBox1.SelectedItem = (this.form_mode == FORM_MODE.EDIT_ITEM ? inline_medcert.comboBox1.Items.Cast<ComboboxItem>().Where(i => i.string_value == ((EventCalendar)this.dgv.Rows[this.dgv.CurrentCell.RowIndex].Tag).med_cert).First<ComboboxItem>() : (ComboboxItem)inline_medcert.comboBox1.Items[0]);

            NumericUpDown inline_fine = new NumericUpDown();
            inline_fine.Name = "inline_fine";
            inline_fine.Maximum = 1000;
            inline_fine.Minimum = 0;
            inline_fine.AutoSize = false;
            inline_fine.Font = new Font("tahoma", 9.75f);
            inline_fine.ThousandsSeparator = true;
            inline_fine.BorderStyle = BorderStyle.None;
            inline_fine.TextAlign = HorizontalAlignment.Right;
            this.dgv.Parent.Controls.Add(inline_fine);
            inline_fine.Value = (this.form_mode == FORM_MODE.EDIT_ITEM ? ((EventCalendar)this.dgv.Rows[this.dgv.CurrentCell.RowIndex].Tag).fine : 0);

            this.SetInlineFormPosition();
            this.dgv.SendToBack();
            this.dgv.Enabled = false;
            inline_users_name.BringToFront();
            inline_leave_cause.BringToFront();
            inline_from_time.BringToFront();
            inline_to_time.BringToFront();
            inline_status.BringToFront();
            inline_customer.BringToFront();
            inline_medcert.BringToFront();
            inline_fine.BringToFront();
        }
コード例 #5
0
ファイル: LeaveWindow.cs プロジェクト: wee2tee/SN_Net
        private void ShowInlineFormLeaveList()
        {
            this.FormEditItem();
            CustomTimePicker inline_from_time = new CustomTimePicker();
            inline_from_time.Name = "inline_from_time";
            inline_from_time.Read_Only = false;
            this.dgvLeaveList.Parent.Controls.Add(inline_from_time);

            CustomTimePicker inline_to_time = new CustomTimePicker();
            inline_to_time.Name = "inline_to_time";
            inline_to_time.Read_Only = false;
            this.dgvLeaveList.Parent.Controls.Add(inline_to_time);

            CustomComboBox inline_status = new CustomComboBox();
            inline_status.Name = "inline_status";
            inline_status.Read_Only = false;
            inline_status.BorderStyle = BorderStyle.None;
            inline_status.AddItem(new ComboboxItem("WAIT", (int)CustomDateEvent.EVENT_STATUS.WAIT_FOR_CONFIRM, "WAIT"));
            inline_status.AddItem(new ComboboxItem("CONFIRMED", (int)CustomDateEvent.EVENT_STATUS.CONFIRMED, "CONFIRMED"));
            inline_status.AddItem(new ComboboxItem("CANCELED", (int)CustomDateEvent.EVENT_STATUS.CANCELED, "CANCELED"));
            this.dgvLeaveList.Parent.Controls.Add(inline_status);

            CustomTextBox inline_customer = new CustomTextBox();
            inline_customer.Name = "inline_customer";
            inline_customer.Read_Only = false;
            inline_customer.BorderStyle = BorderStyle.None;
            inline_customer.MaxChar = 40;
            this.dgvLeaveList.Parent.Controls.Add(inline_customer);

            CustomComboBox inline_medcert = new CustomComboBox();
            inline_medcert.Name = "inline_medcert";
            inline_medcert.Read_Only = false;
            inline_medcert.BorderStyle = BorderStyle.None;
            inline_medcert.AddItem(new ComboboxItem("N/A (ไม่ระบุ)", 9, "X"));
            inline_medcert.AddItem(new ComboboxItem("ไม่มีใบรับรองแพทย์", 0, "N"));
            inline_medcert.AddItem(new ComboboxItem("มีใบรับรองแพทย์", 1, "Y"));
            this.dgvLeaveList.Parent.Controls.Add(inline_medcert);

            NumericUpDown inline_fine = new NumericUpDown();
            inline_fine.Name = "inline_fine";
            inline_fine.Font = new Font("tahoma", 9.75f);
            inline_fine.Maximum = 1000;
            inline_fine.Minimum = 0;
            inline_fine.BorderStyle = BorderStyle.None;
            inline_fine.TextAlign = HorizontalAlignment.Right;
            inline_fine.GotFocus += delegate
            {
                inline_fine.Select(0, inline_fine.Text.Length);
            };
            this.dgvLeaveList.Parent.Controls.Add(inline_fine);

            this.SetPositionFormLeaveList();
            this.dgvAbsentSummary.Enabled = false;
            this.dgvLeaveList.Enabled = false;
            this.dgvLeaveList.SendToBack();
            inline_from_time.BringToFront();
            inline_to_time.BringToFront();
            inline_status.BringToFront();
            inline_customer.BringToFront();
            inline_medcert.BringToFront();
            inline_fine.BringToFront();

            if (this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag is EventCalendar)
            {
                string[] from = ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).from_time.Split(':');
                inline_from_time.Time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), 0);
                string[] to = ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).to_time.Split(':');
                inline_to_time.Time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), 0);
                inline_status.comboBox1.SelectedItem = inline_status.comboBox1.Items.Cast<ComboboxItem>().Where(i => i.int_value == ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).status).First<ComboboxItem>();
                inline_customer.Texts = ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).customer;
                inline_medcert.comboBox1.SelectedItem = inline_medcert.comboBox1.Items.Cast<ComboboxItem>().Where(i => i.string_value == ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).med_cert).First<ComboboxItem>();
                inline_fine.Value = ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).fine;
            }
        }