예제 #1
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "BoxID":
                            if (_dbservicewms.FindSKUID(BoxID) == null)
                            {
                                validationResult = ResourceReader.GetString("ERR_BOXID");
                            }
                            break;

                        case "Qty":
                            if (Qty <= 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_RANGE");
                            }
                            break;

                        case "ProdDate":
                            if (ProdDate < SqlDateTime.MinValue.Value || ProdDate > SqlDateTime.MaxValue.Value)
                            {
                                validationResult = ResourceReader.GetString("ERR_DATE");
                            }
                            break;

                        case "ExpDate":
                            if (ExpDate < SqlDateTime.MinValue.Value || ExpDate > SqlDateTime.MaxValue.Value)
                            {
                                validationResult = ResourceReader.GetString("ERR_DATE");
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
예제 #2
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "ID":
                            if (ID == null || ID.Trim().Length == 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_INDEX_FORMAT");
                            }
                            else if (AllowChangeIndex && _dbservicewms.FindSKUID(ID) != null)
                            {
                                validationResult = ResourceReader.GetString("ERR_INDEX_EXISTS");
                            }
                            break;

                        case "DefaultQty":
                            if (DefaultQty <= 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_RANGE") + " > 0";
                            }
                            break;

                        case "FrequencyClass":
                            if (FrequencyClass < 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_RANGE") + " >= 0";
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
예제 #3
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "ID":
                            if (AddEnabled && _dbservicewms.CountBoxIDs(ID) != 0 || ID.Length == 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_BOXID_EXISTS");
                            }
                            break;

                        case "SKUID":
                            if (_dbservicewms.FindSKUID(SKUID) == null || SKUID == null || SKUID.Length == 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_SKUID_NONE");
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
예제 #4
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "ERPID":
                            break;

                        case "OrderID":
                            if (OrderID <= 0 || (_dbservicewms.ExistsOrderID(ERPID, OrderID) && OrderID != ReferenceOrderID))
                            {
                                validationResult = ResourceReader.GetString("ERR_ORDERID");
                            }
                            break;

                        case "Destination":
                            if (_dbservicewms.FindPlaceID(Destination) == null)
                            {
                                validationResult = ResourceReader.GetString("ERR_DESTINATION");
                            }
                            break;

                        case "ReleaseTime":
                            if (ReleaseTime < SqlDateTime.MinValue.Value || ReleaseTime > SqlDateTime.MaxValue.Value)
                            {
                                validationResult = ResourceReader.GetString("ERR_RANGE");
                            }
                            break;

                        case "SubOrderID":
                            if (SubOrderID <= 0 || (_dbservicewms.ExistsSubOrderID(OrderID, SubOrderID) && SubOrderID != ReferenceSubOrderID))
                            {
                                validationResult = ResourceReader.GetString("ERR_SUBORDERID");
                            }
                            break;

                        case "SubOrderERPID":
                            if (SubOrderERPID < 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_SUBORDERID");
                            }
                            break;

                        case "SubOrderName":
                            if (SubOrderName == null || SubOrderName.Length == 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_SUBORDERNAME");
                            }
                            break;

                        case "SKUID":
                            if (_dbservicewms.FindSKUID(SKUID) == null)
                            {
                                validationResult = ResourceReader.GetString("ERR_SKU");
                            }
                            break;

                        case "SKUBatch":
                            break;

                        case "SKUQty":
                            if (SKUQty <= 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_RANGE");
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
예제 #5
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "BoxID":
                            var b = _dbservicewms.FindBoxByBoxID(BoxID);
                            if (b != null)
                            {
                                SKUID       = b.SKU_ID;
                                Batch       = b.Batch;
                                Description = _dbservicewms.FindSKUID(SKUID)?.Description ?? "-";
                                var tu = _dbservicewms.FindTUByBoxID(BoxID);
                                if (tu != null && tu.TU_ID != _tuid)
                                {
                                    validationResult = ResourceReader.GetString("ERR_BOXID_EXISTS");
                                }
                            }
                            else
                            {
                                SKUID       = null;
                                Batch       = null;
                                Description = null;
                                if (BoxID != null)
                                {
                                    validationResult = ResourceReader.GetString("ERR_BOXID_EXISTS");
                                }
                            }
                            break;

                        case "Qty":
                            if (Qty <= 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_RANGE");
                            }
                            break;

                        case "DimensionClass":
                            if (Qty <= 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_CLASS");
                            }
                            break;

                        case "ProdDate":
                            if (ProdDate < SqlDateTime.MinValue.Value || ProdDate > SqlDateTime.MaxValue.Value)
                            {
                                validationResult = ResourceReader.GetString("ERR_DATE");
                            }
                            break;

                        case "ExpDate":
                            if (ExpDate < SqlDateTime.MinValue.Value || ExpDate > SqlDateTime.MaxValue.Value)
                            {
                                validationResult = ResourceReader.GetString("ERR_DATE");
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    Messenger.Default.Send <MessageValidationInfo>(new MessageValidationInfo()
                    {
                        AllPropertiesValid = AllPropertiesValid
                    });
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }