예제 #1
0
        void Save()
        {
            JsonRequest request = new JsonRequest();

            ProcAction action = request.NewAction();

            action.proc = WebUtil.Values.PROC_SQL;

            StringBuilder sql = new StringBuilder();

            //Update text
            if (!bolNewFlag)
            {
                sql.Append(" UPDATE " + HBConstant.TB_SYS_TEXT);
                sql.Append(" SET ko = #{ko}, en = #{en}, vi = #{vi}");
                sql.Append(" WHERE id = #{id}");
                action.text = sql.ToString();

                action.param.Add(etKO.FieldName, etKO.Text);
                action.param.Add(etEN.FieldName, etEN.Text);
                action.param.Add(etVI.FieldName, etVI.Text);
                action.param.Add(etID.FieldName, etID.Text);
            }
            // New Text
            else
            {
                if (string.IsNullOrEmpty(etID.Text) || HBConstant.checkExistID(HBConstant.TB_SYS_TEXT, etID.FieldName, etID.Text) != HBConstant.NORMAL)
                {
                    //XtraMessageBox.Show("이미 존재하거나 비어있는 ID.", "성공");
                    XtraMessageBox.Show("Id đang trống hoặc đã tồn tại.", "Lỗi");
                    return;
                }

                sql.Append("INSERT INTO " + HBConstant.TB_SYS_TEXT + " (id, ko, en, vi)");
                sql.Append(" VALUES (#{id}, #{ko}, #{en}, #{vi}) ");
                action.text = sql.ToString();

                action.param.Add(etID.FieldName, etID.Text);
                action.param.Add(etKO.FieldName, etKO.Text);
                action.param.Add(etEN.FieldName, etEN.Text);
                action.param.Add(etVI.FieldName, etVI.Text);
            }

            WebClient client = new WebClient();
            DataSet   ds     = client.Execute(request);

            if (client.check)
            {
                //XtraMessageBox.Show("저장 했습니다.", "성공");
                XtraMessageBox.Show("Lưu thành công.", "Thông báo");
                Search();
            }
            else
            {
                //XtraMessageBox.Show("저장 실패: " + client.message, "실패");
                XtraMessageBox.Show("Có lỗi xảy ra: \n" + client.message, "Lỗi");
            }
        }
