Пример #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            int officeID = 0;

            if (checkBox1.Checked == true)
            {
                if (comboBox1.SelectedIndex == -1)
                {
                    MessageBox.Show("事業所を選択してください", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    comboBox1.Focus();
                    return;
                }
                else
                {
                    //事業所コード
                    Utility.ComboOffice cmb1 = new Utility.ComboOffice();
                    cmb1     = (Utility.ComboOffice)comboBox1.SelectedItem;
                    officeID = cmb1.ID;
                }
            }

            //画面表示
            GridviewSet.ShowData(dataGridView2, Convert.ToDateTime(dateTimePicker1.Value.ToShortDateString()), officeID, comboBox1);
            dataGridView2.CurrentCell = null;

            if (dataGridView2.RowCount > 0)
            {
                button1.Enabled = true;
            }
        }
Пример #2
0
        //登録データチェック
        private Boolean fDataCheck()
        {
            string str;
            double d;

            try
            {
                //登録モードのとき、コードをチェック
                if (fMode.Mode == 0)
                {
                    // 数字か?
                    if (txtCode.Text == null)
                    {
                        this.txtCode.Focus();
                        throw new Exception("コードは数字で入力してください");
                    }

                    str = this.txtCode.Text;

                    if (double.TryParse(str, System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.InvariantInfo, out d))
                    {
                    }
                    else
                    {
                        this.txtCode.Focus();
                        throw new Exception("コードは数字で入力してください");
                    }

                    // 未入力またはスペースのみは不可
                    if ((this.txtCode.Text).Trim().Length < 1)
                    {
                        this.txtCode.Focus();
                        throw new Exception("コードを入力してください");
                    }

                    //ゼロは不可
                    if (Convert.ToInt32(this.txtCode.Text.ToString()) == 0)
                    {
                        this.txtCode.Focus();
                        throw new Exception("ゼロは登録できません");
                    }

                    //登録済みコードか調べる
                    string          sqlStr;
                    Control.配布員     Staff = new Control.配布員();
                    OleDbDataReader dr;

                    sqlStr = " where ID = " + txtCode.Text.ToString();
                    dr     = Staff.FillBy(sqlStr);

                    if (dr.HasRows == true)
                    {
                        txtCode.Focus();
                        dr.Close();
                        Staff.Close();
                        throw new Exception("既に登録済みのコードです");
                    }

                    dr.Close();
                    Staff.Close();
                }

                //名称チェック
                if (txtName1.Text.Trim().Length < 1)
                {
                    txtName1.Focus();
                    throw new Exception("氏名を入力してください");
                }

                ////支払形態チェック
                //if (cmbShiharai.SelectedIndex == -1)
                //{
                //    cmbShiharai.Focus();
                //    throw new Exception("支払形態を選択してください");
                //}

                ////事業所チェック
                //if (cmbShozoku.SelectedIndex == -1)
                //{
                //    cmbShozoku.Focus();
                //    throw new Exception("事業所を選択してください");
                //}

                //金融機関コード
                if (txtBankCode.Text.ToString().Trim() != "")
                {
                    str = this.txtBankCode.Text.ToString();

                    if (double.TryParse(str, System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.InvariantInfo, out d))
                    {
                    }
                    else
                    {
                        this.txtBankCode.Focus();
                        throw new Exception("金融機関コードは数字で入力してください");
                    }
                }

                // 支店コード
                if (txtShitenCode.Text.ToString().Trim() != "")
                {
                    str = this.txtShitenCode.Text.ToString();

                    if (double.TryParse(str, System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.InvariantInfo, out d))
                    {
                    }
                    else
                    {
                        this.txtShitenCode.Focus();
                        throw new Exception("支店コードは数字で入力してください");
                    }
                }

                // マイナンバー
                if (txtMyNumber.Text != string.Empty)
                {
                    if (Utility.strToLong(txtMyNumber.Text) == 0)
                    {
                        this.txtShitenCode.Focus();
                        throw new Exception("マイナンバーは数字で入力してください");
                    }

                    if (txtMyNumber.Text.Length != 12)
                    {
                        this.txtShitenCode.Focus();
                        throw new Exception("マイナンバーは数字で12桁入力してください");
                    }
                }

                //クラスにデータセット
                cMaster.ID   = Convert.ToInt32(txtCode.Text.ToString());
                cMaster.氏名   = txtName1.Text.ToString();
                cMaster.フリガナ = txtFuri.Text.ToString();

                if (mtxtZipCode.Text.ToString().Replace("-", "").Trim() == "")
                {
                    cMaster.郵便番号 = "";
                }
                else
                {
                    cMaster.郵便番号 = mtxtZipCode.Text.ToString();
                }

                cMaster.住所     = txtAddress.Text.ToString();
                cMaster.携帯電話番号 = txtMobile.Text.ToString();
                cMaster.自宅電話番号 = txtTel.Text.ToString();
                cMaster.PCアドレス = txteMail.Text.ToString();
                cMaster.携帯アドレス = txteMailm.Text.ToString();

                if (iDate.Checked == false)
                {
                    cMaster.登録日 = "";
                }
                else
                {
                    cMaster.登録日 = iDate.Value.ToShortDateString();
                }

                if (chkKinmu.Checked == true)
                {
                    cMaster.勤務区分 = 1;
                }
                else
                {
                    cMaster.勤務区分 = 0;
                }

                if (chkGaitou.Checked == true)
                {
                    cMaster.街頭配布区分 = 1;
                }
                else
                {
                    cMaster.街頭配布区分 = 0;
                }

                cMaster.街頭配布備考 = txtGaitouMemo.Text.ToString();
                cMaster.支払区分   = cmbShiharai.Text;

                if (cmbShozoku.SelectedIndex == -1)
                {
                    cMaster.事業所コード = 0;
                }
                else
                {
                    Utility.ComboOffice cmb1 = new Utility.ComboOffice();
                    cmb1           = (Utility.ComboOffice)cmbShozoku.SelectedItem;
                    cMaster.事業所コード = cmb1.ID;
                }

                cMaster.金融機関コード = txtBankCode.Text.ToString().Trim();
                cMaster.金融機関名   = txtBank.Text.ToString();

                if (txtBankFuri.Text.ToString().Length > 15)
                {
                    cMaster.金融機関名カナ = txtBankFuri.Text.ToString().Substring(0, 15);
                }
                else
                {
                    cMaster.金融機関名カナ = txtBankFuri.Text.ToString();
                }

                cMaster.支店コード = txtShitenCode.Text.ToString().Trim();
                cMaster.支店名   = txtShiten.Text.ToString();

                if (txtShitenFuri.Text.ToString().Length > 15)
                {
                    cMaster.支店名カナ = txtShitenFuri.Text.ToString().Substring(0, 15);
                }
                else
                {
                    cMaster.支店名カナ = txtShitenFuri.Text.ToString();
                }

                if (cmbShubetsu.SelectedIndex == -1)
                {
                    cMaster.口座種別 = 0;
                }
                else
                {
                    Utility.ComboKouza cmb2 = new Utility.ComboKouza();
                    cmb2         = (Utility.ComboKouza)cmbShubetsu.SelectedItem;
                    cMaster.口座種別 = cmb2.ID;
                }

                cMaster.口座番号   = txtKouza.Text.ToString();
                cMaster.口座名義カナ = txtMeigi.Text.ToString();
                cMaster.備考     = txtMemo.Text.ToString();

                if (fMode.Mode == 0)
                {
                    cMaster.登録年月日 = DateTime.Now;
                    cMaster.更年月日  = DateTime.Now;
                }
                else
                {
                    cMaster.更年月日 = DateTime.Now;
                }

                cMaster.マイナンバー = txtMyNumber.Text;      // 2015/07/16
                cMaster.ユーザーID = global.loginUserID;    // 2015/07/16

                return(true);
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, MESSAGE_CAPTION + "保守", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
        }
Пример #3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int officeID, tYear, tMonth, zYear, zMonth;

            try
            {
                if (comboBox1.SelectedIndex == -1)
                {
                    MessageBox.Show("事業所を選択してください", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    comboBox1.Focus();
                    return;
                }

                if (Utility.NumericCheck(txtYear.Text) == false)
                {
                    MessageBox.Show("対象年は数字で入力してください", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtYear.Focus();
                    return;
                }

                if (Utility.NumericCheck(txtMonth.Text) == false)
                {
                    MessageBox.Show("対象月は数字で入力してください", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtMonth.Focus();
                    return;
                }

                if (int.Parse(txtMonth.Text, System.Globalization.NumberStyles.Any) < 1 || int.Parse(txtMonth.Text, System.Globalization.NumberStyles.Any) > 12)
                {
                    MessageBox.Show("対象月が正しくありません", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtMonth.Focus();
                    return;
                }

                //当月
                tYear  = int.Parse(txtYear.Text, System.Globalization.NumberStyles.Any);
                tMonth = int.Parse(txtMonth.Text, System.Globalization.NumberStyles.Any);

                //前月
                if (tMonth == 1)
                {
                    zYear  = tYear - 1;
                    zMonth = 12;
                }
                else
                {
                    zYear  = tYear;
                    zMonth = tMonth - 1;
                }

                //事業所コード
                Utility.ComboOffice cmb1 = new Utility.ComboOffice();
                cmb1     = (Utility.ComboOffice)comboBox1.SelectedItem;
                officeID = cmb1.ID;

                //データ表示
                GridviewSet.ShowData(dataGridView1, tYear, tMonth, zYear, zMonth, officeID);

                //見出し書き換え
                dataGridView1.Columns[2].HeaderText  = zMonth.ToString() + "月度実績";
                dataGridView1.Columns[3].HeaderText  = tMonth.ToString() + "月度実績";
                dataGridView1.Columns[6].HeaderText  = zMonth.ToString() + "月度収支";
                dataGridView1.Columns[7].HeaderText  = tMonth.ToString() + "月度収支";
                dataGridView1.Columns[10].HeaderText = zMonth.ToString() + "月配布員";
                dataGridView1.Columns[11].HeaderText = tMonth.ToString() + "月配布員";

                if (dataGridView1.RowCount > 0)
                {
                    btnPrn.Enabled  = true;
                    button1.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "選択", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }