async void FillData(Orphan o)
        {
            Family f  = o.OrphanFamily;
            var    hs = House.GetHouseAllByFamilyID(f.FamilyID);

            if (hs != null && hs.Count() > 0)
            {
                f.FamilyHouse = hs.Last();
            }
            else
            {
                f.FamilyHouse = new House();
            }

            if (f.FamilyID.HasValue)
            {
                cOrphanFamily.dgChild.ItemsSource = (from x in FamilyPerson.GetFamilyPersonByFamilyID(f.FamilyID.Value) orderby x.DOB select x).ToList();
            }
            else
            {
                cOrphanFamily.dgChild.ItemsSource = new List <FamilyPerson>();
            }

            cFamilyNeed.FamilyID            = f.FamilyID;
            cExternalFamilySupport.FamilyID = f.FamilyID;
            cSpecialCard.FamilyID           = f.FamilyID;
            cListerGroup.FamilyID           = f.FamilyID;
            cTrainings.FamilyID             = f.FamilyID;

            if (o.OrphanID.HasValue)
            {
                cSponsor.OrphanID = o.OrphanID;
            }
            cOrders.FamilyID = f.FamilyID;
            cOrphanFamily.txtFamilyCode.IsReadOnly = true;
            if (o.OrphanID.HasValue)
            {
                o.Account        = Account.GetAccountByOwnerID(Account.AccountType.Orphan, o.OrphanID.Value);
                cAccount.Account = o.Account;
            }

            Guardian.GetAllGuardianByFamily(f);
            if (f.OrphanNursemaid == null)
            {
                f.OrphanNursemaid = new Guardian()
                {
                    Gender = "أنثى"
                }
            }
            ;
            if (f.OrphanGuardian == null)
            {
                f.OrphanGuardian = new Guardian()
                {
                    Gender = "ذكر"
                }
            }
            ;

            if (!o.OrphanID.HasValue)
            {
                cOrphansAccounts.lvInvoices.ItemsSource = Invoice.GetAllInvoiceByFamilyID(o.OrphanFamily.FamilyID.Value);
            }
            cOrphansAccounts.FamilyID = o.OrphanFamily.FamilyID.Value;

            f.FamilyOrphans = await Orphan.GetAllOrphanByFamily(f, o, true);

            cOrphanFamily.Orphans = f.FamilyOrphans;
        }
Example #2
0
        private void btnGoToFamily_Click(object sender, RoutedEventArgs e)
        {
            var        o = (Orphan)this.DataContext;
            MainWindow m = App.Current.MainWindow as MainWindow;

            m.SendTabItem(new TabItem()
            {
                Header = o.OrphanFamily.FamilyName, Content = new OrphanDetailsControl(Family.GetFamilyByID(o.OrphanFamily.FamilyID.Value))
            });
        }
Example #3
0
        public AddFamilyControlHilal(TempFamily tf)
        {
            InitializeComponent();
            DisableTabs();
            this.tf = tf;

            //Family
            Family f = new Family();

            //f.FamilyCode = tf.FamilyCode;
            f.FamilyName         = tf.FamilyName;
            f.FamilyType         = tf.FamilyType;
            f.ApplyDate          = tf.ApplyDate;
            f.Notes              = tf.Notes;
            f.FamilyPersonCount  = tf.FamilyPersonCount.ToString();
            f.FamilyIdentityID   = tf.FamilyIdentityID;
            f.DefinedPersonPhone = tf.Phone;
            cFamily.DataContext  = f;

            //Father
            f.FamilyFather.FirstName  = tf.FatherFirstName;
            f.FamilyFather.FatherName = tf.FatherFatherName;
            f.FamilyFather.LastName   = tf.FatherLastName;
            f.FamilyFather.DOB        = tf.FatherDOB;
            f.FamilyFather.BirthPlace = tf.FatherBornPlace;
            f.FamilyFather.PID        = tf.FatherPID;
            f.FamilyFather.Phone      = tf.Phone;
            f.FamilyFather.Mobile     = tf.Mobile1;

            //Mother
            f.FamilyMother.FirstName  = tf.MotherFirstName;
            f.FamilyMother.FatherName = tf.MotherFatherName;
            f.FamilyMother.LastName   = tf.MotherLastName;
            f.FamilyMother.DOB        = tf.MotherDOB;
            f.FamilyMother.BirthPlace = tf.MotherBornPlace;
            f.FamilyMother.PID        = tf.MotherPID;
            f.FamilyMother.Phone      = tf.Phone;
            f.FamilyMother.Mobile     = tf.Mobile2;

            //House
            House h = new House();

            h.Phone               = tf.Phone;
            h.HouseSection        = tf.HouseSection;
            h.HouseStreet         = tf.HouseStreet;
            h.Address             = tf.HouseAddress;
            h.OldAddress          = tf.HouseOldAddress;
            h.HouseBuildingNumber = tf.HouseBuildingNumber;
            h.HouseFloor          = tf.HouseFloor;
            f.FamilyHouse         = h;

            List <FamilyPerson> chlds = new List <FamilyPerson>();

            foreach (var c in tf.TempChilds)
            {
                chlds.Add(new FamilyPerson()
                {
                    FirstName = c.Name, DOB = c.DOB, Gender = c.Gender, RelationShip = c.Gender == "ذكر" ? "ابن" : "ابنة"
                });
            }
            cFamily.dgChild.ItemsSource = (from x in chlds orderby x.DOB select x).ToList();

            cFamily.UserControl_Loaded(null, null);

            var sb = cFamily.FindResource("sbShowDetails") as Storyboard;

            if (sb != null)
            {
                sb.Begin(cFamily);
            }
        }