/// <summary> /// ログインボタンクリックアクション /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void loginBtn_Click(object sender, EventArgs e) { CommonFunction common = new CommonFunction(); common.setDbPath(this.dataSourcePath.Text); using (var context = new MyContext()) { long condtion = Convert.ToInt64(this.UserId.Text); var w = context.UserMst.Where(x => x.EMP_ID == condtion && x.SANKA_KAHI == 0).ToArray(); if (w.Count() == 0) { MessageBox.Show( MessageConst.ERR_007, System.Windows.Forms.Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (w.Count() == 1) { WordConverter.Settings1.Default.UserId = this.UserId.Text; WordConverter.Settings1.Default.DataSource = this.dataSourcePath.Text; WordConverter.Settings1.Default.Save(); UserInfoBo userInfo = new UserInfoBo(); userInfo.kengen = w[0].KENGEN; userInfo.userId = w[0].USER_ID; userInfo.hotKey = WordConverter.Settings1.Default.HotKey; BaseForm form = new BaseForm(userInfo); this.Close(); return; } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void shounin_Click(object sender, EventArgs e) { int upCount = 0; for (int i = 0; i < shinseiDataGridView1.Rows.Count; i++) { if (shinseiDataGridView1.Rows[i].Cells[0].Value == null || (bool)shinseiDataGridView1.Rows[i].Cells[0].Value == false) { continue; } using (var context = new MyContext()) { long condtion = Convert.ToInt64(this.shinseiDataGridView1.Rows[i].Cells["SHINSEI_ID"].Value.ToString()); var w = context.WordShinsei.Single(x => x.SHINSEI_ID == condtion); w.CRE_DATE = System.DateTime.Now.ToString(); w.STATUS = 1; WordDic word = new WordDic(); word.RONRI_NAME1 = Convert.ToString(this.shinseiDataGridView1.Rows[i].Cells["RONRI_NAME1"].Value); word.RONRI_NAME2 = Convert.ToString(this.shinseiDataGridView1.Rows[i].Cells["RONRI_NAME2"].Value); word.BUTSURI_NAME = Convert.ToString(this.shinseiDataGridView1.Rows[i].Cells["BUTSURI_NAME"].Value); word.USER_ID = BaseForm.UserInfo.userId; word.CRE_DATE = System.DateTime.Now.ToString(); context.WordDic.Add(word); context.SaveChanges(); upCount++; } } if (upCount == 0) { MessageBox.Show(MessageConst.ERR_004); return; } MessageBox.Show(MessageConst.CONF_002); this.Shinsei_Load(sender, e); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void kyakka_Click(object sender, EventArgs e) { int upCount = 0; for (int i = 0; i < shinseiDataGridView1.Rows.Count; i++) { if (shinseiDataGridView1.Rows[i].Cells[0].Value == null || (bool)shinseiDataGridView1.Rows[i].Cells[0].Value == false) { continue; } using (var context = new MyContext()) { long condtion = Convert.ToInt64(this.shinseiDataGridView1.Rows[i].Cells["SHINSEI_ID"].Value.ToString()); var w = context.WordShinsei.Single(x => x.SHINSEI_ID == condtion); w.CRE_DATE = System.DateTime.Now.ToString(); w.STATUS = 2; context.SaveChanges(); } upCount++; } if (upCount == 0) { MessageBox.Show(MessageConst.ERR_004); return; } MessageBox.Show(MessageConst.CONF_003); this.Shinsei_Load(sender, e); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void delete_Click(object sender, EventArgs e) { bool isExistCheck = false; 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; } using (var context = new MyContext()) { long condtion = Convert.ToInt64(this.userKanriDataGridView1.Rows[i].Cells["USER_ID"].Value.ToString()); var u = context.UserMst.Single(x => x.USER_ID == condtion); u.DELETE_FLG = 1; u.CRE_DATE = System.DateTime.Now.ToString(); context.SaveChanges(); } isExistCheck = true; } if (!isExistCheck) { MessageBox.Show( MessageConst.ERR_005, "入力エラー", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } MessageBox.Show(MessageConst.CONF_005); this.searchAction(ref userKanriDataGridView1, this); }