示例#1
0
 public IHttpActionResult GetParameterListById(int id)
 {
     try
     {
         List <ParamType> paramTypeList = _systemParameterContext.GetSystemParameterListById(id);
         return(Ok(paramTypeList));
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
        /// <summary>
        /// This method is used to check whether items can be returned to a supplier. - JJ
        /// </summary>
        /// <param name="SupplierReturnRequest">list of objects of SupplierReturnRequest</param>
        /// <param name="SupplierId"></param>
        /// <returns>status</returns>
        private string CheckSupplierConditions(int SupplierId, List <SupplierReturnItemAC> SupplierReturnItemAC)
        {
            var causeList = _systemParameterContext.GetSystemParameterListById(35);
            var causeId   = 0;
            var supplier  = _supplierProfileContext.DoesSupplierAcceptExpiredItem(SupplierId);
            var allowSave = true;

            if (supplier != null)
            {
                if (supplier.IsActive)
                {
                    foreach (var cause in causeList)
                    {
                        if (cause.ValueEn == StringConstants.Expier)
                        {
                            causeId = cause.Id;
                        }
                    }
                    foreach (var returnItem in SupplierReturnItemAC)
                    {
                        if (causeId == returnItem.ReturnCauseId && !supplier.IsAcceptReturnForExpiredItem)
                        {
                            allowSave = false;
                            break;
                        }
                    }
                    if (allowSave)
                    {
                        return("ok");
                    }
                    else
                    {
                        return("Supplier does not accept expired items");
                    }
                }
                else
                {
                    return("Items cannot be returned as Supplier is Inactive");
                }
            }
            else
            {
                return("Supplier Does Not Exist");
            }
        }