Beispiel #1
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Kids.Clear();
                WebRequest request = WebRequest.Create("http//:kidstracking.azurewebsites.net/api/parent/GetAllKids");
                request.Headers.Add(HttpRequestHeader.Authorization, Xamarin.Essentials.Preferences.Get("token", ""));
                WebResponse      response = request.GetResponse();
                System.IO.Stream stream   = response.GetResponseStream();
                byte[]           data     = new byte[(int)stream.Length];
                stream.Read(data, 0, (int)stream.Length);
                string Json  = System.Text.Encoding.UTF8.GetString(data);
                var    items = Newtonsoft.Json.JsonConvert.DeserializeObject <System.Collections.Generic.IEnumerable <Kid> >(Json);
                foreach (var item in items)
                {
                    Kids.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #2
0
 public void DeadMom()
 {
     if (ManType == PersonType.Mom && ChildrenList.Count > 0)
     {
         foreach (var Kids in ChildrenList)
         {
             Kids.GetComponent <Children>().DeadMommy();
         }
     }
 }
Beispiel #3
0
    public void DeleteFamily()
    {
        //gonna remove it since IsEmptyFamily() doesnt talk abt HomeKey
        //ask abt the amt of family memenrs
        //Home = "";
        State = H.None;

        Kids.Clear();
        _father = "";
        _mother = "";
    }
        public ActionResult Presents(Kids model, FormCollection formcollection)
        {
            // polaczenie
            OracleConnection conn = new OracleConnection();

            conn.ConnectionString = "Data Source=(DESCRIPTION="
                                    + "(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))"
                                    + "(CONNECT_DATA=(SID=xe)));"
                                    + "User Id=hr; Password=hr;";
            conn.Open();
            // Lista modeli obecnosci
            var obecnosci = new List <Obecnosci>();

            var projectName = formcollection["ProjectName"];
            var NazwaKlasy  = projectName.Split(' ');

            PupilsController.ClassName   = NazwaKlasy[0];
            PupilsController.SubjectName = NazwaKlasy[1];
            PupilsController.data        = model.Date;

            string sql = "select u.IDUCZNIA, u.imie, u.nazwisko, o.data, g.IDGODZ, o.obecny, o.IdObec from uczen u " +
                         "join obecnosci o on o.UCZEN_iducznia = u.iducznia " +
                         "join godziny g on g.IDGODZ = o.GODZINY_IDGODZ " +
                         "join przedmiot p on p.IDPRZEDM = o.PRZEDMIOT_IDPRZEDM " +
                         "join klasa k on k.IDKLASY = p.KLASA_IDKLASY " +
                         "join nauczyciel n on n.idnaucz = p.NAUCZYCIEL_IDNAUCZ " +
                         "where p.NAUCZYCIEL_IDNAUCZ =" + Convert.ToInt16(Session["IDZalogowanego"]) + "and o.data = TO_DATE('" + PupilsController.data.ToString("yyyy/MM/dd") + "', 'yyyy/mm/dd') and p.NAZWA ='" + PupilsController.SubjectName + "' and k.NAZWA = '" + PupilsController.ClassName + "'" +
                         "Order by u.iducznia, o.data, g.IDGODZ";

            OracleCommand cmd = new OracleCommand(sql, conn);

            cmd.CommandType = CommandType.Text;
            OracleDataReader dr = cmd.ExecuteReader();

            // wypelnienie modelu obecnosci danymi z bazy
            while (dr.Read())
            {
                obecnosci.Add
                (
                    new Obecnosci
                {
                    IDUcznia     = Convert.ToInt16(dr.GetValue(0)),
                    Imie         = dr.GetString(1),
                    Nazwisko     = dr.GetString(2),
                    Date         = DateTime.Parse(dr.GetOracleDate(3).ToString()),
                    GodzinaZajec = Convert.ToInt16(dr.GetValue(4)),
                    CzyObecny    = dr.GetString(5),
                    IDObecnosci  = Convert.ToInt16(dr.GetValue(6))
                }
                );
            }
            conn.Close();
            return(PartialView(obecnosci));
        }
Beispiel #5
0
 public void RefreshKids()
 {
     if (Kids == null)
     {
         Kids = new ObservableCollection <string>();
     }
     Kids.Clear();
     foreach (var kid in UserProfileService.Instance.CurrentUserProfile.Kids)
     {
         Kids.Add(kid);
     }
 }
Beispiel #6
0
    /// <summary>
    /// Copyng values one by one. to cut refernce
    /// </summary>
    /// <param name="family"></param>
    public Family(Family family)
    {
        KidsMax = family.KidsMax;

        for (int i = 0; i < family.Kids.Count; i++)
        {
            Kids.Add(family.Kids[i]);
        }

        Mother = family.Mother;
        Father = family.Father;
        Home   = family.Home;
        State  = family.State;

        FamilyId = family.FamilyId;
    }
Beispiel #7
0
        internal async Task AddKid(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }
            var item = Kids.FirstOrDefault(i => i == name);

            if (item != null)
            {
                return;
            }
            await UserProfileService.Instance.AddKid(name);

            Kids.Add(name);
            OnPropertyChanged("Kids");
        }
