示例#1
0
        /// <summary>
        /// This method is used for fetching Last spo workFlowLog from database. - JJ
        /// </summary>
        /// <param name="id">id of spo</param>
        /// <returns>WorkFlowLogAC</returns>
        private WorkFlowLogAC GetSPOLog(int id)
        {
            var userName = "";
            var log      = _workFlowLogContext.Fetch(x => x.RecordId == id).ToList().LastOrDefault();

            if (_userDetailContext.Fetch(x => x.UserId == log.UserId).Any())
            {
                userName = _userDetailContext.FirstOrDefault(x => x.UserId == log.UserId).UserName;
            }
            WorkFlowLogAC workFlow = new WorkFlowLogAC
            {
                Id              = log.Id,
                Stage           = log.Stage,
                Action          = log.Action,
                ParentRecord    = log.ParentRecord,
                Comments        = log.Comments,
                RecordId        = log.RecordId,
                RoleId          = log.RoleId,
                RoleName        = log.RoleDetails.RoleName,
                UserId          = log.UserId,
                UserName        = userName,
                CreatedDateTime = log.CreatedDateTime,
                WorkFlowDetail  = log.WorkFlowDetail,
                WorkFlowId      = log.WorkFlowId
            };

            return(workFlow);
        }
示例#2
0
        /// <summary>
        /// This method is used for fetching supplier purchase order from database. - JJ
        /// </summary>
        /// <param name="POUD">ID OF PO</param>
        /// <returns>object of SupplierPOAC</returns>
        public SupplierPOAC GetSupplierPO(int POId)
        {
            if (_supplierPOContext.Fetch(x => x.Id == POId).Any())
            {
                var supplierPurchaseOrder = _supplierPOContext.FirstOrDefault(x => x.Id == POId);
                var workLog = new List <WorkFlowLogAC>();
                var lastLog = new WorkFlowLogAC();
                if (supplierPurchaseOrder.RecordId != null && supplierPurchaseOrder.RecordId > 0)
                {
                    workLog = GetSPOWorkFlowLog((int)supplierPurchaseOrder.RecordId);
                    lastLog = GetSPOLog((int)supplierPurchaseOrder.RecordId);
                }
                var itemList   = GetSupplierPOItemList(supplierPurchaseOrder.Id, supplierPurchaseOrder.PurchaseOrderNumber);
                var branchList = GetSPOBranchList(supplierPurchaseOrder.Id);

                SupplierPOAC supplierPO = new SupplierPOAC();
                supplierPO.Id                   = supplierPurchaseOrder.Id;
                supplierPO.DueDate              = supplierPurchaseOrder.DueDate;
                supplierPO.IsApproved           = supplierPurchaseOrder.IsApproved;
                supplierPO.IsConfirmed          = supplierPurchaseOrder.IsConfirmed;
                supplierPO.IsRejected           = supplierPurchaseOrder.IsRejected;
                supplierPO.IsCanceled           = supplierPurchaseOrder.IsCanceled;
                supplierPO.IsReceived           = supplierPurchaseOrder.IsReceived;
                supplierPO.IsSend               = supplierPurchaseOrder.IsSend;
                supplierPO.IsSubmitted          = supplierPurchaseOrder.IsSubmitted;
                supplierPO.UserId               = supplierPurchaseOrder.UserId;
                supplierPO.IsCancelApproved     = supplierPurchaseOrder.IsCancelApproved;
                supplierPO.IsPartiallyReceived  = supplierPurchaseOrder.IsPartiallyReceived;
                supplierPO.IsCancelApproved     = supplierPurchaseOrder.IsCancelApproved;
                supplierPO.PurchaseOrderNumber  = supplierPurchaseOrder.PurchaseOrderNumber;
                supplierPO.InitiationBranchId   = supplierPurchaseOrder.InitiationBranchId;
                supplierPO.InitiationBranchName = supplierPurchaseOrder.InitiatorBranch.Name;
                supplierPO.IssueDate            = supplierPurchaseOrder.CreatedDateTime;
                supplierPO.SupplierId           = supplierPurchaseOrder.SupplierId;
                supplierPO.SupplierName         = supplierPurchaseOrder.SupplierProfile.NameEn;
                supplierPO.IsVerified           = supplierPurchaseOrder.IsVerified;
                supplierPO.SupplierCode         = supplierPurchaseOrder.SupplierProfile.Code;
                supplierPO.WorkFlowLog          = workLog;
                supplierPO.SupplierItem         = itemList;
                supplierPO.SPOBranch            = branchList;
                supplierPO.ParentRecordId       = supplierPurchaseOrder.RecordId;
                supplierPO.LastLog              = lastLog;
                return(supplierPO);
            }
            else
            {
                return(null);
            }
        }
示例#3
0
        /// <summary>
        /// This method is used for fetching spo workFlowLog from database. - JJ
        /// </summary>
        /// <param name="id">id of spo</param>
        /// <returns>list of objects of WorkFlowLog</returns>
        public List <WorkFlowLogAC> GetSPOWorkFlowLog(int id)
        {
            var workFlowLog = new List <WorkFlowLogAC>();
            var list        = _supplierPurchaseOrderLogContext.Fetch(x => x.RecordId == id).ToList();

            foreach (var log in list)
            {
                WorkFlowLogAC workFlow = new WorkFlowLogAC
                {
                    Id              = log.Id,
                    Stage           = log.Stage,
                    Action          = log.Action,
                    Comments        = log.Comments,
                    RecordId        = (int)log.RecordId,
                    RoleName        = log.RoleName,
                    UserName        = log.UserName,
                    CreatedDateTime = log.CreatedDateTime
                };
                workFlowLog.Add(workFlow);
            }
            return(workFlowLog);
        }