コード例 #1
0
        public List <ActivityDetail> GetActivityDetails(int act_id)
        {
            List <ActivityDetail> activityDetails = new List <ActivityDetail>();
            string sql = "select * from activity where act_id='" + act_id + "'" + " and status = 1";

            var    row      = _theDataSource.SelectOne(sql);
            string material = row["material"].ToString();

            List <MWMaterial> mWMaterials = (List <MWMaterial>)DaoUtil.ConvertMaterialJson(material);

            for (int i = 0; i < mWMaterials.Count; i++)
            {
                MWMaterial data = mWMaterials[i];
                //Debug.Log(data[i]["cuteffect_id"]);
                ActivityDetail activityDetail = new ActivityDetail();
                if (data.type == "video")
                {
                    activityDetail.Type     = 1;
                    activityDetail.Image    = data.cover;
                    activityDetail.VideoUrl = data.path;
                }
                else if (data.type == "image")
                {
                    activityDetail.Type  = 0;
                    activityDetail.Image = data.path;
                }
                activityDetail.Description = data.description;
                activityDetails.Add(activityDetail);
            }

            return(activityDetails);
        }
コード例 #2
0
        public List <Video> GetVideosByEnvId(int envId)
        {
            List <Video> videos = new List <Video>();

            string sql = "select video from company where com_id=" + envId + " and status = 1";

            //Debug.Log("GetVideosByEnvId : " + sql);

            var row = _theDataSource.SelectOne(sql);

            if (row != null)
            {
                string material = row["video"].ToString();

                object mWMaterialsObj = DaoUtil.ConvertMaterialJson(material);
                if (mWMaterialsObj != null)
                {
                    List <MWMaterial> mWMaterials = (List <MWMaterial>)mWMaterialsObj;

                    for (int i = 0; i < mWMaterials.Count; i++)
                    {
                        MWMaterial data = mWMaterials[i];
                        //Debug.Log(data[i]["cuteffect_id"]);
                        Video video = new Video();
                        video.V_id = i;
                        if (data.type == "video")
                        {
                            video.Cover   = data.cover;
                            video.Address = data.path;
                        }
                        video.Description = data.description;
                        videos.Add(video);
                    }
                }
            }

            return(videos);
        }
コード例 #3
0
        public List <ProductDetail> GetProductDetails(int pro_id)
        {
            List <ProductDetail> productDetails = new List <ProductDetail>();

            string sql = "select * from product where prod_id=" + pro_id;
            var    row = _theDataSource.SelectOne(sql);

            if (row != null)
            {
                string material = row["material"].ToString();

                List <MWMaterial> mWMaterials = (List <MWMaterial>)DaoUtil.ConvertMaterialJson(material);

                for (int i = 0; i < mWMaterials.Count; i++)
                {
                    MWMaterial data = mWMaterials[i];
                    //Debug.Log(data[i]["cuteffect_id"]);
                    ProductDetail productDetail = new ProductDetail();

                    if (data.type == "video")
                    {
                        productDetail.Type     = 1;
                        productDetail.Image    = data.cover;
                        productDetail.VideoUrl = data.path;
                    }
                    else if (data.type == "image")
                    {
                        productDetail.Type  = 0;
                        productDetail.Image = data.path;
                    }
                    productDetail.Description = data.description;
                    productDetails.Add(productDetail);
                }
            }
            return(productDetails);
        }
コード例 #4
0
ファイル: Material.cs プロジェクト: xu509/MagicWall
        public MWMaterial ConvertJSONToObject(string str)
        {
            bool hasType        = false;
            bool hasPath        = false;
            bool hasDescription = false;
            bool hasCover       = false;


            //Debug.Log(str);
            if (str.Contains("type"))
            {
                str     = str.Replace("type", "'type'");
                hasType = true;
            }

            if (str.Contains("path"))
            {
                str     = str.Replace("path", "'path'");
                hasPath = true;
            }

            if (str.Contains("description"))
            {
                str            = str.Replace("description", "'description'");
                hasDescription = true;
            }

            if (str.Contains("cover"))
            {
                str      = str.Replace("cover", "'cover'");
                hasCover = true;
            }

            if (str.IndexOf("}") < 0)
            {
                str = str + "}";
            }

            if (str.IndexOf("{") < 0)
            {
                str = "{" + str;
            }


            //Debug.Log("After Convert");
            //Debug.Log(str);

            JsonData   data       = JsonMapper.ToObject(str);
            MWMaterial mWMaterial = new MWMaterial();

            if (hasType)
            {
                mWMaterial.type = (string)data["type"];
            }
            if (hasPath)
            {
                mWMaterial.path = (string)data["path"];
            }
            if (hasDescription)
            {
                mWMaterial.description = (string)data["description"];
            }
            if (hasCover)
            {
                mWMaterial.cover = (string)data["cover"];
            }

            return(mWMaterial);
        }
コード例 #5
0
ファイル: DaoUtil.cs プロジェクト: xu509/MagicWall
        private static MWMaterial ConvertMaterialObject(string jsonstr)
        {
            MWMaterial mWMaterial = new MWMaterial();

            return(mWMaterial.ConvertJSONToObject(jsonstr));
        }