예제 #1
0
        //「登録」ボタンの押下
        private void btnReg_Click(object sender, EventArgs e)
        {
            if (txtName.Text == "")
            {
                MessageBox.Show("すべての情報を入力してください");
                txtName.Focus();
                return;
            }
            if (txtLoginID.Text == "")
            {
                MessageBox.Show("すべての情報を入力してください");
                txtLoginID.Focus();
                return;
            }
            if (txtPass.Text == "")
            {
                MessageBox.Show("すべての情報を入力してください");
                txtPass.Focus();
                return;
            }

            //DB確認
            string       StoreName = "SP_INSERT_USERS";
            DialogResult result    = MessageBox.Show("登録して欲しいですか。", "確認", MessageBoxButtons.YesNo);



            if (result == DialogResult.Yes)
            {
                DataTable _mchek = new DataConfig().getTable("select * from EMPLOYEE where Employee_LoginID='" + txtLoginID.Text + "'");
                if (_mchek != null && _mchek.Rows.Count > 0)
                {
                    MessageBox.Show("ユーザが存在しました。");
                    txtLoginID.Focus();
                    return;
                }
                else
                {
                    DataConfig clins = new DataConfig();

                    if (cmbBumon.SelectedIndex == -1)
                    {
                        cmbBumon.SelectedIndex = 0;
                    }
                    GlobalVariables.Item it = (GlobalVariables.Item)cmbBumon.SelectedItem;

                    string SQL = "exec " + StoreName + " 0,N'" + txtName.Text.ToString() + "',N'" + txtLoginID.Text + "',N'" + txtPass.Text + "',N'" + txtSiteName.Text + "'," + it.Value + ",0";
                    clins.Excute(SQL);
                    lblInf.Text    = "登録に成功しました。";
                    btnReg.Enabled = false;
                }
            }
        }
예제 #2
0
        private void frmUsers_Load(object sender, EventArgs e)
        {
            disablecontrol(false);
            btnSave.Enabled = false;
            btnDel.Enabled  = false;
            GENUSERS();

            DataConfig clsdt  = new DataConfig();
            DataTable  _mdata = clsdt.getTable("exec [GET_ALLEMPLOYEE_DETAIL] '" + GlobalVariables.User + "'");

            if (_mdata != null)
            {
                txtID.Text         = _mdata.Rows[0]["Employee_id"].ToString();
                txtName.Text       = _mdata.Rows[0]["氏名"].ToString();
                txtUser.Text       = _mdata.Rows[0]["社員ID"].ToString();
                txtSiteName.Text   = _mdata.Rows[0]["サイト名"].ToString();
                chkIsadmin.Checked = true;
                if (_mdata.Rows[0]["IsAdmin"].ToString() == "0")
                {
                    chkIsadmin.Checked = false;
                }
                cmbbumon.Items.Clear();
                clsdt = new DataConfig();
                DataTable _mbumon = clsdt.getTable("select * from BUMON");
                if (_mbumon != null)
                {
                    for (int j = 0; j < _mbumon.Rows.Count; j++)
                    {
                        cmbbumon.Items.Add(new GlobalVariables.Item(_mbumon.Rows[j]["Bumon_Name"].ToString().ToUpper(), _mbumon.Rows[j]["ID"].ToString().ToUpper()));
                    }
                    for (int j = 0; j < cmbbumon.Items.Count; j++)
                    {
                        GlobalVariables.Item it = (GlobalVariables.Item)cmbbumon.Items[j];

                        if (it.Value == _mdata.Rows[0]["BUMON_ID"].ToString())
                        {
                            cmbbumon.SelectedItem = it;
                        }
                    }
                }
            }
            if (GlobalVariables.IsAdmin == 0)
            {
                groupControl1.Visible = false;
                btnSave.Enabled       = false;
                btnDel.Enabled        = false;
                btnNew.Enabled        = false;
                disablecontrol(false);
            }
        }
예제 #3
0
        private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            for (int i = 0; i < gridView1.SelectedRowsCount; i++)
            {
                if (gridView1.GetSelectedRows()[i] >= 0)
                {
                    int    slrow = gridView1.GetSelectedRows()[i];
                    string uname = gridView1.GetRowCellValue(slrow, gridView1.Columns["社員ID"]).ToString();
                    IDGD = int.Parse(gridView1.GetRowCellValue(slrow, gridView1.Columns["Employee_id"]).ToString());
                    DataConfig clsget = new DataConfig();
                    DataTable  _mdt   = clsget.getTable("GET_ALLEMPLOYEE_DETAIL '" + uname.ToString() + "'");
                    if (_mdt != null && _mdt.Rows.Count > 0)
                    {
                        txtID.Text         = _mdt.Rows[0]["Employee_id"].ToString();
                        txtName.Text       = _mdt.Rows[0]["氏名"].ToString();
                        txtUser.Text       = _mdt.Rows[0]["社員ID"].ToString();
                        txtSiteName.Text   = _mdt.Rows[0]["サイト名"].ToString();
                        chkIsadmin.Checked = true;
                        if (_mdt.Rows[0]["IsAdmin"].ToString() == "0")
                        {
                            chkIsadmin.Checked = false;
                        }
                        cmbbumon.Items.Clear();
                        DataConfig clsdt   = new DataConfig();
                        DataTable  _mbumon = clsdt.getTable("select * from BUMON");
                        if (_mbumon != null)
                        {
                            for (int j = 0; j < _mbumon.Rows.Count; j++)
                            {
                                cmbbumon.Items.Add(new GlobalVariables.Item(_mbumon.Rows[j]["BUMON_NAME"].ToString().ToUpper(), _mbumon.Rows[j]["id"].ToString().ToUpper()));
                            }
                            for (int j = 0; j < cmbbumon.Items.Count; j++)
                            {
                                GlobalVariables.Item it = (GlobalVariables.Item)cmbbumon.Items[j];

                                if (it.Value == _mdt.Rows[0]["BUMON_ID"].ToString())   //cái bumon id minh bo ko để hiển thị nữa
                                {
                                    cmbbumon.SelectedItem = it;
                                }
                            }
                        }

                        btnDel.Enabled  = true;
                        btnSave.Enabled = true;
                        IsNew           = 0; isUpdate = 1;
                        disablecontrol(true);
                    }
                }
            }
        }
예제 #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string StoreName = "", strconfirm = "";

            if (IsNew == 1)
            {
                StoreName  = "SP_INSERT_USERS";
                strconfirm = "追加してよろしいでしょうか?";
            }
            else if (isUpdate == 1)
            {
                StoreName  = "SP_UPDATE_USERS";
                strconfirm = "更新してよろしいでしょうか?";
            }
            //    #region
            DialogResult result = MessageBox.Show(strconfirm, "確認", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                DataConfig clins = new DataConfig();
                int        isad  = 0;
                if (chkIsadmin.Checked == true)
                {
                    isad = 1;
                }
                if (cmbbumon.SelectedIndex == -1)
                {
                    cmbbumon.SelectedIndex = 0;
                }
                GlobalVariables.Item it = (GlobalVariables.Item)cmbbumon.SelectedItem;

                string SQL = "exec " + StoreName + " " + IDGD.ToString() + ",N'" + txtName.Text.ToString() + "',N'" + txtUser.Text + "',N'" + txtPass.Text + "',N'" + txtSiteName.Text + "'," + it.Value + "," + isad + "";
                clins.Excute(SQL);

                Clear();
                btnSave.Enabled = false;
                btnDel.Enabled  = false;
                GENUSERS();
                IDGD = 0;
                MessageBox.Show("追加しました。");
            }
        }