/// ---------------------------------------------------------------------- /// <summary> /// ログインタイプヘッダ、タグデータ表示 </summary> /// <param name="sID"> /// ヘッダID</param> /// ---------------------------------------------------------------------- private void getData(int sID) { // ログインタイプヘッダ DataSet1.ログインユーザーRow r = dts.ログインユーザー.Single(a => a.ID == sID); txtAccount.Text = r.アカウント; txtPassword.Text = r.パスワード; txtName.Text = r.前; txtMemo.Text = r.備考; // 処理モード fMode.Mode = 1; fMode.ID = r.ID; // ユーザーアカウント、パスワードの編集は不可とします txtAccount.Enabled = false; // パスワード編集チェック checkBox1.Visible = true; txtPassword.Enabled = false; txtPassword2.Enabled = false; // 削除、取消ボタンの使用を可能とします button2.Enabled = true; button4.Enabled = true; }
/// ------------------------------------------------------------------------- /// <summary> /// ログインタイプヘッダ、タグデータ登録 </summary> /// <param name="sMode"> /// 処理モード</param> /// <param name="sID"> /// ヘッダID</param> /// ------------------------------------------------------------------------- private void dataUpdate(int sMode, int sID) { // 新規登録 if (sMode == global.FORM_ADDMODE) { DataSet1.ログインユーザーRow r = dts.ログインユーザー.NewログインユーザーRow(); r.アカウント = txtAccount.Text; r.パスワード = txtPassword.Text; r.前 = txtName.Text; r.備考 = txtMemo.Text; r.更新年月日 = DateTime.Now; dts.ログインユーザー.AddログインユーザーRow(r); } else if (sMode == global.FORM_EDITMODE) // 更新 { DataSet1.ログインユーザーRow r = dts.ログインユーザー.Single(a => a.ID == sID); // パスワード変更のとき if (txtPassword.Visible) { r.パスワード = txtPassword.Text; } r.前 = txtName.Text; r.備考 = txtMemo.Text; r.更新年月日 = DateTime.Now; } // データベース更新 uAdp.Update(dts.ログインユーザー); // データ読み込み uAdp.Fill(dts.ログインユーザー); }
/// ---------------------------------------------------------------------- /// <summary> /// データ削除 </summary> /// <param name="sID"> /// ヘッダID</param> /// ---------------------------------------------------------------------- private void delData(int sID) { // ヘッダデータ削除 DataSet1.ログインユーザーRow hr = dts.ログインユーザー.Single(a => a.ID == sID); hr.Delete(); // データベース更新 uAdp.Update(dts.ログインユーザー); // データ読み込み uAdp.Fill(dts.ログインユーザー); }
/// -------------------------------------------------------------------------- /// <summary> /// ユーザーが登録されていないとき adminユーザーを自動登録する /// </summary> /// -------------------------------------------------------------------------- public void addAdminUser() { if (dts.ログインユーザー.Count() == 0) { DataSet1.ログインユーザーRow r = dts.ログインユーザー.NewログインユーザーRow(); r.アカウント = global.ADMIN_USER; r.パスワード = global.ADMIN_PASS; r.前 = "管理者"; r.備考 = ""; r.更新年月日 = DateTime.Now; dts.ログインユーザー.AddログインユーザーRow(r); // データベース登録 adp.Update(dts.ログインユーザー); } }
private void frmConfig_Load(object sender, EventArgs e) { Utility.WindowsMaxSize(this, this.Width, this.Height); Utility.WindowsMinSize(this, this.Width, this.Height); var s = dts.環境設定.Single(a => a.ID == global.configKEY); if (s.Is年Null()) { txtYear.Text = string.Empty; } else { txtYear.Text = s.年.ToString(); } if (s.Is月Null()) { txtMonth.Text = string.Empty; } else { txtMonth.Text = s.月.ToString(); } if (s.Is汎用データ出力先Null()) { txtCsvPath.Text = string.Empty; } else { txtCsvPath.Text = s.汎用データ出力先; } if (s.Is社員マスターパスNull()) { txtMstPath.Text = string.Empty; } else { txtMstPath.Text = s.社員マスターパス; } if (s.Isデータ保存月数Null()) { txtDataSpan.Text = string.Empty; } else { txtDataSpan.Text = s.データ保存月数.ToString(); } if (s.Is受信監視スパンNull()) { txtRecSpan.Text = string.Empty; } else { txtRecSpan.Text = s.受信監視スパン.ToString(); } // adminでログイン時のみログインユーザー登録可能とする btnUser.Visible = false; if (dts.ログインユーザー.Any(a => a.ID == global.loginUserID)) { DataSet1.ログインユーザーRow ur = dts.ログインユーザー.Single(a => a.ID == global.loginUserID); if (ur.アカウント == global.ADMIN_USER) { btnUser.Visible = true; } } }