public void Notify(List<Common.Models.NotificationDetails> notificationDetails) { eZeeFlowTraceListener traceListener = new eZeeFlowTraceListener(); DataStorageHelper objStorageHelper = new DataStorageHelper(); try { foreach (var nd in notificationDetails) { if (!string.IsNullOrEmpty(nd.NotificationMode)) { if (nd.NotificationMode == eZeeFlow.Notification.Gateway.Constants.HTTPRequest) { nd.RecipientDetails = PostFileUploadedSuccessUri; var tenantId = nd.TenantID.ToString(); ProcessedFileDetail objFileDetail = new ProcessedFileDetail(); objFileDetail.FileId = nd.FileID.ToString(); objFileDetail.FileUrl = nd.FileURI; HttpWebRequest httpWebRequest = WebRequest.Create(PostFileUploadedSuccessUri) as HttpWebRequest; httpWebRequest.ContentType = "text/json"; httpWebRequest.Method = "POST"; string serializedObj = JsonConvert.SerializeObject(objFileDetail).Replace(@"\", "-"); using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { streamWriter.Write(serializedObj); } string response = new StreamReader(httpWebRequest.GetResponse().GetResponseStream()).ReadToEnd(); traceListener.WriteLog(Categories.Info, "Eventing - HTTP Notification", response, string.Empty, tenantId); } } } GatewayFactory objGF = new GatewayFactory(); objGF.WriteNotificationToStorage(notificationDetails, true, Constants.HTTPRequest); //// TODO: Though we send out multiple notifications, there is a single column for the status -- db structure needs to be updated to support granular tracking. var isNotificationUpdated = objGF.UpdateNotificationStatus(notificationDetails, true); } catch (Exception ex) { traceListener.WriteLog(Categories.Error, "Eventing", ex.Message.ToString(), ex.StackTrace.ToString()); } }
int IComparer <TDataItem> .Compare(TDataItem x, TDataItem y) { int num1 = x.GetHashCode().CompareTo(y.GetHashCode()); if (num1 == 0) { return(0); } if (this.sortContext == null || this.sortContext.Count == 0) { return(num1); } for (int index = 0; index < this.sortContext.Count; ++index) { if (this.sortContext[index].PropertyIndex < 0) { this.sortContext[index].PropertyIndex = x.IndexOf(this.sortContext[index].PropertyName); } object val1 = x[this.sortContext[index].PropertyIndex]; object val2 = y[this.sortContext[index].PropertyIndex]; int num2 = !(val1 is IComparable) || val2 == null || (object)val2.GetType() != (object)val1.GetType() ? DataStorageHelper.CompareNulls(val1, val2) : ((IComparable)val1).CompareTo(val2); if (num2 != 0) { if (this.sortContext[index].Direction != ListSortDirection.Descending) { return(num2); } return(-num2); } } return(0); }
/// <summary> /// Gets the expression. /// </summary> /// <param name="dateTimeFilterDescriptor">The filter descriptor.</param> /// <returns></returns> public static string GetExpression(DateFilterDescriptor dateTimeFilterDescriptor) { if (dateTimeFilterDescriptor.IgnoreTimePart) { if (String.IsNullOrEmpty(dateTimeFilterDescriptor.PropertyName) || dateTimeFilterDescriptor.Operator == FilterOperator.None) { return(string.Empty); } if ((dateTimeFilterDescriptor.Operator != FilterOperator.IsNotNull && dateTimeFilterDescriptor.Operator != FilterOperator.IsNull) && dateTimeFilterDescriptor.Value == null) { return(string.Empty); } string dateBegin = null; string dateEnd = null; string propertyName = DataStorageHelper.EscapeName(dateTimeFilterDescriptor.PropertyName); if (dateTimeFilterDescriptor.Value != null) { dateBegin = String.Format(CultureInfo.InvariantCulture, "#{0}#", dateTimeFilterDescriptor.Value.Value.Date); dateEnd = String.Format(CultureInfo.InvariantCulture, "#{0}#", dateTimeFilterDescriptor.Value.Value.Date.AddDays(1)); } switch (dateTimeFilterDescriptor.Operator) { case FilterOperator.None: return(String.Empty); case FilterOperator.IsNull: return(string.Format("{0} IS NULL", propertyName)); case FilterOperator.IsNotNull: return(string.Format("NOT ({0} IS NULL)", propertyName)); case FilterOperator.IsLessThan: return(string.Format("{0} < {1}", propertyName, dateBegin)); case FilterOperator.IsLessThanOrEqualTo: return(string.Format("{0} < {1}", propertyName, dateEnd)); case FilterOperator.IsLike: case FilterOperator.IsEqualTo: return(string.Format("{0} >= {1} AND {0} < {2}", propertyName, dateBegin, dateEnd)); case FilterOperator.IsNotLike: case FilterOperator.IsNotEqualTo: return(string.Format("{0} < {1} OR {0} >= {2}", propertyName, dateBegin, dateEnd)); case FilterOperator.IsGreaterThanOrEqualTo: return(string.Format("{0} >= {1}", propertyName, dateBegin)); case FilterOperator.IsGreaterThan: return(string.Format("{0} >= {1}", propertyName, dateEnd)); case FilterOperator.StartsWith: case FilterOperator.EndsWith: case FilterOperator.Contains: case FilterOperator.NotContains: case FilterOperator.IsContainedIn: case FilterOperator.IsNotContainedIn: default: return(String.Empty); } } else { return(FilterDescriptor.GetExpression(dateTimeFilterDescriptor)); } }
public bool WriteNotificationToStorage(List<NotificationDetails> notificationDetails, bool IsNotified, string notificationMode) { try { DataStorageHelper objStorageHelper = new DataStorageHelper(); string tenantId; string fileID; foreach (var nd in notificationDetails) { tenantId = nd.TenantID.ToString(); fileID = nd.FileID.ToString(); if (!string.IsNullOrEmpty(nd.NotificationMode)) { if (nd.NotificationMode == notificationMode) { objStorageHelper.WriteNotificationToStorage(tenantId, fileID, nd.FileUploadStatus, nd.NotificationMode, nd.RecipientDetails, IsNotified); } } } return true; } catch (Exception ex) { //TODO: Log return false; } }
public int Compare(Group <T> x, Group <T> y) { object[] xArr = x.Key as object[]; object[] yArr = y.Key as object[]; if (xArr != null && yArr != null && xArr.Length == yArr.Length) { int result = 0; for (int i = 0; i < xArr.Length; i++) { IComparable xComp = xArr[i] as IComparable; IComparable yComp = yArr[i] as IComparable; if (xComp == null || yComp == null) { if (xComp == yComp) { result = 0; } else { result = DataStorageHelper.CompareNulls(xComp, yComp); } } else { if (xComp.GetType() == yComp.GetType()) { result = xComp.CompareTo(yComp); } else { result = -1; } } if (result != 0) { if (this.directions[i] == ListSortDirection.Descending) { return(-result); } return(result); } } return(result); } if (x.Key is IComparable && x.Key.GetType() == y.Key.GetType()) { int result = ((IComparable)x.Key).CompareTo(y.Key); if (this.directions[this.directions.Length - 1] == ListSortDirection.Descending) { return(-result); } return(result); } return(x.GetHashCode().CompareTo(y.GetHashCode())); }
public static string GetExpression( FilterDescriptor filterDescriptor, Function <FilterDescriptor, object> formatValue) { if (string.IsNullOrEmpty(filterDescriptor.PropertyName) || filterDescriptor.filterOperator == FilterOperator.None || filterDescriptor.Operator != FilterOperator.IsNotNull && filterDescriptor.Operator != FilterOperator.IsNull && (filterDescriptor.Operator != FilterOperator.IsEqualTo && filterDescriptor.Operator != FilterOperator.IsNotEqualTo) && filterDescriptor.value == null) { return(string.Empty); } FilterOperator filterOperator = filterDescriptor.Operator; object obj = FilterDescriptor.GetExpressionValue(filterDescriptor, formatValue); if (filterDescriptor.value == null || filterDescriptor.value == DBNull.Value) { if (filterOperator == FilterOperator.IsEqualTo) { filterOperator = FilterOperator.IsNull; } if (filterOperator == FilterOperator.IsNotEqualTo) { filterOperator = FilterOperator.IsNotNull; } } if (filterOperator == FilterOperator.IsContainedIn || filterOperator == FilterOperator.IsNotContainedIn) { IEnumerable enumebrable = obj as IEnumerable; if (enumebrable != null && obj is string) { enumebrable = (IEnumerable)obj.ToString().Trim('\'').Split(new char[2] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); obj = (object)DataStorageHelper.ParseEnumerbale(enumebrable); } if (!(obj is string) && enumebrable != null) { obj = (object)DataStorageHelper.ParseEnumerbale(enumebrable); } } string empty = string.Empty; string str1 = DataStorageHelper.EscapeName(filterDescriptor.PropertyName); switch (filterOperator) { case FilterOperator.IsLike: return(string.Format("{0} LIKE {1}", (object)str1, obj)); case FilterOperator.IsNotLike: return(string.Format("{0} NOT LIKE {1}", (object)str1, obj)); case FilterOperator.IsLessThan: return(string.Format("{0} < {1}", (object)str1, obj)); case FilterOperator.IsLessThanOrEqualTo: return(string.Format("{0} <= {1}", (object)str1, obj)); case FilterOperator.IsEqualTo: return(string.Format("{0} = {1}", (object)str1, obj)); case FilterOperator.IsNotEqualTo: return(string.Format("{0} <> {1}", (object)str1, obj)); case FilterOperator.IsGreaterThanOrEqualTo: return(string.Format("{0} >= {1}", (object)str1, obj)); case FilterOperator.IsGreaterThan: return(string.Format("{0} > {1}", (object)str1, obj)); case FilterOperator.StartsWith: string str2 = DataStorageHelper.EscapeLikeValue(Convert.ToString(filterDescriptor.Value, (IFormatProvider)CultureInfo.InvariantCulture)); return(string.Format("{0} LIKE '{1}%'", (object)str1, (object)str2)); case FilterOperator.EndsWith: string str3 = DataStorageHelper.EscapeLikeValue(Convert.ToString(filterDescriptor.Value, (IFormatProvider)CultureInfo.InvariantCulture)); return(string.Format("{0} LIKE '%{1}'", (object)str1, (object)str3)); case FilterOperator.Contains: string str4 = DataStorageHelper.EscapeLikeValue(Convert.ToString(filterDescriptor.Value, (IFormatProvider)CultureInfo.InvariantCulture)); return(string.Format("{0} LIKE '%{1}%'", (object)str1, (object)str4)); case FilterOperator.NotContains: string str5 = DataStorageHelper.EscapeLikeValue(Convert.ToString(filterDescriptor.Value, (IFormatProvider)CultureInfo.InvariantCulture)); return(string.Format("{0} NOT LIKE '%{1}%'", (object)str1, (object)str5)); case FilterOperator.IsNull: return(string.Format("{0} IS NULL", (object)str1)); case FilterOperator.IsNotNull: return(string.Format("NOT ({0} IS NULL)", (object)str1)); case FilterOperator.IsContainedIn: return(string.Format("{0} IN ({1})", (object)str1, obj)); case FilterOperator.IsNotContainedIn: return(string.Format("{0} NOT IN ({1})", (object)str1, obj)); default: return(string.Empty); } }
private static object GetExpressionValue( FilterDescriptor filterDescriptor, Function <FilterDescriptor, object> formatValue) { object obj1 = filterDescriptor.Value; if (!(obj1 is string) && obj1 is IEnumerable) { IEnumerable enumerable = obj1 as IEnumerable; List <object> objectList = new List <object>(); foreach (object obj2 in enumerable) { FilterDescriptor filterDescriptor1 = filterDescriptor.Clone() as FilterDescriptor; filterDescriptor1.Value = obj2; object expressionValue = FilterDescriptor.GetExpressionValue(filterDescriptor1, formatValue); objectList.Add(expressionValue); } return((object)objectList.ToArray()); } object obj3 = formatValue != null?formatValue(filterDescriptor) : filterDescriptor.Value; object obj4; if (obj3 is string || obj3 is char || (obj3 is Guid || obj3 is TimeSpan)) { obj4 = (object)("'" + DataStorageHelper.EscapeValue(Convert.ToString(obj3)) + "'"); } else if (obj3 is Enum) { obj4 = (object)Convert.ToInt32(obj3); } else if (obj3 is DateTime) { obj4 = (object)string.Format((IFormatProvider)CultureInfo.InvariantCulture, "#{0}#", obj3); } else { obj4 = !(obj3 is double) ? (!(obj3 is Color) ? (obj3 is short || obj3 is int || (obj3 is long || obj3 is Decimal) || (obj3 is float || obj3 is double || obj3 is bool) ? (object)Convert.ToString(filterDescriptor.Value, (IFormatProvider)CultureInfo.InvariantCulture) : (object)("'" + DataStorageHelper.EscapeValue(Convert.ToString(filterDescriptor.Value, (IFormatProvider)CultureInfo.InvariantCulture)) + "'")) : (object)((Color)obj3).ToArgb()) : (object)((double)obj3).ToString("G17", (IFormatProvider)CultureInfo.InvariantCulture); } return(obj4); }
public int Compare(Group <T> x, Group <T> y) { object[] key1 = x.Key as object[]; object[] key2 = y.Key as object[]; if (key1 != null && key2 != null && key1.Length == key2.Length) { int num = 0; for (int index = 0; index < key1.Length; ++index) { IComparable comparable1 = key1[index] as IComparable; IComparable comparable2 = key2[index] as IComparable; num = comparable1 == null || comparable2 == null ? (comparable1 != comparable2 ? DataStorageHelper.CompareNulls((object)comparable1, (object)comparable2) : 0) : ((object)comparable1.GetType() != (object)comparable2.GetType() ? -1 : comparable1.CompareTo((object)comparable2)); if (num != 0) { if (this.directions[index] == ListSortDirection.Descending) { return(-num); } return(num); } } return(num); } if (!(x.Key is IComparable) || (object)x.Key.GetType() != (object)y.Key.GetType()) { return(x.GetHashCode().CompareTo(y.GetHashCode())); } int num1 = ((IComparable)x.Key).CompareTo(y.Key); if (this.directions[this.directions.Length - 1] == ListSortDirection.Descending) { return(-num1); } return(num1); }
/// <summary> /// Gets the expression. /// </summary> /// <param name="filterDescriptor">The filter descriptor.</param> /// <returns></returns> public static string GetExpression(FilterDescriptor filterDescriptor) { if (string.IsNullOrEmpty(filterDescriptor.PropertyName) || filterDescriptor.filterOperator == FilterOperator.None) { return(string.Empty); } if ((filterDescriptor.Operator != FilterOperator.IsNotNull && filterDescriptor.Operator != FilterOperator.IsNull) && filterDescriptor.value == null) { return(string.Empty); } object value = filterDescriptor.Value; if (value is string || value is char) { value = "'" + DataStorageHelper.EscapeValue(Convert.ToString(value)) + "'"; } else if (value is Enum) { value = Convert.ToInt32(value); } else if (value is DateTime) { value = String.Format(CultureInfo.InvariantCulture, "#{0}#", value); } else if (value is double) { value = ((double)value).ToString("R", CultureInfo.InvariantCulture); } else { value = Convert.ToString(filterDescriptor.Value, CultureInfo.InvariantCulture); } string likeValue = String.Empty; string name = DataStorageHelper.EscapeName(filterDescriptor.PropertyName); switch (filterDescriptor.Operator) { case FilterOperator.IsLike: return(string.Format("{0} LIKE {1}", name, value)); case FilterOperator.IsNotLike: return(string.Format("{0} NOT LIKE {1}", name, value)); case FilterOperator.StartsWith: likeValue = DataStorageHelper.EscapeLikeValue(Convert.ToString(filterDescriptor.Value, CultureInfo.InvariantCulture)); return(string.Format("{0} LIKE '{1}%'", name, likeValue)); case FilterOperator.EndsWith: likeValue = DataStorageHelper.EscapeLikeValue(Convert.ToString(filterDescriptor.Value, CultureInfo.InvariantCulture)); return(string.Format("{0} LIKE '%{1}'", name, likeValue)); case FilterOperator.Contains: likeValue = DataStorageHelper.EscapeLikeValue(Convert.ToString(filterDescriptor.Value, CultureInfo.InvariantCulture)); return(string.Format("{0} LIKE '%{1}%'", name, likeValue)); case FilterOperator.NotContains: likeValue = DataStorageHelper.EscapeLikeValue(Convert.ToString(filterDescriptor.Value, CultureInfo.InvariantCulture)); return(string.Format("{0} NOT LIKE '%{1}%'", name, likeValue)); case FilterOperator.IsEqualTo: return(string.Format("{0} = {1}", name, value)); case FilterOperator.IsLessThan: return(string.Format("{0} < {1}", name, value)); case FilterOperator.IsLessThanOrEqualTo: return(string.Format("{0} <= {1}", name, value)); case FilterOperator.IsGreaterThan: return(string.Format("{0} > {1}", name, value)); case FilterOperator.IsGreaterThanOrEqualTo: return(string.Format("{0} >= {1}", name, value)); case FilterOperator.IsNotEqualTo: return(string.Format("{0} <> {1}", name, value)); case FilterOperator.IsNull: return(string.Format("{0} IS NULL", name)); case FilterOperator.IsNotNull: return(string.Format("NOT ({0} IS NULL)", name)); case FilterOperator.IsContainedIn: return(string.Format("{0} IN ({1})", name, value)); case FilterOperator.IsNotContainedIn: return(string.Format("{0} NOT IN ({1})", name, value)); } return(string.Empty); }