Ejemplo n.º 1
0
        public HttpResponseMessage GetIdentificationById(HttpRequestMessage reqObject)
        {
            string IdentificationId = string.Empty;

            _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
            if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
            {
                _IdentificationType = JsonConvert.DeserializeObject <IdentificationType>(_requestedDataObject.BusinessData);
                IdentificationId    = _IdentificationType.IdentificationId;
            }

            if (!string.IsNullOrWhiteSpace(IdentificationId))
            {
                _IdentificationType = new IdentificationType();
                _IdentificationType = _IIdentificationTypeService.GetIdentificationTypeById(IdentificationId);
            }
            if (_IdentificationType != null)
            {
                _serviceResponse = _IDataManipulation.ResopnseWhenDataFound(_IdentificationType, "information has been fetched successfully");
            }
            else
            {
                _serviceResponse = _IDataManipulation.ResopnseWhenDataNotFound("Identification Not Found...");
            }
            _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
            return(_response);
        }
Ejemplo n.º 2
0
        private bool CheckDataIfExists(string query, IdentificationType identificationType, string data)
        {
            try
            {
                Connect();

                var command = connection.CreateCommand();
                command.CommandText = query;
                command.Parameters.AddWithValue("@" + identificationType, data);

                var result = command.ExecuteScalar();

                return(result != null ? true : false);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);

                return(false);
            }
            finally
            {
                connection.Close();
            }
        }
Ejemplo n.º 3
0
        public HttpResponseMessage UpdateAccGroup(HttpRequestMessage reqObject)
        {
            int result = 0;

            _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
            if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
            {
                _IdentificationType = JsonConvert.DeserializeObject <IdentificationType>(_requestedDataObject.BusinessData);
            }

            if (_IdentificationType == null || string.IsNullOrWhiteSpace(_IdentificationType.IdentificationId))
            {
                _serviceResponse = _IDataManipulation.ResopnseWhenDataNotFound("Identification Not Found...");
                _response        = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
                return(_response);
            }

            result = _IIdentificationTypeService.UpdateIdentificationType(_IdentificationType);
            if (result == 1)
            {
                _serviceResponse = _IDataManipulation.ResopnseWhenDataFound(result, "information has been updated successfully");
            }
            else
            {
                _serviceResponse = _IDataManipulation.ResopnseWhenDataNotFound("Identification Not Found...");
            }
            _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
            return(_response);
        }
