Beispiel #1
0
        private void ComboxLocality_SelectedIndexChanged(object sender, EventArgs e)
        {
            UInt32 LocalityID_UL = 0;

            ComboxLocality.GetSelectedItemID(out LocalityID_UL);

            if (LocalityID_UL > 0)
            {
                ComboxPostalCode.SelectItemByID(LocalityID_UL);
            }

            ValueChanged(this, EventArgs.Empty);
        }
Beispiel #2
0
        private void MemberClick(UInt32 MemberID_UL)
        {
            // Load client info in each control
            String        SQLRequest_ST;
            SqlDataReader SqlDataReader_O;
            UInt32        CPID_UL         = 0;
            UInt32        PersStatusID_UL = 0;

            mInitializingData_b = true;

            TxtTel.Clear();
            DTPBirthdate.Value = DTPBirthdate.MinDate;
            DTPEntryDate.Value = DTPEntryDate.MinDate;

            TxtCost.Clear();
            TxtBankAccount.Clear();
            TxtRegNumber.Clear();
            TxtChilds.Clear();
            TxtAdress.Clear();
            ComBoxFamilyState.SelectedItem = null;
            CheckBoxActivePartner.Checked  = false;
            DBComboxStatus.ClearSelectedItem();
            ComboxPostalCode.ClearSelectedItem();
            ComboxLocality.ClearSelectedItem();
            LblMemberName.Text            = "";
            CheckBoxActivePartner.Checked = false;
            DepartmentSelector.Clear();
            MemberDayChickingViewer.ChangePers(0, true);
            TxtLogin.Clear();

            bool ActivePartner_b = false;

            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                // Fill fields of member
                SQLRequest_ST   = "SELECT * FROM Pers WHERE PersID=" + MemberID_UL;
                SqlDataReader_O = mDBManager_O.Select(SQLRequest_ST);

                while (SqlDataReader_O.Read())
                {
                    bool.TryParse(SqlDataReader_O["ConjActif"].ToString(), out ActivePartner_b);

                    // Fill info in panel edit controls
                    TxtTel.Text = SqlDataReader_O["NumTel"].ToString();
                    try
                    {
                        DTPBirthdate.Value = Convert.ToDateTime(SqlDataReader_O["DateNaissance"].ToString());
                    }
                    catch (FormatException e)
                    {
                        DTPBirthdate.Value = DTPBirthdate.MinDate;
                    }

                    try
                    {
                        DTPEntryDate.Value = Convert.ToDateTime(SqlDataReader_O["DateEntreeService"].ToString());
                    }
                    catch (FormatException e)
                    {
                        DTPEntryDate.Value = DTPEntryDate.MinDate;
                    }

                    TxtCost.Text           = SqlDataReader_O["CoutHeure"].ToString() + "\u20AC";
                    TxtBankAccount.Text    = SqlDataReader_O["CompteBanq"].ToString();
                    TxtRegNumber.Text      = SqlDataReader_O["NumRegNat"].ToString();
                    TxtChilds.Text         = SqlDataReader_O["NbrEnfCharge"].ToString();
                    TxtAdress.Text         = SqlDataReader_O["Adresse"].ToString();
                    ComBoxFamilyState.Text = SqlDataReader_O["SitFam"].ToString();
                    TxtLogin.Text          = SqlDataReader_O["UserLogin"].ToString();

                    CheckBoxActivePartner.Checked = ActivePartner_b;

                    if (UInt32.TryParse(SqlDataReader_O["PersStatutID"].ToString(), out PersStatusID_UL))
                    {
                        DBComboxStatus.SelectItemByID(PersStatusID_UL);
                    }
                    if (UInt32.TryParse(SqlDataReader_O["CodePostalID"].ToString(), out CPID_UL))
                    {
                        ComboxPostalCode.SelectItemByID(CPID_UL);
                        ComboxLocality.SelectItemByID(CPID_UL);
                    }
                    else
                    {
                        ComboxPostalCode.ClearSelectedItem();
                        ComboxLocality.ClearSelectedItem();
                    }

                    // Fill info in panel check controls
                    LblMemberName.Text = SqlDataReader_O["PersNom"].ToString();

                    CheckBoxActivePartner.Checked = ActivePartner_b;

                    // Refresh checking recap
                    //int NbDays = DateTime.Today.DayOfWeek - DayOfWeek.Monday;
                    if (!String.IsNullOrEmpty(SqlDataReader_O["PersNom"].ToString()))
                    {
                        MemberDayChickingViewer.ChangePers(MemberID_UL, true);
                    }
                }

                SqlDataReader_O.Close();

                // Fill associated departments
                SQLRequest_ST   = "SELECT DepID FROM RelDepPers WHERE PersID=" + MemberID_UL;
                SqlDataReader_O = mDBManager_O.Select(SQLRequest_ST);
                List <UInt32> DepID_UL = new List <UInt32>();
                UInt32        ID_UL;

                while (SqlDataReader_O.Read())
                {
                    if (UInt32.TryParse(SqlDataReader_O["DepID"].ToString(), out ID_UL))
                    {
                        DepID_UL.Add(ID_UL);
                    }
                }

                DepartmentSelector.CheckDepartments(DepID_UL);

                SqlDataReader_O.Close();
            }

            mInitializingData_b = false;
        }