Exemplo n.º 1
0
 public SupportNoteWindow(SnWindow parent_window, Serial serial, List<SerialPassword> password_list)
     : this()
 {
     this.main_form = parent_window.main_form;
     this.parent_window = parent_window;
     this.serial = serial;
     this.password_list = password_list;
 }
Exemplo n.º 2
0
        private void LostRenewForm_Load(object sender, EventArgs e)
        {
            this.serial = this.parent_window.serial;
            this.mskLostSernum.Text = this.serial.sernum;
            //this.chkCDTraining.Checked = (this.serial.expdat.tryParseToDateTime() == false ? true : false);

            this.mskNewSernum.GotFocus += new EventHandler(this.keptCurrentFocusedControl);
            this.txtVersion.GotFocus += new EventHandler(this.keptCurrentFocusedControl);
            this.chkNewRwt.GotFocus += new EventHandler(this.keptCurrentFocusedControl);
            this.chkNewRwtJob.GotFocus += new EventHandler(this.keptCurrentFocusedControl);
            this.chkCDTraining.GotFocus += new EventHandler(this.keptCurrentFocusedControl);
            this.btnOK.GotFocus += new EventHandler(this.keptCurrentFocusedControl);
            this.btnCancel.GotFocus += new EventHandler(this.keptCurrentFocusedControl);

            this.mskNewSernum.GotFocus += new EventHandler(this.textBoxGotFocusHandler);
            this.txtVersion.GotFocus += new EventHandler(this.textBoxGotFocusHandler);
            this.mskNewSernum.Leave += new EventHandler(this.textBoxLeaveFocusHandler);
            this.txtVersion.Leave += new EventHandler(this.textBoxLeaveFocusHandler);

            this.mskNewSernum.Leave += new EventHandler(this.validateSernum);

            this.chkNewRwt.CheckStateChanged += new EventHandler(this.onCheckBoxStateChange);
            this.chkNewRwtJob.CheckStateChanged += new EventHandler(this.onCheckBoxStateChange);
        }
Exemplo n.º 3
0
        private void GetRegisterData()
        {
            if (this.dgvRegister.Rows[this.dgvRegister.CurrentCell.RowIndex].Tag is RegisterData)
            {
                this.rg = (RegisterData)this.dgvRegister.Rows[this.dgvRegister.CurrentCell.RowIndex].Tag;
                bool get_serial_success = false;

                this.FormBegining();
                this.FormProcessing();
                RegisterData reg = (RegisterData)this.dgvRegister.Rows[this.dgvRegister.CurrentCell.RowIndex].Tag;
                this.wAddr01.Text = reg.comp_addr1;
                this.wAddr02.Text = reg.comp_addr2;
                this.wAddr03.Text = reg.comp_addr3;
                this.wBusides.Text = reg.comp_bus_desc;
                this.wBusityp.Text = reg.comp_bus_type;
                this.wCompnam.Text = reg.comp_name;
                this.wContact.Text = reg.cont_name;
                this.wContEmail.Text = reg.cont_email;
                this.wContTelnum.Text = reg.cont_tel;
                this.dealer_code = (reg.purchase_from == "Express" ? "X-ESG" : "");
                this.wDealer.Text = (reg.purchase_from == "Express" ? reg.purchase_from : reg.purchase_from_desc);
                this.wEmail.Text = reg.comp_email;
                this.wFaxnum.Text = reg.comp_fax;
                this.wPosition.Text = reg.cont_position;
                this.wPrenam.Text = reg.comp_prenam;
                this.wSernum.Text = reg.sn;
                this.wTelnum.Text = reg.comp_tel;
                this.wZipcod.Text = reg.comp_zipcod;
                this.wRegDate.pickedDate(reg.reg_date);
                this.sRegDate.pickedDate(reg.reg_date);

                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += delegate
                {
                    CRUDResult get = ApiActions.GET(PreferenceForm.API_MAIN_URL() + "serial/get_sn_register&sernum=" + this.wSernum.Text);
                    ServerResult sr = JsonConvert.DeserializeObject<ServerResult>(get.data);

                    if (sr.result == ServerResult.SERVER_RESULT_SUCCESS)
                    {
                        if (sr.serial.Count > 0)
                        {
                            this.serial = sr.serial[0];
                            get_serial_success = true;
                        }
                        else
                        {
                            this.serial = null;
                            get_serial_success = false;
                            MessageAlert.Show("Can not find this S/N", "Error", MessageAlertButtons.OK, MessageAlertIcons.ERROR);
                        }

                        if (sr.problem.Count > 0)
                        {
                            this.prob_email = sr.problem[0].probdesc;
                        }
                        else
                        {
                            this.prob_email = "";
                        }
                    }
                    else
                    {
                        this.serial = null;
                        get_serial_success = false;
                        MessageAlert.Show(sr.message, "Error", MessageAlertButtons.OK, MessageAlertIcons.ERROR);
                    }
                };

                worker.RunWorkerCompleted += delegate
                {
                    if (get_serial_success)
                    {
                        this.sAddr01.Text = this.serial.addr01;
                        this.sAddr02.Text = this.serial.addr02;
                        this.sAddr03.Text = this.serial.addr03;
                        this.sBusides.Text = this.serial.busides;
                        this.sBusityp.Text = this.serial.busityp;
                        this.lblBusityp_typdes.Text = (this.parent_window.main_form.data_resource.LIST_BUSITYP.Find(t => t.typcod == this.sBusityp.Text) != null ? this.parent_window.main_form.data_resource.LIST_BUSITYP.Find(t => t.typcod == this.sBusityp.Text).typdes_th : "");
                        this.sCompnam.Text = this.serial.compnam;
                        this.sContact.Text = this.serial.contact;
                        this.sContEmail.Text = "";
                        this.sContTelnum.Text = "";
                        //this.sDealer.Text = this.dealer_code;
                        this.sDealer.Text = this.serial.dealer_dealer;
                        this.lblDealer_Compnam.Text = (this.parent_window.main_form.data_resource.LIST_DEALER.Find(t => t.dealer == this.sDealer.Text) != null ? this.parent_window.main_form.data_resource.LIST_DEALER.Find(t => t.dealer == this.sDealer.Text).compnam : "");
                        this.sEmail.Text = this.prob_email;
                        this.sFaxnum.Text = this.serial.faxnum;
                        this.sPosition.Text = this.serial.position;
                        this.sPrenam.Text = this.serial.prenam;
                        this.sSernum.Text = this.serial.sernum;
                        this.sTelnum.Text = this.serial.telnum;
                        this.sZipcod.Text = this.serial.zipcod;

                        this.FormEditing();
                        this.sPrenam.Focus();
                    }
                    else
                    {
                        this.FormBegining();
                    }
                };

                worker.RunWorkerAsync();
            }
        }
