Exemplo n.º 1
0
        public IEnumerable<Email> Get(SubjectType subjectType, int subjectId, DateTime since, int? offset = null)
        {
            var url = offset.HasValue
                         ? String.Format("/{0}/{1}/emails.xml?since={2}&n={3}", subjectType.ToString().ToLower(), subjectId, since, offset.Value)
                         : String.Format("/{0}/{1}/emails.xml?since={2}", subjectType.ToString().ToLower(), subjectId, since);

            var response = _client.Execute<List<Email>>(new RestRequest(url, Method.GET));
            var results = response.Data;
            return results;
        }
Exemplo n.º 2
0
        public IEnumerable <Email> Get(SubjectType subjectType, int subjectId, int?offset = null)
        {
            var url = offset.HasValue
                ? string.Format("{0}/{1}/emails.xml?n={2}", subjectType.ToString().ToLower(), subjectId, offset.Value)
                : string.Format("{0}/{1}/emails.xml", subjectType.ToString().ToLower(), subjectId);

            var response = Client.Execute <List <Email> >(new RestRequest(url, Method.GET));

            return(response.Data);
        }
Exemplo n.º 3
0
        public IEnumerable<Note> Get(SubjectType subjectType, int subjectId, int? offset = null)
        {
            var url = offset.HasValue
                         ? String.Format("/{0}/{1}/notes.xml?n={2}", subjectType.ToString().ToLower(), subjectId, offset.Value)
                         : String.Format("/{0}/{1}/notes.xml", subjectType.ToString().ToLower(), subjectId);

            var response = _client.Execute<List<Note>>(new RestRequest(url, Method.GET));
            var results = response.Data;
            return results;
        }
Exemplo n.º 4
0
        public IEnumerable <Note> Get(SubjectType subjectType, int subjectId, int?offset = null)
        {
            var url = offset.HasValue
                         ? String.Format("/{0}/{1}/notes.xml?n={2}", subjectType.ToString().ToLower(), subjectId, offset.Value)
                         : String.Format("/{0}/{1}/notes.xml", subjectType.ToString().ToLower(), subjectId);

            var response = _client.Execute <List <Note> >(new RestRequest(url, Method.GET));
            var results  = response.Data;

            return(results);
        }
Exemplo n.º 5
0
        public IEnumerable <Email> Get(SubjectType subjectType, int subjectId, DateTime since, int?offset = null)
        {
            var url = offset.HasValue
                         ? String.Format("/{0}/{1}/emails.xml?since={2}&n={3}", subjectType.ToString().ToLower(), subjectId, since, offset.Value)
                         : String.Format("/{0}/{1}/emails.xml?since={2}", subjectType.ToString().ToLower(), subjectId, since);

            var response = _client.Execute <List <Email> >(new RestRequest(url, Method.GET));
            var results  = response.Data;

            return(results);
        }
Exemplo n.º 6
0
        public bool Delete(SubjectType subjectType, int subjectId, int tagId)
        {
            var response = _client.Execute<Tag>(new RestRequest(String.Format("{0}/{1}/tags/{2}.xml",
                subjectType.ToString().ToLower(), subjectId, tagId), Method.DELETE));

            return response.StatusCode == HttpStatusCode.OK;
        }
Exemplo n.º 7
0
 public IEnumerable<Task> Get(SubjectType subjectType, int subjectId)
 {
     var url = String.Format("{0}/{1}/tasks.xml", subjectType.ToString().ToLower(),subjectId);
     var response = _client.Execute<List<Task>>(new RestRequest(url, Method.GET));
     var tasks = response.Data;
     return tasks;
 }
Exemplo n.º 8
0
        public async Task <List <Definition> > GetDefinitionList(SubjectType subjectType)
        {
            var pathToDefs = Path.Combine(FnDefDir, FnDefs.Replace("*", subjectType.ToString().ToLower()));
            var list       = await GetData <List <Definition> >(pathToDefs);

            return(list);
        }
Exemplo n.º 9
0
        public bool Delete(SubjectType subjectType, int subjectId, int tagId)
        {
            var response = _client.Execute <Tag>(new RestRequest(String.Format("{0}/{1}/tags/{2}.xml",
                                                                               subjectType.ToString().ToLower(), subjectId, tagId), Method.DELETE));

            return(response.StatusCode == HttpStatusCode.OK);
        }
Exemplo n.º 10
0
        public IEnumerable <Task> Get(SubjectType subjectType, int subjectId)
        {
            var url      = String.Format("{0}/{1}/tasks.xml", subjectType.ToString().ToLower(), subjectId);
            var response = Client.Execute <List <Task> >(new RestRequest(url, Method.GET));
            var tasks    = response.Data;

            return(tasks);
        }
