private bool SaveActorSLAs(AddActorDetailRequest request) { #region Add new SLAs Int32 actorId = request.ActorId ?? 0; if (actorId > 0) { //Copy SLA of the source actor if (request.CopySLAActorId.HasValue) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { dbEntity.API_INSERT_ACTOR_SLA_FROM_SRC_ACTOR(request.ActorId, request.CopySLAActorId, request.CurrentUser); } } else if (request.SLAs != null && request.SLAs.Any()) { request.SLAs.ForEach(s => { SaveSLA(s, actorId, request.CurrentUser); }); } #endregion return(true); } else { return(false); } }
public IEnumerable <ORDER_LIST_Result> GetOrders(OrderRequest request) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { dbEntity.Configuration.ProxyCreationEnabled = false; List <ORDER_LIST_Result> result = dbEntity.API_ORDER_LIST( request.OrdOrderNumber, request.RetailerChainId, request.OrderDateFrom, request.OrderDateTo, request.OrderNew, request.OrderOpen, request.OrderValidated, request.OrderId, request.CiDateFrom, request.CiDateTo, request.ValidationDeadline, request.User, request.ActorIdFrom, request.ActorIdTo, request.OrderNumber, request.ShopCountOk, request.ShopCountNok, request.ValidationOpen, request.ValidationExceeded, request.ValidationPassed, request.ActorId, request.ShipmentNumber) .Take(1000) .ToList(); return(result); }; }
public NonValidatedOrderResponse ValidateMultipleOrders(List <int> orderIdList, string userEmail) { NonValidatedOrderResponse response = new NonValidatedOrderResponse(); List <API_LIST_ORDERS_SSCC_FOR_APPROVAL_Result> result = new List <API_LIST_ORDERS_SSCC_FOR_APPROVAL_Result>(); //Fetch the non-validated SSCC list for the order ids using (var dbEntity = new BACKUP_SRL_20180613Entities()) { result = dbEntity.API_LIST_ORDERS_SSCC_FOR_APPROVAL(string.Join(",", orderIdList)).ToList(); } if (result.Any()) { //Validate the SSCCs found SSCCListRepository repository = new SSCCListRepository(); List <string> output = repository.ValidateMultipleSSCC(result.Select(item => item.SSCC).ToList(), userEmail); if (output != null && output.Any()) { //In case some SSCC are not validated, then fetch the order numbers and SSCC numbers of these SSCCs. List <API_LIST_ORDERS_SSCC_FOR_APPROVAL_Result> nonValidatedList = new List <API_LIST_ORDERS_SSCC_FOR_APPROVAL_Result>(); output.ForEach(s => { nonValidatedList.AddRange(result.Where(item => item.SSCC == s)); }); response = nonValidatedList.ConvertNonValidatedOrder(); } } return(response); }
public List <Actor> GetActorsList(string userEmail) { List <Actor> actors = new List <Actor>(); using (var dbEntity = new BACKUP_SRL_20180613Entities()) { dbEntity.Configuration.ProxyCreationEnabled = false; actors = dbEntity.API_LIST_ACTORS_TRANSACTION(-1).ConvertActorList(); } //Fetch actors for logged in user UserRepository userRepository = new UserRepository(); //Fetch actors assigned to the user List <int> actorIdList = userRepository.GetActorIdList(userEmail); List <Actor> actorsList = new List <Actor>(); if (actorIdList.Any()) { foreach (var actorId in actorIdList) { Actor actor = actors.FirstOrDefault(a => a.ActorId == actorId); if (actor != null) { actorsList.Add(actor); } } return(actorsList); } else { return(actors); } }
private int SaveSLA(Actor_SLA_Request actor_SLA, int actorId, string currentUser) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { return(dbEntity.API_SLA_INSERT(actor_SLA.LoadUnitId, actorId, actor_SLA.RTIAcceptance, currentUser, actor_SLA.StandardSLA).FirstOrDefault() ?? 0); } }
public int DeleteSLA(int SLAId) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { return(dbEntity.API_SLA_DELETE(SLAId).FirstOrDefault() ?? 0); } }
public IEnumerable <API_LIST_LOAD_UNIT_CONDITIONS_Result> GetAnomalies(int?retailerChainId = null) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { dbEntity.Configuration.ProxyCreationEnabled = false; return(dbEntity.API_LIST_LOAD_UNIT_CONDITIONS(retailerChainId).ToList()); } }
private int SaveActorMasterDetail(AddActorDetailRequest request) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { return(dbEntity.API_ADD_ACTOR_MASTERDATA(request.ActorId, request.ActorTypeId, request.ActorCode, request.RetailerChainId, request.DefaultLanguageCodeId, request.DefaultLanguageCode, request.ActorIPAddress, request.EmergencyStockQty, request.DummyActorReferenceId, request.LabelType, request.NOVEXXClientCode, request.NumberOfLabel, request.CardboardBox, request.ActorDeliveryId, request.CurrentUser).FirstOrDefault().ACTOR_ID ?? 0); } }
public List <ActorMasterListResponse> GetActorMasterDataList(ActorMasterListRequest request) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { dbEntity.Configuration.ProxyCreationEnabled = false; IEnumerable <API_LIST_ACTOR_MASTERDATA_Result> result = dbEntity.API_LIST_ACTOR_MASTERDATA(request.ActorName, request.ActorCode, request.RetailerChainId, request.Location); return(result.ConvertActorMasterList()); } }
public IEnumerable <API_LIST_ACTORS_TRANSACTION_Result> GetActorList(int retailerChainId) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { dbEntity.Configuration.ProxyCreationEnabled = false; IEnumerable <API_LIST_ACTORS_TRANSACTION_Result> result = dbEntity.API_LIST_ACTORS_TRANSACTION(retailerChainId); return(result); } }
public SSCCPendingChangeResponse GetPendingChangesForSSCC(string SSCCNumber) { SSCCPendingChangeResponse response = new SSCCPendingChangeResponse(); using (var dbEntity = new BACKUP_SRL_20180613Entities()) { return(response = dbEntity.API_PENDING_SSCC_CHANGE(SSCCNumber).ToList().ConvertSSCCPendingChange()); } }
public IList <API_LIST_RTI_Result> Index() { log.Info(string.Format(LogMessages.RequestMethod, RequestContext.Principal.Identity.Name, $"rti\\get")); BACKUP_SRL_20180613Entities dbEntities = new BACKUP_SRL_20180613Entities(); var result = dbEntities.API_LIST_RTI() .ToList <API_LIST_RTI_Result>(); return(result); }
public API_LCP_ORDER_DETAILS_Result GetSSCCOrderDetails(string id) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { dbEntity.Configuration.ProxyCreationEnabled = false; var orderDetails = dbEntity.API_LCP_ORDER_DETAILS(id).FirstOrDefault(); return(orderDetails); } }
public IEnumerable <API_LCP_TRANSACTIONS_Result> GetSSCCLoadCarrier(string id) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { dbEntity.Configuration.ProxyCreationEnabled = false; var loadCarrierDetailsList = dbEntity.API_LCP_TRANSACTIONS(id).ToList <API_LCP_TRANSACTIONS_Result>(); return(loadCarrierDetailsList); } }
public IEnumerable <API_LCP_DEVIATIONS_Result> GetSSCCDeviationDetails(string id) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { dbEntity.Configuration.ProxyCreationEnabled = false; var deviationDetailsList = dbEntity.API_LCP_DEVIATIONS(id).ToList <API_LCP_DEVIATIONS_Result>(); return(deviationDetailsList); } }
public IEnumerable <API_LCP_IMAGES_Result> GetSSCCImages(string id) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { dbEntity.Configuration.ProxyCreationEnabled = false; var imageList = dbEntity.API_LCP_IMAGES(id).ToList <API_LCP_IMAGES_Result>(); return(imageList); } }
public IEnumerable <API_LCP_COUNTING_Result> GetSSCCPalletCounting(string id) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { dbEntity.Configuration.ProxyCreationEnabled = false; var palletCountingList = dbEntity.API_LCP_COUNTING(id).ToList <API_LCP_COUNTING_Result>(); return(palletCountingList); } }
private static string GetActorName(int actorId) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { string actorName = (from a in dbEntity.ACTOR_REFERENCE where a.ACTOR_ID == actorId select a.ACTOR_LABEL).SingleOrDefault(); return(actorName); } }
public IList <API_LIST_ACTORS_TRANSACTION_Result> Index() { // Todo: Get current User. log.Info(string.Format(LogMessages.RequestMethod, RequestContext.Principal.Identity.Name, "Actor\\GetAll")); BACKUP_SRL_20180613Entities dbEntities = new BACKUP_SRL_20180613Entities(); var result = dbEntities.API_LIST_ACTORS_TRANSACTION(-1) .ToList <API_LIST_ACTORS_TRANSACTION_Result>(); return(result); }
public LUCsForOrder GetSSCCLUCsForOrder(long orderId) { LUCsForOrder response = new LUCsForOrder(); List <string> conditionNames = new List <string>(); using (var cntx = new BACKUP_SRL_20180613Entities()) { response = cntx.API_DEVIATION_ON_ORDER(orderId, Resources.Common.EnglishLanguage).ToList().ConvertSSCCLoadUnitCondition(); } return(response); }
public IEnumerable <API_LIST_LOAD_CARRIER_Result> GetCarriersList() { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { dbEntity.Configuration.ProxyCreationEnabled = false; IEnumerable <API_LIST_LOAD_CARRIER_Result> result = dbEntity.API_LIST_LOAD_CARRIER(); return(result); }; }
public ActorDetailResponse GetActorDetail(int actorId) { ActorDetailResponse actorDetail = new ActorDetailResponse(); using (var dbEntity = new BACKUP_SRL_20180613Entities()) { actorDetail = dbEntity.API_ACTOR_MASTERDATA_DETAILS(actorId).ToList().ConvertActorDetail(); actorDetail.SLAs = dbEntity.API_SLA_LIST_PER_RETAILER(actorDetail.RetailerChainId, actorId).ToList().ConvertToSLAsForActor(); } return(actorDetail); }
/// <summary> /// Validate multiple SSCC /// </summary> /// <param name="SSCCs">SSCC list</param> /// <param name="currentUserEmail">logged in user email</param> /// <returns>Non validated SSCC list</returns> public List <string> ValidateMultipleSSCC(List <string> SSCCs, string currentUserEmail) { List <string> failedSSCCs = new List <string>(); if (SSCCs.Any()) { using (var dbEntity = new BACKUP_SRL_20180613Entities()) { failedSSCCs = dbEntity.API_VALIDATE_MULTIPLE_SSCC(string.Join(",", SSCCs), currentUserEmail).ToList().ConvertNonValidatedSSCC(); } } return(failedSSCCs); }
public IEnumerable <ORDER_LIST_Result> GetOrderNumbers(OrderRequest request, string userEmail) { #region User Management //To fetch order numbers for the assigned actors of the logged in user UserRepository userRepository = new UserRepository(); List <int> actorIds = userRepository.GetActorIdList(userEmail); if (actorIds.Any()) { request.ActorIdFrom = string.Join(",", actorIds.Select(a => a).ToArray()); } #endregion using (var dbEntity = new BACKUP_SRL_20180613Entities()) { dbEntity.Configuration.ProxyCreationEnabled = false; List <ORDER_LIST_Result> result = dbEntity.API_ORDER_LIST( request.OrdOrderNumber, request.RetailerChainId, request.OrderDateFrom, request.OrderDateTo, request.OrderNew, request.OrderOpen, request.OrderValidated, request.OrderId, request.CiDateFrom, request.CiDateTo, request.ValidationDeadline, request.User, request.ActorIdFrom, request.ActorIdTo, request.OrderNumber, request.ShopCountOk, request.ShopCountNok, request.ValidationOpen, request.ValidationExceeded, request.ValidationPassed, request.ActorId, request.ShipmentNumber) .ToList(); return(result); }; }
//to get search result public IEnumerable <API_SSCC_OVERVIEW_Result> GetSSCCList(SSCCListRequest request, string userEmail) { if (string.IsNullOrEmpty(request.ActorID) && string.IsNullOrEmpty(request.ActorOriginId)) { UserRepository userRepository = new UserRepository(); //Fetch actors assigned to the user List <int> actorIdList = userRepository.GetActorIdList(userEmail); request.ActorOriginId = string.Join(",", actorIdList.Select(n => n).ToArray()); } using (var dbEntity = new BACKUP_SRL_20180613Entities()) { dbEntity.Configuration.ProxyCreationEnabled = false; List <API_SSCC_OVERVIEW_Result> result = dbEntity.API_SSCC_OVERVIEW( request.ActorID, request.ActorOriginId, request.SsccStatusNew, request.SsccStatusProcessed, request.SsccStatusValidated, request.SsccDateFrom, request.SsccDateTo, request.CiDateFrom, request.CiDateTo, request.ValidationOpen, request.ValidationExceeded, request.ValidationPassed, request.SsccNr, request.OrderNr, request.CountingOK, request.CountingNOK, request.SlaOK, request.SlaNOK, request.RetailerChainId, request.ShipmentNumber) .Take(1000) .ToList <API_SSCC_OVERVIEW_Result>(); return(result); } }
public SSCCStatusResponse GetSSCCStatus(string SSCCNumber) { SSCCStatusResponse response = new SSCCStatusResponse(); using (var dbEntity = new BACKUP_SRL_20180613Entities()) { var result = dbEntity.API_GET_SSCC_STATUS(SSCCNumber).ToList(); if (result != null && result.Any() && result[0] != null) { response.Status = Enum.GetName(typeof(Models.Enums.SSCCStatus), result.FirstOrDefault().Value); if (string.Compare(response.Status, Resources.SSCCStatus.VALIDATED, true) == 0) { response.Validated = true; } else { response.Validated = false; } } } return(response); }
public List <int> GetActorIdList(string userEmail) { List <int?> actorIdList = new List <int?>(); string retailerChainList = string.Empty; List <int> actorIds = new List <int>(); //get all the actors assigned to the user using (var ctx = new SRLManagementEntities()) { actorIdList = ctx.sp_GetActorsForUser(userEmail).ToList(); } if (actorIdList.Any()) { actorIdList.ForEach(a => { if (a.HasValue) { actorIds.Add(a.Value); } }); } //get all retailer chains assigned to the user using (var ctx = new SRLManagementEntities()) { retailerChainList = string.Join(",", ctx.sp_GetRetailerChainForUser(userEmail).ToArray()); } if (!string.IsNullOrEmpty(retailerChainList)) { List <Common.ActorRetailerChain> actorRetailerChainlist = new List <Common.ActorRetailerChain>(); //get list of actors and their assigned retailer chain using (var ctx = new BACKUP_SRL_20180613Entities()) { actorRetailerChainlist = ctx.API_LIST_ACTORID_FOR_RETAILERCHAIN(retailerChainList).ToList() .ToEntityActorRetailerChain(); } if (actorRetailerChainlist.Any()) { //remove retailer chains whose actors are assigned to the user, so as to get retailer chains for whom no actors are assigned directly to the user List <Common.ActorRetailerChain> toBeRemoved = actorRetailerChainlist.Where(a => actorIds.Contains(a.ActorId)).ToList(); if (toBeRemoved.Any()) { List <int> toBeRemovedRetailerChain = toBeRemoved.Select(a => a.RetailerChainId).Distinct().ToList(); toBeRemovedRetailerChain.ForEach(r => { actorRetailerChainlist.RemoveAll(a => a.RetailerChainId == r); }); } actorRetailerChainlist.ForEach(a => actorIds.Add(a.ActorId)); } } return(actorIds); }