Ejemplo n.º 1
0
 private void ValidationInit()
 {
     if (this.ValidationGroup.IsNoNull() && this.ResourceTypeID.IsNoNull())
     {
         if (this.FileExtension.IsNoNull())
         {
             this.ValidationExpression = "(" + this.FileExtension.Replace(',', '|') + ")$";
         }
         if (this.HintMessage.IsNull())
         {
             object hintMessage;
             if ((this.MaxFileSize > 0) || this.FileExtension.IsNoNull())
             {
                 this.HintMessage  = (this.FileExtension.IsNoNull() ? ("文件类型:" + this.FileExtension) : "") + ((this.MaxFileSize > 0) ? ((this.FileExtension.IsNoNull() ? "," : "") + "文件必须小于" + ((int)(this.MaxFileSize * 0x400)).RenderFileSize()) : "");
                 this.ErrorMessage = "请上传:" + (this.FileExtension.IsNoNull() ? ("文件类型:" + this.FileExtension) : "") + ((this.MaxFileSize > 0) ? ((this.FileExtension.IsNoNull() ? "," : "") + "文件必须小于" + ((int)(this.MaxFileSize * 0x400)).RenderFileSize()) : "");
             }
             if ((this.ImageWidth > 0) && (this.ImageHeight > 0))
             {
                 hintMessage       = this.HintMessage;
                 this.HintMessage  = string.Concat(new object[] { hintMessage, ",尺寸:", this.ImageWidth, " x ", this.ImageHeight });
                 hintMessage       = this.ErrorMessage;
                 this.ErrorMessage = string.Concat(new object[] { hintMessage, ",尺寸:", this.ImageWidth, " x ", this.ImageHeight });
             }
             if (this.FileVers.Count > 0)
             {
                 int         imageWidth = 0;
                 FileVerInfo info       = null;
                 foreach (FileVerInfo info2 in this.FileVers)
                 {
                     if (info2.ImageWidth > imageWidth)
                     {
                         info       = info2;
                         imageWidth = info2.ImageWidth;
                     }
                 }
                 if ((info != null) && (info.ImageWidth > 0))
                 {
                     hintMessage       = this.HintMessage;
                     this.HintMessage  = string.Concat(new object[] { hintMessage, ",宽:", info.ImageWidth, "px 高:", info.ImageHeight, "px" });
                     hintMessage       = this.ErrorMessage;
                     this.ErrorMessage = string.Concat(new object[] { hintMessage, ",宽:", info.ImageWidth, "px 高:", info.ImageHeight, "px" });
                 }
             }
         }
         if (!string.IsNullOrEmpty(this.ValidationGroup))
         {
             base.Attributes.Add("ValidationGroup", this.ValidationGroup);
         }
         if (!string.IsNullOrEmpty(this.ValidationExpression))
         {
             base.Attributes.Add("ValidationExpression", this.ValidationExpression);
         }
         if (!string.IsNullOrEmpty(this.ErrorMessage))
         {
             base.Attributes.Add("ErrorMessage", this.ErrorMessage);
             base.Attributes.Add("onblur", "$(this).BlurValidationError(" + (this.BlurSucessCall.IsNull() ? "" : this.BlurSucessCall) + ");");
         }
         if (!string.IsNullOrEmpty(this.HintMessage))
         {
             base.Attributes.Add("HintMessage", this.HintMessage);
             base.Attributes.Add("onfocus", "$(this).FocusValidationHint();");
         }
         if (this.MessageWidth != 0)
         {
             base.Attributes.Add("MessageWidth", this.MessageWidth.ToString());
         }
         if (this.CheckValueEmpty)
         {
             base.Attributes.Add("CheckValueEmpty", this.CheckValueEmpty.ToString());
         }
     }
 }
Ejemplo n.º 2
0
 public void Add(FileVerInfo aItem)
 {
     base.List.Add(aItem);
 }