Beispiel #1
0
    private void SetStyle(Society.StyleChoices value)
    {
        _style = value;

        if (value == Society.StyleChoices.None)
            return;

        StartCoroutine(CrossfadeStyle());
    }
        private Society CreateModel(SocietyBindingModel model, Society society, SchoolDataBase context)
        {
            society.SocietyName = model.SocietyName;
            society.AgeLimit    = model.AgeLimit;
            society.Sum         = model.Sum;
            society.ClientId    = model.ClientId;
            if (society.Id == 0)
            {
                society.DateCreate = DateTime.Now;
                context.Societies.Add(society);
                context.SaveChanges();
            }

            if (model.Id.HasValue)
            {
                var lessons = context.SocietyLessons
                              .Where(rec => rec.SocietyId == model.Id.Value)
                              .ToList();

                context.SocietyLessons.RemoveRange(lessons
                                                   .Where(rec => !model.Lessons.Contains(rec.LessonId))
                                                   .ToList());
                context.SaveChanges();

                foreach (var updateLesson in lessons)
                {
                    model.Lessons.Remove(updateLesson.LessonId);
                }
            }

            foreach (var lesson in model.Lessons)
            {
                context.SocietyLessons.Add(new SocietyLesson
                {
                    SocietyId = society.Id,
                    LessonId  = lesson
                });
                context.SaveChanges();
            }

            return(society);
        }
Beispiel #3
0
        public async Task SaveSocietyAsync(Society society)
        {
            await Initialize();

            try
            {
                if (society.Id == null)
                {
                    await tableSociety.InsertAsync(society);
                }
                else
                {
                    await tableSociety.UpdateAsync(society);
                }
                // await Syncsocieties();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Unable to save society: " + ex);
            }
        }
