public static ReceiveFormEntity Get(string id)
 {
     return(ReceiveFormRepository.Get(id, null, null));
 }
 public static ReceiveFormEntity GetBySerialId(string serialId)
 {
     return(ReceiveFormRepository.GetBySerialId(serialId));
 }
Пример #3
0
        public static bool CanFormValidate(string formId, FormType formType, string hospitalId, out string errorCode)
        {
            errorCode = string.Empty;
            if (string.IsNullOrEmpty(formId))
            {
                errorCode = GoodsStateValidateCodes.NotValidState;
                return(false);
            }

            bool   noForm;
            string formHospitalId;

            switch (formType)
            {
            case FormType.Receive:
                var receive = ReceiveFormRepository.Get(formId);
                noForm         = receive == null;
                formHospitalId = noForm ? string.Empty : receive.HospitalId;
                break;

            case FormType.Inspection:
                var inspection = InspectionFormRepository.Get(formId);
                noForm         = inspection == null;
                formHospitalId = noForm ? string.Empty : inspection.HospitalId;
                break;

            case FormType.Incoming:
                var incoming = IncomingFormRepository.Get(formId);
                noForm         = incoming == null;
                formHospitalId = noForm ? string.Empty : incoming.HospitalId;
                break;

            case FormType.Apply:
                var apply = ApplyFormRepository.Get(formId);
                noForm         = apply == null;
                formHospitalId = noForm ? string.Empty : apply.HospitalId;
                break;

            case FormType.Return:
                var @return = ReturnFormRepository.Get(formId);
                noForm         = @return == null;
                formHospitalId = noForm ? string.Empty : @return.HospitalId;
                break;

            default:
                errorCode      = GoodsStateValidateCodes.NotValidState;
                noForm         = true;
                formHospitalId = string.Empty;
                break;
            }

            if (!string.IsNullOrEmpty(errorCode))
            {
                return(false);
            }

            if (noForm)
            {
                errorCode = GoodsStateValidateCodes.FutureFormNotExist;
                return(false);
            }

            if (string.Compare(formHospitalId, hospitalId, true) != 0)
            {
                errorCode = GoodsStateValidateCodes.HospitalNoFutureForm;
                return(false);
            }

            return(true);
        }