예제 #2
0
        void Save()
        {
            JsonRequest request = new JsonRequest();

            ProcAction action = request.NewAction();

            action.proc = WebUtil.Values.PROC_SQL;

            StringBuilder sql = new StringBuilder();

            // Insert New User
            if (bolNewUser)
            {
                if (String.IsNullOrEmpty(txtUserID.Text) || HBConstant.checkExistID(HBConstant.TB_SYS_USER, txtUserID.FieldName, txtUserID.Text) != HBConstant.NORMAL)
                {
                    //XtraMessageBox.Show("이미 존재하거나 비어있는 ID.", "성공");
                    XtraMessageBox.Show("Mã người dùng đang trống hoặc đã tồn tại", "Lỗi");
                    return;
                }

                sql.Append(" INSERT INTO " + HBConstant.TB_SYS_USER);
                sql.Append(" (user_id, user_nm, user_pw, loc_cd, role_id, use_yn, in_id, in_dt)");
                //sql.Append(" VALUES (#{user_id}, #{user_nm}, TO_BASE64(#{user_pw}), #{loc_cd}, #{use_yn}, #{in_id}, CURRENT_TIMESTAMP)");
                sql.Append(" VALUES (#{user_id}, #{user_nm}, #{user_pw}, #{loc_cd}, #{role_id}, #{use_yn}, #{in_id}, CURRENT_TIMESTAMP)");

                action.text = sql.ToString();

                action.param.Add(txtUserID.FieldName, txtUserID.Text);
                action.param.Add(txtUserName.FieldName, txtUserName.Text);
                action.param.Add(txtPassword.FieldName, COM.AES256.AESEncrypt256(txtPassword.Text));

                action.param.Add(popLocation.FieldName, popLocation.Text);
                action.param.Add(cbRole.FieldName, cbRole.Value);
                action.param.Add(chkUse.FieldName, chkUse.Value);
                action.param.Add(HBConstant.C_IN_ID, COM.UserInfo.UserID);
            }
            //Update User
            else
            {
                sql.Append("UPDATE " + HBConstant.TB_SYS_USER);
                //sql.Append(" SET user_nm = #{user_nm}, user_pw = TO_BASE64(#{user_pw}), loc_cd = #{loc_cd}, use_yn = #{use_yn}, up_id = #{up_id}, up_dt = CURRENT_TIMESTAMP ");
                sql.Append(" SET user_nm = #{user_nm}, user_pw = #{user_pw}, loc_cd = #{loc_cd}, role_id = #{role_id}, use_yn = #{use_yn}, up_id = #{up_id}, up_dt = CURRENT_TIMESTAMP ");
                sql.Append(" WHERE user_id = #{user_id}");

                action.text = sql.ToString();
                action.param.Add(txtUserName.FieldName, txtUserName.Text);
                action.param.Add(txtPassword.FieldName, COM.AES256.AESEncrypt256(txtPassword.Text));

                action.param.Add(popLocation.FieldName, popLocation.Text);
                action.param.Add(cbRole.FieldName, cbRole.Value);
                action.param.Add(chkUse.FieldName, chkUse.Value);
                action.param.Add(HBConstant.C_UP_ID, COM.UserInfo.UserID);
                action.param.Add(txtUserID.FieldName, txtUserID.Text);
            }

            WebClient client = new WebClient();
            DataSet   ds     = client.Execute(request);

            if (client.check)
            {
                //XtraMessageBox.Show("저장 했습니다.", "성공");
                XtraMessageBox.Show("Lưu thành công.", "Thông báo");
                Search();
            }
            else
            {
                //XtraMessageBox.Show("저장 실패: " + client.message, "실패");
                XtraMessageBox.Show("Có lỗi xảy ra: \n" + client.message, "Lỗi");
            }
        }
예제 #3
0
        void btnSaveCode_Click(object sender, System.EventArgs e)
        {
            if (bolNewGroup)
            {
                //XtraMessageBox.Show("새 코드 그룹을 저장하십시오.", "성공");
                XtraMessageBox.Show("Một nhóm mới đang được thêm, hãy thực hiện lưu nhóm.", "Thông báo");
                btnSaveCode.Focus();
                return;
            }

            JsonRequest request = new JsonRequest();

            ProcAction action = request.NewAction();

            action.proc = WebUtil.Values.PROC_SQL;

            StringBuilder sql = new StringBuilder();
            DataRowView   row;
            string        cd       = String.Empty;
            string        cd_nm    = String.Empty;
            string        grp_cd   = String.Empty;
            int           sort_seq = 0;

            if (gridViewCode.GetSelectedRows().Length > 0)
            {
                row      = (DataRowView)gridViewCode.GetRow(gridViewCode.GetSelectedRows()[0]);
                cd       = row.Row[0].ToString();
                grp_cd   = txtGroupId.Text;
                cd_nm    = row.Row[1].ToString();
                sort_seq = int.Parse(row.Row[4].ToString());
            }

            // Insert new code
            if (bolNewCode)
            {
                if (String.IsNullOrEmpty(cd) || HBConstant.checkExistID(HBConstant.TB_SYS_CODE, "cd", cd) != HBConstant.NORMAL)
                {
                    //XtraMessageBox.Show("이미 존재하거나 비어있는 ID.", "성공");
                    XtraMessageBox.Show("Mã đang trống hoặc đã tồn tại.", "Lỗi");
                    return;
                }

                sql.Append("INSERT INTO " + HBConstant.TB_SYS_CODE);
                sql.Append(" (cd, grp_cd, cd_nm, sort_seq) ");
                sql.Append(" VALUES (#{cd}, #{grp_cd}, #{cd_nm}, #{sort_seq})");

                action.text = sql.ToString();
                action.param.Add("cd", cd);
                action.param.Add("grp_cd", grp_cd);
                action.param.Add("cd_nm", cd_nm);
                action.param.Add("sort_seq", sort_seq);
            }
            // Update code
            else
            {
                sql.Append("UPDATE " + HBConstant.TB_SYS_CODE);
                sql.Append(" SET cd_nm = #{cd_nm}, sort_seq = #{sort_seq}");
                sql.Append(" WHERE cd = #{cd}");

                action.text = sql.ToString();
                action.param.Add("cd_nm", cd_nm);
                action.param.Add("sort_seq", sort_seq);
                action.param.Add("cd", cd);
            }

            WebClient client = new WebClient();
            DataSet   ds     = client.Execute(request);

            if (client.check)
            {
                //XtraMessageBox.Show("저장 했습니다.", "성공");
                XtraMessageBox.Show("Lưu thành công.", "Thông báo");
                RefreshCode((int)gridViewCodeGroup.GetSelectedRows()[0]);
            }
            else
            {
                //XtraMessageBox.Show("저장 실패: " + client.message, "실패");
                XtraMessageBox.Show("Có lỗi xảy ra: \n" + client.message, "Lỗi");
            }
        }