Beispiel #8
0
        public void Kids_tab()
        {
            Kids kid = new Kids();

            System.IO.StreamReader kidfile = new System.IO.StreamReader(@"C:\Users\BlooddSkullKing\source\repos\school\SecretSanta\kids.txt");


            kid.Name  = kidfile.ReadLine();
            kid.Gifts = kidfile.ReadLine();


            kidsbox.Text = kid.Name;
            kgifts.Text  = kid.Gifts;
            int a = kid.Giftnumber(kid.Gifts);

            kgiftnum.Text = a.ToString();
        }
Beispiel #9
0
        private async void OnDelete(object obj)
        {
            string name = obj as string;

            if (string.IsNullOrEmpty(name))
            {
                return;
            }
            var item = Kids.FirstOrDefault(i => i == name);

            if (item != null)
            {
                await UserProfileService.Instance.RemoveKid(name);

                Kids.Remove(item);
                OnPropertyChanged("Kids");
            }
        }
Beispiel #10
0
        public ActionResult Presents(Kids model)
        {
            // polaczenie
            OracleConnection conn = new OracleConnection();

            conn.ConnectionString = "Data Source=(DESCRIPTION="
                                    + "(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))"
                                    + "(CONNECT_DATA=(SID=xe)));"
                                    + "User Id=hr; Password=hr;";
            conn.Open();
            string sql = "select u.imie, u.nazwisko, o.data, g.IDGODZ, o.obecny, p.nazwa, u.iducznia from uczen u " +
                         " join obecnosci o on o.uczen_iducznia = u.IDUCZNIA " +
                         " join godziny g on g.IDGODZ = o.GODZINY_IDGODZ " +
                         " join przedmiot p on p.IDPRZEDM = o.PRZEDMIOT_IDPRZEDM " +
                         " join UCZEN_RODZIC ur on ur.uczen_iducznia = u.IDUCZNIA " +
                         " join RODZIC r on r.idrodzica = ur.RODZIC_IDRODZICA " +
                         " where ur.RODZIC_IDRODZICA = " + Convert.ToInt16(Session["IDZalogowanego"]) + "and o.data = TO_DATE('" + model.Date.ToString("yyyy/MM/dd") + "', 'yyyy/mm/dd') and u.iducznia =" + model.IDDziecka +
                         " Order by u.nazwisko, o.data, g.IDGODZ";
            // lista obecnosci
            var           obecnosci = new List <Obecnosci>();
            OracleCommand cmd       = new OracleCommand(sql, conn);

            cmd.CommandType = CommandType.Text;
            OracleDataReader dr = cmd.ExecuteReader();

            // wypelnianie modelu danymi z bazy
            while (dr.Read())
            {
                obecnosci.Add
                (
                    new Obecnosci
                {
                    Imie         = dr.GetString(0),
                    Nazwisko     = dr.GetString(1),
                    Date         = DateTime.Parse(dr.GetOracleDate(2).ToString()),
                    GodzinaZajec = Convert.ToInt16(dr.GetValue(3)),
                    CzyObecny    = dr.GetString(4),
                    Przedmiot    = dr.GetString(5)
                }
                );
            }
            conn.Close();
            return(PartialView(obecnosci));
        }
