コード例 #1
0
        //public static void IsRequestAllow(string serviceEndpoint, string serverIP, string serverPort)
        //{
        //    // Truongnx: test performance
        //    //return;
        //    IsRequestAllow(serverIP, serverPort, serviceEndpoint);
        //}

        public static List <ClientResponseDetail> convertToClientResponseDetail <R>(R response) where R : class
        {
            List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
            List <object> responseDetail = ((object[])response.GetType().GetProperty("ResponseDetail").GetValue(response, null)).ToList();

            int i = 0;

            foreach (object item in responseDetail)
            {
                int    id        = int.Parse(item.GetType().GetProperty("Id").GetValue(item, null).ToString());
                string obj       = item.GetType().GetProperty("Object").GetValue(item, null).IsNullOrEmpty() ? "" : item.GetType().GetProperty("Object").GetValue(item, null).ToString();
                string operation = item.GetType().GetProperty("Operation").GetValue(item, null).IsNullOrEmpty() ? "" : item.GetType().GetProperty("Operation").GetValue(item, null).ToString();
                string result    = item.GetType().GetProperty("Result").GetValue(item, null).IsNullOrEmpty() ? "" : item.GetType().GetProperty("Result").GetValue(item, null).ToString();
                string detail    = item.GetType().GetProperty("Detail").GetValue(item, null).IsNullOrEmpty() ? "" : item.GetType().GetProperty("Detail").GetValue(item, null).ToString();

                ++i;
                ClientResponseDetail clientResponseDetail = new ClientResponseDetail();
                clientResponseDetail.Stt       = i;
                clientResponseDetail.Id        = id;
                clientResponseDetail.Object    = obj;
                clientResponseDetail.Operation = LLanguage.SearchResourceByKey(operation);
                clientResponseDetail.Result    = LLanguage.SearchResourceByKey(result);
                clientResponseDetail.Detail    = LLanguage.SearchResourceByKey(detail, '#');

                listClientResponseDetail.Add(clientResponseDetail);
            }
            return(listClientResponseDetail);
        }
コード例 #2
0
        public static List <ClientResponseDetail> convertToClientResponseDetail <R>(R response) where R : class
        {
            List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
            List <object> responseDetail = ((object[])response.GetType().GetProperty("ResponseDetail").GetValue(response, null)).ToList();

            int i = 0;

            foreach (object item in responseDetail)
            {
                int    id        = int.Parse(item.GetType().GetProperty("Id").GetValue(item, null).ToString());
                string obj       = item.GetType().GetProperty("Object").GetValue(item, null).IsNullOrEmpty() ? "" : item.GetType().GetProperty("Object").GetValue(item, null).ToString();
                string operation = item.GetType().GetProperty("Operation").GetValue(item, null).IsNullOrEmpty() ? "" : item.GetType().GetProperty("Operation").GetValue(item, null).ToString();
                string result    = item.GetType().GetProperty("Result").GetValue(item, null).IsNullOrEmpty() ? "" : item.GetType().GetProperty("Result").GetValue(item, null).ToString();
                string detail    = item.GetType().GetProperty("Detail").GetValue(item, null).IsNullOrEmpty() ? "" : item.GetType().GetProperty("Detail").GetValue(item, null).ToString();

                ++i;
                string strOperation = "";
                string strResult    = "";
                string strDetail    = "";

                if (ClientInformation.ClientType.Equals(ApplicationConstant.ClientType.DESKTOP.layGiaTri()))
                {
                    strOperation = LLanguage.SearchResourceByKey(operation);
                    strResult    = LLanguage.SearchResourceByKey(result);
                    strDetail    = LLanguage.SearchResourceByKey(detail, '#');
                }
                else
                {
                    strOperation = operation;
                    strResult    = result;
                    strDetail    = detail;
                }


                ClientResponseDetail clientResponseDetail = new ClientResponseDetail();
                clientResponseDetail.Stt       = i;
                clientResponseDetail.Id        = id;
                clientResponseDetail.Object    = obj;
                clientResponseDetail.Operation = strOperation;
                clientResponseDetail.Result    = strResult;
                clientResponseDetail.Detail    = strDetail;

                listClientResponseDetail.Add(clientResponseDetail);
            }
            return(listClientResponseDetail);
        }