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 override void Deserialize(IoBuffer input, ISerializationContext context) { Type = input.GetEnum <ClaimType>(); Action = input.GetEnum <ClaimAction>(); EntityId = input.GetInt32(); ClaimId = input.GetUInt32(); SpecialId = input.GetUInt32(); FromOwner = input.GetPascalString(); }
public bool TryAcceptClaim(int lotId, uint claimId, uint specialId, string previousOwner, ClaimAction openAction) { if (claimId == 0) { //job lot GetLot(lotId).Bootstrap(new LotContext { DbId = (int)specialId, //contains job type/grade Id = (uint)lotId, //lotId contains a "job lot location", not a DbId. ClaimId = claimId, ShardId = 0, Action = openAction }); return(true); } using (var da = DAFactory.Get) { var didClaim = da.LotClaims.Claim(claimId, previousOwner, Config.Call_Sign); if (!didClaim) { RemoveLot(lotId); return(false); } else { try { LOG.Info("Checking out db... " + lotId + "..."); var claim = da.LotClaims.Get(claimId); if (claim == null) { RemoveLot(lotId); return(false); } var lot = da.Lots.Get(claim.lot_id); if (lot == null) { RemoveLot(lotId); return(false); } LOG.Info("Starting claimed lot with dbid = " + lotId + "..."); GetLot(claim.lot_id).Bootstrap(new LotContext { DbId = lot.lot_id, Id = lot.location, ClaimId = claimId, ShardId = lot.shard_id, Action = openAction, HighMax = lot.admit_mode > 4 }); LOG.Info("Bootstrapped lot with dbid = " + lotId + "!"); return(true); } catch (Exception e) { LOG.Info("Lot bootstrap error! EXCEPTION: " + e.ToString()); return(false); } } } }
public void SetLot(DbLot lot, uint specialId, ClaimAction openAction) { Lot = lot; SpecialId = specialId; OpenAction = openAction; }
public async Task <ExecutionResponse <object> > AddRemoveClaims(UserClaimModel claims, ClaimAction action) { try { var client = await GetClient(isCurrentClient : true); var dtoString = JsonConvert.SerializeObject(claims); StringContent httpContent = new StringContent(dtoString, Encoding.UTF8, "application/json"); var response = await client.PostAsync($"/account/{(action == ClaimAction.Add ? "addclaims" : "removeclaims")}", httpContent); var result = await response.Content.ReadAsStringAsync(); var resObj = JsonConvert.DeserializeObject <object>(result); if (response.IsSuccessStatusCode) { return(new ExecutionResponse <object> { Message = $"User claims {(action == ClaimAction.Add ? "added" : "removed")} successfully", ResponseCode = ResponseCode.Ok, ResponseData = resObj }); } else { return(new ExecutionResponse <object> { Message = $"{result}", ResponseCode = ResponseCode.ServerException, ResponseData = null }); } } catch (Exception ex) { Log.Error(ex); return(new ExecutionResponse <object> { Message = "An error occurred while processing your request", ResponseCode = ResponseCode.ServerException, ResponseData = null }); } }