예제 #1
0
        public static Data.Notification Create(string title, string message, bool important, DataType data_type, long data_id)
        {
            var dt = "";
            switch(data_type)
            {
            case DataType.Drug:
                dt = "drug";
                break;
            case DataType.DrugCompany:
                dt = "drug-company";
                break;
            default:
                throw new ArgumentOutOfRangeException("Unrecognized value for data_type");
            }

            var ret = new Data.Notification() {
                DataID = data_id,
                DataType = dt,
                Important = important ? "yes" : "no",
                Link = BuildNotificationUrl(data_type, data_id),
                Message = message,
                Sent = DateTime.Now,
                Title = title,
            };

            ret.Save();

            return ret;
        }
예제 #2
0
        public static Data.Notification Create(string title, string message, bool important, string link)
        {
            var ret = new Data.Notification()
            {
                DataType = "link",
                Important = important ? "yes" : "no",
                Link = link,
                LinkType = "link",
                Message = message,
                Sent = DateTime.Now,
                Title = title,
            };

            ret.Save();

            return ret;
        }