Esempio n. 1
0
        public CorrespondentDO(Correspondent c)
            : this()
        {
            if (c != null)
            {
                this.CorrespondentId = c.CorrespondentId;
                this.CorrespondentGroupId = c.CorrespondentGroupId;
                this.RegisterIndexId = c.RegisterIndexId;
                this.Email = c.Email;
                this.DisplayName = c.DisplayName;
                this.CorrespondentTypeId = c.CorrespondentTypeId;
                //bgcitizen
                this.BgCitizenFirstName = c.BgCitizenFirstName;
                this.BgCitizenLastName = c.BgCitizenLastName;
                this.BgCitizenUIN = c.BgCitizenUIN;
                //foreigner
                this.ForeignerFirstName = c.ForeignerFirstName;
                this.ForeignerCountryId = c.ForeignerCountryId;
                this.ForeignerLastName = c.ForeignerLastName;
                this.ForeignerSettlement = c.ForeignerSettlement;
                this.ForeignerBirthDate = c.ForeignerBirthDate;
                //legal entity
                this.LegalEntityName = c.LegalEntityName;
                this.LegalEntityBulstat = c.LegalEntityBulstat;
                //foreign legal entity
                this.FLegalEntityName = c.FLegalEntityName;
                this.FLegalEntityCountryId = c.FLegalEntityCountryId;
                this.FLegalEntityRegisterName = c.FLegalEntityRegisterName;
                this.FLegalEntityRegisterNumber = c.FLegalEntityRegisterNumber;
                this.FLegalEntityOtherData = c.FLegalEntityOtherData;

                //contact
                this.ContactDistrictId = c.ContactDistrictId;
                this.ContactMunicipalityId = c.ContactMunicipalityId;
                this.ContactSettlementId = c.ContactSettlementId;
                this.ContactPostCode = c.ContactPostCode;
                this.ContactAddress = c.ContactAddress;
                this.ContactPostOfficeBox = c.ContactPostOfficeBox;
                this.ContactPhone = c.ContactPhone;
                this.ContactFax = c.ContactFax;

                this.Alias = c.Alias;
                this.IsActive = c.IsActive;
                this.Version = c.Version;

                this.RegisterIndexCodeName = c.RegisterIndex != null ? string.Format("{0} {1}", c.RegisterIndex.Code, c.RegisterIndex.Name) : string.Empty;

                if (c.CorrespondentType != null)
                {
                    this.CorrespondentTypeAlias = c.CorrespondentType.Alias;
                    this.CorrespondentTypeName = c.CorrespondentType.Name;
                }
            }
        }
        public async Task <IHttpActionResult> GetCorrespondent(string id)
        {
            Correspondent correspondent = corrService.GetById(id);

            if (correspondent == null)
            {
                return(NotFound());
            }

            return(Ok(correspondent));
        }
        public async Task <IHttpActionResult> PostCorrespondent(Correspondent correspondent)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            corrService.Add(correspondent);
            corrService.CommitAsync();

            return(CreatedAtRoute("DefaultApi", new { id = correspondent.CorrespondentId }, correspondent));
        }
        public async Task <IHttpActionResult> PutCorrespondent(string id, Correspondent correspondent)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != correspondent.CorrespondentId)
            {
                return(BadRequest());
            }

            corrService.Update(correspondent);
            corrService.CommitAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 5
0
        private Correspondent GetCorrespondentFromPdfFile(string path)
        {
            var text = GetPdfFileText(path);
            //Console.WriteLine($@"Got text: {text}");

            Correspondent matchingCorrespondent = null;

            foreach (var correspondent in Configuration.Values.Correspondents)
            {
                if (correspondent.MatchesText(text))
                {
                    matchingCorrespondent = correspondent;
                    break;
                }
            }

            return(matchingCorrespondent);
        }
Esempio n. 6
0
        public DocCorrespondentDO(Correspondent c, bool isSelected = false, bool isNew = false, bool isDeleted = false)
        {
            this.DocCorrespondentId = null;
            this.DocId = null;

            if (c != null)
            {
                this.CorrespondentId = c.CorrespondentId;
                this.CorrespondentDisplayName = c.DisplayName;
                this.CorrespondentEmail = c.Email;

                if (c.CorrespondentType != null)
                {
                    this.CorrespondentCorrespondentTypeName = c.CorrespondentType.Name;
                }

                this.CorrespondentRegisterIndexCodeName = c.RegisterIndex != null ? string.Format("{0} {1}", c.RegisterIndex.Code, c.RegisterIndex.Name) : string.Empty;
            }

            this.IsSelected = isSelected;
            this.IsNew = isNew;
            this.IsDeleted = isDeleted;
        }
