private void GenerateEDIAccount(int index) { try { frmUsageInfoRegistrationListController oController = new frmUsageInfoRegistrationListController(); if ((EDITable.Rows.Count <= 0) && FirstLunch)//if it is first time { EDITable = oController.GetEDICandidates(); FirstLunch = false; } if (EDITable.Rows.Count <= 0) //if there is no candidate left { //show message here dgvList.Rows[index].Cells["colUPDATE_MESSAGE"].Value = JimugoMessages.E000ZZ042; dgvList.Rows[index].Cells["colMK"].Value = "X"; //end process } else { //get random EDI account int totalAccounts = EDITable.Rows.Count; Random random = new System.Random(); int randomIndex = random.Next(0, totalAccounts - 1); //random account string EDIAccount = EDITable.Rows[randomIndex][0].ToString(); string COMPANY_NO_BOX = dgvList.Rows[index].Cells["colCOMPANY_NO_BOX"].Value == null ? "" : dgvList.Rows[index].Cells["colCOMPANY_NO_BOX"].Value.ToString(); if (string.IsNullOrEmpty(COMPANY_NO_BOX)) { dgvList.Rows[index].Cells["colUPDATE_MESSAGE"].Value = String.Format(JimugoMessages.E000ZZ051, "会社番号+BOX"); dgvList.Rows[index].Cells["colMK"].Value = "X"; } else { //remove current account from random pool EDITable.Rows.RemoveAt(randomIndex); //get more info for EDIAccount DataTable dt = oController.GetEDIAccountDetail(COMPANY_NO_BOX); //set values SetEDIValue(dt.Rows[0], index, EDIAccount); } } } catch (Exception ex) { Utility.WriteErrorLog(ex.Message, ex, false); } }
private void BtnSendMail_Click(object sender, EventArgs e) { try { if (uIUtility.checkSelectedRow()) { var confirmResult = MetroMessageBox.Show(this, "\n" + "メール送信しますか?", "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (confirmResult == DialogResult.OK) { DataTable dt = uIUtility.GetCheckedValuesForMail(); if (dt.Rows.Count > 0) { //Show mail progress message Thread mailthread = new Thread(new ThreadStart(ShowMailLoading)); mailthread.Start(); //send to web service frmUsageInfoRegistrationListController oController = new frmUsageInfoRegistrationListController(); DataTable result = oController.SettingComplete(dt, out uIUtility.MetaData); //close mail dialog mailthread.Abort(); if (result.Rows.Count > 0) { Dialog = DialogResult.OK; this.UPDATED_AT = result.Rows[0]["UPDATED_AT"].ToString(); this.UPDATED_AT_RAW = result.Rows[0]["UPDATED_AT_RAW"].ToString(); this.SYSTEM_SETTING_STATUS = result.Rows[0]["SYSTEM_SETTING_STATUS"].ToString(); } //update data grid view uIUtility.UpdateReturnedresults(result); } } } } catch (System.TimeoutException) { MetroMessageBox.Show(this, "\n" + Messages.General.ServerTimeOut, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Net.WebException) { MetroMessageBox.Show(this, "\n" + Messages.General.NoConnection, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { Utility.WriteErrorLog(ex.Message, ex, false); MetroMessageBox.Show(this, "\n" + Messages.General.ThereWasAnError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BtnSubmit_Click(object sender, EventArgs e) { //get column values where MK not null or empty DataTable dt = uIUtility.SubmitChanges(); if (dt.Rows.Count > 0) { //send to web service frmUsageInfoRegistrationListController oController = new frmUsageInfoRegistrationListController(); try { DataTable result = oController.Submit(dt, out uIUtility.MetaData); //update data grid view uIUtility.UpdateReturnedresults(result); } catch (Exception ex) { Utility.WriteErrorLog(ex.Message, ex, false); } } }
private void BindGrid() { try { string company_no_box, company_name, edi_account; if (!CheckUtility.SearchConditionCheck(this, lblCompanyNoBox.Text, txtCompanyNoBox.Text, false, Utility.DataType.HALF_ALPHA_NUMERIC, 10, 0)) { return; } if (!CheckUtility.SearchConditionCheck(this, lblCompanyName.Text, txtCompanyName.Text, false, Utility.DataType.FULL_WIDTH, 80, 0)) { return; } if (!CheckUtility.SearchConditionCheck(this, lblEDIAccount.Text, txtEDIAccount.Text, false, Utility.DataType.EDI_ACCOUNT, 4, 0)) { return; } company_no_box = txtCompanyNoBox.Text.Trim(); company_name = txtCompanyName.Text.Trim(); edi_account = txtEDIAccount.Text.Trim(); frmUsageInfoRegistrationListController oController = new frmUsageInfoRegistrationListController(); DataTable dt = oController.GetUsageInfoRegistrationList(company_no_box, company_name, edi_account, uIUtility.MetaData.Offset, uIUtility.MetaData.Limit, out uIUtility.MetaData); if (dt.Rows.Count > 0) { uIUtility.dtList = dt; dgvList.DataSource = uIUtility.dtList; uIUtility.dtOrigin = uIUtility.dtList.Copy(); //pagination uIUtility.CalculatePagination(lblcurrentPage, lblTotalPages, lblTotalRecords); uIUtility.FormatUpdatedat(); } else { //pagination uIUtility.CalculatePagination(lblcurrentPage, lblTotalPages, lblTotalRecords); //clear data except headers uIUtility.ClearDataGrid(); } uIUtility.CheckPagination(btnFirst, btnPrev, btnNext, btnLast, lblcurrentPage.Text, lblTotalPages.Text); } catch (System.TimeoutException) { MetroMessageBox.Show(this, "\n" + Messages.General.ServerTimeOut, "Search Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Net.WebException) { MetroMessageBox.Show(this, "\n" + Messages.General.NoConnection, "Search Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { Utility.WriteErrorLog(ex.Message, ex, false); MetroMessageBox.Show(this, "\n" + Messages.General.ThereWasAnError, "Search Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } }