Ejemplo n.º 1
0
 /// <summary>
 /// Adds the sp hierarchy.
 /// </summary>
 /// <param name="spHierarchy">The sp hierarchy.</param>
 /// <returns>boolean value</returns>
 public bool AddSPHierarchy(ISPHierarchy spHierarchy)
 {
     try
     {
         return(solutionPartnerDataService.AddSPHierarchy(spHierarchy));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
        ////public ISOSolutionPartner GetSftpFolderPath(int solutionPartnerId)
        //// {
        ////     var solutionPartner = solutionPartners.Entities.Where(x => x.Id == solutionPartnerId).FirstOrDefault();
        ////     return solutionPartner;
        //// }

        //// public async Task<bool> UpdateSftpFolderPath(int solutionPartnerId, string sftpFolderPath)
        //// {
        ////     var solutionPartnerEntity = await solutionPartners.GetByIdAsync(solutionPartnerId);
        ////     solutionPartnerEntity.SftpFolderPath = sftpFolderPath;
        ////     solutionPartners.Update(solutionPartnerEntity);
        ////     var updatedSolutionPartner = UnitOfWork.Commit();
        ////     return true;
        //// }
        #endregion

        /// <summary>
        /// Adds the sp hierarchy.
        /// </summary>
        /// <param name="partnerHierarchy">The partner hierarchy.</param>
        /// <returns>
        /// boolean value
        /// </returns>
        public bool AddSPHierarchy(ISPHierarchy partnerHierarchy)
        {
            try
            {
                var hierarchy = partnerHierarchies.Add(partnerHierarchy);
                UnitOfWork.Commit();
                var addStatus = UnitOfWork.Commit();
                return(addStatus == 0 ? true : false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Updates the sp hierarchy.
        /// </summary>
        /// <param name="partnerHierarchy">The partner hierarchy.</param>
        /// <returns>
        /// boolean value
        /// </returns>
        public async Task <bool> UpdateSPHierarchy(ISPHierarchy partnerHierarchy)
        {
            var hierarchyEntity = await partnerHierarchies.GetByIdAsync(partnerHierarchy.Id);

            hierarchyEntity.Id                   = partnerHierarchy.Id;
            hierarchyEntity.CreatedDate          = partnerHierarchy.CreatedDate;
            hierarchyEntity.EditedDate           = partnerHierarchy.EditedDate;
            hierarchyEntity.EnableDistributor    = partnerHierarchy.EnableDistributor;
            hierarchyEntity.EnableModernTrade    = partnerHierarchy.EnableModernTrade;
            hierarchyEntity.EnableSubDistributor = partnerHierarchy.EnableSubDistributor;
            hierarchyEntity.EnableWholesaler     = partnerHierarchy.EnableWholesaler;
            partnerHierarchies.Update(hierarchyEntity);
            var updateStatus = UnitOfWork.Commit();

            return(updateStatus == 0 ? true : false);
        }
        public HttpResponseMessage AddSPHierarchy([ModelBinder(typeof(IocCustomCreationConverter))] ISPHierarchy partnerHierarchy)
        {
            try
            {
                var status = hierarchyService.AddSPHierarchy(partnerHierarchy);
                if (!status)
                {
                    return(CreateHttpResponse <ISPHierarchy>(HttpStatusCode.Accepted, HttpCustomStatus.Failure, null, GetLocalisedString("Operation failed.")));
                }

                return(CreateHttpResponse <ISPHierarchy>(HttpStatusCode.Created, HttpCustomStatus.Success, null, GetLocalisedString("msgSuccess")));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(CreateHttpResponse <ISPHierarchy>(HttpStatusCode.InternalServerError, HttpCustomStatus.Failure, null, GetLocalisedString("msgWebServiceError")));
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Updates the sp hierarchy.
 /// </summary>
 /// <param name="spHierarchy">The sp hierarchy.</param>
 /// <returns>boolean value</returns>
 public async Task <bool> UpdateSPHierarchy(ISPHierarchy spHierarchy)
 {
     return(await solutionPartnerDataService.UpdateSPHierarchy(spHierarchy));
 }