Exemplo n.º 1
0
        protected Guid UpdateAndReturnKey(string sql, string pkName, OracleDynamicParameters oracleParameters, IDbConnection connection)
        {
            try
            {
                var affectedRows = connection.Execute(sql, param: oracleParameters, commandType: CommandType.StoredProcedure);
                if (affectedRows == -1)
                {
                    s_log.Trace($"Update success [UpdateTag]");
                    var returnValueByteArray = oracleParameters.Get <byte[]>(pkName);
                    var primaryKeyguidId     = GuidConvert.FromRaw(returnValueByteArray);
                    return(primaryKeyguidId);
                }

                throw new DBOperationException("Update Tag was not successful!");
            }
            catch (Oracle.ManagedDataAccess.Client.OracleException ex)
            {
                s_log.ErrorException("Update Fails (Oracle Exception)", ex, "BaseStore");
                throw new DBOperationException(ex.Message, ex.Number, GlobalOptions.DBExceptionScenarios.OracleExceptionOccured, ex);
            }
            catch (Exception ex)
            {
                s_log.ErrorException("Update Fails", ex, "BaseStore");
                throw new DBOperationException(ex.Message, GlobalOptions.DBExceptionScenarios.ExceptionOccured, ex);
            }
        }
Exemplo n.º 2
0
        private RuleSetDTO MapToRuleSetDTOForListItem(IDictionary <string, Object> dictionary)
        {
            var rulesetGuid  = dictionary["RULESETGUID"];
            var rulesetName  = dictionary["RULESETNAME"];
            var isActive     = dictionary["ISACTIVE"];
            var hospitalID   = dictionary["HOSPITALID"];
            var departmentID = dictionary["DEPARTMENTID"];

            RuleSetDTO dto = new RuleSetDTO();

            if (rulesetGuid != null)
            {
                dto.RuleSetGUID = GuidConvert.FromRaw((byte[])rulesetGuid);
            }
            dto.Name     = rulesetName as string;
            dto.IsActive = (Convert.ToInt16(isActive) == 0 ? false : true);

            dto.HospitalID = (long)hospitalID;
            if (departmentID != null)
            {
                dto.DepartmentID = (long)departmentID;
            }
            else
            {
                dto.DepartmentID = null;
            }

            return(dto);
        }
        public TextTemplateDTO MapToTextTemplateDTO(IDictionary<string, object> dictionary)
        {
            var smsTextId = dictionary["SMSTEXTGUID"];
            var textTemplateName = dictionary["SMSTEXTNAME"];
            var ruleSetGuid = dictionary["RULESETGUID"];
            var hospitalId = dictionary["HOSPITALID"];
            var departmentId = dictionary["DEPARTMENTID"];
            var opdId = dictionary["OPDID"];
            var locationId = dictionary["LOCATIONID"];
            var sectionId = dictionary["SECTIONID"];
            var wardId = dictionary["WARDID"];
            var officailLevelCare = dictionary["OFFICIALLEVELOFCARE"];
            var contactType = dictionary["CONTACTTYPE"];
            var GroupTemplateId = dictionary["SMSTEXTTEMPLATEGUID"];
            var smsText = dictionary["SMSTEXT"];
            var groupSMSText = dictionary["GROUPSMSTEXT"];
            var validFrom = dictionary["VALIDFROM"];
            var isPSSLinkAvailable = dictionary["SENDPSSAPPLINK"];
            var isVideoAppoinment = dictionary["ISVIDEO"];
            var isSMSGenerate = dictionary["GENERATESMS"];
            var validTo = dictionary["VALIDTO"];
            var isActive = dictionary["ISACTIVE"];
            var rulesetName = dictionary["RULESETNAME"];
            var sendbeforedays = dictionary["SENDBEFOREDAYS"];
            var excludedOrgUnits = dictionary["RESHIDS"];
            var templateDepartmentId = dictionary["TEXTDEPTID"];

            var smsTextDto = new TextTemplateDTO();

            if (smsTextId != null) smsTextDto.TemplateGUID = GuidConvert.FromRaw((byte[])smsTextId);
            if (ruleSetGuid != null) smsTextDto.RuleSetGUID = GuidConvert.FromRaw((byte[])ruleSetGuid);
            if (GroupTemplateId != null)
            {
                smsTextDto.GroupedTextGUID = GuidConvert.FromRaw((byte[])GroupTemplateId);
                if (groupSMSText != null) smsTextDto.SMSText = groupSMSText.ToString();
            }
            else
             if (smsText != null) smsTextDto.SMSText = smsText.ToString();

            if (textTemplateName != null) smsTextDto.Name = textTemplateName.ToString();

            if (hospitalId != null) smsTextDto.HospitalID = (long)hospitalId;
            if (departmentId != null) smsTextDto.DepartmentID = (long)departmentId;
            if (templateDepartmentId != null) smsTextDto.TemplateDepartmentID = (long)templateDepartmentId;
            if (opdId != null) smsTextDto.OPDID = (long)opdId;
            if (locationId != null) smsTextDto.LocationID = (long)locationId;
            if (sectionId != null) smsTextDto.SectionID = (long)sectionId;
            if (wardId != null) smsTextDto.WardID = (long)wardId;

            if (contactType != null)
            {
                smsTextDto.ContactType = contactType.ToString().Split(',').Select(conType => Convert.ToInt64(conType)).ToList();
            }
            if (officailLevelCare != null)
            {
                smsTextDto.OfficialLevelOfCare = officailLevelCare.ToString().Split(',').Select(offcarelvl => Convert.ToInt64(offcarelvl)).ToList();
            }

            if (validFrom != null) smsTextDto.ValidFrom = (DateTime)validFrom;
            if (validTo != null) smsTextDto.ValidTo = (DateTime)validTo;
            if (isActive != null) smsTextDto.IsActive = (Convert.ToInt16(isActive) == 0 ? false : true);
            if (isPSSLinkAvailable != null) smsTextDto.AttachPSSLink = (Convert.ToInt16(isPSSLinkAvailable) == 0 ? false : true);
            if (isVideoAppoinment != null) smsTextDto.IsVideoAppoinment = (Convert.ToInt16(isVideoAppoinment) == 0 ? false : true);
            if (isSMSGenerate != null) 
                smsTextDto.IsGenerateSMS = (Convert.ToInt16(isSMSGenerate) == 0 ? false : true);

            if (rulesetName != null) smsTextDto.RuleSetName = rulesetName.ToString();

            if (excludedOrgUnits != null) smsTextDto.ExcludedOrgUnits = excludedOrgUnits.ToString().Split(',').ToList();
            if (sendbeforedays != null) smsTextDto.SendSMSBeforeDays = Convert.ToInt32(sendbeforedays);
            return smsTextDto;
        }