Esempio n. 7
0
        public IHttpActionResult GetCorrespondentEmail(int id)
        {
            Doc doc = this.docRepository.Find(id,
                e => e.DocCorrespondents.Select(dc => dc.Correspondent),
                e => e.DocStatus,
                e => e.DocFiles.Select(k => k.DocFileKind),
                e => e.DocFiles.Select(k => k.DocFileOriginType));

            if (doc == null)
            {
                return NotFound();
            }

            Doc caseDoc = this.docRepository.Find(this.docRepository.GetCaseId(id));

            CorrespondentEmailDO email = new CorrespondentEmailDO();
            Correspondent correspondent = new Correspondent();

            foreach (var item in doc.DocCorrespondents)
            {
                NomDo corrNom = new NomDo();
                corrNom.NomValueId = item.Correspondent.CorrespondentId;
                corrNom.Name = item.Correspondent.DisplayName + " " + item.Correspondent.Email;
                corrNom.Alias = item.Correspondent.Alias;
                corrNom.IsActive = item.Correspondent.IsActive;

                email.EmailTo.Add(corrNom);
            }

            foreach (var item in doc.DocFiles.Where(e => e.DocFileKind.Alias == "PublicAttachedFile"))
            {
                email.PublicFiles.Add(new DocFileDO(item));
            }

            EmailType emailType = this.emailRepository.GetEmailTypeByAlias("CorrespondentEmail");

            email.EmailBcc = "";
            email.EmailTypeId = emailType.EmailTypeId;
            email.Subject = emailType.Subject
                .Replace("@@CaseNum", !string.IsNullOrEmpty(caseDoc.RegUri) ? caseDoc.RegUri : "[Няма номер на преписка]");
            email.Body = emailType.Body
                .Replace("@@CaseNum", !string.IsNullOrEmpty(caseDoc.RegUri) ? caseDoc.RegUri : "[Няма номер на преписка]")
                .Replace("@@DocViewUrl", EmailRepository.DocViewUrl)
                .Replace("@@CaseViewUrl", EmailRepository.CaseViewUrl)
                .Replace("@@AccessCode", caseDoc.AccessCode);

            return Ok(new
            {
                email = email
            });
        }