Exemplo n.º 4
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     this.serial = null;
     this.rg = null;
     this.dealer_code = "";
     this.prob_email = "";
     this.FormBegining();
 }
Exemplo n.º 5
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();
        }
Exemplo n.º 6
0
 private void btnViewDetail_Click(object sender, EventArgs e)
 {
     if (this.main_form.sn_wind != null)
     {
         if (this.main_form.sn_wind.serial.id != this.serial.id)
         {
             this.main_form.sn_wind.serial = this.serial;
             this.main_form.sn_wind.toolStripReload.PerformClick();
         }
         this.main_form.sn_wind.Activate();
     }
     else
     {
         SnWindow sn_wind = new SnWindow(this.main_form);
         this.main_form.sn_wind = sn_wind;
         sn_wind.MdiParent = this.main_form;
         sn_wind.Show();
     }
 }
Exemplo n.º 7
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();
                    }

                }
            }
        }
Exemplo n.º 8
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;
                /*****************************/
            }
        }
Exemplo n.º 9
0
 public void CrossingCall(Serial serial, List<SerialPassword> password_list)
 {
     this.Activate();
     this.toolStripAdd.PerformClick();
     this.txtSernum.Texts = serial.sernum;
     this.ValidateSN();
 }
Exemplo n.º 10
0
        private void SNInquiryWindow_Load(object sender, EventArgs e)
        {
            this.lblLoading.Dock = DockStyle.Fill;
            this.dgvSerial.Dock = DockStyle.Fill;
            this.setTitleText();
            this.serial_id_list = parentWindow.serial_id_list;
            this.current_serial = parentWindow.serial;
            this.sortMode = parentWindow.sortMode;
            this.dgvSerial.RowPostPaint += new DataGridViewRowPostPaintEventHandler(this.drawRowBorder);
            this.dgvSerial.Paint += new PaintEventHandler(this.loadPreviousWhilePaint);
            this.dgvSerial.MouseWheel += new MouseEventHandler(this.mouseWheelHandler);

            if (this.inquiry_type == INQUIRY_TYPE.REST)
            {
                this.inquiryRest();
            }
            else
            {
                this.inquireAll();
            }
        }