Beispiel #4
0
        public SocietyViewModel()
        {
            azureService = DependencyService.Get <AzureService>();

            Title = "Societies";

            // Command implementation
            // implement the ICommands
            SelectionCommand = new Command <Society>(async(item) =>
            {
                if (item == null)
                {
                    return;
                }

                IsBusy = true;
                Debug.WriteLine(string.Concat("Society selected is: ", item.SocietyName));
                await Shell.Current.Navigation.PushAsync(new SocietyDetailPage(item));
                // un-select the list
                SelectedSociety = null;
                IsBusy          = false;
            });

            AddSocietiesCommand = new Command(async() =>
            {
                IsBusy = true;
                // create new society object
                Society item           = new Society();
                item.SocietyId         = Guid.NewGuid().ToString();
                item.CreatedByPlayerId = Preferences.Get("PlayerId", null);
                item.CreatedDate       = DateTime.Now;
                await Shell.Current.Navigation.PushAsync(new SocietyDetailPage(item));
                IsBusy = false;
            });

            LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand());

            // subscribe to messaging so that updates in detail ViewModel can reflect back in the list
            SubscribeToMessageCenter();
        }
        public Society Add(Society account)
        {
            SqlConnection conn    = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
            SqlCommand    command = new SqlCommand("AddSociety", conn);

            command.CommandType = System.Data.CommandType.StoredProcedure;
            command.Parameters.Add(new SqlParameter("Name", account.SocietyName));
            command.Parameters.Add(new SqlParameter("RegistrationNo", account.RegistrationNo));


            SqlDataAdapter adapter = new SqlDataAdapter(command);
            DataTable      t       = new DataTable();

            adapter.Fill(t);
            if (t.Rows.Count == 0)
            {
                return(null);
            }
            return(new Society {
                SocietyId = (int)t.Rows[0][0], SocietyName = (string)t.Rows[0][1], RegistrationNo = (string)t.Rows[0][2]
            });
        }
        public void TestUpdateCreature()
        {
            Creature        cOne           = new Creature();
            Creature        cTWo           = new Creature();
            string          NAME           = "Balzeria";
            string          CLASSIFICATION = "Republic";
            List <Creature> CREATURES      = new List <Creature>()
            {
                cOne, cTWo
            };
            Society society            = new Society(NAME, CLASSIFICATION, CREATURES);
            int     cTwoAlphaRaceValue = cTWo.Genetics.Alpha.Race.Value;
            int     VARIATION          = ExtensionMethods.GetRandom(1, 5);

            cTWo.Genetics.Alpha.Race.Value += VARIATION;
            Assert.IsTrue(society.UpdateCreature(cTWo));
            Creature cTwoChangeCheck;

            Assert.IsTrue(society.GetCreatures(cTWo, out cTwoChangeCheck));
            Assert.AreNotEqual(cTwoAlphaRaceValue, cTwoChangeCheck.Genetics.Alpha.Race.Value);
            Assert.AreEqual(cTwoAlphaRaceValue + VARIATION, cTwoChangeCheck.Genetics.Alpha.Race.Value);
        }
        public MastersForm()
        {
            InitializeComponent();

            countryRepo         = new GenericRepository <Country>();
            stateRepo           = new GenericRepository <State>();
            districtRepo        = new GenericRepository <District>();
            areaRepo            = new GenericRepository <Area>();
            societyRepo         = new GenericRepository <Society>();
            cityRepo            = new GenericRepository <City>();
            categoryRepo        = new GenericRepository <Category>();
            subCategoryRepo     = new GenericRepository <SubCategory>();
            brandRepo           = new GenericRepository <Brand>();
            measurementUnitRepo = new GenericRepository <MeasurementUnit>();
            departmentRepo      = new GenericRepository <Department>();
            designationRepo     = new GenericRepository <Designation>();

            //countryList = new List<Country>();
            //stateList = new List<State>();
            //districtList = new List<District>();
            //cityList = new List<City>();
            //areaList = new List<Area>();

            //country = new Country();
            state           = new State();
            district        = new District();
            city            = new City();
            area            = new Area();
            society         = new Society();
            category        = new Category();
            subCategory     = new SubCategory();
            brand           = new Brand();
            measurementUnit = new MeasurementUnit();
            department      = new Department();
            designation     = new Designation();

            BindAllDataGrids();
            BindAllComboBoxes();
        }
        public void TestGetCreatures()
        {
            Creature        cOne           = new Creature();
            Creature        cTWo           = new Creature();
            Creature        cThree         = new Creature();
            Creature        cFour          = new Creature();
            Creature        cFive          = new Creature();
            string          NAME           = "Balzeria";
            string          CLASSIFICATION = "Republic";
            List <Creature> CREATURES      = new List <Creature>()
            {
                cOne, cTWo, cThree, cFour, cFive
            };
            Society         society       = new Society(NAME, CLASSIFICATION, CREATURES);
            List <Creature> creaturesList = new List <Creature>();

            Assert.IsTrue(society.GetCreatures(out creaturesList));
            CollectionAssert.Contains(creaturesList, cOne);
            CollectionAssert.Contains(creaturesList, cTWo);
            CollectionAssert.Contains(creaturesList, cThree);
            CollectionAssert.Contains(creaturesList, cFour);
            CollectionAssert.Contains(creaturesList, cFive);
        }