Esempio n. 8
0
        private List<Correspondent> GetDocumentCorrespondents(ElectronicServiceApplicant electronicServiceApplicant, ElectronicServiceApplicantContactData electronicServiceApplicantContactData)
        {
            List<Correspondent> returnValue = new List<Correspondent>();

            if (electronicServiceApplicant != null && electronicServiceApplicant.RecipientGroupCollection[0].RecipientCollection.Count > 0)
            {
                foreach (var recipient in electronicServiceApplicant.RecipientGroupCollection[0].RecipientCollection)
                {
                    Correspondent correspondent = null;

                    bool isNew = false;

                    string email = electronicServiceApplicant.EmailAddress ?? "";

                    if (recipient.Person != null)
                    {
                        string bgCitizenFirstName = recipient.Person.Names.First;
                        string bgCitizenLastName = recipient.Person.Names.Last;
                        string bgCitizenEgn = recipient.Person.Identifier.EGN;

                        //Get EmptyCorrespondent
                        if (String.IsNullOrWhiteSpace(email) ||
                            String.IsNullOrWhiteSpace(bgCitizenFirstName) ||
                            String.IsNullOrWhiteSpace(bgCitizenLastName) ||
                            String.IsNullOrWhiteSpace(bgCitizenEgn))
                        {
                            correspondent = this.unitOfWork.DbContext.Set<Correspondent>().SingleOrDefault(e => e.Alias == "Empty");
                        }
                        else
                        {
                            correspondent = this.correspondentRepository.GetBgCitizenCorrespondent(email, bgCitizenFirstName, bgCitizenLastName, bgCitizenEgn);

                            if (correspondent == null)
                            {
                                isNew = true;

                                correspondent = new Correspondent();
                                correspondent.CorrespondentGroupId = this.unitOfWork.DbContext.Set<CorrespondentGroup>()
                                    .SingleOrDefault(e => e.Alias == "Applicants")
                                    .CorrespondentGroupId;
                                correspondent.CorrespondentTypeId = this.unitOfWork.DbContext.Set<CorrespondentType>()
                                    .SingleOrDefault(e => e.Alias == "BulgarianCitizen")
                                    .CorrespondentTypeId;
                                correspondent.BgCitizenFirstName = bgCitizenFirstName;
                                correspondent.BgCitizenLastName = bgCitizenLastName;
                                correspondent.BgCitizenUIN = bgCitizenEgn;
                            }
                        }
                    }
                    else if (recipient.ForeignPerson != null)
                    {
                        string foreignerFirstName = recipient.ForeignPerson.Names.FirstLatin;
                        string foreignerLastName = recipient.ForeignPerson.Names.LastLatin;
                        string foreignerSettlement = recipient.ForeignPerson.PlaceOfBirth != null ? recipient.ForeignPerson.PlaceOfBirth.SettlementName : string.Empty;
                        DateTime? foreignerBirthDate = recipient.ForeignPerson.BirthDate;
                        string foreignerCountryCode = recipient.ForeignPerson.PlaceOfBirth != null ? recipient.ForeignPerson.PlaceOfBirth.CountryCode : string.Empty;
                        int? foreignerCountryId = null;

                        if (!String.IsNullOrWhiteSpace(foreignerCountryCode))
                        {
                            var country = this.unitOfWork.DbContext.Set<Country>()
                                .SingleOrDefault(e => e.Code == foreignerCountryCode);
                            foreignerCountryId = country != null ? country.CountryId : (int?)null;
                        }

                        //Get EmptyCorrespondent
                        if (String.IsNullOrWhiteSpace(email) ||
                            String.IsNullOrWhiteSpace(foreignerFirstName) ||
                            String.IsNullOrWhiteSpace(foreignerLastName))
                        {
                            correspondent = this.unitOfWork.DbContext.Set<Correspondent>().SingleOrDefault(e => e.Alias == "Empty");
                        }
                        else
                        {
                            correspondent = this.correspondentRepository.GetForeignerCorrespondent(email, foreignerFirstName, foreignerLastName, foreignerCountryId, foreignerSettlement, foreignerBirthDate);

                            if (correspondent == null)
                            {
                                isNew = true;

                                correspondent = new Correspondent();
                                correspondent.CorrespondentGroupId = this.unitOfWork.DbContext.Set<CorrespondentGroup>()
                                    .SingleOrDefault(e => e.Alias == "Applicants")
                                    .CorrespondentGroupId;
                                correspondent.CorrespondentTypeId = this.unitOfWork.DbContext.Set<CorrespondentType>()
                                    .SingleOrDefault(e => e.Alias == "Foreigner")
                                    .CorrespondentTypeId;
                                correspondent.ForeignerFirstName = foreignerFirstName;
                                correspondent.ForeignerLastName = foreignerLastName;
                                correspondent.ForeignerCountryId = foreignerCountryId;
                                correspondent.ForeignerSettlement = foreignerSettlement;
                                correspondent.ForeignerBirthDate = foreignerBirthDate;
                            }
                        }
                    }
                    else if (recipient.Entity != null)
                    {
                        string legalEntityName = recipient.Entity.Name;
                        string legalEntityBulstat = recipient.Entity.Identifier;

                        //Get EmptyCorrespondent
                        if (String.IsNullOrWhiteSpace(email) ||
                            String.IsNullOrWhiteSpace(legalEntityName) ||
                            String.IsNullOrWhiteSpace(legalEntityBulstat))
                        {
                            correspondent = this.unitOfWork.DbContext.Set<Correspondent>().SingleOrDefault(e => e.Alias == "Empty");
                        }
                        else
                        {
                            correspondent = this.correspondentRepository.GetLegalEntityCorrespondent(email, legalEntityName, legalEntityBulstat);

                            if (correspondent == null)
                            {
                                isNew = true;

                                correspondent = new Correspondent();
                                correspondent.CorrespondentGroupId = this.unitOfWork.DbContext.Set<CorrespondentGroup>()
                                    .SingleOrDefault(e => e.Alias == "Applicants")
                                    .CorrespondentGroupId;
                                correspondent.CorrespondentTypeId = this.unitOfWork.DbContext.Set<CorrespondentType>()
                                    .SingleOrDefault(e => e.Alias == "LegalEntity")
                                    .CorrespondentTypeId;
                                correspondent.LegalEntityName = legalEntityName;
                                correspondent.LegalEntityBulstat = legalEntityBulstat;
                            }
                        }
                    }
                    else if (recipient.ForeignEntity != null)
                    {
                        string fLEgalEntityName = recipient.ForeignEntity.ForeignEntityName;
                        string fLegalEntityRegisterName = recipient.ForeignEntity.ForeignEntityRegister;
                        string fLegalEntityRegisterNumber = recipient.ForeignEntity.ForeignEntityIdentifier;
                        string fLegalEntityOtherData = recipient.ForeignEntity.ForeignEntityOtherData;
                        string fLegalEntityCountryCode = recipient.ForeignEntity.CountryISO3166TwoLetterCode;
                        int? fLegalEntityCountryId = null;

                        if (!String.IsNullOrWhiteSpace(fLegalEntityCountryCode))
                        {
                            var country = this.unitOfWork.DbContext.Set<Country>()
                                .SingleOrDefault(e => e.Code == fLegalEntityCountryCode);
                            fLegalEntityCountryId = country != null ? country.CountryId : (int?)null;
                        }

                        //Get EmptyCorrespondent
                        if (String.IsNullOrWhiteSpace(email) ||
                            String.IsNullOrWhiteSpace(fLEgalEntityName) ||
                            !fLegalEntityCountryId.HasValue)
                        {
                            correspondent = this.unitOfWork.DbContext.Set<Correspondent>().SingleOrDefault(e => e.Alias == "Empty");
                        }
                        else
                        {
                            correspondent = this.correspondentRepository.GetFLegalEntityCorrespondent(email, fLEgalEntityName, fLegalEntityCountryId, fLegalEntityRegisterName, fLegalEntityRegisterNumber);

                            if (correspondent == null)
                            {
                                isNew = true;

                                correspondent = new Correspondent();
                                correspondent.CorrespondentGroupId = this.unitOfWork.DbContext.Set<CorrespondentGroup>()
                                    .SingleOrDefault(e => e.Alias == "Applicants")
                                    .CorrespondentGroupId;
                                correspondent.CorrespondentTypeId = this.unitOfWork.DbContext.Set<CorrespondentType>()
                                    .SingleOrDefault(e => e.Alias == "ForeignLegalEntity")
                                    .CorrespondentTypeId;
                                correspondent.FLegalEntityName = fLEgalEntityName;
                                correspondent.FLegalEntityCountryId = fLegalEntityCountryId;
                                correspondent.FLegalEntityRegisterName = fLegalEntityRegisterName;
                                correspondent.FLegalEntityName = fLegalEntityRegisterNumber;
                                correspondent.FLegalEntityOtherData = fLegalEntityOtherData;
                            }
                        }
                    }

                    if (electronicServiceApplicantContactData != null)
                    {
                        int? contactDistrictId = null;
                        int? contactMunicipalityId = null;
                        int? contactSettlementId = null;

                        if (!String.IsNullOrWhiteSpace(electronicServiceApplicantContactData.DistrictCode))
                        {
                            var district = this.unitOfWork.DbContext.Set<District>()
                                .SingleOrDefault(e => e.Code == electronicServiceApplicantContactData.DistrictCode);
                            contactDistrictId = district != null ? district.DistrictId : (int?)null;
                        }

                        if (!String.IsNullOrWhiteSpace(electronicServiceApplicantContactData.MunicipalityCode))
                        {
                            var municipality = this.unitOfWork.DbContext.Set<Municipality>()
                                .SingleOrDefault(e => e.Code == electronicServiceApplicantContactData.MunicipalityCode);
                            contactMunicipalityId = municipality != null ? municipality.MunicipalityId : (int?)null;
                        }

                        if (!String.IsNullOrWhiteSpace(electronicServiceApplicantContactData.SettlementCode))
                        {
                            var settlement = this.unitOfWork.DbContext.Set<Settlement>()
                                .SingleOrDefault(e => e.Code == electronicServiceApplicantContactData.SettlementCode);
                            contactSettlementId = settlement != null ? settlement.SettlementId : (int?)null;
                        }

                        correspondent.ContactDistrictId = contactDistrictId;
                        correspondent.ContactMunicipalityId = contactMunicipalityId;
                        correspondent.ContactSettlementId = contactSettlementId;
                        correspondent.ContactAddress = electronicServiceApplicantContactData.AddressDescription;
                        correspondent.ContactPostCode = electronicServiceApplicantContactData.PostCode;
                        correspondent.ContactPostOfficeBox = electronicServiceApplicantContactData.PostOfficeBox;

                        if (electronicServiceApplicantContactData.PhoneNumbers != null &&
                            electronicServiceApplicantContactData.PhoneNumbers.PhoneNumberCollection != null &&
                            electronicServiceApplicantContactData.PhoneNumbers.PhoneNumberCollection.Count > 0)
                        {
                            correspondent.ContactPhone = electronicServiceApplicantContactData.PhoneNumbers.PhoneNumberCollection[0];
                        }

                        if (electronicServiceApplicantContactData.FaxNumbers != null &&
                            electronicServiceApplicantContactData.FaxNumbers.ElectronicServiceApplicantFaxNumberCollection != null &&
                            electronicServiceApplicantContactData.FaxNumbers.ElectronicServiceApplicantFaxNumberCollection.Count > 0)
                        {
                            correspondent.ContactFax = electronicServiceApplicantContactData.FaxNumbers.ElectronicServiceApplicantFaxNumberCollection[0];
                        }
                    }

                    if (isNew)
                    {
                        correspondent.RegisterIndexId = 1;
                        correspondent.Email = email;
                        correspondent.IsActive = true;
                    }

                    returnValue.Add(correspondent);
                }
            }

            return returnValue;
        }
