private bool SetContender()
        {
            GlobalVars.ListOfContenders = new List <Contenders.Contender>();
            // for out parameter
            bool isok = true;


            // itirate and add contenders to list
            for (int i = 2; i <= LastRow; i++)
            {
                Contenders.Contender con = new Contenders.Contender();

                con.FirstName                 = GetPureStringField(i, ContenderObj.HeadersDictionary["FirstName"], "שם פרטי", out isok);
                con.LastName                  = GetPureStringField(i, ContenderObj.HeadersDictionary["LastName"], "שם משפחה", out isok);
                con.ID                        = GetMixedString(i, ContenderObj.HeadersDictionary["ID"], "תעודת זהות", out isok);
                con.Email                     = GetPureStringField(i, ContenderObj.HeadersDictionary["Email"], "אימייל", out isok);
                con.PhoneNumber               = GetMixedString(i, ContenderObj.HeadersDictionary["PhoneNumber"], "מספר טלפון", out isok);
                con.DateOfBirth               = GetFieldCanBeNull(i, ContenderObj.HeadersDictionary["DateOfBirth"], "תאריך לידה", out isok);
                con.AgeCategory               = GetAgeCategory(i, ContenderObj.HeadersDictionary["AgeCategory"], "קטגורית גיל", out isok);
                con.IsMale                    = GetGender(i, ContenderObj.HeadersDictionary["IsMale"], "מגדר", out isok);
                con.Weight                    = GetWeight(i, ContenderObj.HeadersDictionary["Weight"], "משקל", out isok);
                con.IsChild                   = IsChild(con.AgeCategory);
                con.WeightCategory            = GetWeightCategory(i, ContenderObj.HeadersDictionary["WeightCategory"], "קטגורית משקל", con.IsChild, out isok);
                con.Belt                      = GetBelt(i, ContenderObj.HeadersDictionary["Belt"], "חגורה", out isok);
                con.AcademyName               = GetFieldCanBeNull(i, ContenderObj.HeadersDictionary["AcademyName"], "אקדמיה", out isok);
                con.AcademyNameNotInCombo     = GetFieldCanBeNull(i, ContenderObj.HeadersDictionary["AcademyNameNotInCombo"], "אקדמיה", out isok);
                con.CoachName                 = GetFieldCanBeNull(i, ContenderObj.HeadersDictionary["CoachName"], "מאמן", out isok);
                con.CoachPhone                = GetFieldCanBeNull(i, ContenderObj.HeadersDictionary["CoachPhone"], "טלפון מאמן", out isok);
                con.IsAllowedWeightGradeAbove = GetBooleanQuestions(i, ContenderObj.HeadersDictionary["IsAllowedWeightGradeAbove"], "אישור דרגת משקל מעל", out isok);
                con.IsAllowedAgeGradeAbove    = GetBooleanQuestions(i, ContenderObj.HeadersDictionary["IsAllowedAgeGradeAbove"], "אישור דרגת גיל מעל", out isok);
                con.IsAllowedBeltGradeAbove   = GetBooleanQuestions(i, ContenderObj.HeadersDictionary["IsAllowedBeltGradeAbove"], "אישור דרגת חגורה מעל", out isok);
                con.IsAllowedVersusMan        = GetBooleanQuestions(i, ContenderObj.HeadersDictionary["IsAllowedVersusMan"], "אישור להתחרות מול בנים", out isok);

                GlobalVars.ListOfContenders.Add(con);
            }

            if (Defects.Count <= 0)
            {
                return(true);
            }
            else
            {
                GlobalVars.ListOfContenders.Clear();
                GlobalVars.ListOfContenders = null;

                string ExDefects = "";
                foreach (string s in Defects)
                {
                    ExDefects += s + Environment.NewLine;
                }
                this.Close(); // close excel file
                Martial_Arts_league_Management2.PromtForm p = new Martial_Arts_league_Management2.PromtForm(ExDefects, true, "התוכנית תפסיק את פעולתה:" + " " + "נדרשים תיקונים לקובץ נתונים", true);
                p.ShowDialog();
                return(false);
            }
        }
 public void AddSingleContender(Contenders.Contender cont)
 {
     ContendersList.Add(cont);
 }