예제 #4
0
        void Save()
        {
            JsonRequest request = new JsonRequest();

            ProcAction action = request.NewAction();

            action.proc = WebUtil.Values.PROC_SQL;

            StringBuilder sql = new StringBuilder();

            // New Group
            if (bolNewGroup)
            {
                if (String.IsNullOrEmpty(txtGroupId.Text) || HBConstant.checkExistID(HBConstant.TB_SYS_CODE_GRP, txtGroupId.FieldName, txtGroupId.Text) != HBConstant.NORMAL)
                {
                    //XtraMessageBox.Show("이미 존재하거나 비어있는 ID.", "성공");
                    XtraMessageBox.Show("Mã nhóm đang trống hoặc đã tồn tại.", "Lỗi");
                    return;
                }

                sql.Append("INSERT INTO " + HBConstant.TB_SYS_CODE_GRP);
                sql.Append("(grp_cd, grp_nm, sys_yn, use_yn, remark)");
                sql.Append(" VALUES (#{grp_cd}, #{grp_nm}, #{sys_yn}, #{use_yn}, #{remark}) ");

                action.text = sql.ToString();
                action.param.Add(txtGroupId.FieldName, txtGroupId.Text);
                action.param.Add(txtGroupName.FieldName, txtGroupName.Text);
                action.param.Add(chkSys.FieldName, chkSys.Value);
                action.param.Add(chkUse.FieldName, chkUse.Value);
                action.param.Add(txtRemark.FieldName, txtRemark.Text);
            }
            //Update Group
            else
            {
                sql.Append("UPDATE " + HBConstant.TB_SYS_CODE_GRP);
                sql.Append(" SET grp_nm = #{grp_nm}, sys_yn = #{sys_yn}, use_yn = #{use_yn}, remark = #{remark} ");
                sql.Append("WHERE grp_cd = #{grp_cd}");

                action.text = sql.ToString();
                action.param.Add(txtGroupName.FieldName, txtGroupName.Text);
                action.param.Add(chkSys.FieldName, chkSys.Value);
                action.param.Add(chkUse.FieldName, chkUse.Value);
                action.param.Add(txtRemark.FieldName, txtRemark.Text);
                action.param.Add(txtGroupId.FieldName, txtGroupId.Text);
            }

            WebClient client = new WebClient();
            DataSet   ds     = client.Execute(request);

            if (client.check)
            {
                //XtraMessageBox.Show("저장 했습니다.", "성공");
                XtraMessageBox.Show("Lưu thành công.", "Thông báo");
                Search();
            }
            else
            {
                //XtraMessageBox.Show("저장 실패: " + client.message, "실패");
                XtraMessageBox.Show("Có lỗi xảy ra: \n" + client.message, "Lỗi");
            }
        }