示例#1
0
        private void btnInsertUpdate_Click(object sender, EventArgs e)
        {
            //[1] 사용자정보 VO객체 생성
            UserInfoProxyVO ui = GetUserInfo();
            //[2] 업데이트 인지 인서트 인지 구분하여 명령어 객체 생성
            ICMD cmd = null;

            if (!txtID.Enabled)
            {
                //업데이트 하는 경우
                cmd = new libHitpan5.Controller.CommandController.User.Update((UserInfoProxyVO)(new SelectUser(txtID.Text).GetData()), ui, string.Format("{0} 유저의 정보를 업데이트", ui.UsersVO.UserID));
                linkInsertMode.Visible = true;
            }
            else
            {
                //인서트 하는 경우
                //[1] id겹치는지 점검
                bool isDuplicated = false;
                foreach (UserInfoProxyVO uv in this.userList)
                {
                    if (uv.UsersVO.UserID == ui.UsersVO.UserID)
                    {
                        isDuplicated = true;
                        break;
                    }
                }
                //[2] id안겹치면 인서트
                if (isDuplicated)
                {
                    MessageBox.Show("입력하고자 하는 아이디가 이미 존재합니다");
                    txtID.Text = string.Empty;
                    return;
                }
                else
                {
                    cmd = new libHitpan5.Controller.CommandController.User.Insert(ui);
                }
            }

            try
            {
                frmMain.htpClientLib.Do(cmd);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            SetView();
        }
示例#2
0
        private void btnInsertUpdate_Click(object sender, EventArgs e)
        {
            //[1] 사용자정보 VO객체 생성
            UserInfoProxyVO ui = GetUserInfo();
            //[2] 업데이트 인지 인서트 인지 구분하여 명령어 객체 생성
            ICMD cmd = null;
            if (!txtID.Enabled)
            {
                //업데이트 하는 경우
                cmd = new libHitpan5.Controller.CommandController.User.Update((UserInfoProxyVO)(new SelectUser(txtID.Text).GetData()), ui, string.Format("{0} 유저의 정보를 업데이트", ui.UsersVO.UserID));
                linkInsertMode.Visible = true;
            }
            else
            {
                //인서트 하는 경우
                //[1] id겹치는지 점검
                bool isDuplicated = false;
                foreach (UserInfoProxyVO uv in this.userList)
                {
                    if (uv.UsersVO.UserID==ui.UsersVO.UserID)
                    {
                        isDuplicated = true;
                        break;
                    }
                }
                //[2] id안겹치면 인서트
                if (isDuplicated)
                {
                    MessageBox.Show("입력하고자 하는 아이디가 이미 존재합니다");
                    txtID.Text = string.Empty;
                    return;
                }
                else
                {
                    cmd = new libHitpan5.Controller.CommandController.User.Insert(ui);
                }
            }

            try
            {
                frmMain.htpClientLib.Do(cmd);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            SetView();
        }