Beispiel #11
0
    /// <summary>
    /// Used to move one family booked to the final destination
    ///
    /// Or to remove kid tht reach majority
    ///
    /// Now used too , with person that dies
    /// </summary>
    public void RemovePersonFromFamily(Person personToRemove)
    {
        for (int i = 0; i < Kids.Count; i++)
        {
            if (Kids[i] == personToRemove.MyId)
            {
                Kids.RemoveAt(i);
                return;
            }
        }

        if (_father == personToRemove.MyId)
        {
            _father = "";
        }
        else if (_mother == personToRemove.MyId)
        {
            _mother = "";
        }
    }
Beispiel #12
0
        public ActionResult Ocenki(Kids model)
        {
            // polaczenie
            OracleConnection conn = new OracleConnection();

            conn.ConnectionString = "Data Source=(DESCRIPTION="
                                    + "(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))"
                                    + "(CONNECT_DATA=(SID=xe)));"
                                    + "User Id=hr; Password=hr;";

            conn.Open();
            // lista Ocen
            var grades = new List <Oceny>();

            string sql = "select u.imie, u.nazwisko, o.Ocena, p.nazwa, o.typ from uczen u " +
                         " join oceny o on u.IDUCZNIA = o.UCZEN_IDUCZNIA " +
                         " join przedmiot p on p.IDPRZEDM = o.PRZEDMIOT_IDPRZEDM " +
                         " join klasa k on k.IDKLASY = p.KLASA_IDKLASY " +
                         " join Uczen_rodzic ur on ur.uczen_IDUCZNIA = u.IDUCZNIA " +
                         " join Rodzic r on r.IDRODZICA = ur.RODZIC_IDRODZICA " +
                         " where ur.RODZIC_IDRODZICA =" + Convert.ToInt16(Session["IDZalogowanego"]) + " and u.IDUCZNIA=" + model.IDDziecka +
                         " Order by u.nazwisko, p.nazwa, o.ocena";

            OracleCommand cmd = new OracleCommand(sql, conn);

            cmd.CommandType = CommandType.Text;
            OracleDataReader dr = cmd.ExecuteReader();

            // wypelnianie danych dla wybranego dziecka
            while (dr.Read())
            {
                grades.Add
                (
                    new Oceny {
                    Imie = dr.GetString(0), Nazwisko = dr.GetString(1), Ocena = Convert.ToDouble(dr.GetValue(2)), Przedmiot = dr.GetString(3), Typ = dr.GetString(4)
                }
                );
            }
            conn.Close();
            return(PartialView(grades));
        }
Beispiel #13
0
        /// <summary>
        ///     Migrates the database and sets up items that need to be set up from scratch.
        /// </summary>
        public void Initialize()
        {
            try
            {
                Database.Migrate();

                const int count = 2000;

                List <Thing> things = new List <Thing>();
                if (false == Things.Any())
                {
                    Faker <Thing> faker = new Faker <Thing>().Rules((f, thing) =>
                    {
                        thing.Bar = f.Hacker.Noun();
                        thing.Foo = f.Hacker.Verb();
                    });

                    things = faker.Generate(count).ToList();
                    Things.AddRange(things);
                }

                if (false == Kids.Any())
                {
                    Faker <Child> faker = new Faker <Child>().Rules((f, child) =>
                    {
                        child.Name   = f.Person.FullName;
                        child.Parent = f.PickRandom(things);
                    });
                    Kids.AddRange(faker.Generate(count));
                }

                SaveChanges();
            }
            catch (InvalidOperationException e) when(e.Message ==
                                                     "No service for type 'Microsoft.EntityFrameworkCore.Migrations.IMigrator' has been registered."
                                                     )
            {
                // this exception is expected when using an InMemory database
            }
        }
        public static bool menu_kids(Cart order)
        {
            bool exit = false;

            while (exit == false)
            {
                cart_view(order);

                Console.WriteLine("Kids Menu");
                Console.WriteLine("\n1. Chips\tR10\n2. Sandwhich\tR15\n3. Russians\tR10\n0. Back");
                int  option = int.Parse(Console.ReadLine());
                Kids choice = (Kids)option;
                switch (choice)
                {
                case Kids.Chips:
                    cart_add(order, "Chips", 10);
                    break;

                case Kids.Sandwhich:
                    cart_add(order, "Sandwhich", 15);
                    break;

                case Kids.Russians:
                    cart_add(order, "Russains", 10);
                    break;

                case Kids.Back:
                    exit = true;
                    break;

                default:
                    Console.WriteLine("Invaild entry");
                    Console.ReadKey();
                    break;
                }
            }

            return(exit);
        }