Exemplo n.º 11
0
        private void btnCD_Click(object sender, EventArgs e)
        {
            if (MessageAlert.Show("Generate \"CD training date\"", "", MessageAlertButtons.OK_CANCEL, MessageAlertIcons.QUESTION) == DialogResult.OK)
            {
                this.FormProcessing();
                bool post_success = false;

                BackgroundWorker workerCD = new BackgroundWorker();
                workerCD.DoWork += delegate
                {
                    string json_data = "{\"id\":" + this.serial.id.ToString() + ",";
                    json_data += "\"users_name\":\"" + this.main_form.G.loged_in_user_name + "\"}";
                    Console.WriteLine(json_data);
                    CRUDResult post = ApiActions.POST(PreferenceForm.API_MAIN_URL() + "serial/gen_cd_training_date", json_data);
                    Console.WriteLine("post.data = " + post.data);
                    ServerResult sr = JsonConvert.DeserializeObject<ServerResult>(post.data);

                    if (sr.result == ServerResult.SERVER_RESULT_SUCCESS)
                    {
                        this.serial = sr.serial[0];
                        post_success = true;
                    }
                    else
                    {
                        MessageAlert.Show(sr.message, "Error", MessageAlertButtons.OK, MessageAlertIcons.ERROR);
                        post_success = false;
                    }
                };

                workerCD.RunWorkerCompleted += delegate
                {
                    if (post_success)
                    {
                        this.dtExpdat.TextsMysql = this.serial.expdat;
                        this.lblExpdat2.pickedDate(this.serial.expdat);
                        this.FormRead();
                    }
                    else
                    {
                        this.FormRead();
                    }
                };

                workerCD.RunWorkerAsync();
            }
            else
            {
                this.FormRead();
            }
        }
Exemplo n.º 12
0
 private void getSerial(int row_id)
 {
     CRUDResult get = ApiActions.GET(PreferenceForm.API_MAIN_URL() + "serial/get_at&id=" + row_id);
     ServerResult sr = JsonConvert.DeserializeObject<ServerResult>(get.data);
     if (sr.result == ServerResult.SERVER_RESULT_SUCCESS)
     {
         if (sr.serial.Count > 0)
         {
             this.serial = sr.serial[0];
             this.problem = (sr.problem.Count > 0 ? sr.problem : this.problem_not_found);
             this.problem_im_only = (sr.problem.Count > 0 ? sr.problem.Where<Problem>(t => t.probcod == "IM").ToList<Problem>() : this.problem_not_found);
             this.ma = sr.ma;
             this.cloudsrv = sr.cloudsrv;
         }
         else
         {
             this.getSerialIDList();
             this.getSerial(this.serial_id_list.Last<Serial>().id);
         }
     }
     else
     {
         MessageAlert.Show(sr.message, "Error", MessageAlertButtons.OK, MessageAlertIcons.ERROR);
     }
 }
Exemplo n.º 13
0
        private void btnSwithToRefnum_Click(object sender, EventArgs e)
        {
            if (this.form_mode == FORM_MODE.READ)
            {
                if (this.serial.refnum.Replace("-", "").Replace(" ", "").Length > 0)
                {
                    bool founded_sn = false;
                    this.FormProcessing();
                    BackgroundWorker workerSwitchRefnum = new BackgroundWorker();
                    workerSwitchRefnum.DoWork += delegate
                    {
                        this.getSerialIDList();
                        CRUDResult get = ApiActions.GET(PreferenceForm.API_MAIN_URL() + "serial/get_by_sernum&sernum=" + this.serial.refnum);
                        ServerResult sr = JsonConvert.DeserializeObject<ServerResult>(get.data);

                        if (sr.result == ServerResult.SERVER_RESULT_SUCCESS)
                        {
                            if (sr.serial.Count > 0)
                            {
                                founded_sn = true;
                                this.serial = sr.serial[0];
                                this.problem = (sr.problem.Count > 0 ? sr.problem : this.problem_not_found);
                                this.problem_im_only = (sr.problem.Count > 0 ? sr.problem.Where<Problem>(t => t.probcod == "IM").ToList<Problem>() : this.problem_not_found);
                            }
                            else
                            {
                                founded_sn = false;
                            }
                        }
                        else
                        {
                            MessageAlert.Show(sr.message, "Error", MessageAlertButtons.OK, MessageAlertIcons.ERROR);
                        }
                    };
                    workerSwitchRefnum.RunWorkerCompleted += delegate
                    {
                        if (founded_sn)
                        {
                            this.fillSerialInForm();
                            this.FormRead();
                        }
                        else
                        {
                            this.FormRead();
                            MessageAlert.Show("Reference S/N not found", "Error", MessageAlertButtons.OK, MessageAlertIcons.ERROR);
                        }

                    };
                    workerSwitchRefnum.RunWorkerAsync();
                }
            }
        }