Esempio n. 9
0
        public virtual ArrayList C3GetDocs(string data, string mod)
        {
            int numAllegati = 0;

            string fromTime = "", toTime = "", optionTime = "";
            bool   modificati = false;
            //if (!string.IsNullOrEmpty(request.DateLimitsOptions))
            //    optionTime = request.DateLimitsOptions;
            //else
            //{
            //    if (!string.IsNullOrEmpty(request.FromDateTime))
            //    {
            //        fromTime = request.FromDateTime;
            //        if (!string.IsNullOrEmpty(request.ToDateTime))
            //            toTime = request.ToDateTime;
            //    }
            //    else
            //    {
            //        optionTime = "6";
            //    }
            //}

            DateTime dataX1 = DateTime.ParseExact(data, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);

            fromTime = dataX1.AddDays(-1).ToString("dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture) + " 00:00:00";
            toTime   = dataX1.AddDays(-1).ToString("dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture) + " 23:59:59";


            if (!string.IsNullOrEmpty(mod) && mod.ToLower() == "true")
            {
                modificati = true;
            }
            System.Data.DataTable fromDB = null;
            if (!modificati)
            {
                fromDB = BusinessLogic.Amministrazione.SistemiEsterni.C3GetDocs(fromTime, toTime, optionTime);
            }
            else
            {
                fromDB = BusinessLogic.Amministrazione.SistemiEsterni.C3GetDocsMod(fromTime, toTime, optionTime);
            }
            C3Document    docX = null;
            ArrayList     listaDocs = new ArrayList();
            Correspondent corrTemp = null, corrMitt = null;

            DocsPaVO.ProfilazioneDinamica.Templates templateDocX;
            ArrayList mitts = new ArrayList(), dest = new ArrayList(), destCC = new ArrayList();

            if (fromDB != null && fromDB.Rows != null && fromDB.Rows.Count > 0)
            {
                foreach (System.Data.DataRow r in fromDB.Rows)
                {
                    templateDocX      = null;
                    docX              = new C3Document();
                    docX.Id           = r["SYSTEM_ID"].ToString();
                    docX.DocumentType = r["CHA_TIPO_PROTO"].ToString();
                    docX.Object       = r["OGGETTO"].ToString();
                    docX.CreationDate = r["DATACREAZIONE"].ToString();
                    if (docX.DocumentType != "G")
                    {
                        docX.Signature      = r["DOCNAME"].ToString();
                        docX.ProtocolNumber = r["NUM_PROTO"].ToString();
                        docX.ProtocolYear   = r["NUM_ANNO_PROTO"].ToString();
                        docX.ProtocolDate   = r["DATAPROTO"].ToString();
                        if (r["REGISTRO"] != null && !string.IsNullOrEmpty(r["REGISTRO"].ToString()))
                        {
                            docX.Register             = new Register();
                            docX.Register.Id          = r["REGISTRO"].ToString().Split('§')[0];
                            docX.Register.Code        = r["REGISTRO"].ToString().Split('§')[1];
                            docX.Register.Description = r["REGISTRO"].ToString().Split('§')[2];
                            docX.Register.IsRF        = r["REGISTRO"].ToString().Split('§')[3] == "1" ? true : false;
                        }
                        if (r["MITT_DEST"] != null && !string.IsNullOrEmpty(r["MITT_DEST"].ToString()))
                        {
                            string[] arrCorr = r["MITT_DEST"].ToString().Split(';');
                            foreach (string sX in arrCorr)
                            {
                                corrTemp = new Correspondent();
                                if (sX.Contains("(D)"))
                                {
                                    corrTemp.Description = sX.Replace("(D)", "");
                                    dest.Add(corrTemp);
                                }
                                else if (sX.Contains("(CC)"))
                                {
                                    corrTemp.Description = sX.Replace("(CC)", "");
                                    destCC.Add(corrTemp);
                                }
                                else
                                {
                                    corrTemp.Description = sX;
                                    mitts.Add(corrTemp);
                                }
                            }

                            if (mitts.Count < 2 && mitts.Count > 0)
                            {
                                corrMitt = (Correspondent)mitts[0];
                            }

                            if (corrMitt != null)
                            {
                                docX.Sender = corrMitt;
                            }
                            if (corrMitt == null && mitts.Count > 0)
                            {
                                docX.MultipleSenders = (Correspondent[])mitts.ToArray(typeof(Correspondent));
                            }
                            if (dest.Count > 0)
                            {
                                docX.Recipients = (Correspondent[])dest.ToArray(typeof(Correspondent));
                            }
                            if (destCC.Count > 0)
                            {
                                docX.RecipientsCC = (Correspondent[])destCC.ToArray(typeof(Correspondent));
                            }
                        }
                    }
                    docX.Author       = r["AUTORE"].ToString();
                    docX.AuthorId     = r["IDAUTORE"].ToString();
                    docX.AuthorRole   = r["RUOLOCREATORE"].ToString();
                    docX.AuthorRoleId = r["IDRUOLOAUTORE"].ToString();
                    docX.AuthorUO     = r["UOCREATRICE"].ToString();
                    if (r["TIPOLOGIA"] != null && !string.IsNullOrEmpty(r["TIPOLOGIA"].ToString()))
                    {
                        docX.Template      = new Template();
                        docX.Template.Id   = r["TIPOLOGIA"].ToString().Split('§')[0];
                        docX.Template.Name = r["TIPOLOGIA"].ToString().Split('§')[1];
                        templateDocX       = BusinessLogic.ProfilazioneDinamica.ProfilazioneDocumenti.getTemplateDettagli(docX.Id);
                        docX.Template      = Utils.GetDetailsTemplateDoc(templateDocX, docX.Id);
                    }

                    if (r["DOC_PRINCIPALE"] != null && !string.IsNullOrEmpty(r["DOC_PRINCIPALE"].ToString()))
                    {
                        docX.MainDocument               = new C3File();
                        docX.MainDocument.Name          = r["DOC_PRINCIPALE"].ToString().Split('§')[0];
                        docX.MainDocument.VersionId     = r["DOC_PRINCIPALE"].ToString().Split('§')[1];
                        docX.MainDocument.MimeType      = r["DOC_PRINCIPALE"].ToString().Split('§')[2];
                        docX.MainDocument.VersionIdinDB = r["DOC_PRINCIPALE"].ToString().Split('§')[3];
                        docX.MainDocument.PathName      = r["DOC_PRINCIPALE"].ToString().Split('§')[4];
                        docX.MainDocument.FileSize      = r["DOC_PRINCIPALE"].ToString().Split('§')[5];
                    }

                    if (r["NUM_ALLEGATI"] != null && !string.IsNullOrEmpty(r["NUM_ALLEGATI"].ToString()) && Int32.Parse(r["NUM_ALLEGATI"].ToString()) > 0)
                    {
                        C3File                allX      = null;
                        ArrayList             allXs     = new ArrayList();
                        System.Data.DataTable fromDBAll = BusinessLogic.Amministrazione.SistemiEsterni.C3GetAllByIdDoc(docX.Id);
                        foreach (System.Data.DataRow rAll in fromDBAll.Rows)
                        {
                            allX             = new C3File();
                            allX.Description = rAll["OGGETTO"].ToString();
                            allX.Id          = rAll["SYSTEM_ID"].ToString();
                            if (rAll["FILE_ALLEGATO"] != null && !string.IsNullOrEmpty(rAll["FILE_ALLEGATO"].ToString()))
                            {
                                allX.Name          = rAll["FILE_ALLEGATO"].ToString().Split('§')[0];
                                allX.VersionId     = rAll["FILE_ALLEGATO"].ToString().Split('§')[1];
                                allX.MimeType      = rAll["FILE_ALLEGATO"].ToString().Split('§')[2];
                                allX.VersionIdinDB = rAll["FILE_ALLEGATO"].ToString().Split('§')[3];
                                allX.PathName      = rAll["FILE_ALLEGATO"].ToString().Split('§')[4];
                                allX.FileSize      = rAll["FILE_ALLEGATO"].ToString().Split('§')[5];
                            }

                            allXs.Add(allX);
                        }
                        numAllegati += fromDBAll.Rows.Count;
                        if (allXs != null && allXs.Count > 0)
                        {
                            docX.Attachments = (C3File[])allXs.ToArray(typeof(C3File));
                        }
                    }

                    listaDocs.Add(docX);
                }
            }

            return(listaDocs);
        }
Esempio n. 10
0
        private List<Correspondent> GetDocumentCorrespondents(object rioApplication)
        {
            List<Correspondent> returnValue = new List<Correspondent>();

            CorrespondentDo correspondentDo = rioObjectExtractor.Extract<CorrespondentDo>(rioApplication);

            if (correspondentDo != null)
            {

                Correspondent correspondent = null;

                //Get EmptyCorrespondent
                if (String.IsNullOrWhiteSpace(correspondentDo.Email) ||
                    String.IsNullOrWhiteSpace(correspondentDo.FirstName) ||
                    String.IsNullOrWhiteSpace(correspondentDo.LastName))
                {
                    correspondent = this.unitOfWork.DbContext.Set<Correspondent>().SingleOrDefault(e => e.Alias == "Empty");
                }
                else
                {
                    correspondent = this.correspondentRepository.GetBgCitizenCorrespondent(correspondentDo.Email, correspondentDo.FirstName, correspondentDo.LastName, null);

                    if (correspondent == null)
                    {
                        correspondent = new Correspondent();
                        correspondent.CorrespondentGroupId = this.unitOfWork.DbContext.Set<CorrespondentGroup>()
                            .SingleOrDefault(e => e.Alias == "Applicants")
                            .CorrespondentGroupId;
                        correspondent.CorrespondentTypeId = this.unitOfWork.DbContext.Set<CorrespondentType>()
                            .SingleOrDefault(e => e.Alias == "BulgarianCitizen")
                            .CorrespondentTypeId;
                        correspondent.BgCitizenFirstName = correspondentDo.FirstName;
                        correspondent.BgCitizenLastName = correspondentDo.LastName;
                        correspondent.BgCitizenUIN = null;
                        correspondent.RegisterIndexId = 1;
                        correspondent.Email = correspondentDo.Email;
                        correspondent.IsActive = true;
                    }
                }

                returnValue.Add(correspondent);
            }

            return returnValue;
        }
Esempio n. 11
0
        private List<Correspondent> GetDocumentCorrespondents(object rioApplication)
        {
            CorrespondentDo correspondentDo = rioObjectExtractor.Extract<CorrespondentDo>(rioApplication);

            List<Correspondent> returnValue = new List<Correspondent>();

            Correspondent correspondent = new Correspondent();
            correspondent.CorrespondentGroupId = this.unitOfWork.DbContext.Set<CorrespondentGroup>()
                .SingleOrDefault(e => e.Alias == "Applicants")
                .CorrespondentGroupId;
            correspondent.CorrespondentTypeId = this.unitOfWork.DbContext.Set<CorrespondentType>()
                .SingleOrDefault(e => e.Alias == "BulgarianCitizen")
                .CorrespondentTypeId;
            correspondent.BgCitizenFirstName = correspondentDo.FirstName;
            correspondent.BgCitizenLastName = correspondentDo.LastName;
            correspondent.BgCitizenPosition = correspondentDo.Position;
            correspondent.ContactPhone = correspondentDo.Phone;
            correspondent.RegisterIndexId = 1;

            correspondent.IsActive = true;

            returnValue.Add(correspondent);

            return returnValue;
        }