Exemple #1
0
        private void ユーザー管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            UserKanri form = UserKanri.Instance;

            form.Activate();
            form.Show();
        }
Exemple #2
0
        /// <summary>
        /// 検索アクション
        /// </summary>
        /// <param name="userKanriDataGridView1"></param>
        /// <param name="userKanri"></param>
        /// <param name="isDoneRegist"></param>
        private void searchAction(ref DataGridView userKanriDataGridView1, UserKanri userKanri, bool isDoneRegist)
        {
            errorProvider1.SetError(userKanri.empId, "");
            errorProvider1.SetError(userKanri.userName, "");
            errorProvider1.SetError(userKanri.kengen, "");

            if (!isDoneRegist && !this.searchPreCheck(userKanriDataGridView1))
            {
                return;
            }

            UserKanriSearchServiceInBo userSearchServiceInBo = new UserKanriSearchServiceInBo();
            UserKanriSearchService     userSearchService     = new UserKanriSearchService();

            userSearchServiceInBo.empId               = userKanri.empId.Text;
            userSearchServiceInBo.userName            = userKanri.userName.Text;
            userSearchServiceInBo.kengenSelectedIndex = userKanri.kengen.SelectedIndex;
            userSearchService.setInBo(userSearchServiceInBo);
            UserKanriSearchServiceOutBo userSearchServiceOutBo = userSearchService.execute();

            userKanriDataGridView1.DataSource = userSearchServiceOutBo.usersList;
            this.kensu.Text = userSearchServiceOutBo.usersList.Count.ToString();

            this.userKanriViewSetthing(ref userKanriDataGridView1);
        }
Exemple #3
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);
        }
Exemple #4
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;
        }
Exemple #5
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);
        }
Exemple #6
0
        /// <summary>
        /// 検索アクション
        /// </summary>
        /// <param name="userKanriDataGridView1"></param>
        /// <param name="userKanri"></param>
        /// <param name="isDoneRegist"></param>
        private void searchAction(ref DataGridView userKanriDataGridView1, UserKanri userKanri, bool isDoneRegist)
        {
            errorProvider1.SetError(userKanri.empId, "");
            errorProvider1.SetError(userKanri.userName, "");
            errorProvider1.SetError(userKanri.kengen, "");

            if (!isDoneRegist && !this.searchPreCheck(userKanriDataGridView1))
            {
                return;
            }

            UserKanriSearchServiceInBo userSearchServiceInBo = new UserKanriSearchServiceInBo();
            UserKanriSearchService userSearchService = new UserKanriSearchService();
            userSearchServiceInBo.empId = userKanri.empId.Text;
            userSearchServiceInBo.userName = userKanri.userName.Text;
            userSearchServiceInBo.kengenSelectedIndex = userKanri.kengen.SelectedIndex;
            userSearchService.setInBo(userSearchServiceInBo);
            UserKanriSearchServiceOutBo userSearchServiceOutBo = userSearchService.execute();
            userKanriDataGridView1.DataSource = userSearchServiceOutBo.usersList;
            this.kensu.Text = userSearchServiceOutBo.usersList.Count.ToString();

            this.userKanriViewSetthing(ref userKanriDataGridView1);
        }
Exemple #7
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;
        }