コード例 #1
0
        public static Int64 SaveNotification(RealTimeNotifications obj)
        {
            try
            {
                using (var ctx = new NotificationEngineDataContext())
                {
                    var query = "execute [dbo].[usp_CreateAndUpdateNotifications] @pNotificationID, @ReceiverAppID, @SenderID, @ReceiverID, @NotificationDetail,@IsRead,@datetime,@extraDataAsJson";

                    var args = new DbParameter[] {
                        new SqlParameter {
                            ParameterName = "@pNotificationID", Value = obj.NotificationID
                        },
                        new SqlParameter {
                            ParameterName = "@ReceiverAppID", Value = obj.receiverAppID
                        },
                        new SqlParameter {
                            ParameterName = "@SenderID", Value = obj.SenderID
                        },
                        new SqlParameter {
                            ParameterName = "@ReceiverID", Value = obj.ReceiverID
                        },
                        new SqlParameter {
                            ParameterName = "@NotificationDetail", Value = obj.NotificationDetail
                        },
                        new SqlParameter {
                            ParameterName = "@isRead", Value = obj.IsRead
                        },
                        new SqlParameter {
                            ParameterName = "@datetime", Value = obj.CreatedOn
                        },
                        new SqlParameter {
                            ParameterName = "@extraDataAsJson", Value = obj.extraDataAsJson
                        },
                    };

                    var data = ctx.Database.SqlQuery <Int64>(query, args).FirstOrDefault();
                    return(data);
                }
            }
            catch (Exception ex)
            {
                LogHandler.WriteLog(MethodBase.GetCurrentMethod().Name, ex.Message, PUCIT.AIMRL.Common.Logger.LogType.ErrorMsg, ex);
                return(0);
            }
        }
コード例 #2
0
        public static Int64 UpdateNotificationReadStatus(Int64 pNotificationID, string receiverAppID, int empID, Boolean isRead, Boolean markAll, DateTime dateTime)
        {
            try
            {
                using (var ctx = new NotificationEngineDataContext())
                {
                    var query = "execute dbo.UpdateNotificationReadStatus @pNotificationID,@ReceiverAppID,@empID, @isRead,@markAll, @dateTime";

                    var args = new DbParameter[] {
                        new SqlParameter {
                            ParameterName = "@pNotificationID", Value = pNotificationID
                        },
                        new SqlParameter {
                            ParameterName = "@ReceiverAppID", Value = receiverAppID
                        },
                        new SqlParameter {
                            ParameterName = "@empID", Value = empID
                        },
                        new SqlParameter {
                            ParameterName = "@isRead", Value = isRead
                        },
                        new SqlParameter {
                            ParameterName = "@markAll", Value = markAll
                        },
                        new SqlParameter {
                            ParameterName = "@dateTime", Value = dateTime
                        },
                    };

                    var data = ctx.Database.SqlQuery <Int64>(query, args).FirstOrDefault();
                    return(data);
                }
            }
            catch (Exception ex)
            {
                LogHandler.WriteLog(MethodBase.GetCurrentMethod().Name, ex.Message, PUCIT.AIMRL.Common.Logger.LogType.ErrorMsg, ex);
                return(0);
            }
        }
コード例 #3
0
        public static List <RealTimeNotifications> GetNotifcations(string appID, int empID, int max_notification_id)
        {
            try
            {
                using (var ctx = new NotificationEngineDataContext())
                {
                    var query = "execute [dbo].[usp_GetRealTimeNotification] @AppID , @EmployeeID , @maxNotificationId";

                    var args = new DbParameter[] {
                        new SqlParameter {
                            ParameterName = "@AppID", Value = appID
                        },
                        new SqlParameter {
                            ParameterName = "@EmployeeID", Value = empID
                        },
                        new SqlParameter {
                            ParameterName = "@maxNotificationId", Value = max_notification_id
                        },
                    };

                    var data = ctx.Database.SqlQuery <RealTimeNotifications>(query, args).ToList();

                    foreach (var d in data)
                    {
                        d.CreatedOn = d.CreatedOn.ToTimeZoneTime(tzi);
                    }

                    return(data);
                }
            }
            catch (Exception ex)
            {
                LogHandler.WriteLog(MethodBase.GetCurrentMethod().Name, ex.Message, PUCIT.AIMRL.Common.Logger.LogType.ErrorMsg, ex);
                return(new List <RealTimeNotifications>());
            }
        }