玄铁剑

成功的途径:抄,创造,研究,发明...
posts - 128, comments - 42, trackbacks - 0, articles - 174

WebService动态解析对象

Posted on 2010-07-04 09:14 玄铁剑 阅读(495) 评论(0)  编辑 收藏 引用 所属分类: asp.net

        装载相关图片(從WebService讀取並解析)
        private void ReadPictureInfo(string strProductCode)
        {
                    object objPicture = OpenDb.InvokeWebService(uSession.Service_URL, "GetProductPicture", objArray);
                    if (objPicture != null)
                    {
                        pic = new PictureInfo();
                        pic.ID = iRow;
                        FieldInfo[] fields = objPicture.GetType().GetFields();
                        for (int k = 0; k < fields.Length; ++k)
                        {
                            FieldInfo filed = fields.GetValue(k) as FieldInfo;

                            switch (filed.Name)
                            {
                                case "ID":
                                    break;
                                case "SmallPicture":
                                    pic.SmallPicture = filed.GetValue(objPicture).ToString();
                                    break;
                                case "BinSmallInfo":
                                    pic.BinSmallInfo = (byte[])filed.GetValue(objPicture);
                                    break;
                                case "BigPicture":
                                    pic.BigPicture = filed.GetValue(objPicture).ToString();
                                    break;
                                case "BinBigInfo":
                                    pic.BinBigInfo = (byte[])filed.GetValue(objPicture);
                                    break;
                            }
                            filed.GetValue(objPicture);

                        }
                        pic.IsDefault = Row.IsDefault ?? false;
                        pic.ProductCode = strProductCode;
                        lstPictures.Add(pic);
                    }
                }
            }
        }

只有注册用户登录后才能发表评论。