Ejemplo n.º 1
0
        private void loginAction(Login form, UserInfoBo userInfo)
        {
            MyRepository rep = new MyRepository(userInfo.dbType);
            UserMst userMst = rep.FindSankaUserByEmpId(form.UserId.Text.ToIntType());

            if (userMst.user_id == 0)
            {
                MessageBox.Show(
                    MessageConst.ERR_007,
                    System.Windows.Forms.Application.ProductName,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);

                return;
            }
            WordConverter_v2.Settings1.Default.UserId = this.UserId.Text;
            WordConverter_v2.Settings1.Default.FukusuRiyou = this.fukusuRdo.Checked;
            WordConverter_v2.Settings1.Default.KojinRiyou = this.kojinRdo.Checked;
            WordConverter_v2.Settings1.Default.Save();
            userInfo.kengen = userMst.kengen;
            userInfo.userId = userMst.user_id;
            userInfo.empId = userMst.emp_id;
            userInfo.hotKey = WordConverter_v2.Settings1.Default.HotKey;
            BaseForm bForm = new BaseForm(userInfo);

            this.Close();
            return;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 追加前チェック
        /// </summary>
        /// <param name="form"></param>
        /// <returns></returns>
        private bool addPreCheck(UserKanri form)
        {
            bool isNgRequired = false;
            if (String.IsNullOrEmpty(form.empId.Text))
            {
                errorProvider1.SetError(form.empId, MessageConst.ERR_001);
                isNgRequired = true;
            }
            if (String.IsNullOrEmpty(form.userName.Text))
            {
                errorProvider1.SetError(form.userName, MessageConst.ERR_001);
                isNgRequired = true;
            }
            if (String.IsNullOrEmpty(form.kengen.Text) || form.kengen.Text.ToIntType() == 2)
            {
                errorProvider1.SetError(form.kengen, MessageConst.ERR_001);
                isNgRequired = true;
            }
            if (isNgRequired)
            {
                return false;
            }

            MyRepository rep = new MyRepository();
            UserMst mailUser = rep.FindMailingListUser();

            if (!String.IsNullOrEmpty(mailUser.user_name) && form.kengen.SelectedIndex == (int)KengenKbn.メーリングリスト)
            {
                errorProvider1.SetError(form.kengen, MessageConst.ERR_008);
                return false;
            }

            checkValList = new List<bool>();
            for (int i = 0; i < form.userKanriDataGridView1.Rows.Count; i++)
            {
                if (form.userKanriDataGridView1.Rows[i].Cells[0].Value != null &&
                    (bool)form.userKanriDataGridView1.Rows[i].Cells[0].Value != false)
                {
                    checkValList.Add((bool)form.userKanriDataGridView1.Rows[i].Cells[0].Value);
                    continue;
                }
                checkValList.Add(false);
            }
            return true;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 削除ボタンクリックイベント
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void delete_Click(object sender, EventArgs e)
 {
     if (!this.deletePreCheck(this))
     {
         return;
     }
     for (int i = 0; i < this.userKanriDataGridView1.Rows.Count; i++)
     {
         if (this.userKanriDataGridView1.Rows[i].Cells[0].Value == null
             || (bool)this.userKanriDataGridView1.Rows[i].Cells[0].Value == false)
         {
             continue;
         }
         MyRepository rep = new MyRepository();
         rep.DeleteUserByUserId(this.userKanriDataGridView1.Rows[i].Cells["user_id"].Value.ToString().ToKeyType());
     }
     MessageBox.Show(MessageConst.CONF_005);
     this.searchAction(ref userKanriDataGridView1, this, false);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 検索前チェック
        /// </summary>
        /// <param name="userKanriDataGridView1"></param>
        /// <returns></returns>
        private bool searchPreCheck(DataGridView userKanriDataGridView1)
        {
            for (int i = 0; i < userKanriDataGridView1.Rows.Count; i++)
            {
                if (userKanriDataGridView1.Rows[i].Cells["user_id"].Value.ToString().ToIntType() == 0)
                {
                    MyRepository rep = new MyRepository();
                    bool isExistUser = rep.IsExistUser(userKanriDataGridView1.Rows[i].Cells["emp_id"].Value.ToString().ToKeyType());
                    if (isExistUser)
                    {
                        continue;
                    }
                    DialogResult result = MessageBox.Show(
                        "追加した単語がクリアされますがよろしいですか?",
                        "確認",
                        MessageBoxButtons.OKCancel,
                        MessageBoxIcon.Question);

                    if (result == System.Windows.Forms.DialogResult.Cancel)
                    {
                        return false;
                    }
                }
            }
            return true;
        }
Ejemplo n.º 5
0
        private void sqliteTestConnectBtn_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("Data Source=" + this.sqliteDbFilePath.Text);
            sb.Append(";foreign keys=true;");
            CommonFunction common = new CommonFunction();
            string dbConnectionString = common.getDbConnectionString();
            string dbProviderName = common.getDbProviderName();

            try
            {
                using (SQLiteConnection cn = new SQLiteConnection(sb.ToString()))
                {
                    cn.Open();
                    SQLiteCommand cmd = cn.CreateCommand();
                    cmd.CommandText = "SELECT * FROM WORD_DIC";
                    cmd.ExecuteReader();

                    common.setSqliteDbContextPath(sb.ToString());
                    MyRepository rep = new MyRepository();
                    UserMst fromUser = rep.FindUserMstByUserId(999);

                    MessageBox.Show("DB接続に成功しました!!");
                    this.sqliteConnectableDbPath.Text = sb.ToString();
                    this.sqliteSaveBtn.Visible = true;
                    this.sqliteDbFilePath.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("DB接続失敗");
                common.resetDbContextPath(dbConnectionString, dbProviderName);
            }
        }