Ejemplo n.º 4
0
        public async Task <ResponseModel> Insert(IdentificationTypeModel model)
        {
            ResponseModel response = new ResponseModel();

            try
            {
                IdentificationType md = new IdentificationType();

                md.Name       = model.Name;
                md.Precedence = model.Precedence;
                md.IsActive   = model.IsActive;
                md.CreateBy   = base.UserId;
                md.CreateDate = DateTime.Now;
                md.Deleted    = false;

                await _context.IdentificationTypeRepository.AddAsync(md).ConfigureAwait(true);

                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> PutIdentificationType(int id, IdentificationType identificationType)
        {
            if (id != identificationType.Id)
            {
                return(BadRequest());
            }

            _context.Entry(identificationType).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!IdentificationTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 public IdentificationDocument(string identification, IdentificationType identificationType)
 {
     identification.EnsureMinimumLength(5, "On creating identification document data was invalid ");
     Value = identification;
     EnsureIdentificationTypeNotNone(identificationType, "On creating identification document, document type was invalid");
     Type = identificationType;
 }
Ejemplo n.º 7
0
        public async Task <ResponseModel> Delete(IdentificationTypeModel model)
        {
            ResponseModel response = new ResponseModel();

            try
            {
                IdentificationType md = await _context.IdentificationTypeRepository.FirstOrDefaultAsync(m => m.Id == model.Id);

                if (!md.RowVersion.SequenceEqual(model.RowVersion))
                {
                    response.ResponseStatus = Core.CommonModel.Enums.ResponseStatus.OutOfDateData;
                    return(response);
                }

                md.Deleted    = true;
                md.UpdateBy   = base.UserId;
                md.UpdateDate = DateTime.Now;

                _context.IdentificationTypeRepository.Update(md);

                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
 public void EnsureIdentificationTypeNotNone(IdentificationType addressType, string message)
 {
     if (addressType == IdentificationType.None)
     {
         throw new ArgumentException(message);
     }
 }
Ejemplo n.º 9
0
        public JsonResult Delete(int id)
        {
            try
            {
                if (id == 0)
                {
                    return(Json(new { responseCode = "-10" }));
                }


                IdentificationType model = this._identificationTypeBusiness.Get(id);
                model.Enable = false;
                this._identificationTypeBusiness.Save(model);

                var responseObject = new
                {
                    responseCode = 0
                };
                return(Json(responseObject));
            }
            catch (Exception)
            {
                return(Json(new { responseCode = "-10" }));
            }
        }
Ejemplo n.º 10
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (IdentificationType != 0)
            {
                hash ^= IdentificationType.GetHashCode();
            }
            if (Identifier.Length != 0)
            {
                hash ^= Identifier.GetHashCode();
            }
            if (IssuingCountry.Length != 0)
            {
                hash ^= IssuingCountry.GetHashCode();
            }
            if (NonstateIssuer.Length != 0)
            {
                hash ^= NonstateIssuer.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 11
0
 public async Task <Person> GetByIdentificationNumberAsync(IdentificationType type, string number)
 {
     return(await _context.Persons
            .Include(p => p.ContactInformations)
            .Include(p => p.Address)
            .FirstOrDefaultAsync(p => p.IdentificationType == type && p.IdentificationNumber == number));
 }
        public ActionResult DeleteConfirmed(int id)
        {
            IdentificationType identificationType = db.IdentificationType.Find(id);

            db.IdentificationType.Remove(identificationType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 13
0
        private void Update(IdentificationType view)
        {
            IdentificationType model = Get(view.Id);

            model.Name = view.Name;

            this.repository.Update(view);
        }
Ejemplo n.º 14
0
        public static IdentificationType CreateIdentificationType(string identificationTypeId, int fixedLength)
        {
            IdentificationType identificationType = new IdentificationType();

            identificationType.IdentificationTypeId = identificationTypeId;
            identificationType.FixedLength          = fixedLength;
            return(identificationType);
        }
 public ActionResult Edit(IdentificationType identificationType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(identificationType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(identificationType));
 }
Ejemplo n.º 16
0
        private Identification(IdentificationType type, string value)
        {
            Type = type;

            if (string.IsNullOrEmpty(value))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(value));
            }

            Value = value;
        }
Ejemplo n.º 17
0
        public async Task Edit(IdentificationType _identificationType)
        {
            var _identificationTypeToEdit = await GetById(_identificationType.Id);

            if (_identificationTypeToEdit != null)
            {
                _identificationTypeToEdit.Title = _identificationType.Title;

                await _context.SaveChangesAsync();
            }
        }
Ejemplo n.º 18
0
 public void Save(IdentificationType model)
 {
     if (model.Id > 0)
     {
         Update(model);
     }
     else
     {
         Create(model);
     }
 }
        public ActionResult Create(IdentificationType identificationType)
        {
            if (ModelState.IsValid)
            {
                db.IdentificationType.Add(identificationType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(identificationType));
        }
        // GET: /Admin/IdentificationTypes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IdentificationType identificationType = db.IdentificationType.Find(id);

            if (identificationType == null)
            {
                return(HttpNotFound());
            }
            return(View(identificationType));
        }
Ejemplo n.º 21
0
 public IActionResult Post([FromBody] IdentificationType identificationType)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest());
         }
         return(Ok(_unitOfWork.IdentificationType.Insert(identificationType)));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, "Internal server error: " + ex.Message));
     }
 }
 public IdentificationType GetIdentificationTypeBy(IdentificationType _IdentificationId)
 {
     try
     {
         return(_IUoW.Repository <IdentificationType>().GetBy(x => x.IdentificationId == _IdentificationId.IdentificationId &&
                                                              x.AuthStatusId == "A" &&
                                                              x.LastAction != "DEL"));
     }
     catch (Exception ex)
     {
         _ObjErrorLogService = new ErrorLogService();
         _ObjErrorLogService.AddErrorLog(ex, string.Empty, "GetIdentificationTypeBy(string)", string.Empty);
         return(null);
     }
 }