Exemplo n.º 11
0
        public Email Create(SubjectType subjectType, int subjectId, Email email)
        {
            var request = new RestRequest(String.Format("{0}/{1}/emails.xml",
                subjectType.ToString().ToLower(), subjectId), Method.POST)
            { XmlSerializer = new XmlSerializer() };
            request.AddBody(email);

            var response = _client.Execute<Email>(request);
            return response.Data;
        }
Exemplo n.º 12
0
        public Note Create(SubjectType subjectType, int subjectId, Note note)
        {
            var request = new RestRequest(String.Format("{0}/{1}/notes.xml",
                subjectType.ToString().ToLower(), subjectId), Method.POST)
            { XmlSerializer = new XmlSerializer() };
            request.AddBody(note);

            var response = _client.Execute<Note>(request);
            return response.Data;
        }
Exemplo n.º 13
0
        public Tag Create(SubjectType subjectType, int subjectId, Tag tag)
        {
            var request = new RestRequest(String.Format("{0}/{1}/tags.xml",
                subjectType.ToString().ToLower(), subjectId), Method.POST) { XmlSerializer = new XmlSerializer() };

            request.AddParameter("name", tag.Name);

            var response = _client.Execute<Tag>(request);
            return response.Data;
        }
Exemplo n.º 14
0
 public void NodeToXML(XmlWriter xw)
 {
     xw.WriteStartElement(Type.ToString());
     xw.WriteAttributeString("name", Name);
     xw.WriteAttributeString("depth", Depth.ToString());
     foreach (var child in Children)
     {
         child.NodeToXML(xw);
     }
     xw.WriteEndElement();
 }
Exemplo n.º 15
0
 public static string GetDesc(this SubjectType type)
 {
     return(type switch
     {
         SubjectType.Book => "书籍",
         SubjectType.Anime => "动画",
         SubjectType.Music => "音乐",
         SubjectType.Game => "游戏",
         SubjectType.Real => "三次元",
         _ => type.ToString(),
     });
Exemplo n.º 16
0
        public async Task <List <Formula> > GetFormulaList(SubjectType subjectType)
        {
            var pathToFmls = Path.Combine(FnFmlsDir, FnFmls.Replace("*", subjectType.ToString().ToLower()));
            var list       = await GetData <List <Formula> >(pathToFmls);

            if (list == null)
            {
                return(null);
            }
            return(list);
        }
Exemplo n.º 17
0
        //Notification Messages

        public static void GetNotificationMessagesInfo(Guid applicationId, List <Pair> userStatusPairList,
                                                       SubjectType subjectType, ActionType action, ref List <NotificationMessage> retMessageList)
        {
            SqlConnection con = new SqlConnection(ProviderUtil.ConnectionString);
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection = con;

            DataTable userStatusPairTable = new DataTable();

            userStatusPairTable.Columns.Add("FirstValue", typeof(Guid));
            userStatusPairTable.Columns.Add("SecondValue", typeof(string));
            foreach (Pair _pair in userStatusPairList)
            {
                userStatusPairTable.Rows.Add((Guid)_pair.First, ((UserStatus)_pair.Second).ToString());
            }

            SqlParameter userStatusPairParam = new SqlParameter("@UserStatusPair", SqlDbType.Structured);

            userStatusPairParam.TypeName = "[dbo].[GuidStringTableType]";
            userStatusPairParam.Value    = userStatusPairTable;

            cmd.Parameters.AddWithValue("@ApplicationID", applicationId);
            if (RaaiVanSettings.ReferenceTenantID.HasValue)
            {
                cmd.Parameters.AddWithValue("@RefAppID", RaaiVanSettings.ReferenceTenantID.Value);
            }
            cmd.Parameters.Add(userStatusPairParam);
            cmd.Parameters.AddWithValue("@SubjectType", subjectType.ToString());
            cmd.Parameters.AddWithValue("@Action", action.ToString());

            string spName = GetFullyQualifiedName("GetNotificationMessagesInfo");

            string sep       = ",";
            string arguments = "@ApplicationID" + sep +
                               (!RaaiVanSettings.ReferenceTenantID.HasValue ? "null" : "@RefAppID") + sep +
                               "@UserStatusPair" + sep + "@SubjectType" + sep + "@Action";

            cmd.CommandText = ("EXEC" + " " + spName + " " + arguments);

            con.Open();

            try
            {
                IDataReader reader = (IDataReader)cmd.ExecuteReader();
                _parse_notification_messages_info(applicationId, ref reader, ref retMessageList);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.NTFN);
            }
            finally { con.Close(); }
        }
Exemplo n.º 18
0
        public Email Create(SubjectType subjectType, int subjectId, Email email)
        {
            var request = new RestRequest(String.Format("{0}/{1}/emails.xml",
                                                        subjectType.ToString().ToLower(), subjectId), Method.POST)
            {
                XmlSerializer = new XmlSerializer()
            };

            request.AddBody(email);

            var response = _client.Execute <Email>(request);

            return(response.Data);
        }