Beispiel #15
0
        /// <summary>
        /// abstract factory pattern is a creational pattern in which interfaces are defined
        /// for creating families of related objects without specifying their actual implementations
        ///
        /// whe using this pattern, you create factories which return many kinds of related objects.
        /// Participants : 1-abstract Factory, 2-Conceret Factory, 3-Abstract Product, 4-Conceret Product, 5-Client [uses abstract factory, and abstract products]
        ///
        /// Example:
        /// lets say we want to model 2 kinsds of recipes: a sandwich and a dessert, and let is make assumption that adults and kids
        /// do not eat the same things, and so we want one of each kind of reecipe for adults and for kids.
        /// AbstractProduct [sandwich, dessert] : abstract class represnts generic kind of recipes.
        /// Abstract Factory : abstract class that will return a Sandwich and a Dessert.
        /// ConcreteProduct  : implementing the actual objects.
        /// ConcreteFactory  : implements the AbstractFactory
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            VechileFactory honda       = new HondaFactory();
            ClientVechile  hondaClient = new ClientVechile(honda, "regular");

            Console.WriteLine("*** Honda ***");
            Console.WriteLine(hondaClient.GetBikeName());
            Console.WriteLine(hondaClient.GetCarName());

            hondaClient = new ClientVechile(honda, "sport");
            Console.WriteLine(hondaClient.GetBikeName());
            Console.WriteLine(hondaClient.GetCarName());


            Console.WriteLine("Who are you? (A)dult or (C)hild?");
            char input = Console.ReadKey().KeyChar;


            Recipe factory;

            switch (input)
            {
            case 'A': factory = new Adult();
                break;

            case 'B': factory = new Kids();
                break;

            default: throw new NotImplementedException();
            }

            var sandwich = factory.CreateSandwich();
            var dessert  = factory.CreateDessert();

            Console.WriteLine("\n sandwich" + sandwich.GetType().Name);
            Console.WriteLine("\n dessert" + dessert.GetType().Name);

            Console.ReadLine();
        }
Beispiel #16
0
    /// <summary>
    /// Addressing kids that are major but never found a house
    ///
    /// Will make the first kid major and head of the house
    /// </summary>
    public void HandleKids()
    {
        if (Adults() > 0)
        {
            return;
        }

        //u will be able to fit only two kids in the family now as adults
        for (int i = 0; i < Kids.Count; i++)
        {
            var kid = FindPerson(Kids[i]);

            if (Adults() == 0)
            {
                Set1stAdult(kid);

                kid.IsMajor = true;
                Kids.Remove(kid.MyId);
                i--;
            }
        }
    }
Beispiel #17
0
        /// <summary>
        /// Akcja generujaca dzieci dla zalogowanego rodzica
        /// </summary>
        /// <returns> zwraca widok dzieci</returns>
        public ActionResult Dzieciaki()
        {
            // polaczenie
            OracleConnection conn = new OracleConnection();

            conn.ConnectionString = "Data Source=(DESCRIPTION="
                                    + "(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))"
                                    + "(CONNECT_DATA=(SID=xe)));"
                                    + "User Id=hr; Password=hr;";

            conn.Open();
            var    model = new Kids();
            string sql   = "select u.iducznia, u.imie || ' ' || u.nazwisko as imieNazwisko from uczen u" +
                           " join Uczen_rodzic ur on ur.uczen_iducznia = u.iducznia" +
                           " join Rodzic r on r.IDRODZICA = ur.RODZIC_IDRODZICA where r.idrodzica =" + Convert.ToInt16(Session["IDZalogowanego"]) +
                           " order by imieNazwisko";
            // Lista dzieci.
            DBList Kids = new DBList();

            model.Dzieci = Kids.GetSelectListItems(sql);
            conn.Close();
            return(PartialView(model));
        }
