コード例 #1
0
ファイル: SupportNoteWindow.cs プロジェクト: wee2tee/SN_Net
 private void toolStripTeacher_Click(object sender, EventArgs e)
 {
     TrainerNoteDialog dlg = new TrainerNoteDialog(this.main_form, (Users)((ComboboxItem)this.cbUsersCode.SelectedItem).Tag, this.dtWorkDate.ValDateTime);
     if (dlg.ShowDialog() == DialogResult.OK)
     {
         this.GetNote();
     }
 }
コード例 #2
0
ファイル: SupportNoteWindow.cs プロジェクト: wee2tee/SN_Net
        private void toolStripEdit_Click(object sender, EventArgs e)
        {
            if (this.dgvNote.CurrentCell != null && (this.dgvNote.Rows[this.dgvNote.CurrentCell.RowIndex]).Tag is SupportNote)
            {
                this.note = (SupportNote)this.dgvNote.Rows[this.dgvNote.CurrentCell.RowIndex].Tag;

                if (((SupportNote)this.dgvNote.Rows[this.dgvNote.CurrentCell.RowIndex].Tag).is_break != "Y")
                {
                    this.tabControl1.SelectedTab = this.tabPage1;
                    this.cbProbcod.SelectedIndex = this.probcod.FindIndex(t => t.typcod == "--");

                    this.txtSernum.Texts = this.note.sernum;
                    this.dtStartTime.Text = this.note.start_time;
                    this.dtEndTime.Text = this.note.end_time;
                    this.txtRemark.Text = this.note.remark;
                    this.txtContact.Texts = this.note.contact;
                    this.CheckedProblem(this.note.problem);
                    this.txtContact.Focus();

                    if (this.txtSernum.Texts.Replace("-", "").Trim().Length > 0)
                    {
                        CRUDResult get = ApiActions.GET(PreferenceForm.API_MAIN_URL() + "serial/check_sn_exist&sernum=" + this.note.sernum);
                        ServerResult sr = JsonConvert.DeserializeObject<ServerResult>(get.data);
                        if (sr.result == ServerResult.SERVER_RESULT_SUCCESS)
                        {
                            if (sr.serial.Count<Serial>() > 0)
                            {
                                this.btnViewDetail.Enabled = true;
                                this.picCheck.Visible = true;
                                this.serial = sr.serial[0];
                                this.password_list = sr.serial_password;
                                this.list_problem = sr.problem;
                                this.lblCompnam.Text = this.serial.compnam;
                                this.lblAddr.Text = this.serial.addr01 + " " + this.serial.addr02 + " " + this.serial.addr03 + " " + this.serial.zipcod;
                                if (this.list_verext.Find(v => v.typcod == this.serial.verext) != null)
                                    this.lblVerext.Text = this.list_verext.Find(v => v.typcod == this.serial.verext).typcod + " : " + this.list_verext.Find(v => v.typcod == this.serial.verext).typdes_th;

                                this.FillDgvProblem();
                                if (sr.serial_password.Count > 0)
                                {
                                    this.btnViewPassword.Enabled = true;
                                }
                                else
                                {
                                    this.btnViewPassword.Enabled = false;
                                }

                                if (sr.ma.Count > 0)
                                {
                                    this.ma = sr.ma[0];
                                    this.btnMA.Enabled = true;
                                }
                                else
                                {
                                    this.ma = null;
                                    this.btnMA.Enabled = false;
                                }
                            }
                            else
                            {
                                this.btnViewDetail.Enabled = false;
                                this.btnViewPassword.Enabled = false;
                                this.picCheck.Visible = false;
                                this.serial = null;
                                this.list_problem = null;
                                this.lblCompnam.Text = "";
                                this.lblAddr.Text = "";
                                this.lblVerext.Text = "";
                                this.FillDgvProblem();
                            }
                        }
                        else
                        {
                            this.btnViewDetail.Enabled = false;
                            this.btnViewPassword.Enabled = false;
                            this.picCheck.Visible = false;
                            this.serial = null;
                            this.list_problem = null;
                            this.lblCompnam.Text = "";
                            this.lblAddr.Text = "";
                            this.lblVerext.Text = "";
                            this.FillDgvProblem();
                        }
                    }
                    else
                    {
                        this.btnViewDetail.Enabled = false;
                        this.btnViewPassword.Enabled = false;
                        this.picCheck.Visible = false;
                        this.serial = null;
                        this.list_problem = null;
                        this.lblCompnam.Text = "";
                        this.lblAddr.Text = "";
                        this.lblVerext.Text = "";
                        this.FillDgvProblem();
                    }

                    this.FormEdit();
                }
                else
                {
                    if (((SupportNote)this.dgvNote.Rows[this.dgvNote.CurrentCell.RowIndex].Tag).reason.Contains(SupportNote.BREAK_REASON.TRAINING_TRAINER.FormatBreakReson())) // if Trainer
                    {
                        TrainerNoteDialog wind = new TrainerNoteDialog(this.main_form, (Users)((ComboboxItem)this.cbUsersCode.SelectedItem).Tag, this.dtWorkDate.dateTimePicker1.Value, (SupportNote)this.dgvNote.Rows[this.dgvNote.CurrentCell.RowIndex].Tag);
                        if (wind.ShowDialog() == DialogResult.OK)
                        {
                            this.GetNote();
                        }
                    }
                    else
                    {
                        this.tabControl1.SelectedTab = this.tabPage2;
                        this.FormEditBreak();
                        this.txtSernum2.Texts = this.note.sernum;
                        this.dtBreakStart.Text = this.note.start_time;
                        this.dtBreakEnd.Text = this.note.end_time;
                        this.txtRemark2.Text = this.note.remark;
                        this.rbToilet.Checked = (this.note.reason.Contains(SupportNote.BREAK_REASON.TOILET.FormatBreakReson()) ? true : false);
                        this.rbQt.Checked = (this.note.reason.Contains(SupportNote.BREAK_REASON.QT.FormatBreakReson()) ? true : false);
                        this.rbMeetCust.Checked = (this.note.reason.Contains(SupportNote.BREAK_REASON.MEET_CUST.FormatBreakReson()) ? true : false);
                        this.rbTraining.Checked = (this.note.reason.Contains(SupportNote.BREAK_REASON.TRAINING_ASSIST.FormatBreakReson()) ? true : false);
                        this.rbCorrectData.Checked = (this.note.reason.Contains(SupportNote.BREAK_REASON.CORRECT_DATA.FormatBreakReson()) ? true : false);
                        this.rbOther.Checked = (this.note.reason.Contains(SupportNote.BREAK_REASON.OTHER.FormatBreakReson()) ? true : false);
                        this.txtRemark2.Focus();

                        this.FormEditBreak();
                    }

                }
            }
        }