public DnsResult ValidateForSubmission(IDnsRequestContext context)
        {
            SqlDistributionModel m = GetModel(context);
            IList <string>       errorMessages;

            if (Validate(m, out errorMessages))
            {
                return(DnsResult.Success);
            }
            else
            {
                return(DnsResult.Failed(errorMessages.ToArray <string>()));
            }
        }
        public static SqlDistributionModel InitializeModel(SqlDistributionModel m, IDnsRequestContext request)
        {
            m.RequestType = SqlDistributionRequestType.All.FirstOrDefault(rt => rt.ID == request.RequestType.ID);
            m.RequestID   = request.RequestID;
            m.SqlQuery    = "";

            if (request.Documents != null && request.Documents.Count() > 0)
            {
                using (var db = new DataContext())
                {
                    var doc = request.Documents.FirstOrDefault(s => s.Kind == DocumentKind.Request);
                    if (doc != null)
                    {
                        m.SqlQuery = System.Text.UTF8Encoding.UTF8.GetString(doc.GetData(db));
                    }
                }
            }
            return(m);
        }
 private bool Validate(SqlDistributionModel m, out IList <string> errorMessages)
 {
     errorMessages = new List <string>();
     return(errorMessages.Count > 0 ? false : true);
 }