Пример #1
0
 public MAFormDialog(Ma ma_readonly)
     : this()
 {
     this.Read_only_ma = new Ma()
     {
         id = ma_readonly.id,
         email = ma_readonly.email,
         start_date = ma_readonly.start_date,
         end_date = ma_readonly.end_date,
         sernum = ma_readonly.sernum,
         rec_by = ma_readonly.rec_by,
         rec_date = ma_readonly.rec_date,
     };
 }
Пример #2
0
        private void ClearForm()
        {
            this.tabControl2.SelectedTab = this.tabPage3;
            this.parent_window.btnSupportNote.Enabled = true;
            this.serial = null;
            this.note = null;
            this.ma = null;
            if (this.WindowState == FormWindowState.Minimized)
            {
                this.WindowState = FormWindowState.Maximized;
            }
            this.splitContainer1.SplitterDistance = 42;

            #region First tab
            this.txtSernum.Texts = "";
            this.lblCompnam.Text = "";
            this.lblAddr.Text = "";
            this.lblVerext.Text = "";
            this.txtContact.Texts = "";
            this.chAlsoF8.CheckState = CheckState.Unchecked;
            this.chAssets.CheckState = CheckState.Unchecked;
            this.chError.CheckState = CheckState.Unchecked;
            this.chFonts.CheckState = CheckState.Unchecked;
            this.chForm.CheckState = CheckState.Unchecked;
            this.chInstall.CheckState = CheckState.Unchecked;
            this.chMailWait.CheckState = CheckState.Unchecked;
            this.chMapDrive.CheckState = CheckState.Unchecked;
            this.chPeriod.CheckState = CheckState.Unchecked;
            this.chPrint.CheckState = CheckState.Unchecked;
            this.chRepExcel.CheckState = CheckState.Unchecked;
            this.chSecure.CheckState = CheckState.Unchecked;
            this.chStatement.CheckState = CheckState.Unchecked;
            this.chStock.CheckState = CheckState.Unchecked;
            this.chTransferMkt.CheckState = CheckState.Unchecked;
            this.chTraining.CheckState = CheckState.Unchecked;
            this.chYearEnd.CheckState = CheckState.Unchecked;
            this.txtRemark.Text = "";
            #endregion First tab

            #region Second tab
            this.rbToilet.Checked = true;
            this.rbQt.Checked = false;
            this.rbMeetCust.Checked = false;
            this.rbTraining.Checked = false;
            this.rbCorrectData.Checked = false;
            this.rbOther.Checked = false;
            this.txtSernum2.Texts = "";
            this.lblCompnam2.Text = "";
            this.txtRemark2.Text = "";
            #endregion Second tab

            if (this.tm != null)
            {
                this.tm.Stop();
                this.tm.Enabled = false;
            }
            this.main_form.lblTimeDuration.Text = TimeSpan.Zero.ToString();
        }
Пример #3
0
        private void ValidateSN(bool skip_serial_check = false)
        {
            if (this.txtSernum.Texts.Replace("-", "").Trim().Length > 0)
            {
                if (this.serial != null && this.serial.sernum == this.txtSernum.Texts && skip_serial_check == false)
                    return;

                CRUDResult get_exist_sernum = ApiActions.GET(PreferenceForm.API_MAIN_URL() + "serial/check_sn_exist&sernum=" + this.txtSernum.Texts);
                ServerResult sr_exist_sernum = JsonConvert.DeserializeObject<ServerResult>(get_exist_sernum.data);

                if (sr_exist_sernum.result == ServerResult.SERVER_RESULT_SUCCESS)
                {
                    if (sr_exist_sernum.serial.Count > 0) // s/n found
                    {
                        this.toolStripSave.Enabled = true;
                        this.btnViewDetail.Enabled = true;
                        this.picCheck.Visible = true;
                        this.lblCompnam.Text = sr_exist_sernum.serial[0].compnam;
                        if (this.list_verext.Find(v => v.typcod == sr_exist_sernum.serial[0].verext) != null)
                            this.lblVerext.Text = this.list_verext.Find(v => v.typcod == sr_exist_sernum.serial[0].verext).typcod + " : " + this.list_verext.Find(v => v.typcod == sr_exist_sernum.serial[0].verext).typdes_th;
                        this.lblAddr.Text = sr_exist_sernum.serial[0].addr01 + " " + sr_exist_sernum.serial[0].addr02 + " " + sr_exist_sernum.serial[0].addr03 + " " + sr_exist_sernum.serial[0].zipcod;
                        this.serial = sr_exist_sernum.serial[0];
                        this.password_list = sr_exist_sernum.serial_password;
                        this.list_problem = sr_exist_sernum.problem;
                        this.FillDgvProblem();

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

                        if (sr_exist_sernum.ma.Count > 0)
                        {
                            this.ma = sr_exist_sernum.ma[0];
                            this.btnMA.Enabled = true;
                        }
                        else
                        {
                            this.ma = null;
                            this.btnMA.Enabled = false;
                        }

                        if (this.form_mode == FORM_MODE.ADD)
                        {
                            BackgroundWorker worker_spylog = new BackgroundWorker();
                            worker_spylog.DoWork += delegate
                            {
                                string json_data = "{\"users_name\":\"" + this.main_form.G.loged_in_user_name + "\",";
                                json_data += "\"sernum\":\"" + this.txtSernum.textBox1.Text.cleanString() + "\",";
                                json_data += "\"compnam\":\"\"}";
                                ApiActions.POST(PreferenceForm.API_MAIN_URL() + "spylog/create", json_data);
                            };
                            worker_spylog.RunWorkerAsync();
                        }
                    }
                    else // s/n not found
                    {
                        MessageAlert.Show(StringResource.DATA_NOT_FOUND, "", MessageAlertButtons.OK, MessageAlertIcons.WARNING);
                        this.tabControl2.SelectedTab = this.tabPage3;
                        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 setting is temporary */
                        //this.txtSernum.Focus();
                        this.toolStripSave.Enabled = true;
                        /*****************************/
                    }
                }
                else // error while get data from server
                {
                    MessageAlert.Show(sr_exist_sernum.message, "Error", MessageAlertButtons.OK, MessageAlertIcons.ERROR);
                    this.tabControl2.SelectedTab = this.tabPage3;
                    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 setting is temporary */
                    //this.txtSernum.Focus();
                    this.toolStripSave.Enabled = true;
                    /*****************************/
                }
            }
            else // s/n is blank
            {
                this.tabControl2.SelectedTab = this.tabPage3;
                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 setting is temporary */
                this.toolStripSave.Enabled = true;
                /*****************************/
            }
        }
Пример #4
0
        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();
                    }

                }
            }
        }