Beispiel #9
0
 public bool PostSociety(Society s)
 {
     try
     {
         Society_Details sd = new Society_Details();
         sd.Society_ID         = s.Society_ID;
         sd.Society_Name       = s.Society_Name;
         sd.Society_City       = s.Society_City;
         sd.Society_Pincode    = s.Society_Pincode;
         sd.Society_NoOffHouse = s.Society_NoOffHouse;
         es.Society_Details.Add(sd);
         var res = es.SaveChanges();
         if (res > 0)
         {
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private void btnSaveSociety_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtSocietyName.Text.Trim()))
                {
                    MessageBox.Show("Society Name required");
                    txtCity.Focus();
                }
                else
                {
                    if (society == null)
                    {
                        society = new Society();
                    }

                    string[] societies = txtSocietyName.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string st in societies)
                    {
                        society.AreaId     = Convert.ToInt32(cmbAreaOnSociety.SelectedValue);
                        society.Name       = st;
                        society.IsSelected = false;
                        societyRepo.Add(society);
                        societyRepo.Save();
                    }
                    txtSocietyName.Clear();

                    BindAllDataGrids();
                    BindAllComboBoxes();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #11
0
        public static Society Create(string name)
        {
            Society mySociety = new Society();

            mySociety.Name       = name;
            mySociety.ID         = Guid.NewGuid();
            mySociety.Apartments = new List <Apartment>();
            //create some apartments

            Apartment apartment1 = new Apartment();

            apartment1.HousingSociety = mySociety;
            apartment1.OwnerName      = "RDR";
            apartment1.Block          = "D";
            apartment1.ID             = Guid.NewGuid();

            apartment1.Rooms = new List <Room>();

            Room room1 = new Room();

            room1.ID          = Guid.NewGuid();
            room1.MyApartment = apartment1;
            room1.RoomType    = RoomTypeEnum.DrawingRoom;
            apartment1.Rooms.Add(room1);

            Room room2 = new Room();

            room2.ID          = Guid.NewGuid();
            room2.MyApartment = apartment1;
            room2.RoomType    = RoomTypeEnum.DiningRoom;
            apartment1.Rooms.Add(room2);


            mySociety.Apartments.Add(apartment1);

            return(mySociety);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var path = Server.MapPath("~") + "Files\\Input.txt";

            string[] inputs = File.ReadAllLines(path);

            Society nasa = new Society("NASA");

            Rover r1 = new Rover();

            r1.Land(inputs[1]);
            r1.Owner = nasa;

            Rover r2 = new Rover();

            r2.Land(inputs[3]);
            r2.Owner = nasa;

            nasa.NotifyRobot(r1, inputs[2]);
            nasa.NotifyRobot(r2, inputs[4]);

            output1.InnerText = r1.X + " " + r1.Y + " " + r1.Direction;
            output2.InnerText = r2.X + " " + r2.Y + " " + r2.Direction;
        }
        public void SetUp()
        {
            ContextRegistry.Clear();
            tesla = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian");
            tesla.Inventions = new string[]
                {
                    "Telephone repeater", "Rotating magnetic field principle",
                    "Polyphase alternating-current system", "Induction motor",
                    "Alternating-current power transmission", "Tesla coil transformer",
                    "Wireless communication", "Radio", "Fluorescent lights"
                };
            tesla.PlaceOfBirth.City = "Smiljan";

            pupin = new Inventor("Mihajlo Pupin", new DateTime(1854, 10, 9), "Serbian");
            pupin.Inventions = new string[] { "Long distance telephony & telegraphy", "Secondary X-Ray radiation", "Sonar" };
            pupin.PlaceOfBirth.City = "Idvor";
            pupin.PlaceOfBirth.Country = "Serbia";

            ieee = new Society();
            ieee.Members.Add(tesla);
            ieee.Members.Add(pupin);
            ieee.Officers["president"] = pupin;
            ieee.Officers["advisors"] = new Inventor[] { tesla, pupin }; // not historically accurate, but I need an array in the map ;-)
        }
Beispiel #14
0
    public void BaseSetup()
    {
        society = ((GameObject)GameObject.Find("ExperimentHolder")).GetComponent <Society> ();
        dna     = GetComponentInChildren <DNA>();
        hitRb   = GetComponent <Rigidbody2D> ();

        // Messy way of getting collider used by rigidbody
        Transform child;

        for (int i = 0; i < transform.childCount; i++)
        {
            child = transform.GetChild(i);
            if (!child.tag.Equals("Experiment"))
            {
                continue;
            }
            SetShapeFields(child.gameObject);
        }

        expGroup   = -1;
        numOverlap = 0;
        aState     = AnimState.Neutral;
        dir        = Direction.Down;
    }
Beispiel #15
0
        public void SetUp()
        {
            ContextRegistry.Clear();
            tesla            = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian");
            tesla.Inventions = new string[]
            {
                "Telephone repeater", "Rotating magnetic field principle",
                "Polyphase alternating-current system", "Induction motor",
                "Alternating-current power transmission", "Tesla coil transformer",
                "Wireless communication", "Radio", "Fluorescent lights"
            };
            tesla.PlaceOfBirth.City = "Smiljan";

            pupin                      = new Inventor("Mihajlo Pupin", new DateTime(1854, 10, 9), "Serbian");
            pupin.Inventions           = new string[] { "Long distance telephony & telegraphy", "Secondary X-Ray radiation", "Sonar" };
            pupin.PlaceOfBirth.City    = "Idvor";
            pupin.PlaceOfBirth.Country = "Serbia";

            ieee = new Society();
            ieee.Members.Add(tesla);
            ieee.Members.Add(pupin);
            ieee.Officers["president"] = pupin;
            ieee.Officers["advisors"]  = new Inventor[] { tesla, pupin }; // not historically accurate, but I need an array in the map ;-)
        }
Beispiel #16
0
        public IEnumerable <Society> GetAllSociety()
        {
            try
            {
                var            res = es.Society_Details.ToList();
                List <Society> sd  = new List <Society>();
                foreach (var r in res)
                {
                    Society s = new Society();
                    s.Society_ID         = r.Society_ID;
                    s.Society_Name       = r.Society_Name;
                    s.Society_City       = r.Society_City;
                    s.Society_Pincode    = r.Society_Pincode;
                    s.Society_NoOffHouse = r.Society_NoOffHouse;

                    sd.Add(s);
                }
                return(sd);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #17
0
 public string PutSociety(Society s, string sid)
 {
     throw new NotImplementedException();
 }
        public void TestNestingCollectionValidator()
        {            
            Society soc = new Society();
            soc.Members.Add(new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian"));
            soc.Members.Add(new Inventor("Mihajlo Pupin", new DateTime(1854, 10, 9), "Serbian"));
            
            
            RequiredValidator req = new RequiredValidator("Name", "true");

            RegularExpressionValidator reg = new RegularExpressionValidator("Name", "true", @"[a-z]*\s[a-z]*");
            reg.Options = RegexOptions.IgnoreCase;
            
            CollectionValidator validator = new CollectionValidator();
            validator.Validators.Add(req);
            validator.Validators.Add(reg);                        
                       
            validator.Context = Expression.Parse("Members");
            
            Assert.IsTrue(validator.Validate(soc, new ValidationErrors()));
            
            validator.Context = null;
            Assert.IsTrue(validator.Validate(soc.Members, new ValidationErrors()));
        }
        public async Task <ActionResult> updateSocietyProfile([FromBody] Society Society)
        {
            await context.update(Society.societyId, Society);

            return(Ok(Society));
        }
Beispiel #20
0
        private async void btnUpload_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                btnUpload.IsEnabled = false;
                btnUpload.Content   = "Uploading......";
                string fileName    = "";
                bool   imageExist  = false;
                string fileAddress = "";
                Random r           = new Random();
                if (!storageFile.Equals(null))
                {
                    imageExist = true;
                    // Source: https://azure.microsoft.com/en-us/documentation/articles/mobile-services-javascript-backend-windows-universal-dotnet-upload-data-blob-storage/#test
                    // Part one: upload images to database
                    // Create the connectionstring
                    String StorageConnectionString = "DefaultEndpointsProtocol=https;AccountName=uonlife;AccountKey=LzU9gRoJgvtKtY7rIPE3w1Z7Toc39AfcBO+Y+Q4ZCYoZmXd2KTgpZ5muya6JkxaZRtNAo3ib3FTpw7gAncpOPA==";
                    // Retrieve storage account from connection string.
                    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(StorageConnectionString);
                    // Create the blob client.
                    CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
                    // Retrieve a reference to a container. (pictures)
                    CloudBlobContainer container = blobClient.GetContainerReference("images");
                    await container.CreateIfNotExistsAsync();

                    string sFileName = img.Source.ToString();
                    fileName = tbxName.Text.Trim() + r.Next(10000000, 99999999).ToString() + ".jpg";
                    CloudBlockBlob blobFromSASCredential =
                        container.GetBlockBlobReference(fileName);
                    await blobFromSASCredential.UploadFromFileAsync(storageFile);
                }
                // Step two: store data into table
                if (imageExist == true)
                {
                    fileAddress = "https://uonlife.blob.core.windows.net/images/" + fileName;
                }

                Society society = new Society
                {
                    societyName  = tbxName.Text,
                    clubwebsite  = tbxWebsite.Text,
                    places       = tbxPlaces.Text,
                    description  = tbxDescription.Text,
                    contact      = tbxContact.Text,
                    imageAddress = fileAddress,
                    publisher    = GlobalVariable.loginUser
                };
                await App.mobileService.GetTable <Society>().InsertAsync(society);

                MessageDialog msgbox = new MessageDialog("Upload success");
                await msgbox.ShowAsync();

                Frame.Navigate(typeof(MainPage));
            }
            catch (Exception ex)
            {
                MessageDialog msgbox = new MessageDialog("Error: " + ex.Message);
                await msgbox.ShowAsync();

                btnUpload.IsEnabled = true;
                btnUpload.Content   = "Upload";
            }
        }
Beispiel #21
0
 public void Remove(Society entity)
 {
     throw new NotImplementedException();
 }
        public ActionResult Edit(int SocietyID)
        {
            Society society = myDbContext.Societies.FirstOrDefault(s => s.SocietyID == SocietyID);

            return(View(society));
        }
Beispiel #23
0
        //constructor
        public SocietyCompViewModel()
        {
            Title = "Round Setup";

            azureService = DependencyService.Get <AzureService>();

            // implement the ICommands
            AddSocietiesCommand = new Command(async() =>
            {
                IsBusy = true;
                // create new society object
                Society item           = new Society();
                item.SocietyId         = Guid.NewGuid().ToString();
                item.CreatedByPlayerId = Preferences.Get("PlayerId", null);
                item.CreatedDate       = DateTime.Now;
                await Shell.Current.Navigation.PushAsync(new SocietyDetailPage(item));
                IsBusy = false;
            });

            EditSocietiesCommand = new Command(async() =>
            {
                IsBusy = true;
                // create new society object
                Society item = SelectedSociety;
                await Shell.Current.Navigation.PushAsync(new SocietyDetailPage(item));
                IsBusy = false;
            });

            AddCompetitionsCommand = new Command(async() =>
            {
                IsBusy = true;
                // create new competition object
                if (SelectedSociety != null)
                {
                    Competition item   = new Competition();
                    item.CompetitionId = Guid.NewGuid().ToString();
                    item.SocietyId     = SelectedSociety.SocietyId;
                    //item.SocietyName = SelectedSociety.SocietyName;
                    item.StartDate = DateTime.Now;
                    await Shell.Current.Navigation.PushAsync(new CompetitionDetailPage(item));
                }
                IsBusy = false;
            });

            EditCompetitionsCommand = new Command(async() =>
            {
                IsBusy = true;
                if (SelectedCompetition != null)
                {
                    // create new society object
                    Competition item = SelectedCompetition;
                    await Shell.Current.Navigation.PushAsync(new CompetitionDetailPage(item));
                }
                IsBusy = false;
            });

            AddRoundsCommand = new Command(async() =>
            {
                IsBusy = true;
                if (SelectedCompetition != null)
                {
                    // create new round object
                    Round item         = new Round();
                    item.RoundId       = Guid.NewGuid().ToString();
                    item.CompetitionId = SelectedCompetition.CompetitionId;


                    item.RoundDate = DateTime.Now;
                    await Shell.Current.Navigation.PushAsync(new RoundDetailPage(item));
                }
                IsBusy = false;
            });

            EditRoundsCommand = new Command(async() =>
            {
                IsBusy = true;
                if (SelectedRound != null)
                {
                    // create new round object
                    Round item = SelectedRound;
                    await Shell.Current.Navigation.PushAsync(new RoundDetailPage(item));
                }
                IsBusy = false;
            });

            ResultsCommand = new Command(async() =>
            {
                IsBusy = true;
                if (SelectedCompetition != null)
                {
                    // create new society object
                    Competition item = SelectedCompetition;
                    await Shell.Current.Navigation.PushAsync(new ResultsPage(item));
                }
                IsBusy = false;
            });

            PlayersCommand = new Command(async() =>
            {
                IsBusy = true;
                // create new competition object
                if (SelectedRound != null)
                {
                    await Shell.Current.Navigation.PushAsync(new CompPlayersPage(SelectedRound));
                }
                IsBusy = false;
            });
        }
        public void TestNestingCollectionValidatorWithXMLDescription()
        {     
              const string xml = @"<?xml version='1.0' encoding='UTF-8' ?>
            <objects xmlns='http://www.springframework.net' xmlns:v='http://www.springframework.net/validation'>
              <v:group id='validatePerson' when='T(Spring.Objects.TestObject) == #this.GetType()'>
                <v:required id ='req' when='true' test='Name'/>
                <v:regex id ='reg' test='Name'>
                  <v:property name='Expression' value='[a-z]*\s[a-z]*'/>
                  <v:property name='Options' value='IgnoreCase'/>
                  <v:message id='reg1' providers='regExpr' when='true'>
                     <v:param value='#this.ToString()'/> 
                  </v:message>
                </v:regex>
              </v:group>  
           
              <v:group id='validator'>
                  <v:collection id='collectionValidator' validate-all='true' context='Members' include-element-errors='true'>
                      <v:message id='coll1' providers='membersCollection' when='true'>
                          <v:param value='#this.ToString()'/> 
                      </v:message>
                      <v:ref name='validatePerson'/>
                  </v:collection>     
              </v:group>  
           </objects>";

            MemoryStream stream = new MemoryStream(new UTF8Encoding().GetBytes(xml));
            IResource resource = new InputStreamResource(stream, "collection validator test");

            XmlObjectFactory objectFactory = new XmlObjectFactory(resource, null);                        
                     
            ValidatorGroup validator = (ValidatorGroup) objectFactory.GetObject("validator");
            Society soc = new Society();
                         
            soc.Members.Add(new TestObject("Damjan Tomic", 24));
            soc.Members.Add(new TestObject("Goran Milosavljevic", 24));
            soc.Members.Add(new TestObject("Ivan Cikic", 28));
           
            IValidationErrors err1 = new ValidationErrors();
            
            Assert.IsTrue(validator.Validate(soc, err1));
            
            soc.Members.Add(new TestObject("foo", 30));
            soc.Members.Add(new TestObject("bar", 30));
            Assert.IsFalse(validator.Validate(soc, err1));
             
        }                           
Beispiel #25
0
        public void CreateTest()
        {
            Society gayatriSociety = CreatorCode.Create("Gayatri");

            Assert.IsNotNull(gayatriSociety);
        }
 public Task UpdateSetting(Society society)
 {
     return(_societyRepository.UpdateSetting(society));
 }
 public Task UpdateLoginDetails(Society society)
 {
     return(_societyRepository.UpdateLoginDetails(society));
 }
Beispiel #28
0
    public IEnumerator IGetSocieties(SeachType type, string SeachKeyword, bool isForCheck)
    {
        ScreenAndPopupCall.Instance.LoadingScreen();
        var encoding = new System.Text.UTF8Encoding();

        Dictionary <string, string> postHeader = new Dictionary <string, string> ();
        var jsonElement = new Simple_JSON.JSONClass();

        jsonElement ["data_type"]   = "search";
        jsonElement ["search_type"] = type.ToString();
        jsonElement ["keyword"]     = SeachKeyword;
        jsonElement ["player_id"]   = PlayerPrefs.GetInt("PlayerId").ToString();

        postHeader.Add("Content-Type", "application/json");
        postHeader.Add("Content-Length", jsonElement.Count.ToString());

        WWW www = new WWW(SocietyLink, encoding.GetBytes(jsonElement.ToString()), postHeader);

        print("jsonDtat is ==>> " + jsonElement.ToString());
        yield return(www);

        if (www.error == null)
        {
            JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text);
            print("_jsnode ==>> " + _jsnode.ToString());
            if (_jsnode ["status"].ToString().Contains("400") || _jsnode ["status"].ToString().Contains("200"))
            {
                JSONNode data      = _jsnode ["data"];
                var      Societies = new List <Society> ();
                for (int i = 0; i < data.Count; i++)
                {
                    string name        = data [i] ["society_name"];
                    string description = data [i] ["society_description"];
                    int    emblem      = 0;
                    int.TryParse(data [i] ["emblem_index"], out emblem);
                    int room = 0;
                    int.TryParse(data [i] ["room_index"], out room);
                    int _id = 0;
                    int.TryParse(data [i] ["society_id"], out _id);

                    JSONNode tags       = data [i] ["tags"];
                    var      listofTags = new List <string> ();

                    for (int x = 0; x < tags.Count; x++)
                    {
                        listofTags.Add(tags [x] ["tag_title"]);
                    }

                    Society sc = new Society(name, _id, description, emblem - 1, room - 1, listofTags);
                    Societies.Add(sc);
                }
                switch (type)
                {
                case SeachType.mine:
                    if (Societies.Count > 0)
                    {
                        _mySociety = Societies [0];
                    }
                    else
                    {
                        _mySociety = null;
                    }

                    if (!isForCheck)
                    {
                        CreateSocietyList(Societies, MySocietyContainer);
                        ScreenManager.Instance.SocietyListScreen.transform.FindChild("MySociety").GetComponent <Button> ().interactable = false;
                        if (!GameManager.Instance.gameObject.GetComponent <Tutorial> ()._SocietyCreated)
                        {
                            ScreenManager.Instance.SocietyListScreen.transform.FindChild("MostRecent").GetComponent <Button> ().interactable = false;
                        }
                        else
                        {
                            ScreenManager.Instance.SocietyListScreen.transform.FindChild("MostRecent").GetComponent <Button> ().interactable = true;
                        }
                        IndicationManager.Instance.IncrementIndicationFor("Society", 4);
                    }
                    break;

                case SeachType.recent:
                    CreateSocietyList(Societies, RecentSocietyContainer);
                    ScreenManager.Instance.SocietyListScreen.transform.FindChild("MySociety").GetComponent <Button> ().interactable  = true;
                    ScreenManager.Instance.SocietyListScreen.transform.FindChild("MostRecent").GetComponent <Button> ().interactable = false;
                    break;

                case SeachType.name:
                    CreateSocietyList(Societies, AllSocietyContainer);
                    ScreenManager.Instance.SocietyListScreen.transform.FindChild("MySociety").GetComponent <Button> ().interactable  = true;
                    ScreenManager.Instance.SocietyListScreen.transform.FindChild("MostRecent").GetComponent <Button> ().interactable = true;
                    break;

                case SeachType.tag:
                    CreateSocietyList(Societies, AllSocietyContainer);
                    ScreenManager.Instance.SocietyListScreen.transform.FindChild("MySociety").GetComponent <Button> ().interactable  = true;
                    ScreenManager.Instance.SocietyListScreen.transform.FindChild("MostRecent").GetComponent <Button> ().interactable = true;
                    break;

                default:
                    Debug.LogError("Search type not specified");
                    break;
                }
                yield return(_mySociety);
            }
        }
        ScreenAndPopupCall.Instance.LoadingScreenClose();
    }
Beispiel #29
0
 public void Awake()
 {
     society = GameObject.Find("ExperimentHolder").GetComponent <Society>();
 }
Beispiel #30
0
        private static void Task6()
        {
            Console.WriteLine("Идет генерация рандомных данных...");

            for (int i = 0; i < rnd.Next(100, 1500); i++)
            {
                switch (rnd.Next(0, 3))
                {
                case 0:
                {
                    Creditor c = new Creditor(); c.GenerateRandData();
                    clients.Add(c);
                    break;
                }

                case 1:
                {
                    Society org = new Society(); org.GenerateRandData();
                    clients.Add(org);
                    break;
                }

                case 2:
                {
                    Investor investor = new Investor();
                    investor.GenerateRandData();
                    clients.Add(investor);
                    break;
                }
                }
            }

start:

            int choice = 0;

            Console.WriteLine("1 - Вывести всех\n2 - Поиск по дате");
            int.TryParse(Console.ReadLine(), out choice);
            switch (choice)
            {
            case 1:
            {
                foreach (Client item in clients)
                {
                    item.PrintInfo();
                }
                Console.WriteLine($"Всего : {phonebooks.Count} клиентов");

                Console.WriteLine("Go to Beginning  - w\nExit - any");
                if (Console.ReadLine()?.ToLower() == "w")
                {
                    goto start;
                }
                break;
            }

            case 2:
            {
                Console.WriteLine("Введите дату : ");
                DateTime date;
                DateTime.TryParse(Console.ReadLine(), out date);

                int counter = 0;
                foreach (Client item in clients)
                {
                    if (item.Search(date))
                    {
                        item.PrintInfo();
                        counter++;
                    }
                }

                Console.WriteLine($"Всего : {counter} клиентов, подходящих по дате");

                Console.WriteLine("Go to Beginning  - w\nExit - any");
                if (Console.ReadLine()?.ToLower() == "w")
                {
                    goto start;
                }
                break;
            }
            }
        }
 public bool Update(Society account)
 {
     return(false); // _context.UpdateSociety(account);
 }
Beispiel #32
0
 public Guid Add(Society newEntity)
 {
     throw new NotImplementedException();
 }
Beispiel #33
0
        //// GET api/society/id
        //public Society GetById(string id)
        //{
        //    var society = societyApi.GetById(id);
        //    if (society == null)
        //    {
        //        throw new HttpResponseException(HttpStatusCode.NotFound);
        //    }
        //    return society;
        //}

        // POST api/society/
        public HttpResponseMessage Post(Society society)
        {
            return(Request.CreateResponse <Society>(HttpStatusCode.Created, societyApi.Add(society)));
        }
Beispiel #34
0
 public void GetMyRole(Society society)
 {
     StartCoroutine(IeGetMyRole(society));
 }