Esempio n. 1
0
        private void loginAction(Login form, UserInfoBo userInfo)
        {
            using (var context = new MyContext())
            {
                long condtion = Convert.ToInt64(form.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_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 = w[0].kengen;
                    userInfo.userId = w[0].user_id;
                    userInfo.empId = w[0].emp_id;
                    userInfo.hotKey = WordConverter_v2.Settings1.Default.HotKey;
                    BaseForm bForm = new BaseForm(userInfo);

                    this.Close();
                    return;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 削除前チェック
        /// </summary>
        /// <param name="userKanri"></param>
        /// <returns></returns>
        private bool deletePreCheck(UserKanri userKanri)
        {
            bool isExistCheck = false;
            for (int i = 0; i < userKanri.userKanriDataGridView1.Rows.Count; i++)
            {
                if (userKanri.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(userKanri.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 false;
            }
            DialogResult result = MessageBox.Show(
                MessageConst.CONF_010,
                "確認",
                MessageBoxButtons.OKCancel,
                MessageBoxIcon.Question);

            if (result == System.Windows.Forms.DialogResult.Cancel)
            {
                return false;
            }
            return true;
        }
 public MyRepository(string dbType)
 {
     context = new MyContext(dbType);
 }
Esempio n. 4
0
        /// <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);
        }