Beispiel #1
0
        private void btnSel_Click(object sender, EventArgs e)
        {
            string sDate = string.Empty;
            int    sCode;

            //エラーチェック
            if (!ErrCheck())
            {
                return;
            }

            //開始部門コード取得
            if (cmbBumonS.SelectedIndex == -1)
            {
                sCode = 0;
            }
            else
            {
                Utility.ComboBumon cmbs = new Utility.ComboBumon();
                cmbs  = (Utility.ComboBumon)cmbBumonS.SelectedItem;
                sCode = Utility.StrtoInt(cmbs.ID);
            }

            //データ表示
            GridViewShowData(dg1, comboBox1.SelectedIndex, sCode.ToString(), Utility.StrtoInt(txtYear.Text), Utility.StrtoInt(txtMonth.Text));
        }
Beispiel #2
0
 private void cmbSz_SelectedIndexChanged(object sender, EventArgs e)
 {
     // 所属・帳票区分対応テーブルより該当する帳票区分を取得して同期をとる
     if (cmbSz.SelectedItem != null)
     {
         Utility.ComboBumon cmb = (Utility.ComboBumon)cmbSz.SelectedItem;
         cmbChohyo.SelectedValue = Utility.getChohyoKbn(Utility.StrtoInt(cmb.ID));
     }
 }
