public void InsertWordDic(WordDic entity) { context.WordDic.Add(entity); context.SaveChanges(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void shounin_Click(object sender, EventArgs e) { if (!this.shouninPreCheck(this.shinseiDataGridView1)) { return; } List<WordDic> shinseiWordDicList = new List<WordDic>(); 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("aaaaaaaa")) { 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(); shinseiWordDicList.Add(word); } } MessageBox.Show(MessageConst.CONF_002); if (!this.mailSend(shinseiWordDicList, (int)ShinseiKbn.承認)) { return; } this.Shinsei_Load(sender, e); }