Ejemplo n.º 1
0
        protected override FieldErrorInfo CheckError(IInputData inputData,
                                                     string value, int position, params object[] args)
        {
            DataRow row = GetPostRow(inputData, position);

            string hdFieldValue = row[HdFieldName].ToString();

            if (string.IsNullOrEmpty(value) && string.IsNullOrEmpty(hdFieldValue))
            {
                return(null);
            }

            EasySearch easySearch = PlugInFactoryManager.CreateInstance <EasySearch>(
                EasySearchPlugInFactory.REG_NAME, fRegName);
            string newValue           = value;
            EasySearchErrorType error = easySearch.CheckName(hdFieldValue, ref newValue, args);

            if (error == EasySearchErrorType.None)
            {
                if (newValue != value)
                {
                    if (string.IsNullOrEmpty(newValue))
                    {
                        row[Field.NickName] = DBNull.Value;
                    }
                    else
                    {
                        row[Field.NickName] = newValue;
                    }
                }
                return(null);
            }
            return(CreateErrorObject(error));
        }
Ejemplo n.º 2
0
        protected FieldErrorInfo CreateErrorObject(EasySearchErrorType error)
        {
            string errorMsg = string.Empty;

            switch (error)
            {
            case EasySearchErrorType.NotExist:
                errorMsg = Field.DisplayName + TkWebApp.EasySearchNotExist;
                break;

            case EasySearchErrorType.VariousTwo:
                errorMsg = Field.DisplayName + TkWebApp.EasySearchVariousTwo;
                break;
            }

            return(CreateErrorObject(errorMsg));
        }