Beispiel #3
0
        ///-----------------------------------------------------------
        /// <summary>
        ///     個別印刷対象者情報をグリッドビューへ追加します </summary>
        ///-----------------------------------------------------------
        private void gridViewAdd()
        {
            // 社員未選択
            if (comboBox1.SelectedIndex == -1)
            {
                MessageBox.Show("印刷する社員を選択して下さい", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                comboBox1.Focus();
                return;
            }

            // 所属未選択
            if (comboBox2.SelectedIndex == -1)
            {
                MessageBox.Show("所属を選択して下さい", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                comboBox2.Focus();
                return;
            }

            // グリッドへ追加
            dg1.Rows.Add();
            dg1[0, dg1.Rows.Count - 1].Value = "True";

            // 部門コンボ情報
            Utility.ComboBumon cmbB = (Utility.ComboBumon)comboBox2.SelectedItem;
            dg1[1, dg1.Rows.Count - 1].Value = cmbB.code;
            dg1[2, dg1.Rows.Count - 1].Value = cmbB.Name;

            // 社員コンボ情報
            Utility.ComboShain cmbS = (Utility.ComboShain)comboBox1.SelectedItem;
            dg1[3, dg1.Rows.Count - 1].Value = cmbS.code;
            dg1[4, dg1.Rows.Count - 1].Value = cmbS.Name;
            dg1[5, dg1.Rows.Count - 1].Value = "";

            // コンボボックスクリア
            comboBox1.SelectedIndex = -1;
            comboBox1.Text          = string.Empty;
            comboBox2.SelectedIndex = -1;
            comboBox2.Text          = string.Empty;
        }
Beispiel #4
0
        private void btnSel_Click(object sender, EventArgs e)
        {
            string sDate = string.Empty;
            int    sCode;
            int    eCode;
            int    sNo;
            int    eNo;

            //エラーチェック
            if (ErrCheck() == false)
            {
                return;
            }

            //基準日付
            sDate = (int.Parse(txtYear.Text) + Properties.Settings.Default.RekiHosei).ToString() + "/" + txtMonth.Text + "/01";

            //開始部門コード取得
            if (cmbBumonS.SelectedIndex == -1)
            {
                sCode = 0;
            }
            else
            {
                Utility.ComboBumon cmbs = new Utility.ComboBumon();
                cmbs  = (Utility.ComboBumon)cmbBumonS.SelectedItem;
                sCode = Utility.StrtoInt(cmbs.ID);
            }

            //終了部門コード取得
            if (cmbBumonE.SelectedIndex == -1)
            {
                eCode = 999999;
            }
            else
            {
                Utility.ComboBumon cmbe = new Utility.ComboBumon();
                cmbe  = (Utility.ComboBumon)cmbBumonE.SelectedItem;
                eCode = Utility.StrtoInt(cmbe.ID);
            }

            //開始社員番号取得
            if (txtSNo.Text == string.Empty)
            {
                sNo = 0;
            }
            else
            {
                sNo = Utility.StrtoInt(txtSNo.Text);
            }

            //終了社員番号取得
            if (txtENo.Text == string.Empty)
            {
                eNo = 9999;
            }
            else
            {
                eNo = Utility.StrtoInt(txtENo.Text);
            }

            //データ表示
            GridViewShowData(dg1, sCode, eCode, sNo, eNo);

            // タイムカード打刻データ印字チェックボックス表示:2018/10/12
            setTimeCardChk();
        }
Beispiel #5
0
        private void btnSel_Click(object sender, EventArgs e)
        {
            string sDate = string.Empty;
            int    sCode;
            int    eCode;
            string sNo;
            string eNo;

            //エラーチェック
            if (!ErrCheck())
            {
                return;
            }

            //開始部門コード取得
            if (cmbBumonS.SelectedIndex == -1 || cmbBumonS.Text == string.Empty)
            {
                sCode = 0;
            }
            else
            {
                Utility.ComboBumon cmbs = new Utility.ComboBumon();
                cmbs  = (Utility.ComboBumon)cmbBumonS.SelectedItem;
                sCode = Utility.StrtoInt(cmbs.code);
            }

            //終了部門コード取得
            if (cmbBumonE.SelectedIndex == -1 || cmbBumonE.Text == string.Empty)
            {
                string endingCode = "9";
                eCode = int.Parse(endingCode.PadLeft(global.ShozokuMaxLength, '9'));
                //eCode = 999;
            }
            else
            {
                Utility.ComboBumon cmbe = new Utility.ComboBumon();
                cmbe  = (Utility.ComboBumon)cmbBumonE.SelectedItem;
                eCode = Utility.StrtoInt(cmbe.code);
            }

            //開始社員番号取得
            if (txtSNo.Text == string.Empty)
            {
                sNo = "00000";
            }
            else
            {
                sNo = txtSNo.Text.Trim().PadLeft(global.ShainLength, '0');
            }

            //終了社員番号取得
            if (txtENo.Text == string.Empty)
            {
                eNo = "99999";
            }
            else
            {
                eNo = txtENo.Text.Trim().PadLeft(global.ShainLength, '0');
            }

            //データ表示
            if (_pMode == global.XLS_MODE)
            {
                // エクセルモード
                GridViewShowXls(dg1, sCode, eCode, sNo, eNo, xS);
            }
            else if (_pMode == global.CSV_MODE)
            {
                // CSVモード
                GridViewShowData(dg1, sCode, eCode, sNo, eNo, csvArray);
            }
        }
Beispiel #6
0
        ///----------------------------------------------------------------
        /// <summary>
        ///     配列からコンボボックスにロードする </summary>
        /// <param name="tempObj">
        ///     コンボボックスオブジェクト</param>
        /// <param name="fName">
        ///     CSVデータファイルパス</param>
        /// <param name="cmbKbn">
        ///     0:社員コンボボックス、1:部門コンボボックス</param>
        ///----------------------------------------------------------------
        private static void arrayCmbLoad(ComboBox tempObj, Utility.xlsShain [] x, int cmbKbn)
        {
            string tl = "";

            try
            {
                if (cmbKbn == global.flgOff)
                {
                    tl = "社員";
                }
                else
                {
                    tl = "部門";
                }

                Utility.ComboBumon cmb1;    // 部門コンボボックス
                Utility.ComboShain cmbS;    // 社員コンボボックス

                tempObj.Items.Clear();
                tempObj.DisplayMember = "DisplayName";
                tempObj.ValueMember   = "code";

                // 社員名簿配列読み込み
                System.Collections.ArrayList al = new System.Collections.ArrayList();
                string bn = "";

                foreach (var t in x)
                {
                    if (cmbKbn == global.flgOff)
                    {
                        // 社員
                        bn = t.sCode.ToString().PadLeft(5, '0') + "," + t.sName + "";
                    }
                    else
                    {
                        // 部門
                        bn = t.bCode.ToString().PadLeft(5, '0') + "," + t.bName + "";
                    }

                    al.Add(bn);
                }

                // 配列をソートします
                al.Sort();

                string alCode = string.Empty;

                foreach (var item in al)
                {
                    string[] d = item.ToString().Split(',');

                    // 重複はネグる
                    if (alCode != string.Empty && alCode.Substring(0, 5) == d[0])
                    {
                        continue;
                    }

                    // コンボボックスにセット
                    if (cmbKbn == global.flgOn)
                    {
                        // 部門コンボボックス
                        cmb1             = new Utility.ComboBumon();
                        cmb1.ID          = 0;
                        cmb1.DisplayName = item.ToString().Replace(',', ' ');

                        string[] cn = item.ToString().Split(',');
                        cmb1.Name = cn[1] + "";
                        cmb1.code = cn[0] + "";
                        tempObj.Items.Add(cmb1);
                    }
                    else if (cmbKbn == global.flgOff)
                    {
                        // 社員コンボボックス
                        cmbS             = new Utility.ComboShain();
                        cmbS.ID          = 0;
                        cmbS.DisplayName = item.ToString().Replace(',', ' ');

                        string[] cn = item.ToString().Split(',');
                        cmbS.Name = cn[1] + "";
                        cmbS.code = cn[0] + "";
                        tempObj.Items.Add(cmbS);
                    }

                    alCode = item.ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, tl + "コンボボックスロード");
            }
        }
Beispiel #7
0
        //登録データチェック
        private Boolean fDataCheck()
        {
            try
            {
                //登録モードのとき番号をチェック
                if (fMode.Mode == global.FORM_ADDMODE)
                {
                    string str = this.txtID.Text;

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

                    //ゼロは不可 : 2014/06/23 0:半休あり
                    //if (this.txtID.Text.ToString() == "0")
                    //{
                    //    this.txtID.Focus();
                    //    throw new Exception("ゼロは登録できません");
                    //}

                    //登録済みコードか調べる
                    MTYSDataSet.社員所属Row r = dts.社員所属.FindBy社員番号(Utility.StrtoInt(txtID.Text));
                    if (r != null)
                    {
                        txtID.Focus();
                        throw new Exception("既に登録済みのコードです");
                    }
                }

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

                // 所属コンボボックス
                if (cmbSz.SelectedIndex == -1)
                {
                    cmbSz.Focus();
                    throw new Exception("所属を選択してください");
                }

                // 在職区分
                if (cmbTaishoku.SelectedIndex == -1)
                {
                    cmbTaishoku.Focus();
                    throw new Exception("在職区分を選択してください");
                }

                // 帳票区分
                if (cmbChohyo.SelectedIndex == -1)
                {
                    cmbChohyo.Focus();
                    throw new Exception("帳票区分を選択してください");
                }

                // 所属・帳票区分対応テーブルより該当する帳票区分を取得して同期をとる
                if (cmbSz.SelectedItem != null)
                {
                    Utility.ComboBumon cmb = (Utility.ComboBumon)cmbSz.SelectedItem;
                    if (cmbChohyo.SelectedValue.ToString() != Utility.getChohyoKbn(Utility.StrtoInt(cmb.ID)).ToString())
                    {
                        cmbChohyo.Focus();
                        throw new Exception("所属に該当しない帳票区分です");
                    }
                }

                // 大阪製造部グループ
                if (cmbOosaka.SelectedIndex == -1)
                {
                    cmbOosaka.Focus();
                    throw new Exception("大阪製造部グループを選択してください");
                }

                if (cmbChohyo.SelectedValue.ToString() == "3" && cmbOosaka.SelectedIndex == 0)
                {
                    if (MessageBox.Show("大阪製造部グループが未選択状態です" + Environment.NewLine + "グループを選択しますか?", "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        cmbOosaka.Focus();
                        return(false);
                    }
                }

                return(true);
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, msName + "保守", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
        }
Beispiel #8
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            //エラーチェック
            if (!fDataCheck())
            {
                return;
            }

            switch (fMode.Mode)
            {
            // 新規登録
            case global.FORM_ADDMODE:

                // 確認
                if (MessageBox.Show(txtName.Text + "を登録します。よろしいですか?", "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }

                // データセットにデータを追加します
                Utility.ComboBumon cmb = (Utility.ComboBumon)cmbSz.SelectedItem;
                dts.社員所属.Add社員所属Row(Utility.StrtoInt(txtID.Text), txtName.Text, txtFuri.Text, Utility.StrtoInt(cmb.ID), cmb.DisplayName, Utility.StrtoInt(txtShokukyu.Text), Utility.StrtoInt(txtShikaku.Text), cmbTaishoku.SelectedIndex, Utility.StrtoInt(cmbChohyo.SelectedValue.ToString()), cmbOosaka.SelectedItem.ToString(), txtMemo.Text, DateTime.Now, cmbTmData.SelectedIndex);

                break;

            // 更新処理
            case global.FORM_EDITMODE:

                // 確認
                if (MessageBox.Show(txtName.Text + "を更新します。よろしいですか?", "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }

                // データセット更新
                var r = dts.社員所属.Single(a => a.RowState != DataRowState.Deleted && a.RowState != DataRowState.Detached && a.社員番号 == Utility.StrtoInt(fMode.ID));

                if (!r.HasErrors)
                {
                    r.氏名   = txtName.Text;
                    r.フリガナ = txtFuri.Text;

                    cmb     = (Utility.ComboBumon)cmbSz.SelectedItem;
                    r.所属コード = Utility.StrtoInt(cmb.ID);
                    r.所属名称  = cmb.DisplayName;

                    r.職級          = Utility.StrtoInt(txtShokukyu.Text);
                    r.資格          = Utility.StrtoInt(txtShikaku.Text);
                    r.退職区分        = cmbTaishoku.SelectedIndex;
                    r.帳票区分        = Utility.StrtoInt(cmbChohyo.SelectedValue.ToString());
                    r.大阪製造部勤務グループ = cmbOosaka.SelectedItem.ToString();
                    r.備考          = txtMemo.Text;
                    r.更新年月日       = DateTime.Now;
                    r.出勤簿タイムカード印字 = cmbTmData.SelectedIndex;        // 2018/10/12
                }
                else
                {
                    MessageBox.Show(fMode.ID + "がキー不在です:データの更新に失敗しました", "更新エラー", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

                break;

            default:
                break;
            }

            // グリッドデータ再表示
            GridViewShow(dg);

            // 画面データ消去
            DispInitial();
        }