Пример #3
0
        public bool Init2()
        {
            dgvMain.Invoke(new Action(DontAllowUserAddRows));

            if (dgvMain.Rows.Count < 2)
            {
                Helpers.ShowGenericPromtForm("חייבות להיות לפחות 2 שורות ברשימה");
                dgvMain.Invoke(new Action(AllowUserAddRows));
                return(false);
            }
            // check if datagridview has errors
            if (HasErrorText() == true)
            {
                Helpers.ShowGenericPromtForm("השדות ברשימה אינם תקינים, מעבר עם העכבר על הסימון האדום בצד ימין יציג את הנתון החסר");
                dgvMain.Invoke(new Action(AllowUserAddRows));
                return(false);
            }

            // double check (in special cases can be null cell without error text)
            if (IsThereNullCell() == true)
            {
                Helpers.ShowGenericPromtForm("השדות ברשימה אינם תקינים, מעבר עם העכבר על הסימון האדום בצד ימין יציג את הנתון החסר");
                dgvMain.Invoke(new Action(AllowUserAddRows));
                return(false);
            }

            GlobalVars.ListOfContenders = new List <Contenders.Contender>();

            bool isok = true;

            // itirate and add contenders to list
            for (int i = 0; i < dgvMain.Rows.Count; i++)
            {
                Contenders.Contender con = new Contenders.Contender();

                con.FirstName   = dgvMain.Rows[i].Cells[1].Value.ToString();
                con.LastName    = dgvMain.Rows[i].Cells[2].Value.ToString();
                con.ID          = dgvMain.Rows[i].Cells[0].Value.ToString();
                con.Email       = dgvMain.Rows[i].Cells[7].Value.ToString();
                con.PhoneNumber = dgvMain.Rows[i].Cells[8].Value.ToString();
                con.DateOfBirth = "28/10/1980";
                con.AgeCategory = Contenders.ContndersGeneral.AgeGrades[dgvMain.Rows[i].Cells[6].Value.ToString()];
                con.IsMale      = (dgvMain.Rows[i].Cells[12].Value.ToString() == "זכר") ? true : false;
                double r = 0;
                Double.TryParse(dgvMain.Rows[i].Cells[5].Value.ToString(), out r);
                con.Weight  = r;
                con.IsChild = MartialArts.ExcelOperations.IsChild(con.AgeCategory);
                if (con.IsChild)
                {
                    con.WeightCategory = Contenders.ContndersGeneral.ChildWeightCat[dgvMain.Rows[i].Cells[4].Value.ToString()];
                }
                else
                {
                    con.WeightCategory = Contenders.ContndersGeneral.AdultWeightCat[dgvMain.Rows[i].Cells[4].Value.ToString()];
                }

                con.Belt        = Contenders.ContndersGeneral.GetBelt(dgvMain.Rows[i].Cells[3].Value.ToString());
                con.AcademyName = dgvMain.Rows[i].Cells[9].Value.ToString();
                con.CoachName   = dgvMain.Rows[i].Cells[10].Value.ToString();
                con.CoachPhone  = dgvMain.Rows[i].Cells[11].Value.ToString();
                con.IsAllowedWeightGradeAbove = Convert.ToBoolean(dgvMain.Rows[i].Cells[16].Value);
                con.IsAllowedAgeGradeAbove    = Convert.ToBoolean(dgvMain.Rows[i].Cells[14].Value);
                con.IsAllowedBeltGradeAbove   = Convert.ToBoolean(dgvMain.Rows[i].Cells[15].Value);
                con.IsAllowedVersusMan        = Convert.ToBoolean(dgvMain.Rows[i].Cells[13].Value);
                GlobalVars.ListOfContenders.Add(con);
            }

            dgvMain.Invoke(new Action(AllowUserAddRows));
            return(true);
        }
Пример #4
0
 public VisualContender(Contenders.Contender contender)
 {
     this.Contender = contender;
     // init belt shapes object
     BeltShapes = GetBeltShades((Contenders.ContndersGeneral.BeltsEnum)contender.Belt);
 }