Beispiel #18
0
        public static void Demo()
        {
            Kids y = Kids.Bathri;
            int  z = (int)y;

            Console.WriteLine($"Kids name: {y}");
            Console.WriteLine($"Kids name as int: {z}");

            Console.WriteLine("Enter a key to get surprised!");
            var x = Console.ReadKey();

            string str = "I don't know the key";

            if (x.KeyChar == ' ')
            {
                str = "Space";
            }
            else if (x.KeyChar == '\t')
            {
                str = "Tab";
            }
            else if (x.KeyChar == '\r' || x.KeyChar == '\n')
            {
                str = "Enter Key";
            }
            else if (x.Key == ConsoleKey.PageUp)
            {
                str = "You are the winner";
            }
            else
            {
                str = x.KeyChar.ToString();
            }

            Console.WriteLine($"The key entered is [{str}]");
        }
Beispiel #19
0
        public override async Task WriteAsync(Stream stream)
        {
            var pdfDictionary = new PdfDictionary();

            pdfDictionary.Items.Clear();
            pdfDictionary.Add(PdfSpec.Names.Type, _type);
            if (MediaBox != null)
            {
                pdfDictionary.Add(PdfSpec.Names.MediaBox, MediaBox);
            }
            if (Kids != null)
            {
                pdfDictionary.Add(PdfSpec.Names.Kids, new PdfArray(Kids.Select(x => (PdfObject)x).ToList()));
                pdfDictionary.Add(PdfSpec.Names.Count, new PdfInteger(Kids.Count));
            }
            if (Resources != null)
            {
                pdfDictionary.Add(PdfSpec.Names.Resources, Resources);
            }

            Value = pdfDictionary;

            await base.WriteAsync(stream);
        }
        /**
         * bind metadata field descriptors to sub-fields of this nested field, with field names as keys,
         * but without mixins field.
         * <p>
         * sub-fields that lack corresponding field descriptors will be removed from this nested field.
         * <p>
         * note that this field no longer uses a boolean flag to prevent multiple invocation. this should
         * have been done by the bindClassDescriptor() method.
         *
         * @param metadataTScope
         *          the translation scope of (generated) metadata classes.
         * @param metadataClassDescriptor
         *          the metadata class descriptor where field descriptors can be found.
         */

        protected void BindMetadataFieldDescriptors(SimplTypesScope metadataTScope,
                                                    MetadataClassDescriptor metadataClassDescriptorToBind)
        {
            bool needCloneKids = false;

            // check if the class's base class is genereic typed, and make sure itself is not generic.
            MetadataClassDescriptor metadataCd = MetadataClassDescriptor;
            MetaMetadata            baseMmd    = TypeMmd;

            while (baseMmd != null && metadataCd != null)
            {
                if (metadataCd.GetGenericTypeVars().Count == 0 && baseMmd.GenericTypeVars != null)
                {
                    needCloneKids = true;
                    break;
                }
                metadataCd = baseMmd.MetadataClassDescriptor;
                baseMmd    = baseMmd.TypeMmd;
            }

            if (needCloneKids)
            {
                DictionaryList <string, MetaMetadataField> clonedKids = new DictionaryList <string, MetaMetadataField>();
                foreach (KeyValuePair <string, MetaMetadataField> entry in Kids)
                {
                    string            key   = entry.Key;
                    MetaMetadataField field = entry.Value;

                    // look up to see if the field is declared in a generic typed class. If not, it does not need to clone it.
                    MetaMetadata declaringMmd = field.DeclaringMmd;
                    if (declaringMmd != null && declaringMmd.GenericTypeVars != null && declaringMmd.IsGenericMetadata)
                    {
                        // clone the field
                        field = field.Clone();
                        // remove the inherited field descriptor
                        field.MetadataFieldDescriptor = null;
                    }
                    clonedKids.Put(key, field);
                }
                Kids = clonedKids;
            }


            // copy the kids collection first to prevent modification to the collection during iteration (which may invalidate the iterator).
            List <MetaMetadataField> fields = new List <MetaMetadataField>(Kids.Values);

            foreach (MetaMetadataField thatChild in fields)
            {
                // look up by field name and bind
                MetadataFieldDescriptor metadataFd = thatChild.BindMetadataFieldDescriptor(metadataTScope, metadataClassDescriptorToBind);
                if (metadataFd == null)
                {
                    Debug.WriteLineIf(BigSemanticsSettings.DebugLevel > 5, "Cannot bind metadata field descriptor for " + thatChild);
                    Kids.Remove(thatChild.Name);
                    continue;
                }

                // set defininig mmdfield

                // process hide and shadows
                var isImage = thatChild is MetaMetadataCompositeField && "image".Equals(((MetaMetadataCompositeField)thatChild).Type);
                HashSet <String> nonDisplayedFieldNames = NonDisplayedFieldNames;
                if (thatChild.Hide && !isImage)
                {
                    nonDisplayedFieldNames.Add(thatChild.Name);
                }
                if (thatChild.Shadows != null)
                {
                    nonDisplayedFieldNames.Add(thatChild.Shadows);
                }

                // recursively process sub-fields
                Int32 fieldType = metadataFd.FdType;
                if (fieldType == FieldTypes.CompositeElement || fieldType == FieldTypes.CollectionElement)
                {
                    // bind class descriptor for nested sub-fields
                    MetaMetadataNestedField nested = (MetaMetadataNestedField)thatChild;
                    MetadataFieldDescriptor fd     = nested.MetadataFieldDescriptor;
                    if (fd.IsPolymorphic)
                    {
                        Debug.WriteLineIf(BigSemanticsSettings.DebugLevel > 5, "Polymorphic field: " + nested + ", not binding an element class descriptor.");
                    }
                    else
                    {
                        MetadataClassDescriptor elementClassDescriptor =
                            ((MetaMetadataNestedField)thatChild).BindMetadataClassDescriptor(metadataTScope);
                        if (elementClassDescriptor != null)
                        {
                            MetaMetadata mmdForThatChild = nested.TypeMmd;
                            if (mmdForThatChild != null && mmdForThatChild.MetadataClassDescriptor == null)
                            {
                                //							mmdForThatChild.setMetadataClassDescriptor(elementClassDescriptor);
                                mmdForThatChild.BindMetadataClassDescriptor(metadataTScope);
                            }
                        }
                        else
                        {
                            Debug.WriteLineIf(BigSemanticsSettings.DebugLevel > 5, "Cannot determine elementClassDescriptor for " + thatChild);
                            Kids.Remove(thatChild.Name);
                        }
                    }
                }

                if (this is MetaMetadata)
                {
                    MetaMetadata mmd       = (MetaMetadata)this;
                    String       naturalId = thatChild.AsNaturalId;
                    if (naturalId != null)
                    {
                        mmd.NaturalIds.Put(naturalId, thatChild);
                    }
                }
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            string rel = "";
            string cID = "";
            string contactno = "";
            int gen = 0;

            if(txtFirstName.Text=="")
            {
                js.showExclamation("Kid's FirstName is required");
                txtFirstName.Focus();
                return;
            }

            if(txtLastName.Text =="")
            {
                js.showExclamation("Kid's LastName is required");
                txtLastName.Focus();
                return;
            }

            if(txtNickName.Text =="")
            {
                js.showExclamation("Kid's NickName is required. It will appear on temporay ID");
                txtNickName.Focus();
                return;
            }

            if (Convert.ToInt32(lblAge.Text) > 12)
            {
                js.showExclamation("Cannot Save age above 12");
                return;
            }

            if(!chkNG.Checked)
            {
                if (txtFirstName2.Text == "")
                {
                    js.showExclamation("Fetcher's FirstName is required");
                    txtFirstName2.Focus();
                    return;
                }

                if (txtLastName2.Text == "")
                {
                    js.showExclamation("Fetcher's LastName is required");
                    txtLastName2.Focus();
                    return;
                }

                if (cboRelationship.Text == "")
                {
                    js.showExclamation("Relationship required");
                    cboRelationship.Focus();
                    return;
                }
                else
                {
                    rel = js.Lookup("fldID", "tblRelationship", "fldRelationship='" + cboRelationship.Text + "'");
                }

                if (txtContactNo.Text == "")
                {
                    js.showExclamation("Contact No. Required");
                    txtContactNo.Focus();
                    return;
                }
                else
                {
                    contactno = txtContactNo.Text;
                    cID = js.Lookup("fldID", "tblContactDetails", "fldContactNumber='" + contactno + "'");
                    cID = SaveUpdateContactDetails(cID, contactno);
                }

                if(!chkNA.Checked)
                {
                    if(txtEmail.Text=="")
                    {
                        js.showExclamation("Email Address Required");
                        txtEmail.Focus();
                        return;
                    }
                }
            }

               if(cboGender.Text =="")
               {
               js.showExclamation("Gender Required");
               cboGender.Focus();
               return;
               }
               else
               {
               gen = Convert.ToInt32(js.Lookup("fldID","tblGender","fldGender='" + cboGender.Text + "'"));
               }

               string query = "SELECT * FROM tblKids WHERE fldLastName='" + txtLastName.Text.Replace("'","''") + "' AND fldBirthday='" + dtBDay.Value.ToShortDateString() + "'";

               js.ExecuteQuery(query);

            if(js.RiD.HasRows)
            {
                js.RiD.Read();
                frmVerifier frm = new frmVerifier();

                frm.Tag = js.RiD["fldStudentID"];
                string id = "" + js.RiD["fldID"];

                if(frm.ShowDialog() == System.Windows.Forms.DialogResult.Yes)
                {
                    this.Tag = id;
                    DialogResult = System.Windows.Forms.DialogResult.Yes;
                    this.Close();
                    return;
                }
            }

            js.CloseConnection();

            Kids kid = new Kids();

            kid.setFirstName(txtFirstName.Text);
            kid.setLastName(txtLastName.Text);
            kid.setNickName(txtNickName.Text);
            kid.setBirthday(dtBDay.Value);
            kid.GetChurchID();
            kid.GenerateStudentID();
            kid.setImage(pbKid.Image);
            kid.setGender(gen);
            kid.setAllergies(txtAllergies.Text);

            string sID = kid.SaveInfo();

            string sql = "UPDATE tblKids SET fldHasVictoryGroup='" + chkVG.Checked + "', fldVGL='" + txtVGL.Text  + "',fldOne2One='" + chkOne2One.Checked + "', fldVW='" + chkVW.Checked + "' WHERE fldID='" + sID + "'";
            js.ExecuteNonQuery(sql);

            sID = kid.SaveInfo(Properties.Settings.Default.Server);
            sql = "UPDATE tblKids SET fldHasVictoryGroup='" + chkVG.Checked + "', fldVGL='" + txtVGL.Text + "',fldOne2One='" + chkOne2One.Checked + "', fldVW='" + chkVW.Checked + "' WHERE fldID='" + sID + "'";
            js.ExecuteNonQuery(sql);

            //string fldPicture = txtFirstName2.Text + txtLastName2.Text + ".jpg";

            //pbFetcher.Image.Save(js.GetPath() + "/Fetchers/" + fldPicture);

            //string q = "INSERT INTO tblFetcher(fldFirstName,fldLastName,fldContactDetails,fldRelationship,fldPicture)" +
            //           " VALUES('" + txtFirstName2.Text + "','" + txtLastName2.Text + "','" + cID + "','" + rel + "','" + fldPicture + "')";

            //js.ExecuteNonQuery(q);

            //Saving Fetcher

            string qq = "UPDATE tblKids SET fldRemarks='" + txtRemarks.Text + "' WHERE fldID='" + sID + "'";
            js.ExecuteNonQuery(qq);

            if(!chkNG.Checked)
            {
                InitialFetcher fetcher = new InitialFetcher();
                fetcher.setFirstName(txtFirstName2.Text);
                fetcher.setLastName(txtLastName2.Text);
                fetcher.setRelationship(Convert.ToInt32(rel));
                fetcher.setContactID(Convert.ToInt32(cID));
                fetcher.setImage(pbFetcher.Image);
                fetcher.setEmail(txtEmail.Text);

                string fID = fetcher.SaveInfo();//js.Lookup("fldID", "tblFetcher", "fldFirstName='" + txtFirstName2.Text + "' AND fldLastName='" + txtLastName2.Text + "'");

                string q = "INSERT INTO tblKidFetcher(fldKidID,fldFetcherID) VALUES('" + sID + "','" + fID + "')";

                js.ExecuteNonQuery(q);
            }

            this.Tag = sID;

            DialogResult = System.Windows.Forms.DialogResult.OK;

            this.Close();
        }