Ejemplo n.º 23
0
        public JsonResult Get(int id)
        {
            IdentificationType model = new IdentificationType();

            try
            {
                model = this._identificationTypeBusiness.Get(id);


                return(Json(model, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                return(Json(new { responseCode = "-10" }));
            }
        }
Ejemplo n.º 24
0
 public CreateCustomerRequest(string identificationNo, IdentificationType identificationType, string taxNumber,
                              string firstName, string middleName, string lastName, string fatherName,
                              string nationality, Gender gender, DateTime birthDate, string userId, Address address)
 {
     IdentificationNo   = Throw.ArgumentNullException.IfNull(identificationNo, nameof(identificationNo));
     IdentificationType = Throw.ArgumentNullException.IfNull(identificationType, nameof(identificationType));
     TaxNumber          = Throw.ArgumentNullException.IfNull(taxNumber, nameof(taxNumber));
     FirstName          = Throw.ArgumentNullException.IfNull(firstName, nameof(firstName));
     MiddleName         = Throw.ArgumentNullException.IfNull(middleName, nameof(middleName));
     LastName           = Throw.ArgumentNullException.IfNull(lastName, nameof(lastName));
     FatherName         = Throw.ArgumentNullException.IfNull(fatherName, nameof(fatherName));
     Nationality        = Throw.ArgumentNullException.IfNull(nationality, nameof(nationality));
     Gender             = Throw.ArgumentNullException.IfNull(gender, nameof(gender));
     BirthDate          = Throw.ArgumentNullException.IfNull(birthDate, nameof(birthDate));
     UserId             = Throw.ArgumentNullException.IfNull(userId, nameof(userId));
     Address            = Throw.ArgumentNullException.IfNull(address, nameof(address));
 }
 public Task <IdentificationTypeDTO> GetById(int id)
 {
     return(Task.Run(() =>
     {
         try
         {
             IEnumerable <IdentificationType> query = _db.IdentificationTypes.FromSqlRaw($"spGetIdentificationTypes").AsEnumerable();
             IdentificationType data = query.Count() > 0 ? query.Where(x => x.Id == id).FirstOrDefault() : null;
             return data != null ? new GenericMapper <IdentificationType, IdentificationTypeDTO>().Map(data) : null;
         }
         catch (Exception ex)
         {
             Console.WriteLine($"Internal Error: {ex}");
         }
         return null;
     }));
 }
        public int UpdateIdentificationType(IdentificationType _IdentificationType)
        {
            try
            {
                int  result = 0;
                bool IsRecordExist;
                if (!string.IsNullOrWhiteSpace(_IdentificationType.IdentificationId))
                {
                    IsRecordExist = _IUoW.Repository <IdentificationType>().IsRecordExist(x => x.IdentificationId == _IdentificationType.IdentificationId);
                    if (IsRecordExist)
                    {
                        var _oldIdentificationType       = _IUoW.Repository <IdentificationType>().GetBy(x => x.IdentificationId == _IdentificationType.IdentificationId);
                        var _oldIdentificationTypeForLog = ObjectCopier.DeepCopy(_oldIdentificationType);

                        _oldIdentificationType.AuthStatusId = _IdentificationType.AuthStatusId = "U";
                        _oldIdentificationType.LastAction   = _IdentificationType.LastAction = "EDT";
                        _oldIdentificationType.LastUpdateDT = _IdentificationType.LastUpdateDT = System.DateTime.Now;
                        _oldIdentificationType.MakeBy       = "mtaka";
                        result = _IUoW.Repository <IdentificationType>().Update(_oldIdentificationType);

                        #region Auth Log
                        if (result == 1)
                        {
                            _IAuthLogService = new AuthLogService();
                            long _outMaxSlAuthLogDtl = 0;
                            result = _IAuthLogService.AddAuthLog(_IUoW, _oldIdentificationTypeForLog, _IdentificationType, "EDT", "0001", "010101001", 1, "IdentificationType", "MTK_CP_IDENTIFICATION_TYPE", "IdentificationId", _IdentificationType.IdentificationId, "mtaka", _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl);
                        }
                        #endregion

                        if (result == 1)
                        {
                            _IUoW.Commit();
                        }
                        return(result);
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                _ObjErrorLogService = new ErrorLogService();
                _ObjErrorLogService.AddErrorLog(ex, string.Empty, "UpdateIdentificationType(obj)", string.Empty);
                return(0);
            }
        }
Ejemplo n.º 27
0
 public static void PopulateIdentificationTypes()
 {
     if (_db.IdentificationTypes.ToList().Count <= 0)
     {
         string identificationTypes = "Cedula Ciudadania, Cedula Extranjera, Tarjeta Identidad, Rut, Nit";
         foreach (var identificationType in identificationTypes.Split(","))
         {
             IdentificationType newIdentificationType = new IdentificationType
             {
                 Name       = identificationType,
                 CreatedBy  = Faker.Name.Name(),
                 ModifiedBy = Faker.Name.Name()
             };
             _db.IdentificationTypes.Add(newIdentificationType);
             _db.SaveChanges();
         }
     }
 }
Ejemplo n.º 28
0
 public IActionResult Put([FromBody] IdentificationType identificationType)
 {
     try
     {
         if (ModelState.IsValid && _unitOfWork.IdentificationType.Update(identificationType))
         {
             return(Ok(new { Message = "Tipo de identificacion se ha actualizado" }));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         return(StatusCode(500, "Internal server error: " + ex.Message));
     }
 }
Ejemplo n.º 29
0
 public HttpResponseMessage GetIdentificationBy(HttpRequestMessage reqObject)
 {
     _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
     if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
     {
         _IdentificationType = JsonConvert.DeserializeObject <IdentificationType>(_requestedDataObject.BusinessData);
         _IdentificationType = _IIdentificationTypeService.GetIdentificationTypeBy(_IdentificationType);
     }
     if (_IdentificationType != null)
     {
         _serviceResponse = _IDataManipulation.ResopnseWhenDataFound(_IdentificationType, "information has been fetched successfully");
     }
     else
     {
         _serviceResponse = _IDataManipulation.ResopnseWhenDataNotFound("Identification Not Found...");
     }
     _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
     return(_response);
 }
Ejemplo n.º 30
0
        public static ItemChoiceType1 ToItemChoiceType1(this IdentificationType identificationType)
        {
            switch (identificationType)
            {
            case IdentificationType.DigipostAddress:
                return(ItemChoiceType1.digipostaddress);

            case IdentificationType.PersonalIdentificationNumber:
                return(ItemChoiceType1.personalidentificationnumber);

            case IdentificationType.OrganizationNumber:
                return(ItemChoiceType1.organisationnumber);

            case IdentificationType.NameAndAddress:
                return(ItemChoiceType1.nameandaddress);

            default:
                throw new ArgumentOutOfRangeException(nameof(identificationType), identificationType, null);
            }
        }
        public virtual async Task<IMessageDeliveryResult> Send(byte[] fileContent, string filetype, string subject,IdentificationType identification,
            string identificationValue, SensitivityLevel sensitivity = SensitivityLevel.Normal,
            AuthenticationLevel authentication = AuthenticationLevel.Password, SmsNotification smsNotification = null,PrintDetails printDetails= null)
        {
            var recipient = new RecipientById(identification, identificationValue);

            var primaryDocument = new Document(subject, filetype, fileContent)
            {
                SensitivityLevel = sensitivity,
                AuthenticationLevel = authentication
            };
            if (smsNotification != null)
                primaryDocument.SmsNotification = smsNotification;
            
            var m = new Message(recipient, primaryDocument);

            if (printDetails != null)
                m.PrintDetails = printDetails;


            return await GetClient().SendMessageAsync(m);
        }
Ejemplo n.º 32
0
        /// <summary>
        /// 创建认证标识
        /// </summary>
        /// <param name="identificationType">认证标识实体</param>
        /// <returns></returns>
        public bool CreateIdentificationType(IdentificationType identificationType, Stream logoStream)
        {
            EventBus<IdentificationType>.Instance().OnBefore(identificationType, new CommonEventArgs(EventOperationType.Instance().Create()));

            identificationType.IdentificationTypeLogo = string.Empty;
            identificationTypeRepository.Insert(identificationType);

            //创建认证标识图片
            if (logoStream != null)
            {
                LogoService logoService = new LogoService(TenantTypeIds.Instance().IdentificationType());
                identificationType.IdentificationTypeLogo = logoService.UploadLogo(identificationType.IdentificationTypeId, logoStream);
                identificationTypeRepository.Update(identificationType);
            }

            EventBus<IdentificationType>.Instance().OnAfter(identificationType, new CommonEventArgs(EventOperationType.Instance().Create()));
            return true;
        }
        private async Task SendMessage(string subject, IdentificationType identification, string identificationValue,
            string filePath, PrintDetails printDetails)
        {
            byte[] file = null;
            var fileType = "";

            if (openFileDialog.FileName != null && !string.IsNullOrEmpty(filePath))
            {
                file = File.ReadAllBytes(openFileDialog.FileName);
                fileType = openFileDialog.FileName.Split('.')[1];
            }
            else if (!string.IsNullOrEmpty(ExtractedHtmlContent))
            {
                file = Encoding.UTF8.GetBytes(ExtractedHtmlContent);
                fileType = "html";
            }

            try
            {
                var response =
                    await
                        _digipostService.Send(file, fileType, subject, identification, identificationValue,
                            printDetails: printDetails);

                AppendResponse("Send: Status: " + response.Status + ", DeliveryMethod: " + response.DeliveryMethod +
                               ", documentGuid:" + response.PrimaryDocument.Guid + ", DeliveryTime" +
                               response.DeliveryTime);
                ResetSendView();
            }
            catch (ClientResponseException cre)
            {
                var message = cre.InnerException?.Message ?? cre.Error.ToString();
                AppendResponse("Send: Status:" + message);
            }
        }