Пример #5
0
        public bool Init()
        {
            dgvMain.Invoke(new Action(DontAllowUserAddRows));

            if (dgvMain.Rows.Count < 2)
            {
                Helpers.ShowGenericPromtForm("חייבות להיות לפחות 2 שורות ברשימה");
                dgvMain.Invoke(new Action(AllowUserAddRows));
                return(false);
            }

            //// check if datagridview has errors
            //if (HasErrorText() == true)
            //{
            //    Helpers.ShowGenericPromtForm("השדות ברשימה אינם תקינים, מעבר עם העכבר על הסימון האדום בצד ימין יציג את הנתון החסר");
            //    dgvMain.Invoke(new Action(AllowUserAddRows));
            //    return false;
            //}

            //// double check (in special cases can be null cell without error text)
            //if (IsThereNullCell() == true)
            //{
            //    Helpers.ShowGenericPromtForm("השדות ברשימה אינם תקינים, מעבר עם העכבר על הסימון האדום בצד ימין יציג את הנתון החסר");
            //    dgvMain.Invoke(new Action(AllowUserAddRows));
            //    return false;
            //}

            GlobalVars.ListOfContenders = new List <Contenders.Contender>();

            bool isok = true;

            // itirate and add contenders to list
            for (int i = 0; i < dgvMain.Rows.Count; i++)
            {
                Contenders.Contender con = new Contenders.Contender();

                con.FirstName                 = GetPureStringField(dgvMain.Rows[i].Cells[1].Value, "שם פרטי", out isok, i);
                con.LastName                  = GetPureStringField(dgvMain.Rows[i].Cells[2].Value, "שם משפחה", out isok, i);
                con.ID                        = GetMixedString(dgvMain.Rows[i].Cells[0].Value, "תעודת זהות", out isok, i);
                con.Email                     = GetPureStringField(dgvMain.Rows[i].Cells[7].Value, "אימייל", out isok, i);
                con.PhoneNumber               = GetMixedString(dgvMain.Rows[i].Cells[8].Value, "מספר טלפון", out isok, i);
                con.DateOfBirth               = "28/10/1980";
                con.AgeCategory               = GetAgeCategory(dgvMain.Rows[i].Cells[6].Value, "קטגורית גיל", out isok, i);
                con.IsMale                    = GetGender(dgvMain.Rows[i].Cells[12].Value, "מגדר", out isok, i);
                con.Weight                    = GetWeight(dgvMain.Rows[i].Cells[5].Value, "משקל", out isok, i);
                con.IsChild                   = MartialArts.ExcelOperations.IsChild(con.AgeCategory);
                con.WeightCategory            = GetWeightCategory(dgvMain.Rows[i].Cells[4].Value, "קטגורית משקל", con.IsChild, out isok, i);
                con.Belt                      = GetBelt(dgvMain.Rows[i].Cells[3].Value, "חגורה", out isok, i);
                con.AcademyName               = GetFieldCanBeNull(dgvMain.Rows[i].Cells[9].Value, "אקדמיה", out isok);
                con.CoachName                 = GetFieldCanBeNull(dgvMain.Rows[i].Cells[10].Value, "מאמן", out isok);
                con.CoachPhone                = GetFieldCanBeNull(dgvMain.Rows[i].Cells[11].Value, "טלפון מאמן", out isok);
                con.IsAllowedWeightGradeAbove = Convert.ToBoolean(dgvMain.Rows[i].Cells[16].Value);
                con.IsAllowedAgeGradeAbove    = Convert.ToBoolean(dgvMain.Rows[i].Cells[14].Value);
                con.IsAllowedBeltGradeAbove   = Convert.ToBoolean(dgvMain.Rows[i].Cells[15].Value);
                con.IsAllowedVersusMan        = Convert.ToBoolean(dgvMain.Rows[i].Cells[13].Value);
                GlobalVars.ListOfContenders.Add(con);
            }



            if (Defects.Count <= 0)
            {
                return(true);
            }
            else
            {
                dgvMain.Invoke(new Action(AllowUserAddRows)); // in order to make changes
                GlobalVars.ListOfContenders.Clear();
                GlobalVars.ListOfContenders = null;
                string ExDefects = "";
                foreach (string s in Defects)
                {
                    ExDefects += s + Environment.NewLine;
                }

                Martial_Arts_league_Management2.PromtForm p = new Martial_Arts_league_Management2.PromtForm(ExDefects, true, "התוכנית תפסיק את פעולתה:" + " " + "נדרשים תיקונים לקובץ נתונים", true);
                p.ShowDialog();
                return(false);
            }
        }