예제 #1
0
 private void btnSearchTypcod_Click(object sender, EventArgs e)
 {
     SearchSerialBox swind = new SearchSerialBox(SearchSerialBox.SEARCH_MODE.USERGROUP);
     swind.txtSearchKey.CharacterCasing = CharacterCasing.Upper;
     if (swind.ShowDialog() == DialogResult.OK)
     {
         this.GetGroupByTypcod(swind.txtSearchKey.Text);
     }
 }
예제 #2
0
파일: SnWindow.cs 프로젝트: wee2tee/SN_Net
        private void toolStripSearch_ButtonClick(object sender, EventArgs e)
        {
            SearchSerialBox box = new SearchSerialBox(SearchSerialBox.SEARCH_MODE.SERNUM);
            box.mskSearchKey.Text = this.find_sernum;
            if (box.ShowDialog() == DialogResult.OK)
            {
                #region keep spy_log (no need response)
                string json_data = "{\"users_name\":\"" + this.G.loged_in_user_name + "\",";
                json_data += "\"sernum\":\"" + box.mskSearchKey.Text.cleanString() + "\",";
                json_data += "\"compnam\":\"\"}";
                CRUDResult post = ApiActions.POST(PreferenceForm.API_MAIN_URL() + "spylog/create", json_data);
                #endregion keep spy_log (no need response)

                this.find_sernum = box.mskSearchKey.Text;
                this.find_type = FIND_TYPE.SERNUM;
                this.FormProcessing();
                BackgroundWorker workerSearch = new BackgroundWorker();
                workerSearch.DoWork += new DoWorkEventHandler(this.workerSearch_DoWork);
                workerSearch.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.workerSearch_Complete);
                workerSearch.RunWorkerAsync();
            }
        }
예제 #3
0
        private void toolStripSearch_Click(object sender, EventArgs e)
        {
            SearchSerialBox sb = new SearchSerialBox(SearchSerialBox.SEARCH_MODE.SERNUM);
            sb.mskSearchKey.Text = this.search_sn;
            if (sb.ShowDialog() == DialogResult.OK)
            {
                this.search_sn = sb.search_sn;

                bool get_success = false;
                string err_msg = "";
                List<SupportNote> search_result = null;

                string support_code = ((ComboboxItem)this.cbUsersCode.SelectedItem).string_value;
                string sernum = sb.search_sn;

                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += delegate
                {
                    CRUDResult get;

                    DateTime date_from = DateTime.Now;
                    DateTime date_to = DateTime.Now;
                    if (PreferenceForm.SEARCH_NOTE_DATE_CONFIGURATION() == (int)PreferenceForm.SEARCH_DATE.BACKWARD_WEEK)
                    {
                        date_from = date_from.AddDays(-7);
                    }
                    if (PreferenceForm.SEARCH_NOTE_DATE_CONFIGURATION() == (int)PreferenceForm.SEARCH_DATE.BACKWARD_MONTH)
                    {
                        date_from = date_from.AddDays(-30);
                    }
                    if (PreferenceForm.SEARCH_NOTE_DATE_CONFIGURATION() == (int)PreferenceForm.SEARCH_DATE.BACKWARD_YEAR)
                    {
                        date_from = date_from.AddDays(-365);
                    }

                    if (PreferenceForm.SEARCH_NOTE_METHOD_CONFIGURATION() == (int)PreferenceForm.SEARCH_NOTE.PRIVATE)
                    {
                        get = ApiActions.GET(PreferenceForm.API_MAIN_URL() + "supportnote/search_note&support_code=" + support_code + "&sernum=" + sernum + "&date_from=" + date_from.ToMysqlDate() + "&date_to=" + date_to.ToMysqlDate());
                    }
                    else
                    {
                        get = ApiActions.GET(PreferenceForm.API_MAIN_URL() + "supportnote/search_note&support_code=*&sernum=" + sernum + "&date_from=" + date_from.ToMysqlDate() + "&date_to=" + date_to.ToMysqlDate());
                    }
                    ServerResult sr = JsonConvert.DeserializeObject<ServerResult>(get.data);

                    if (sr.result == ServerResult.SERVER_RESULT_SUCCESS)
                    {
                        get_success = true;
                        search_result = sr.support_note;
                    }
                    else
                    {
                        get_success = false;
                        err_msg = sr.message;
                    }
                };
                worker.RunWorkerCompleted += delegate
                {
                    if (get_success)
                    {
                        SimpleDatagridDialog sd = new SimpleDatagridDialog(SimpleDatagridDialog.BUTTON_MODE.CLOSE);
                        sd.Text = "ผลการค้นหา S/N : " + sb.search_sn + "";
                        sd.Width = 1200;
                        this.FillDataGrid(sd.dgv, search_result);
                        sd.dgv.Columns[2].Visible = true;
                        if (PreferenceForm.SEARCH_NOTE_METHOD_CONFIGURATION() == (int)PreferenceForm.SEARCH_NOTE.PUBLIC)
                            sd.dgv.Columns[3].Visible = true;
                        sd.ShowDialog();
                    }
                    else
                    {
                        MessageAlert.Show(err_msg, "Error", MessageAlertButtons.OK, MessageAlertIcons.ERROR);
                    }
                };
                worker.RunWorkerAsync();
            }
        }
예제 #4
0
파일: SnWindow.cs 프로젝트: wee2tee/SN_Net
 private void searchOldSerialToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SearchSerialBox box = new SearchSerialBox(SearchSerialBox.SEARCH_MODE.OLDNUM);
     box.mskSearchKey.Text = this.find_oldnum;
     if (box.ShowDialog() == DialogResult.OK)
     {
         this.find_oldnum = box.mskSearchKey.Text;
         this.find_type = FIND_TYPE.OLDNUM;
         this.FormProcessing();
         BackgroundWorker workerSearch = new BackgroundWorker();
         workerSearch.DoWork += new DoWorkEventHandler(this.workerSearch_DoWork);
         workerSearch.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.workerSearch_Complete);
         workerSearch.RunWorkerAsync();
     }
 }