Exemplo n.º 19
0
        public Note Create(SubjectType subjectType, int subjectId, Note note)
        {
            var request = new RestRequest(String.Format("{0}/{1}/notes.xml",
                                                        subjectType.ToString().ToLower(), subjectId), Method.POST)
            {
                XmlSerializer = new XmlSerializer()
            };

            request.AddBody(note);

            var response = _client.Execute <Note>(request);

            return(response.Data);
        }
Exemplo n.º 20
0
        public Tag Create(SubjectType subjectType, int subjectId, Tag tag)
        {
            var request = new RestRequest(String.Format("{0}/{1}/tags.xml",
                                                        subjectType.ToString().ToLower(), subjectId), Method.POST)
            {
                XmlSerializer = new XmlSerializer()
            };

            request.AddParameter("name", tag.Name);

            var response = _client.Execute <Tag>(request);

            return(response.Data);
        }
Exemplo n.º 21
0
        public static bool TrySendMail(string message, SubjectType subjectType, out Exception ex, string replyAddress = "")
        {
            IsSending = true;
            ex        = null;
            bool success = true;

            Message.Body    = message;
            Message.Subject = SubjectBeginning + subjectType.ToString() + (replyAddress == "" ? "" : $" | From {replyAddress}");

            try
            {
                Client.Send(Message);
            }
            catch (Exception e)
            {
                ex      = e;
                success = false;
            }

            IsSending = false;
            return(success);
        }
Exemplo n.º 22
0
        /// <summary>
        /// 转换成字符串
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("{0}{1}", BillItemID.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", BillID.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", Subject.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", StrSubject, WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", SubjectType.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", Amount.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", DueAmt.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", ReceivedAmt.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", PenaltyIntAmt.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), WebServiceConst.Separater_1);

            if (FullPaidTime.HasValue)
            {
                sb.AppendFormat("{0}{1}", FullPaidTime.Value.ToString("yyyy-MM-dd HH:mm:ss"), WebServiceConst.Separater_1);
            }
            else
            {
                sb.AppendFormat("{0}{1}", "", WebServiceConst.Separater_1);
            }

            sb.AppendFormat("{0}{1}", OperatorID.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", IsCurrent.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", IsShelve.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", BusinessID.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", StrAmount, WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", StrDueAmt, WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", StrReceivedAmt, WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", StrReceived, WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", StrReceivable, WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", Display, WebServiceConst.Separater_1);
            sb.Append(StrCreateTime);

            return(sb.ToString());
        }
Exemplo n.º 23
0
        public static string GetValue(this SubjectType subjectType)
        {
            switch (subjectType)
            {
            case SubjectType.Book:
                return("book");

            case SubjectType.Anime:
                return("anime");

            case SubjectType.Music:
                return("music");

            case SubjectType.Game:
                return("game");

            case SubjectType.Real:
                return("real");

            default:
                return(subjectType.ToString());
            }
        }
Exemplo n.º 24
0
 /// <summary>Get overrides for a game object.</summary>
 /// <param name="character">The character for which to get overrides.</param>
 /// <param name="type">The character type.</param>
 public CharacterData GetCharacter(NPC character, SubjectType type)
 {
     return
         (this.Characters?.FirstOrDefault(p => p.ID == $"{type}::{character.Name}") // override by type + name
          ?? this.Characters?.FirstOrDefault(p => p.ID == type.ToString()));        // override by type
 }
Exemplo n.º 25
0
        public IEnumerable <Note> Get(int subjectId, SubjectType subjectType)
        {
            var response = Client.Execute <List <Note> >(new RestRequest(String.Format("{0}/{1}/notes.xml", subjectType.ToString().ToLower(), subjectId), Method.GET));

            return(response.Data);
        }
Exemplo n.º 26
0
 public override string ToString()
 {
     return($"{(!Order.HasValue ? "" :(this.Order.Value+1).ToOrdinalString())} " +
            $"{(!SubjectType.HasValue? "" : SubjectType.ToString())} " +
            $"{(string.IsNullOrEmpty(this.SubjectName)? "":$"'{this.SubjectName}'")} " +
Exemplo n.º 27
0
 public IEnumerable<Tag> Get(SubjectType subjectType, int subjectId)
 {
     var response = _client.Execute<List<Tag>>(new RestRequest(String.Format("{0}/{1}/tags.xml", subjectType.ToString().ToLower(), subjectId), Method.GET));
     return response.Data;
 }
Exemplo n.º 28
0
 public AdministrationBar(SubjectType SubjectType)
     : this(SubjectType.ToString())
 {
 }
Exemplo n.º 29
0
        public IEnumerable <Tag> Get(SubjectType subjectType, int subjectId)
        {
            var response = _client.Execute <List <Tag> >(new RestRequest(String.Format("{0}/{1}/tags.xml", subjectType.ToString().ToLower(), subjectId), Method.GET));

            return(response.Data);
        }