Exemple #1
0
        private bool CheckInfo()
        {
            if (cboCoQuan.Text == string.Empty)
            {
                MsgBox.Show(this.Text, "Vui lòng chọn cơ quan.", IconType.Information);
                cboCoQuan.Focus();
                return(false);
            }

            if (txtNhanXet.Text.Trim() == string.Empty)
            {
                MsgBox.Show(this.Text, "Vui lòng nhập nhận xét.", IconType.Information);
                txtNhanXet.Focus();
                return(false);
            }

            string nhanXetKhamLamSangGUID = _isNew ? string.Empty : _nhanXetKhamLamSang.NhanXetKhamLamSangGUID.ToString();
            Result result = NhanXetKhamLamSangBus.CheckNhanXetExist(nhanXetKhamLamSangGUID, cboCoQuan.SelectedIndex, txtNhanXet.Text);

            if (result.Error.Code == ErrorCode.EXIST || result.Error.Code == ErrorCode.NOT_EXIST)
            {
                if (result.Error.Code == ErrorCode.EXIST)
                {
                    MsgBox.Show(this.Text, "Nhận xét này đã tồn tại rồi. Vui lòng nhập nhận xét khác.", IconType.Information);
                    txtNhanXet.Focus();
                    return(false);
                }
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("NhanXetKhamLamSangBus.CheckNhanXetExist"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("NhanXetKhamLamSangBus.CheckNhanXetExist"));
                return(false);
            }

            return(true);
        }
        private bool InsertNhanXetKhamLamSang(string nhanXet, int loai)
        {
            if (nhanXet.Trim() == string.Empty)
            {
                return(true);
            }
            Result result = NhanXetKhamLamSangBus.CheckNhanXetExist(null, loai, nhanXet);

            if (result.Error.Code == ErrorCode.EXIST || result.Error.Code == ErrorCode.NOT_EXIST)
            {
                if (result.Error.Code == ErrorCode.NOT_EXIST)
                {
                    NhanXetKhamLamSang nhanXetKhamLamSang = new NhanXetKhamLamSang();
                    nhanXetKhamLamSang.Status      = (byte)Status.Actived;
                    nhanXetKhamLamSang.CreatedDate = DateTime.Now;
                    nhanXetKhamLamSang.CreatedBy   = Guid.Parse(Global.UserGUID);
                    nhanXetKhamLamSang.NhanXet     = nhanXet;
                    nhanXetKhamLamSang.Loai        = loai;
                    result = NhanXetKhamLamSangBus.InsertNhanXetKhamLamSang(nhanXetKhamLamSang);
                    if (!result.IsOK)
                    {
                        MsgBox.Show(this.Text, result.GetErrorAsString("NhanXetKhamLamSangBus.InsertNhanXetKhamLamSang"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("NhanXetKhamLamSangBus.InsertNhanXetKhamLamSang"));
                        return(false);
                    }
                }
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("NhanXetKhamLamSangBus.CheckNhanXetExist"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("NhanXetKhamLamSangBus.CheckNhanXetExist"));
                return(false);
            }

            return(true);
        }