public IHttpActionResult AddRoleClaim([FromUri] Guid roleId, [FromBody] ClaimModel model) { if (ModelState.IsValid) { try { var role = Context.Roles.Find(roleId); if (role != null) { var claim = new RoleClaim { Type = model.Type, Value = model.Value, RoleId = role.Id }; role.RoleClaims.Add(claim); Context.SaveChanges(); return(Ok()); } ModelState.AddModelError("", $"Invalid {nameof(roleId)}"); } catch (Exception ex) { return(InternalServerError(ex)); } } return(BadRequest(ModelState)); }
public IHttpActionResult AddUserClaim([FromUri] Guid userId, [FromBody] ClaimModel model) { if (ModelState.IsValid) { try { var user = Context.Users.Find(userId); if (user != null) { var claim = new UserClaim { Type = model.Type, Value = model.Value, UserId = user.Id }; user.UserClaims.Add(claim); Context.SaveChanges(); return(Ok()); } ModelState.AddModelError("", $"Invalid {nameof(userId)}"); } catch (Exception ex) { return(InternalServerError(ex)); } } return(BadRequest(ModelState)); }
// GET: Claim public ActionResult Index(String searchString) { List <ClaimModel> List = new List <ClaimModel>(); foreach (var item in claimService.GetAll()) { ClaimModel cm = new ClaimModel(); cm.id = item.id; cm.etat = item.etat; cm.cinInsured2 = item.cinInsured2; cm.contract_id = item.contract_id; cm.accidentDate = item.accidentDate; cm.localisation = item.localisation; List.Add(cm); } var finds = from m in List select m; if (!String.IsNullOrEmpty(searchString)) { finds = finds.Where(s => s.localisation.Contains(searchString)).AsEnumerable(); } return(View(finds)); }
// GET: Claim public ActionResult Index() { try { using (var db = new ProjeEntities()) { var emp = Session["emp"] as Employee; var ct = db.ClaimTypes.ToList(); List <MVCProje.Models.ClaimType> ctt = new List <MVCProje.Models.ClaimType>(); foreach (ProjeDB.ClaimType item in ct) { ctt.Add(new Models.ClaimType { Id = item.Id, Name = item.Name }); } List <Models.ClaimOther> co = new List <Models.ClaimOther>(); List <Models.ClaimHoliday> ch = new List <Models.ClaimHoliday>(); var clistother = db.EmployeeClaims.Where(x => x.EmployeeId == emp.Id).Where(z => z.ClaimTypeId == 1).ToList(); var clistholiday = db.EmployeeClaims.Where(x => x.EmployeeId == emp.Id).Where(z => z.ClaimTypeId == 2).ToList(); var dbo = DBO.GetInstance(); foreach (var item in clistholiday) { var returnch = dbo.getCholidaybyId(item.Id); Models.ClaimHoliday mch = new Models.ClaimHoliday(); mch.Id = returnch.Id; mch.Start = Convert.ToDateTime(returnch.StartDate); mch.Finish = Convert.ToDateTime(returnch.FinishDate); mch.Accept = (Boolean)returnch.Accept; ch.Add(mch); } foreach (var item in clistother) { var returnch = dbo.getCOtherbyId(item.Id); Models.ClaimOther mco = new Models.ClaimOther(); mco.Id = returnch.Id; mco.Details = returnch.Details; co.Add(mco); } MVCProje.Models.ClaimModel Cmodel = new ClaimModel(); Cmodel.ClaimTypeModel = ctt; Cmodel.ClaimHolidayModel = ch; Cmodel.ClaimOtherModel = co; return(View(Cmodel)); } } catch (Exception) { throw; } }
// POST: api/ClaimApi public HttpResponseMessage Post([FromBody] ClaimModel model) { try { model.StatusId = AttributeProviderSvc.GetClaimStatusIdFromName("new"); var entity = AutoMapper.Mapper.Map <Claim>(model); Uow.Claims.Add(entity); Uow.SaveChanges(); if (string.IsNullOrEmpty(model.ReturnUrl)) { //return RedirectToAction("Index"); return(Request.CreateResponse(HttpStatusCode.OK, new { returnUrl = "Index" })); } else { return(Request.CreateResponse(HttpStatusCode.OK, new { returnUrl = model.ReturnUrl })); //return Redirect(model.ReturnUrl); } } catch { return(Request.CreateResponse(HttpStatusCode.BadRequest)); //return View(); } }
public async Task <IActionResult> UpdateApproval([FromBody] ClaimModel value) { using (SqlConnection sqls = new SqlConnection(_connectionstring)) { using (SqlCommand cmd = new SqlCommand("npf_update_claim", sqls)) { cmd.CommandTimeout = 1200; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@globaluser", User.Identity.Name)); cmd.Parameters.Add(new SqlParameter("@claimtype", value.FundTypeID)); cmd.Parameters.Add(new SqlParameter("@fundtype", HttpContext.Session.GetInt32("fundtypeid"))); cmd.Parameters.Add(new SqlParameter("@bankcode", value.incomeacct)); cmd.Parameters.Add(new SqlParameter("@persid", value.PersonID)); cmd.Parameters.Add("@error", SqlDbType.Char, 500); cmd.Parameters["@error"].Direction = ParameterDirection.Output; await sqls.OpenAsync(); await cmd.ExecuteNonQueryAsync(); string message = (string)cmd.Parameters["@error"].Value; return(Ok(new { responseCode = 200, responseDescription = message })); } } }
public DataResult <int> AddClaimToUser(int userId, ClaimModel claimModel, int claimTypeId) { var newClaim = new ClaimEntity { Value = claimModel.Value }; try { var result = m_claimUoW.AddClaimToUser(userId, newClaim, claimTypeId); return(Success(result)); } catch (NoResultException <UserEntity> e) { m_logger.LogWarning(e); return(Error <int>(m_translator.Translate("invalid-user-id"), DataResultErrorCode.UserNotExistId)); } catch (NoResultException <ClaimTypeEntity> e) { m_logger.LogWarning(e); return(Error <int>(m_translator.Translate("invalid-claim-type"), DataResultErrorCode.ClaimTypeNotExistId)); } catch (DatabaseException e) { m_logger.LogWarning(e); return(Error <int>(e.Message)); } }
public static bool Insert(ClaimModel obj) { var result = false; SqlConnection conn = null; try { var conStr = DbHelper.GetConnectionString(); var query = "usp_claim_insert"; conn = new SqlConnection(conStr); var cmd = new SqlCommand(query, conn); cmd.Parameters.AddWithValue("member_id", obj.MemberId); cmd.Parameters.AddWithValue("Claim_Date", obj.ClaimDate); cmd.Parameters.AddWithValue("Due_Date", obj.DueDate); cmd.Parameters.AddWithValue("Claim_Amount", obj.ClaimAmount); cmd.CommandType = CommandType.StoredProcedure; conn.Open(); result = cmd.ExecuteNonQuery() > 0 ? true : false; conn.Close(); } catch (Exception ex) { Console.WriteLine("An error occurred to insert: '{0}'", ex); } finally { conn?.Close(); } return(result); }
[Authorize]//OAuth2 인증 설정 public ActionResult <SignInSimpleResultModel> AccessToUserInfo() { //리턴 보조 ApiResultReady armResult = new ApiResultReady(this); //리턴용 모델 SignInSimpleResultModel tmResult = new SignInSimpleResultModel(); //유저 정보 추출 ClaimModel cm = new ClaimModel(((ClaimsIdentity)User.Identity).Claims); //검색된 유저 UserSignInfoModel user = GlobalStatic.UserList.List .FirstOrDefault(m => m.ID == cm.id_int); if (null != user) {//유저 정보가 있다. tmResult.id = user.ID; tmResult.email = user.Email; } else {//유저 정보가 없다. armResult.InfoCode = "1"; armResult.Message = "엑세스 토큰이 유효하지 않습니다.[로그인 필요]"; } return(armResult.ToResult(tmResult)); }
protected void btnCreate_Click(object sender, EventArgs e) { int val; var r = int.TryParse(txtAmount.Text, out val); if (!r) { return; } var model = new ClaimModel(Convert.ToInt32(ddlClaim.SelectedValue), Convert.ToDateTime(txtClaimDate.Text).ToShortDateString(), Convert.ToDateTime(txtDueDate.Text).ToShortDateString(), Convert.ToDouble(txtAmount.Text)); var result = new ClaimAction().Insert(model); if (result == true) { lblResult.Text = "Claim Has Been Added Successfully! "; } else { lblResult.Text = "Claim Is Not Added "; } }
protected void btnUpdate_Click(object sender, EventArgs e) { ClaimModel obj = new ClaimModel(); obj.ClaimDate = Convert.ToDateTime(txtClaimDate.Text).ToShortDateString(); obj.DueDate = Convert.ToDateTime(txtDueDate.Text).ToShortDateString(); obj.ClaimAmount = Convert.ToDouble(txtAmount.Text); obj.Member.FirstName = ddlFirstName.SelectedItem.Text; obj.Member.Lastname = ddlLastName.SelectedItem.Text; obj.MemberId = Convert.ToInt32(ddlFirstName.SelectedValue); obj.MemberId = Convert.ToInt32(ddlLastName.SelectedValue); obj.ClaimId = Convert.ToInt32(ViewState["Claim_id"]); bool result = new ClaimAction().Update(obj); if (result == true) { Label1.Text = "Claim Has Been Updated Successfully!"; } else { Label1.Text = "Error to delete -> " + result; } BindData(); udp.Update(); }
public ActionResult <ApiResultObjectModel> SettingLoad() { ApiResultReady rrResult = new ApiResultReady(this); ApiResultObjectModel armResult = new ApiResultObjectModel(); rrResult.ResultObject = armResult; //유저 정보 추출 ClaimModel cm = new ClaimModel(((ClaimsIdentity)User.Identity).Claims); //이 유저가 해당 관리 등급이 있는지 확인한다. ManagementClassCheckType typePC = GlobalStatic.MgtA.MgtClassCheck(cm.id_int , ManagementClassType.Root); if (typePC == ManagementClassCheckType.Ok) { //세팅 로드 GlobalStatic.Setting_DataProc.Setting_Load(); } else { //에러 rrResult.InfoCode = ApiResultType.PermissionCheckError.ToString(); } return(rrResult.ToResult()); }
public List <ClaimModel> GetAllClaimByRoleId(int roleId) { List <ClaimModel> claimModels = new List <ClaimModel>(); using (conn = JBCertConnection.Instance) { string queryString = @"select * from [tblRoleClaim] where roleId = @RoleId and IsDeleted = 0"; conn.Open(); SqlCommand sqlCommand = new SqlCommand(queryString, conn); sqlCommand.CommandType = CommandType.Text; sqlCommand.Parameters.AddWithValue("@RoleId", roleId); SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(); try { while (sqlDataReader.Read()) { ClaimModel claimModel = new ClaimModel(); claimModel.Id = int.Parse(sqlDataReader["ClaimId"].ToString()); claimModels.Add(claimModel); } } catch (Exception ex) { throw ex; } finally { sqlDataReader.Close(); conn.Close(); } } return(claimModels); }
// GET: Claim/Details/5 public ActionResult Details(int id) { /* var userId = (int)Session["idu"]; * String Phone2 = userService.GetById(userId).login; * String mail = userService.GetById(userId).email; * ViewBag.home = mail; * ViewBag.phone = Phone2;*/ if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Claim c; c = ClaimsService.GetById((int)id); if (c == null) { return(HttpNotFound()); } ClaimModel cm = new ClaimModel() { ComplaintId = c.ComplaintId, Name = c.Name, Description = c.Description, ClaimDate = c.ClaimDate, ParentId = c.ParentId, ClaimType = c.ClaimType, status = c.status }; return(View(cm)); }
public async Task UpdateClaim_ClaimExists_ClaimNameIsAccurate(int id, string expectedUpdatedName, string expectedDescriptionName, bool expectedDefaultValue) { // Arrange IClaimRepository claimRepository = new ClaimRepository(new SQLServerGateway(), new ConnectionStringData()); ClaimModel claimModel = new ClaimModel(); claimModel.Id = id; claimModel.Type = expectedUpdatedName; claimModel.Value = expectedDescriptionName; claimModel.IsDefault = expectedDefaultValue; // Act await claimRepository.UpdateClaim(claimModel); var actual = await claimRepository.GetClaimById(id); var actualName = actual.Type; var actualDescriptionName = actual.Value; var actualDefaultValue = actual.IsDefault; // Assert Assert.IsTrue(actualName == expectedUpdatedName && actualDescriptionName == expectedDescriptionName && actualDefaultValue == expectedDefaultValue); }
public async Task <IActionResult> Delete(string clientId, ClaimModel clientClaim) { Client client = await _clientService.Find(clientId); if (client == null) { ViewBag.Message = string.Format("The Auth Central Client with ClientId {0} could not be found.", clientId); return(RedirectToAction("Index")); } bool saveRequired = false; for (int i = (client.Claims.Count - 1); i >= 0; i--) { var existingClientClaim = client.Claims[i]; if (existingClientClaim.Value == clientClaim.Value && existingClientClaim.Type == clientClaim.Type) { client.Claims.Remove(existingClientClaim); saveRequired = true; break; } } if (saveRequired) { await _clientService.Save(client); } return(RedirectToAction("Show", new { clientId = client.ClientId })); }
// GET: Claim/Edit/5 public ActionResult Edit(int id) { var userId = (int)Session["idu"]; String Phone2 = userService.GetById(userId).login; String mail = userService.GetById(userId).email; ViewBag.home = mail; ViewBag.phone = Phone2; if (id == 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } else { Claim e = ClaimsService.GetById(id); ClaimModel em = new ClaimModel(); em.Name = e.Name; em.Description = e.Description; em.ClaimDate = e.ClaimDate; em.ClaimType = e.ClaimType; em.status = e.status; return(View(em)); } }
public ActionResult Save(ClaimModel claimModel) { if (!ModelState.IsValid) { var viewModel = new ClaimsFormViewModel { TyeOfClaims = _context.TyeOfClaims.ToList(), TypesOfForms = _context.TypesOfForms.ToList(), ClaimModel = claimModel }; return(View("ClaimForm", viewModel)); } if (claimModel == null) { return(HttpNotFound()); } //Add the data into Context object _context.ClaimModels.Add(claimModel); // Save the data into the database _context.SaveChanges(); // Return to Home when data save successfully. return(RedirectToAction("Index")); }
public ActionResult <SettingListResultModel> SettingList() { ApiResultReady rrResult = new ApiResultReady(this); SettingListResultModel armResult = new SettingListResultModel(); rrResult.ResultObject = armResult; //유저 정보 추출 ClaimModel cm = new ClaimModel(((ClaimsIdentity)User.Identity).Claims); //이 유저가 해당 관리 등급이 있는지 확인한다. ManagementClassCheckType typePC = GlobalStatic.MgtA.MgtClassCheck(cm.id_int , ManagementClassType.Root); if (typePC == ManagementClassCheckType.Ok) { using (SpaNetCoreFoundationContext db1 = new SpaNetCoreFoundationContext()) { //세팅 리스트 armResult.SettingList = db1.Setting_Data .OrderBy(m => m.Number) .ToArray(); }//end using db1 } else { //에러 rrResult.InfoCode = ApiResultType.PermissionCheckError.ToString(); } return(rrResult.ToResult(armResult)); }
[Authorize]//OAuth2 인증 설정 public ActionResult <TestModel02> Test02(int nData) { //리턴 보조 ApiResultReady rrResult = new ApiResultReady(this); //리턴용 모델 TestModel02 armResult = new TestModel02(); rrResult.ResultObject = armResult; //유저 정보 추출 ClaimModel cm = new ClaimModel(((ClaimsIdentity)User.Identity).Claims); if (0 <= nData) {//양수다. armResult.nTest001 = nData; armResult.sTest002 = "성공 했습니다! : " + cm.id; } else { rrResult.InfoCode = "1"; rrResult.Message = "'nData'에 음수가 입력되었습니다."; } return(rrResult.ToResult(armResult)); }
public void AddClaimForOwner(ClaimModel claim) { _client.Index(claim, p => p .Index(Storage.ClaimIndex) .Id(claim.Id.ToString()) .Refresh(new Refresh())); }
public ActionResult <BoardListResultModel> List() { ApiResultReady rrResult = new ApiResultReady(this); BoardListResultModel armResult = new BoardListResultModel(); rrResult.ResultObject = armResult; //유저 정보 추출 ClaimModel cm = new ClaimModel(((ClaimsIdentity)User.Identity).Claims); //이 유저가 해당 관리 등급이 있는지 확인한다. ManagementClassCheckType typePC = GlobalStatic.MgtA.MgtClassCheck(cm.id_int , ManagementClassType.Admin); if (typePC == ManagementClassCheckType.Ok) { using (SpaNetCoreFoundationContext db1 = new SpaNetCoreFoundationContext()) { armResult.List = db1.Board.ToList(); }//end using db1 } else { //에러 rrResult.InfoCode = typePC.ToString(); } return(rrResult.ToResult()); }
public static ICollection <ClaimModel> GetAll() { ICollection <ClaimModel> results = new List <ClaimModel>(); var conStr = DbHelper.GetConnectionString(); var query = "usp_claim_retrieve"; using (var conn = new SqlConnection(conStr)) { var cmd = new SqlCommand(query, conn); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = null; conn.Open(); dr = cmd.ExecuteReader(); while (dr.Read()) { var obj = new ClaimModel(); obj.ClaimId = Convert.ToInt32(dr["ID"]); obj.MemberId = Convert.ToInt32(dr["member_id"]); obj.ClaimDate = Convert.ToDateTime(dr["claim_date"]).ToShortDateString(); obj.DueDate = Convert.ToDateTime(dr["claim_due_date"]).ToShortDateString(); obj.ClaimAmount = Convert.ToDouble(dr["claim_amount"]); obj.Member.FirstName = dr["member_fname"].ToString(); obj.Member.Lastname = dr["member_lname"].ToString(); obj.Member.MemberId = Convert.ToInt32(dr["member_id"]); results.Add(obj); } } return(results); }
public async Task <IHttpActionResult> AddClaimAsync(string subject, ClaimModel model) { var meta = await GetMetadataAsync(); if (!meta.UserMetadata.SupportsClaims) { return(NotFound()); } if (String.IsNullOrWhiteSpace(subject)) { ModelState["subject.String"].Errors.Clear(); ModelState.AddModelError("", Messages.SubjectRequired); } if (model == null) { ModelState.AddModelError("", Messages.ClaimDataRequired); } if (ModelState.IsValid) { var result = await this.userManager.AddClaimAsync(subject, model.Type, model.Value); if (result.IsSuccess) { return(NoContent()); } ModelState.AddErrors(result); } return(BadRequest(ModelState.ToError())); }
public IActionResult DeleteClaim(int id) { var claim = _configurationDbContext.Set <ClientClaim>() .Include(x => x.Client) .FirstOrDefault(x => x.Id == id); return(View(ClaimModel.FromEntity(claim))); }
public IActionResult DeleteClaim(Guid id) { var claim = _dbContext.Set <UserClaim>() .Include(x => x.User) .FirstOrDefault(x => x.Id == id); return(View(ClaimModel.FromEntity(claim))); }
public void RemoveAssociation(int roleId, ClaimModel claim) { var identityRole = _roleService.GetIdentityRoleBy(roleId); var identityClaim = new Claim(claim.Type, claim.Value); var identityResult = _roleManager.RemoveClaimAsync(identityRole, identityClaim).Result; CustomIdentityError.CatchErrorIfNeeded(identityResult); }
public async Task <IActionResult> DeleteClaim(Guid roleId, Guid claimId) { var role = await _dispatcher.DispatchAsync(new GetRoleQuery { Id = roleId, IncludeClaims = true, AsNoTracking = true }); var claim = role.Claims.FirstOrDefault(x => x.Id == claimId); return(View(ClaimModel.FromEntity(claim))); }
public void RemoveAssociation(int userId, ClaimModel claim) { var userSaved = _userService.GetUserBy(userId); var identityClaim = new Claim(claim.Type, claim.Value); var identityResult = _userManager.RemoveClaimAsync(userSaved, identityClaim).Result; CustomIdentityError.CatchErrorIfNeeded(identityResult); }
public IActionResult DeleteClaim(Guid userId, Guid claimId) { var user = _dispatcher.Dispatch(new GetUserQuery { Id = userId, IncludeClaims = true, AsNoTracking = true }); var claim = user.Claims.FirstOrDefault(x => x.Id == claimId); return(View(ClaimModel.FromEntity(claim))); }
private ObservableCollection<CodeRow> PopulateDetails(ClaimModel claimModel) { ObservableCollection<CodeRow> details = new ObservableCollection<CodeRow>(); details.Add(new CodeRow() { Code = string.Empty, Description = " " }); foreach (ClaimDetailDto claimDetailDto in claimModel.HeaderDto.ClaimDetails) { CodeRow codeRow = new CodeRow(); codeRow.Code = claimDetailDto.ClaimDetailData.ClaimDetailReference; codeRow.Description = claimDetailDto.ClaimDetailData.ClaimDetailReference + (!String.IsNullOrEmpty(claimDetailDto.ClaimDetailData.ClaimDetailTitle) ? (" - " + claimDetailDto.ClaimDetailData.ClaimDetailTitle) : string.Empty); details.Add(codeRow); } claimModel.InvokeCollectionChanged("ClaimEvent", claimModel.HeaderDto.Data.DataId); return details; }
protected override bool IsAvailableFor(ClaimModel model, DtoBase parentDto) { if (base.IsAvailableFor(model, parentDto)) { IClaimLitigationData claimlitigationdata = null; claimlitigationdata = parentDto.Data as ClaimLitigationData; if (claimlitigationdata.LitigationType == AXAClaimConstants.LITIGATIONTYPE_LIT && this.LinkableComponentType == StaticValues.LinkableComponentType.NameInvolvement) { return true; } } return false ; }
protected override bool IsAvailableFor(ClaimModel model, DtoBase parentDto) { if (base.IsAvailableFor(model, parentDto)) { IClaimDetailData claimDetailData = null; claimDetailData = parentDto.Data as ClaimDetailData; if (claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_AD && this.LinkableComponentType == StaticValues.LinkableComponentType.Recovery) { return true; } if ((claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPVD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPPD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPI || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_LIA) && this.LinkableComponentType == StaticValues.LinkableComponentType.Litigation) { return true; } } return false ; }
public AXAClaimDetailModel(ClaimModel ClaimModel) : base(ClaimModel) { // base.AddClaimDetailCommand = new DelegateCommand<NavigationMenuItemEventArgs>(base.OnAddClaimDetail, this.CanAddClaimDetail1); }