public IHttpActionResult InsertPosIncidentReport(DomainModel.Models.IncidentReport.PosIncidentReport posIncidentReport) { try { _incidentReportRepository.InsertPosIncidentReport(posIncidentReport); return(Ok(posIncidentReport)); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
/// <summary> /// this private method used for get expression. -An /// </summary> /// <param name="var1"></param> /// <param name="posIncidentReport"></param> /// <returns></returns> private string GetExpression(string var1, DomainModel.Models.IncidentReport.PosIncidentReport posIncidentReport) { try { string value1 = ""; value1 = posIncidentReport.GetType().GetProperty(var1).GetValue(posIncidentReport, null).ToString(); string str = (value1); return(str.ToLower(CultureInfo.InvariantCulture)); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
private void UpdateItemCommitQuantity(DomainModel.Models.IncidentReport.PosIncidentReport reportDetails) { try { var itemQuantityDetails = _itemQuantityContext.FirstOrDefault(x => x.ItemId == reportDetails.ItemId && x.BranchId == reportDetails.BranchId); if (itemQuantityDetails != null) { itemQuantityDetails.ActualQuantity = reportDetails.CommitedQuantity; itemQuantityDetails.ModifiedDateTime = DateTime.UtcNow; _itemQuantityContext.Update(itemQuantityDetails); _itemQuantityContext.SaveChanges(); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
private PosIncidentReportAc MapPosIncidentReportAc(DomainModel.Models.IncidentReport.PosIncidentReport incidentReportDetails) { try { var incidentAc = new PosIncidentReportAc(); incidentAc = ApplicationClassHelper.ConvertType <DomainModel.Models.IncidentReport.PosIncidentReport, PosIncidentReportAc>(incidentReportDetails); if (incidentReportDetails.RecordId != null) { var parentRecredDetails = _parentRecordContext.FirstOrDefault(x => x.Id == incidentReportDetails.RecordId); if (parentRecredDetails != null) { var workFlowStatusDetails = _workFLowLogContext.Fetch(x => x.RecordId == parentRecredDetails.Id).ToList().Last(); if (workFlowStatusDetails != null) { incidentAc.WorkFlowStatus = workFlowStatusDetails.Action; } } } incidentAc.PosIncidentReportId = incidentReportDetails.Id; incidentAc.IncidentTypeName = incidentReportDetails.IncidentTypes.ValueEn; incidentAc.LossValue = incidentReportDetails.CommittedLossValue; incidentAc.GainValue = incidentReportDetails.CommittedGainValue; incidentAc.ResolveQuantity = incidentReportDetails.CommitedQuantity; incidentAc.ItemName = incidentReportDetails.ItemProfile.ItemNameEn; incidentAc.BranchName = incidentReportDetails.BranchDetail.Name; incidentAc.BranchId = (int)incidentReportDetails.BranchId; incidentAc.CostPrice = incidentReportDetails.ItemProfile.CostPrice; incidentAc.IncidentDate = incidentReportDetails.CreatedDateTime.ToString("dd/MM/yyyy hh:mm"); return(incidentAc); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
/// <summary> /// This method is used for insert data in posIncidentReport. /// </summary> /// <param name="posIncidentReport"></param> /// <returns></returns> public DomainModel.Models.IncidentReport.PosIncidentReport InsertPosIncidentReport(DomainModel.Models.IncidentReport.PosIncidentReport posIncidentReport) { try { posIncidentReport.CreatedDateTime = DateTime.UtcNow; _posIncidentReportDataRepository.Add(posIncidentReport); _posIncidentReportDataRepository.SaveChanges(); return(posIncidentReport); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
private WorkFlowLog SaveWorkFlowDetails(WorkFlowDetail workFlowCurrentDetails, DomainModel.Models.IncidentReport.PosIncidentReport incidentReportInfo, UserDetail userDetails, string comment, string action) { try { WorkFlowLog workFlowLog = new WorkFlowLog(); workFlowLog.Comments = comment; workFlowLog.CreatedDateTime = DateTime.UtcNow; workFlowLog.RecordId = (int)incidentReportInfo.RecordId; workFlowLog.RoleId = userDetails.RoleId; workFlowLog.UserId = userDetails.UserId; workFlowLog.WorkFlowId = workFlowCurrentDetails.Id; workFlowLog.Action = action; workFlowLog.Stage = (userDetails.RoleName) + " " + (workFlowCurrentDetails.Activity != null ? workFlowCurrentDetails.Activity.Name : ""); _workFLowLogContext.Add(workFlowLog); _workFLowLogContext.SaveChanges(); return(workFlowLog); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
private DomainModel.Models.IncidentReport.PosIncidentReport SaveIncidentReportDetails(DomainModel.Models.IncidentReport.PosIncidentReport incidentReportInfo, WorkFlowDetail activityWorkFlow, string comment, UserDetail userDetail) { try { if (incidentReportInfo != null) { ParentRecord parentRecord = new ParentRecord(); parentRecord.BranchId = incidentReportInfo.BranchId; parentRecord.CreatedDateTime = DateTime.UtcNow; parentRecord.InitiationComment = comment; parentRecord.InitiationDate = DateTime.UtcNow; parentRecord.ModificationDate = DateTime.UtcNow; parentRecord.InitiatorId = userDetail.UserId; parentRecord.ModifiedUserId = userDetail.UserId; parentRecord.WorkFlowId = activityWorkFlow.Id; _parentRecordContext.Add(parentRecord); _parentRecordContext.SaveChanges(); if (parentRecord.Id != 0) { WorkFlowLog workFlowLog = new WorkFlowLog(); workFlowLog.Comments = comment; workFlowLog.CreatedDateTime = DateTime.UtcNow; workFlowLog.RecordId = parentRecord.Id; workFlowLog.RoleId = userDetail.RoleId; workFlowLog.UserId = userDetail.UserId; workFlowLog.WorkFlowId = activityWorkFlow.Id; workFlowLog.Action = StringConstants.InitiateAction; workFlowLog.Stage = (userDetail.RoleName) + " " + (activityWorkFlow.Activity != null ? activityWorkFlow.Activity.Name : ""); _workFLowLogContext.Add(workFlowLog); _workFLowLogContext.SaveChanges(); if (workFlowLog.Id != 0) { incidentReportInfo.IsProcess = false; incidentReportInfo.RecordId = parentRecord.Id; incidentReportInfo.ModifiedDateTime = DateTime.UtcNow; _posIncidentReportDataRepository.Update(incidentReportInfo); _posIncidentReportDataRepository.SaveChanges(); } } return(incidentReportInfo); } else { return(null); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public DomainModel.Models.IncidentReport.PosIncidentReport InsertPosIncidentReport(DomainModel.Models.IncidentReport.PosIncidentReport posIncidentReport) { try { _posIncidentReportContext.Add(posIncidentReport); _posIncidentReportContext.SaveChanges(); return(posIncidentReport); } catch (Exception) { throw; } }