public static ExtensionList Combine(ExtensionList list1, ExtensionList list2) { if (list1.Contains("*") || list2.Contains("*")) { return(ExtensionList.AllowAll); } ExtensionList newList = new ExtensionList(); foreach (string extension in list1) { if (!newList.Contains(extension)) { newList.Add(extension); } } foreach (string extension in list2) { if (!newList.Contains(extension)) { newList.Add(extension); } } return(newList); }
public static ExtensionList Parse(string value) { ExtensionList list = new ExtensionList(); if (value != string.Empty) { string[] listArr = value.Trim().Split(','); foreach (string arr in listArr) { if (arr.IndexOf("\r\n") == -1) { if (arr.Trim() != "" && !list.Contains(arr.Trim())) { list.Add(arr.Trim()); } } else { string[] strs = Regex.Split(arr, "\r\n"); foreach (string str1 in strs) { if (str1.Trim() != "" && !list.Contains(str1.Trim())) { list.Add(str1.Trim()); } } } } } return(list); }
public object Clone() { ExtensionList temp = new ExtensionList(); foreach (string item in this) { temp.Add(item); } return(temp); }
static ExtensionList() { Notset = new ExtensionList(); AllowAll = new ExtensionList(); AllowAll.Add("*"); }
public object Clone() { ExtensionList temp = new ExtensionList(); foreach (string item in this) { temp.Add(item); } return temp; }
public static ExtensionList Parse(string value) { ExtensionList list = new ExtensionList(); if (value != string.Empty) { string[] listArr = value.Trim().Split(','); foreach (string arr in listArr) { if (arr.IndexOf("\r\n") == -1) { if (arr.Trim() != "" && !list.Contains(arr.Trim())) list.Add(arr.Trim()); } else { string[] strs = Regex.Split(arr, "\r\n"); foreach (string str1 in strs) { if (str1.Trim() != "" && !list.Contains(str1.Trim())) list.Add(str1.Trim()); } } } } return list; }
public static ExtensionList Combine(ExtensionList list1, ExtensionList list2) { if (list1.Contains("*") || list2.Contains("*")) return ExtensionList.AllowAll; ExtensionList newList = new ExtensionList(); foreach (string extension in list1) { if (!newList.Contains(extension)) newList.Add(extension); } foreach (string extension in list2) { if (!newList.Contains(extension)) newList.Add(extension); } return newList; }
public override AttachmentCollection GetAttachments(int operatorUserID, DateTime? beginDate, DateTime? endDate, string keyword, int pageNumber, int pageSize, ExtensionList fileTypes) { using (SqlQuery query = new SqlQuery()) { query.Pager.IsDesc = true; query.Pager.PageNumber = pageNumber; query.Pager.PageSize = pageSize; query.Pager.SelectCount = true; query.Pager.TableName = "[bx_Attachments]"; query.Pager.SortField = "[AttachmentID]"; StringBuilder condition = new StringBuilder(); condition.Append(" [UserID] = @UserID"); query.CreateParameter<int>("@UserID", operatorUserID, SqlDbType.Int); if (beginDate != null) { condition.Append(" AND [CreateDate] >= @BeginDate"); query.CreateParameter<DateTime>("@BeginDate", beginDate.Value, SqlDbType.DateTime); } if (endDate != null) { condition.Append(" AND [CreateDate] <= @EndDate"); query.CreateParameter<DateTime>("@EndDate", endDate.Value, SqlDbType.DateTime); } if (false == string.IsNullOrEmpty(keyword)) { condition.Append(" AND [FileName] LIKE '%'+@Keyword+'%'"); query.CreateParameter<string>("@Keyword", keyword, SqlDbType.NVarChar, 100); } if (fileTypes != null && fileTypes.Count > 0 && !fileTypes.Contains("*")) { condition.Append(" And ("); int i = 0; string ft; foreach (string s in fileTypes) { ft = "@f_" + i++; condition.Append(" FileType=" + ft); query.CreateParameter<string>(ft, s, SqlDbType.VarChar, 10); if (fileTypes.Count > i) condition.Append(" OR "); } condition.Append(")"); } query.Pager.Condition = condition.ToString(); using (XSqlDataReader reader = query.ExecuteReader()) { AttachmentCollection attachments = new AttachmentCollection(reader); if (reader.NextResult()) { while (reader.Read()) { attachments.TotalRecords = reader.GetInt32(0); } } return attachments; } } }
protected ExtensionList FilterFileType(ExtensionList filetypes) { ExtensionList ext = new ExtensionList(); foreach (string s in filetypes ) { if (ForumAllowedFileTypes.Contains(s)) ext.Add(s); } return ext; }
public InvalidAttachmentFileTypeError(string target, ExtensionList allowExtnames, string currentFileType) : base(target) { AllowExtnames = allowExtnames; CurrentFileType = currentFileType; }