public Boolean SaveCertificationFile(CertificationType cType, Boolean withEmptyPlaceHolders, Int32 idCommunity, Int32 idUser, String cName, String cDescription, long idPath, long idSubActivity, Guid uniqueID, String extension, Boolean restore = false) { Certification cert = null; SubActivity s = Service.GetSubActivity(idSubActivity); if (s != null) { dtoCertification dto = dtoCertification.Create(cType); dto.Name = cName; if (!String.IsNullOrEmpty(cDescription) && cDescription.Contains("{0}")) { cDescription = string.Format(cDescription, Service.GetPathName(idPath)); } dto.Description = cDescription; dto.IdCommunity = idCommunity; dto.IdContainer = idPath; dto.IdOwner = idUser; dto.UniqueIdGeneratedFile = uniqueID; dto.FileExtension = extension; dto.IdTemplate = s.IdCertificate; dto.IdTemplateVersion = s.IdCertificateVersion; dto.WithEmptyPlaceHolders = withEmptyPlaceHolders; dto.SourceItem = ModuleObject.CreateLongObject(idSubActivity, s, (int)COL_BusinessLogic_v2.UCServices.Services_EduPath.ObjectType.SubActivity, idCommunity, COL_BusinessLogic_v2.UCServices.Services_EduPath.Codex, Service.ServiceModuleID()); cert = ServiceCertifications.SaveUserCertification(dto); } return(cert != null); }
public static dtoCertification Create(CertificationType type) { dtoCertification dto = new dtoCertification(); dto.Type = type; dto.Status = CertificationStatus.Valid; dto.IssuedOn = DateTime.Now; dto.CertificationUniqueId = Guid.NewGuid(); return(dto); }
public Resource(string name, string password, string officeNo, CertificationType certificationType, IPAddress certificationAddress, IPEndPoint serverAddress, string serverLoginString, string configurationType, int status, int agentId) { this.Name = name; this.Password = password; this.OfficeNo = officeNo; this.CertificationType = certificationType; this.CertificationAddress = certificationAddress; this.ServerAddress = serverAddress; this.ServerLoginString = serverLoginString; this.ConfigurationType = configurationType; this.Status = status; this.AgentId = agentId; }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 32, Configuration.FieldSeparator), Id, SetIdIn3.HasValue ? SetIdIn3.Value.ToString(culture) : null, CertificationNumber?.ToDelimitedString(), CertifiedBy != null ? string.Join(Configuration.FieldRepeatSeparator, CertifiedBy.Select(x => x.ToDelimitedString())) : null, CertificationRequired, Penalty?.ToDelimitedString(), CertificationDateTime.HasValue ? CertificationDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, CertificationModifyDateTime.HasValue ? CertificationModifyDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, Operator != null ? string.Join(Configuration.FieldRepeatSeparator, Operator.Select(x => x.ToDelimitedString())) : null, CertificationBeginDate.HasValue ? CertificationBeginDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null, CertificationEndDate.HasValue ? CertificationEndDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null, Days?.ToDelimitedString(), NonConcurCodeDescription?.ToDelimitedString(), NonConcurEffectiveDateTime.HasValue ? NonConcurEffectiveDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, PhysicianReviewer != null ? string.Join(Configuration.FieldRepeatSeparator, PhysicianReviewer.Select(x => x.ToDelimitedString())) : null, CertificationContact, CertificationContactPhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, CertificationContactPhoneNumber.Select(x => x.ToDelimitedString())) : null, AppealReason?.ToDelimitedString(), CertificationAgency?.ToDelimitedString(), CertificationAgencyPhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, CertificationAgencyPhoneNumber.Select(x => x.ToDelimitedString())) : null, PreCertificationRequirement != null ? string.Join(Configuration.FieldRepeatSeparator, PreCertificationRequirement.Select(x => x.ToDelimitedString())) : null, CaseManager, SecondOpinionDate.HasValue ? SecondOpinionDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null, SecondOpinionStatus?.ToDelimitedString(), SecondOpinionDocumentationReceived != null ? string.Join(Configuration.FieldRepeatSeparator, SecondOpinionDocumentationReceived.Select(x => x.ToDelimitedString())) : null, SecondOpinionPhysician != null ? string.Join(Configuration.FieldRepeatSeparator, SecondOpinionPhysician.Select(x => x.ToDelimitedString())) : null, CertificationType?.ToDelimitedString(), CertificationCategory?.ToDelimitedString(), OnlineVerificationDateTime.HasValue ? OnlineVerificationDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, OnlineVerificationResult?.ToDelimitedString(), OnlineVerificationResultErrorCode?.ToDelimitedString(), OnlineVerificationResultCheckDigit ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
public Resource Query(int resourceid) { Resource resource = null; string sql = @"select Id, Name, Password, OfficeNo, CertificationType, CertificationAddress,ServerAddress, ServerPort, " + @"ServerLoginString, ConfigurationType, Status, AgentId from Resources where Id = @Id"; using (var dbOperator = new DbOperator(Provider, ConnectionString)) { dbOperator.AddParameter("Id", resourceid); using (var reader = dbOperator.ExecuteReader(sql)) { while (reader.Read()) { int id = reader.GetInt16(0); string name = reader.GetString(1); string password = reader.GetString(2); string officeNo = reader.GetString(3); CertificationType certificationType = (CertificationType)reader.GetInt16(4); IPAddress certificationAddress = null; if (reader.GetString(5) != null) { certificationAddress = IPAddress.Parse(reader.GetString(5)); } IPEndPoint serverAddress = new IPEndPoint(IPAddress.Parse(reader.GetString(6)), reader.GetInt32(7)); string serverLoginString = reader.GetString(8); string configurationType = reader.GetString(9); int status = reader.GetInt16(10); int agentId = reader.GetInt32(11); resource = new Resource(id, name, officeNo, password, certificationType, certificationAddress, serverAddress, serverLoginString, configurationType, status, agentId); } } } return(resource); }
public IEnumerable <Resource> Query() { List <Resource> result = new List <Resource>(); string sql = @"select Id, Name, Password, officeNo, CertificationType, CertificationAddress,ServerAddress, ServerPort, " + @"ServerLoginString, ConfigurationType, Status, AgentId from Resources"; using (var dbOperator = new DbOperator(Provider, ConnectionString)) { using (var reader = dbOperator.ExecuteReader(sql)) { while (reader.Read()) { int id = reader.GetInt16(0); string name = reader.GetString(1); string password = reader.GetString(2); string officeNo = reader.GetString(3); CertificationType certificationType = (CertificationType)reader.GetInt16(4); IPAddress certificationAddress = null; if (!reader.IsDBNull(5)) { certificationAddress = IPAddress.Parse(reader.GetString(5)); } IPEndPoint serverAddress = new IPEndPoint(IPAddress.Parse(reader.GetString(6)), reader.GetInt16(7)); string serverLoginString = reader.GetString(8); string configurationType = reader.GetString(9); byte status = reader.GetByte(10); short agentId = reader.GetInt16(11); Resource resource = new Resource(id, name, password, officeNo, certificationType, certificationAddress, serverAddress, serverLoginString, configurationType, status, agentId); result.Add(resource); } } } return(result); }
public List <Certification> GetUserCertifications(ModuleObject source, Int32 idUser, CertificationType type) { return(GetUserCertifications(source, idUser, false, type)); }
public List <Certification> GetUserCertifications(ModuleObject source, Int32 idUser, Boolean all, CertificationType type = CertificationType.AutoProduced) { List <Certification> items = null; try { Manager.BeginTransaction(); items = (from c in Manager.GetIQ <Certification>() where c.Deleted == BaseStatusDeleted.None && c.SourceItem.Equals(source) && c.Owner.Id == idUser && c.Status == CertificationStatus.Valid && (all || c.Type == type) select c).ToList().OrderByDescending(c => c.CreatedOn).ToList(); Manager.Commit(); } catch (Exception ex) { Manager.RollBack(); items = new List <Certification>(); } return(items); }
public Boolean DeleteUsersCertifications(long idContainer, Int32 idModule, String moduleCode, Int32 idUser, Boolean all, CertificationType type = CertificationType.AutoProduced) { Boolean deleted = false; try { Manager.BeginTransaction(); Person p = Manager.GetPerson(UC.CurrentUserID); if (p != null) { List <Certification> items = (from c in Manager.GetIQ <Certification>() where c.Deleted == BaseStatusDeleted.None && c.SourceIdContainer == idContainer && c.SourceItem.ServiceCode == moduleCode && c.SourceItem.ServiceID == idModule && (idUser == -1 || c.Owner.Id == idUser) && c.Status == CertificationStatus.Valid && (all || c.Type == type) select c).ToList().OrderByDescending(c => c.CreatedOn).ToList(); items.ForEach(i => i.Status = CertificationStatus.Ignore); items.ForEach(i => i.SetDeleteMetaInfo(p, UC.IpAddress, UC.ProxyIpAddress)); } Manager.Commit(); deleted = true; } catch (Exception ex) { Manager.RollBack(); deleted = false; } return(deleted); }
/// <summary> /// Delete users certifications for other module /// </summary> /// <param name="idContainer">module object identifier</param> /// <param name="idModule">identifier module</param> /// <param name="moduleCode">module code</param> /// <param name="all">if true delete certification withot user check</param> /// <param name="type"></param> /// <returns></returns> public Boolean DeleteUsersCertifications(long idContainer, Int32 idModule, String moduleCode, Boolean all, CertificationType type = CertificationType.AutoProduced) { return(DeleteUsersCertifications(idContainer, idModule, moduleCode, -1, all, type)); }
/// <summary> /// Delete users certifications for other module /// </summary> /// <param name="idContainer">module object identifier</param> /// <param name="idModule">identifier module</param> /// <param name="moduleCode">module code</param> /// <param name="type">type of certification to delete</param> /// <returns></returns> public Boolean DeleteUsersCertifications(long idContainer, Int32 idModule, String moduleCode, CertificationType type) { return(DeleteUsersCertifications(idContainer, idModule, moduleCode, false, type)); }
public Boolean DeleteItemCertifications(ModuleObject source, Int32 idUser, CertificationType type) { return(DeleteItemCertifications(source, idUser, false, type)); }
public Boolean DeleteItemCertifications(ModuleObject source, Boolean all, CertificationType type = CertificationType.AutoProduced) { return(DeleteItemCertifications(source, -1, all, type)); }