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); }
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(); } }
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); }
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); }
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; }
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); } }
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" })); } }
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); }
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")); }
private void Update(IdentificationType view) { IdentificationType model = Get(view.Id); model.Name = view.Name; this.repository.Update(view); }
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)); }
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; }
public async Task Edit(IdentificationType _identificationType) { var _identificationTypeToEdit = await GetById(_identificationType.Id); if (_identificationTypeToEdit != null) { _identificationTypeToEdit.Title = _identificationType.Title; await _context.SaveChangesAsync(); } }
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)); }
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); } }
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" })); } }
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); } }
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(); } } }
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)); } }
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); }
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); }
/// <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); } }