public bool AddOrUpdate(InboundFollowUpRequest inboundFollowUpRequest) { bool isSaved = true; using (WTCCeresEntities db = new WTCCeresEntities()) { try { if (inboundFollowUpRequest.InboundFollowUpRequestId == 0) { db.InboundFollowUpRequest.Add(inboundFollowUpRequest); } else { db.InboundFollowUpRequest.AddOrUpdate(inboundFollowUpRequest); } db.SaveChanges(); } catch (Exception ex) { string msg = ex.Message; isSaved = false; } } return(isSaved); }
public void PopulateInfo(VW_InboundRequest req) { LoadForm(); firstLoad = true; btnManageBal.Enabled = true; RelReq = req; cbStatus.SelectedValue = req.RequestStatusId; lblSSLineName.Text = req.SSLineCode; lblRelType.Text = req.ReleaseType; lblSize.Text = req.ContainerSizeName; lblReqDate.Text = req.DateRequested.ToString("dd-MMMd-yyyy"); fu = InboundFollowUpService.GetByOpenInboundRequestId(req.InboundRequestId); ReleaseList = ReleaseService.GetAllVWByInboundReqId(RelReq.InboundRequestId); if (!Information.IsNothing(fu)) { followUpQty = RelReq.TotalQtyAccptOfRequest - SumAddedLocations; var newRel = new VW_Release(); newRel.ReleaseNumber = "FOLLOW UP"; newRel.TotalQtyAccepted = followUpQty; pnlFollowUp.Show(); ReleaseList.Add(newRel); } var inReqDeclinedList = ReleaseList.Where(r => r.InboundReqDeclinedQtyId != 0).ToList(); if (inReqDeclinedList.Count > 0) { InReqDeclined = InboundReqDeclinedQtyService.GetById(inReqDeclinedList[0].InboundReqDeclinedQtyId); var newRel = new VW_Release(); newRel.ReleaseNumber = InReqDeclined.DeclineStatus; newRel.TotalQtyAccepted = InReqDeclined.QtyDeclined; ReleaseList.Add(newRel); btnManageBal.Enabled = false; } VWReleaseBindingSource.DataSource = null; VWReleaseBindingSource.DataSource = ReleaseList; dgvRelease.DataSource = null; dgvRelease.DataSource = VWReleaseBindingSource.DataSource; if (!Information.IsNothing(dgvRelease.CurrentRow) && dgvRelease.Rows.Count > 0 && InReqDeclined.InboundReqDeclinedQtyId == 0) { VW_Release focusedRel = (VW_Release)dgvRelease.CurrentRow.DataBoundItem; RelOrderList = ReleaseOrderService.GetAllVWByReleaseId(focusedRel.ReleaseId); cboRelOrder.DataSource = RelOrderList; cboRelOrder.DisplayMember = "RelOrder"; cboRelOrder.ValueMember = "ReleaseOrderId"; } firstLoad = false; CalculateQtys(); }
public bool Delete(int InboundFollowUpRequestId) { bool isSaved = true; using (WTCCeresEntities db = new WTCCeresEntities()) { try { ifur = db.InboundFollowUpRequest.Find(InboundFollowUpRequestId); db.InboundFollowUpRequest.Remove(ifur); db.SaveChanges(); } catch (Exception ex) { string msg = ex.Message; isSaved = false; } } return(isSaved); }
private void btnComplete_Click(object sender, EventArgs e) { var inbService = new InboundRequestService(); InboundRequest inbReq; inbReq = InboundRequestService.GetById(RelReq.InboundRequestId); inbReq.RequestStatusId = Conversions.ToInteger(cbStatus.SelectedValue); if (inbService.AddOrUpdate(inbReq)) { if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(MdlEnum.RequestStatus.FOLLOW_UP, cbStatus.SelectedValue, false))) { // fu.InboundRequestId = RelReq.InboundRequestId if (Information.IsNothing(fu)) { fu = new InboundFollowUpRequest(); } else { fu.isOpenFollowUp = false; followUpServ.AddOrUpdate(fu); fu = new InboundFollowUpRequest(); } fu.DueDate = dtpFollowUpDate.Value; fu.InboundRequestId = RelReq.InboundRequestId; fu.CreatedAt = DateAndTime.Now; fu.isOpenFollowUp = true; followUpServ.AddOrUpdate(fu); } Close(); } else { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Request status not updated.", "There was a problem updating the status of this request. Please try again or contact IT department", this); } }
public void LoadForm() { firstLoad = true; RelOrderList.Clear(); { var withBlock = cbStatus; withBlock.DataSource = RequestStatusService.GetByFlowType("INBOUND"); withBlock.DisplayMember = "StatusName"; withBlock.ValueMember = "RequestStatusId"; } { var withBlock1 = cboRelOrder; withBlock1.DataSource = RelOrderList; withBlock1.DisplayMember = "RelOrder"; withBlock1.ValueMember = "ReleaseOrderId"; } pnlFollowUp.Hide(); SumAddedLocations = 0; followUpQty = 0; fu = null; firstLoad = false; }
public bool AddOrUpdate(InboundFollowUpRequest inboundFollowUpRequest) { return(repository.AddOrUpdate(inboundFollowUpRequest)); }