Пример #1
0
        public Task <int> ReadDataFromJson()
        {
            var    assembly = typeof(DynamicScreen).GetTypeInfo().Assembly;
            Stream stream   = assembly.GetManifestResourceStream("SampleDB.getbannerdata.json");

            using (var reader = new System.IO.StreamReader(stream))
            {
                var json = reader.ReadToEnd();
                List <GetActiveCategoriesModel.RootObject> data = JsonConvert.DeserializeObject <List <GetActiveCategoriesModel.RootObject> >(json);

                GetActiveCategoriesModel.RootObject[] arrayobj = data.ToArray();
                for (int k = 0; k < arrayobj.Length; k++)
                {
                    JSSEMasterCategory mctbl = new JSSEMasterCategory();
                    mctbl.Category_ID = arrayobj[k].Category_ID;
                    mctbl.Category    = arrayobj[k].Category;
                    App.Database.SaveCategoriesAsync(mctbl);
                    for (int t = 0; t < arrayobj[k].Ratings.Count; t++)
                    {
                        RatingTable rtbl = new RatingTable();
                        rtbl.Rating_ID = arrayobj[k].Ratings[t].Rating_ID;
                        rtbl.Rating    = arrayobj[k].Ratings[t].Rating;
                        App.Database.SaveRatingsAsync(rtbl);
                    }
                    GetActiveCategoriesModel.EntBehavior[] eorgdata = arrayobj[k].EntBehaviors.ToArray();
                    for (int l = 0; l < eorgdata.Length; l++)
                    {
                        JSSEMasterBehavior mbhtbl = new JSSEMasterBehavior();

                        mbhtbl.Behavior_ID     = eorgdata[l].Behavior_ID;
                        mbhtbl.Behavior        = eorgdata[l].Behavior;
                        mbhtbl.Category_ID     = arrayobj[k].Category_ID;
                        mbhtbl.BehaviorType_ID = eorgdata[l].BehaviorType_ID;
                        App.Database.SaveBehaviorssAsync(mbhtbl);
                    }

                    for (int i = 0; i < arrayobj[k].AllOrgBehaviors.Count; i++)
                    {
                        for (int j = 0; j < arrayobj[k].AllOrgBehaviors[i].Count; j++)
                        {
                            JSSEMasterBehavior mbhtbl = new JSSEMasterBehavior();

                            mbhtbl.Behavior_ID     = arrayobj[k].AllOrgBehaviors[i][j].Behavior_ID;
                            mbhtbl.Behavior        = arrayobj[k].AllOrgBehaviors[i][j].Behavior;
                            mbhtbl.Category_ID     = arrayobj[k].Category_ID;
                            mbhtbl.Org_ID          = arrayobj[k].AllOrgBehaviors[i][j].Org_ID;
                            mbhtbl.BehaviorType_ID = arrayobj[k].AllOrgBehaviors[i][j].BehaviorType_ID;
                            App.Database.SaveBehaviorssAsync(mbhtbl);
                        }
                    }
                }
            }

            return(Task.FromResult(1));
        }
Пример #2
0
        public Task <int> SaveRatingsAsync(RatingTable rating)
        {
            //if (employee.EmpId != 0)
            //{
            //  return database.UpdateAsync(employee);

            //}
            //else
            //{
            return(database.InsertAsync(rating));
            //}
        }
Пример #3
0
 public Task <int> DelteRatingAsync(RatingTable rating)
 {
     return(database.DeleteAsync(rating));
 }