Exemplo n.º 1
0
        private void UpdateMsgTimer_Tick(object sender, EventArgs e)
        {
            SqlDataReader SqlDataReader_O;
            String        SqlRequest_st = "SELECT MAX(MsgID) FROM Msg";
            UInt32        DBMaxID_UL, ListMaxID_UL;

            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                SqlDataReader_O = mDBManager_O.Select(SqlRequest_st);

                while (SqlDataReader_O.Read())
                {
                    if (UInt32.TryParse(SqlDataReader_O[0].ToString(), out DBMaxID_UL))
                    {
                        ListMaxID_UL = DBListViewMsg.GetMaxID();

                        if (ListMaxID_UL < DBMaxID_UL)
                        {
                            DBListViewMsg.Refresh();
                            NewMessage();
                        }
                        else if (ListMaxID_UL != DBMaxID_UL)
                        {
                            DBListViewMsg.Refresh();
                        }
                    }
                    else
                    {
                        DBListViewMsg.Refresh();
                    }
                }

                SqlDataReader_O.Close();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method that initialize the user control (it display some lines with a slected department)
        /// </summary>
        public void Initialize(DatabaseManager DBManager_O, List <UInt32> SelectedItem_UL = null)
        {
            mDBManager_O = DBManager_O;

            SqlDataReader SqlDataReader_O;
            String        SQLRequest_O;

            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                SQLRequest_O    = "SELECT * FROM TypeDep";
                SqlDataReader_O = mDBManager_O.Select(SQLRequest_O);

                while (SqlDataReader_O.Read())
                {
                    UInt32 DepID_UL;

                    if (UInt32.TryParse(SqlDataReader_O["TypeDepID"].ToString(), out DepID_UL))
                    {
                        CheckBox Checkbox_O = new CheckBox();
                        Checkbox_O.AutoSize        = true;
                        Checkbox_O.Text            = SqlDataReader_O["TypeDepLib"].ToString();
                        Checkbox_O.Tag             = DepID_UL;
                        Checkbox_O.Checked         = (SelectedItem_UL != null && SelectedItem_UL.Contains(DepID_UL));
                        Checkbox_O.CheckedChanged += new EventHandler(this.DepartmentCheckedChanged);
                        FlowLayoutPanel.Controls.Add(Checkbox_O);
                        mDepartmentCheckbox_O.Add(Checkbox_O);
                    }
                }

                SqlDataReader_O.Close();
            }
        }
Exemplo n.º 3
0
        private void Refresh()
        {
            String        SQLRequest_ST;
            SqlDataReader SqlDataReader_O;

            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                MainFlowLayoutPanel.Controls.Clear();

                SQLRequest_ST = "SELECT ComJobID FROM ComJobSelectPop WHERE " + mWhereFilter_ST + " ORDER BY NumRefInterne";

                SqlDataReader_O = mDBManager_O.Select(SQLRequest_ST);

                while (SqlDataReader_O.Read())
                {
                    UInt32 ComJobID_UL;

                    if (UInt32.TryParse(SqlDataReader_O["ComJobID"].ToString(), out ComJobID_UL))
                    {
                        JobLifeCycle JobLifeCycle_O = new JobLifeCycle(mDBManager_O, ComJobID_UL);
                        MainFlowLayoutPanel.Controls.Add(JobLifeCycle_O);
                        JobLifeCycle_O.Width = MainFlowLayoutPanel.Width - MainFlowLayoutPanel.Padding.Left - MainFlowLayoutPanel.Padding.Right - 25;
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void InitializeInfos()
        {
            String        SQLRequest_ST;
            SqlDataReader SqlDataReader_O;
            int           HoursCorrectd_i; // should be bool but represented by int in DB where false == 0, otherwise true

            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                SQLRequest_ST = "SELECT ClientNom, NumRefInterne, NumOrdre, JobLib, HTravEstim, SommeHeureCorrect, ChkHoursCorrected, SommeHeuresTot FROM ComJobSelectPop WHERE ComJobID=" + mComJobID_UL;

                SqlDataReader_O = mDBManager_O.Select(SQLRequest_ST);

                while (SqlDataReader_O.Read())
                {
                    ToolStripLblClient.Text            = SqlDataReader_O["ClientNom"].ToString();
                    ToolStripLblRefNumber.Text         = SqlDataReader_O["NumRefInterne"].ToString();
                    ToolStripLblJobNb.Text             = SqlDataReader_O["NumOrdre"].ToString();
                    ToolStripLblJobLib.Text            = SqlDataReader_O["JobLib"].ToString();
                    ToolStripLblHEstim.Text            = SqlDataReader_O["HTravEstim"].ToString();
                    ToolStripLblSumHours.Text          = SqlDataReader_O["SommeHeuresTot"].ToString();
                    ToolStripLblSumHoursCorrected.Text = SqlDataReader_O["SommeHeureCorrect"].ToString();

                    if (int.TryParse(SqlDataReader_O["ChkHoursCorrected"].ToString(), out HoursCorrectd_i) && HoursCorrectd_i == 0)
                    {
                        ToolStripLblSumHoursCorrected.ForeColor = Color.Green;
                    }
                    else
                    {
                        ToolStripLblSumHoursCorrected.ForeColor = Color.Gray;
                    }
                }
            }
        }
Exemplo n.º 5
0
        public void FillList(DatabaseManager DBManager_O, String TableName_ST, String DBFieldID_ST, String DBField_ST, String Where_ST = "")
        {
            SqlDataReader  SqlDataReader_O;
            DBComboBoxItem DBListBoxItem_O;
            String         SQLRequest_ST;
            UInt32         ID_UL    = 0;
            String         Field_ST = "";

            if (DBManager_O != null && DBManager_O.mConnected_b && !String.IsNullOrEmpty(TableName_ST) && !String.IsNullOrEmpty(DBFieldID_ST) && !String.IsNullOrEmpty(DBField_ST))
            {
                this.Items.Clear();
                this.Text = null;

                SQLRequest_ST = "SELECT " + DBFieldID_ST + ", " + DBField_ST + " FROM " + TableName_ST;

                if (!String.IsNullOrEmpty(Where_ST))
                {
                    SQLRequest_ST += " WHERE " + Where_ST;
                }

                SqlDataReader_O = DBManager_O.Select(SQLRequest_ST);

                while (SqlDataReader_O.Read())
                {
                    UInt32.TryParse(SqlDataReader_O[DBFieldID_ST].ToString(), out ID_UL);
                    Field_ST = SqlDataReader_O[DBField_ST].ToString();

                    DBListBoxItem_O = new DBComboBoxItem(ID_UL, Field_ST);

                    this.Items.Add(DBListBoxItem_O);
                }

                SqlDataReader_O.Close();
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Method that check if the current build correspond to the version in the database. If they not match a pop-up inform the user that he is not up to date
        /// </summary>
        public void CheckProgramVersion()
        {
            String        SqlRequest_st;
            SqlDataReader SqlDataReader_O;

            Version Version_O = Assembly.GetEntryAssembly().GetName().Version;

            int Major_i, Minor_i, Build_i;

            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                SqlRequest_st = "SELECT * FROM Version";

                SqlDataReader_O = mDBManager_O.Select(SqlRequest_st);

                while (SqlDataReader_O.Read())
                {
                    Major_i = Convert.ToInt32(SqlDataReader_O["Major"].ToString());
                    Minor_i = Convert.ToInt32(SqlDataReader_O["Minor"].ToString());
                    Build_i = Convert.ToInt32(SqlDataReader_O["Build"].ToString());

                    if (Major_i != Version_O.Major || Minor_i != Version_O.Minor || Build_i != Version_O.Build)
                    {
                        MessageBox.Show("Vous ne possédez pas la dernière version de MMSoft.\nVersion installée : " + Version_O.Major + "." + Version_O.Minor +
                                        "\nVersion serveur : " + Major_i + "." + Minor_i + "." + Build_i, "Attention !", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
Exemplo n.º 7
0
        private void InitializeInfos()
        {
            String        SQLRequest_ST;
            SqlDataReader SqlDataReader_O;

            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                SQLRequest_ST = "SELECT ClientNom, NumRefInterne, NumOrdre, JobLib, Qte, CoutEstim, QteProd, QteFact, PVFact FROM ComJobSelectPop WHERE ComJobID=" + mComJobID_UL;

                SqlDataReader_O = mDBManager_O.Select(SQLRequest_ST);

                while (SqlDataReader_O.Read())
                {
                    ToolStripLblClient.Text     = SqlDataReader_O["ClientNom"].ToString();
                    ToolStripLblRefNumber.Text  = SqlDataReader_O["NumRefInterne"].ToString();
                    ToolStripLblJobNb.Text      = SqlDataReader_O["NumOrdre"].ToString();
                    ToolStripLblJobLib.Text     = SqlDataReader_O["JobLib"].ToString();
                    ToolStripLblQte.Text        = SqlDataReader_O["Qte"].ToString();
                    ToolStripLblPUEst.Text      = SqlDataReader_O["CoutEstim"].ToString();
                    ToolStripLblQteProd.Text    = SqlDataReader_O["QteProd"].ToString();
                    ToolStripTxtboxQteFact.Text = SqlDataReader_O["QteFact"].ToString();
                    ToolStripTxtboxPUFact.Text  = SqlDataReader_O["PVFact"].ToString();
                }
            }
        }
Exemplo n.º 8
0
        public void RefreshJobs()
        {
            // TODO : this method may take a little time and optimization by refreshing only selected job could be considered
            SqlDataReader SqlDataReader_O;
            ListViewItem  ListViewItem_O;
            String        SQLRequest_O;

            // Clear list before continuing, otherwise list will only grow with new items
            CustomComJobListView.Items.Clear();

            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                SQLRequest_O = "Select ";

                for (int i = 0; i < mColumnDBField_O.Count; i++)
                {
                    SQLRequest_O += mColumnDBField_O[i];

                    if (i != mColumnDBField_O.Count - 1)
                    {
                        SQLRequest_O += ",";
                    }
                }

                SQLRequest_O += " from ComJobSelectPop " + BuildWhereStatement() + " " + BuildOrderByStatement();

                SqlDataReader_O    = mDBManager_O.Select(SQLRequest_O);
                mLastSQLRequest_st = SQLRequest_O;

                while (SqlDataReader_O.Read())
                {
                    ListViewItem_O = new ListViewItem();
                    ListViewItem_O.SubItems[0].Text = SqlDataReader_O[mColumnDBField_O[0]].ToString();

                    for (int i = 1; i < mColumnDBField_O.Count; i++)
                    {
                        if ((i == 8 || i == 10) && SqlDataReader_O[mColumnDBField_O[i]].ToString().Length > 10)
                        {
                            ListViewItem_O.SubItems.Add(SqlDataReader_O[mColumnDBField_O[i]].ToString().Substring(0, 10));
                        }
                        else
                        {
                            ListViewItem_O.SubItems.Add(SqlDataReader_O[mColumnDBField_O[i]].ToString());
                        }
                    }

                    CustomComJobListView.Items.Add(ListViewItem_O);
                }

                SqlDataReader_O.Close();
            }
        }
Exemplo n.º 9
0
        private void ComClick(UInt32 ComID_UL)
        {
            // Load client info in each control
            String        SQLRequest_ST;
            SqlDataReader SqlDataReader_O;

            int RappConf_i = 0, NoteEnvoi_i = 0, Certif_i = 0;

            mInitializingComData_b = true;

            ClearComInfo();
            if (ComJobSelector.GetJobListView().GetSelectedItemID() == 0)
            {
                ClearJobInfo();
            }

            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                SQLRequest_ST   = "SELECT * FROM ComSelectPop WHERE ComID=" + ComID_UL;
                SqlDataReader_O = mDBManager_O.Select(SQLRequest_ST);

                while (SqlDataReader_O.Read())
                {
                    int.TryParse(SqlDataReader_O["RappConf"].ToString(), out RappConf_i);
                    int.TryParse(SqlDataReader_O["NoteEnvoi"].ToString(), out NoteEnvoi_i);
                    int.TryParse(SqlDataReader_O["Certif"].ToString(), out Certif_i);

                    // Fill info in panel edit controls
                    TxtComNumber.Text = SqlDataReader_O["NumRefInterne"].ToString();
                    TxtClient.Text    = SqlDataReader_O["ClientNom"].ToString();
                    try
                    {
                        DTPComDate.Value = Convert.ToDateTime(SqlDataReader_O["ComDate"].ToString());
                    }
                    catch (FormatException e)
                    {
                        DTPComDate.Value = DTPComDate.MinDate;
                    }
                    TxtNumComClient.Text = SqlDataReader_O["NumCmdClient"].ToString();
                    TxtComLib.Text       = SqlDataReader_O["LibelleCmd"].ToString();
                    TxtComInfos.Text     = SqlDataReader_O["Info"].ToString();

                    CheckBoxRappConf.Checked = RappConf_i != 0 ? true : false;
                    CheckBoxNE.Checked       = NoteEnvoi_i != 0 ? true : false;
                    CheckBoxCertif.Checked   = Certif_i != 0 ? true : false;
                }

                SqlDataReader_O.Close();
            }

            mInitializingComData_b = false;
        }
Exemplo n.º 10
0
        public void Refresh()
        {
            // TODO : this method may take a little time and optimization by refreshing only selected job could be considered
            SqlDataReader SqlDataReader_O;
            ListViewItem  ListViewItem_O;
            String        SQLRequest_O;

            // Clear list before continuing, otherwise list will only grow with new items
            mListView_O.Items.Clear();

            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                SQLRequest_O = "SELECT ";

                for (int i = 0; i < mTableFields_ST.Count; i++)
                {
                    SQLRequest_O += mTableFields_ST[i];

                    if (i != mTableFields_ST.Count - 1)
                    {
                        SQLRequest_O += ",";
                    }
                }

                SQLRequest_O += " FROM " + mTableName_ST;

                if (!String.IsNullOrEmpty(mInitialWhere_ST))
                {
                    SQLRequest_O += " WHERE " + mInitialWhere_ST;
                }

                SQLRequest_O += " " + BuildWhereFromFilter();
                SQLRequest_O += " " + BuildOrderByFromFilter();

                SqlDataReader_O    = mDBManager_O.Select(SQLRequest_O);
                mLastSQLRequest_st = SQLRequest_O;

                if (SqlDataReader_O != null)
                {
                    while (SqlDataReader_O.Read())
                    {
                        ListViewItem_O = new ListViewItem();
                        ListViewItem_O.SubItems[0].Text = SqlDataReader_O[mTableFields_ST[0]].ToString();
                        ListViewItem_O.SubItems[0].Name = mTableFields_ST[0];

                        for (int i = 1; i < mTableFields_ST.Count; i++)
                        {
                            // If type of data is date, take only 10 first char to avoid time
                            if ((SqlDataReader_O.GetFieldType(SqlDataReader_O.GetOrdinal(mTableFields_ST[i])) == typeof(DateTime)) &&
                                !String.IsNullOrEmpty(SqlDataReader_O[mTableFields_ST[i]].ToString()))
                            {
                                DateTime Date_O = Convert.ToDateTime(SqlDataReader_O[mTableFields_ST[i]].ToString());
                                ListViewItem_O.SubItems.Add(Date_O.ToShortDateString());
                            }
                            else
                            {
                                ListViewItem_O.SubItems.Add(SqlDataReader_O[mTableFields_ST[i]].ToString());
                            }

                            ListViewItem_O.SubItems[i].Name = mTableFields_ST[i];
                        }

                        mListView_O.Items.Add(ListViewItem_O);
                    }

                    SqlDataReader_O.Close();

                    if (ListRefreshed != null)
                    {
                        ListRefreshed();
                    }
                }
            }

            if (mListView_O.Items.Count > 0)
            {
                SelectFirst();
            }
            else
            {
                // Throw event as if non existing item with ID 0 was selected, such that UC can understand that no item is selected
                // because .net do not fires selected index changed when nothing is selected
                if (SelectionChanged != null)
                {
                    SelectionChanged(0);
                }
            }
        }
Exemplo n.º 11
0
        public void LoadChecking()
        {
            String        SQLRequest_ST;
            SqlDataReader SqlDataReader_O;
            UInt32        PointageMachine_UL = 1;
            UInt32        TaskID_UL          = 0;
            UInt32        MachineID_UL       = 0;
            UInt32        HallID_UL          = 0;
            UInt32        DepID_UL           = 0;

            if (mDataBaseManager_O != null && mDataBaseManager_O.mConnected_b)
            {
                // Fill pointage info
                SQLRequest_ST   = "SELECT * FROM Pointage WHERE ComJobEtapeID=" + mComJobEtapeID_UL;
                SqlDataReader_O = mDataBaseManager_O.Select(SQLRequest_ST);

                while (SqlDataReader_O.Read())
                {
                    // Select Task
                    if (UInt32.TryParse(mDataBaseManager_O.GetTableField("ComJobEtape", "TypeTacheID", "ComJobEtapeID=" + mComJobEtapeID_UL), out TaskID_UL))
                    {
                        if (UInt32.TryParse(mDataBaseManager_O.GetTableField("TypeTache", "TypeDepID", "TypeTacheID=" + TaskID_UL), out DepID_UL))
                        {
                            DBComboxDep.SelectItemByID(DepID_UL);
                            DBComboxTask.SelectItemByID(TaskID_UL);
                        }
                    }
                    // Fill NbrH field
                    TxtNbrH.Text = SqlDataReader_O["NbrH"].ToString();
                    // Fill Rem field
                    TxtRem.Text = SqlDataReader_O["Rem"].ToString();
                }

                SqlDataReader_O.Close();

                // Fill pointage machine info
                SQLRequest_ST   = "SELECT * FROM PointageMachine WHERE ComJobEtapeID=" + mComJobEtapeID_UL;
                SqlDataReader_O = mDataBaseManager_O.Select(SQLRequest_ST);

                while (SqlDataReader_O.Read())
                {
                    if (PointageMachine_UL >= 1 && PointageMachine_UL <= 4)
                    {
                        UInt32.TryParse(SqlDataReader_O["PointageMachinelID"].ToString(), out mPointageMachineID_O[PointageMachine_UL - 1]);
                    }

                    if (PointageMachine_UL == 1)
                    {
                        if (UInt32.TryParse(SqlDataReader_O["MachineID"].ToString(), out MachineID_UL))
                        {
                            if (UInt32.TryParse(mDataBaseManager_O.GetTableField("Machine", "HallID", "MachineID=" + MachineID_UL), out HallID_UL))
                            {
                                DBComboxHall1.SelectItemByID(HallID_UL);
                                DBComboxMachine1.SelectItemByID(MachineID_UL);
                            }
                        }
                        TxtNbrhMach1.Text = SqlDataReader_O["NbrHMachine"].ToString();
                    }
                    else if (PointageMachine_UL == 2)
                    {
                        if (UInt32.TryParse(SqlDataReader_O["MachineID"].ToString(), out MachineID_UL))
                        {
                            if (UInt32.TryParse(mDataBaseManager_O.GetTableField("Machine", "HallID", "MachineID=" + MachineID_UL), out HallID_UL))
                            {
                                DBComboxHall2.SelectItemByID(HallID_UL);
                                DBComboxMachine2.SelectItemByID(MachineID_UL);
                            }
                        }
                        TxtNbrhMach2.Text = SqlDataReader_O["NbrHMachine"].ToString();
                    }
                    else if (PointageMachine_UL == 3)
                    {
                        if (UInt32.TryParse(SqlDataReader_O["MachineID"].ToString(), out MachineID_UL))
                        {
                            if (UInt32.TryParse(mDataBaseManager_O.GetTableField("Machine", "HallID", "MachineID=" + MachineID_UL), out HallID_UL))
                            {
                                DBComboxHall3.SelectItemByID(HallID_UL);
                                DBComboxMachine3.SelectItemByID(MachineID_UL);
                            }
                        }
                        TxtNbrhMach3.Text = SqlDataReader_O["NbrHMachine"].ToString();
                    }
                    else if (PointageMachine_UL == 4)
                    {
                        if (UInt32.TryParse(SqlDataReader_O["MachineID"].ToString(), out MachineID_UL))
                        {
                            if (UInt32.TryParse(mDataBaseManager_O.GetTableField("Machine", "HallID", "MachineID=" + MachineID_UL), out HallID_UL))
                            {
                                DBComboxHall4.SelectItemByID(HallID_UL);
                                DBComboxMachine4.SelectItemByID(MachineID_UL);
                            }
                        }
                        TxtNbrhMach4.Text = SqlDataReader_O["NbrHMachine"].ToString();
                    }

                    PointageMachine_UL++;
                }

                SqlDataReader_O.Close();
            }
        }
Exemplo n.º 12
0
        private void ClientClick(UInt32 ClientID_UL)
        {
            // Load client info in each control
            String        SQLRequest_ST;
            SqlDataReader SqlDataReader_O;
            UInt32        TypeSocID_UL = 0;
            UInt32        CPID_UL      = 0;

            int RappConf_i = 0, NoteEnvoi_i = 0, Certif_i = 0;

            // Fill info in panel edit controls
            mInitializingData_b = true;

            TxtClientNumber.Clear();
            TxtClientName.Clear();
            TxtTel.Clear();
            TxtFax.Clear();
            TxtAdressFact.Clear();
            TxtAdressLivr.Clear();
            TxtContactMail.Clear();
            TxtContactTel.Clear();
            TxtContactName.Clear();
            TxtTVA.Clear();
            TxtMail.Clear();
            TxtRem.Clear();

            CheckBoxRappConf.Checked = false;
            CheckBoxNE.Checked       = false;
            CheckBoxCertif.Checked   = false;

            DBComboxTypeSoc.ClearSelectedItem();
            DBComboxCPFact.ClearSelectedItem();
            DBComboxCPLivr.ClearSelectedItem();
            DBComboxCPLibFact.ClearSelectedItem();
            DBComboxCPLibLivr.ClearSelectedItem();

            mInitializingData_b = false;


            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                SQLRequest_ST       = "SELECT * FROM Client WHERE ClientID=" + ClientID_UL;
                SqlDataReader_O     = mDBManager_O.Select(SQLRequest_ST);
                mInitializingData_b = true;

                while (SqlDataReader_O.Read())
                {
                    int.TryParse(SqlDataReader_O["RappConf"].ToString(), out RappConf_i);
                    int.TryParse(SqlDataReader_O["NoteEnvoi"].ToString(), out NoteEnvoi_i);
                    int.TryParse(SqlDataReader_O["Certif"].ToString(), out Certif_i);

                    // Fill info in panel edit controls
                    TxtClientNumber.Text = SqlDataReader_O["NumClientInterne"].ToString();
                    TxtClientName.Text   = SqlDataReader_O["ClientNom"].ToString();
                    TxtTel.Text          = SqlDataReader_O["ClientTel"].ToString();
                    TxtFax.Text          = SqlDataReader_O["ClientFax"].ToString();
                    TxtAdressFact.Text   = SqlDataReader_O["AdresseFact"].ToString();
                    TxtAdressLivr.Text   = SqlDataReader_O["AdresseLivraison"].ToString();
                    TxtContactMail.Text  = SqlDataReader_O["ContactEmail"].ToString();
                    TxtContactTel.Text   = SqlDataReader_O["ContactTel"].ToString();
                    TxtContactName.Text  = SqlDataReader_O["Contact"].ToString();
                    TxtTVA.Text          = SqlDataReader_O["NrTVA"].ToString();
                    TxtMail.Text         = SqlDataReader_O["ClientMail"].ToString();
                    TxtRem.Text          = SqlDataReader_O["ClientRem"].ToString();

                    CheckBoxRappConf.Checked = RappConf_i != 0 ? true : false;
                    CheckBoxNE.Checked       = NoteEnvoi_i != 0 ? true : false;
                    CheckBoxCertif.Checked   = Certif_i != 0 ? true : false;

                    if (UInt32.TryParse(SqlDataReader_O["TypeSocID"].ToString(), out TypeSocID_UL))
                    {
                        DBComboxTypeSoc.SelectItemByID(TypeSocID_UL);
                    }

                    if (UInt32.TryParse(SqlDataReader_O["CodePostalFactID"].ToString(), out CPID_UL))
                    {
                        DBComboxCPFact.SelectItemByID(CPID_UL);
                        DBComboxCPLibFact.SelectItemByID(CPID_UL);
                    }
                    else
                    {
                        DBComboxCPFact.ClearSelectedItem();
                        DBComboxCPLibFact.ClearSelectedItem();
                    }

                    if (UInt32.TryParse(SqlDataReader_O["CodePostalLivraisonID"].ToString(), out CPID_UL))
                    {
                        DBComboxCPLivr.SelectItemByID(CPID_UL);
                        DBComboxCPLibLivr.SelectItemByID(CPID_UL);
                    }
                    else
                    {
                        DBComboxCPLivr.ClearSelectedItem();
                        DBComboxCPLibLivr.ClearSelectedItem();
                    }

                    // Refresh job recap
                    if (!String.IsNullOrEmpty(SqlDataReader_O["ClientNom"].ToString()))
                    {
                        DBListViewComjobRecap.SetInitialFilter("ClientNom='" + SqlDataReader_O["ClientNom"].ToString() + "'", "DelaiPromis desc");
                        DBListViewComjobRecap.Refresh();
                    }
                }

                SqlDataReader_O.Close();
                mInitializingData_b = false;
            }
        }
Exemplo n.º 13
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;
        }
Exemplo n.º 14
0
        private void ProviderClick(UInt32 ProviderID_UL)
        {
            // Load provider info in each control
            String        SQLRequest_ST;
            SqlDataReader SqlDataReader_O;
            UInt32        TypeSocID_UL = 0;
            UInt32        CPID_UL      = 0;

            mInitializingData_b = true;

            TxtProviderNumber.Clear();
            TxtProviderName.Clear();
            TxtTel.Clear();
            TxtFax.Clear();
            TxtAdressFact.Clear();
            TxtContactMail.Clear();
            TxtContactTel.Clear();
            TxtContactName.Clear();
            TxtTVA.Clear();
            TxtMail.Clear();
            TxtRem.Clear();

            DBComboxTypeSoc.ClearSelectedItem();
            DBComboxCPFact.ClearSelectedItem();
            DBComboxCPLibFact.ClearSelectedItem();

            mInitializingData_b = false;

            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                SQLRequest_ST       = "SELECT * FROM Fourn WHERE FournID=" + ProviderID_UL;
                SqlDataReader_O     = mDBManager_O.Select(SQLRequest_ST);
                mInitializingData_b = true;

                while (SqlDataReader_O.Read())
                {
                    // Fill info in panel edit controls
                    TxtProviderNumber.Text = SqlDataReader_O["NumFournInterne"].ToString();
                    TxtProviderName.Text   = SqlDataReader_O["FournNom"].ToString();
                    TxtTel.Text            = SqlDataReader_O["FournTel"].ToString();
                    TxtFax.Text            = SqlDataReader_O["FournFax"].ToString();
                    TxtAdressFact.Text     = SqlDataReader_O["Adresse"].ToString();
                    TxtContactMail.Text    = SqlDataReader_O["ContactEmail"].ToString();
                    TxtContactTel.Text     = SqlDataReader_O["ContactTel"].ToString();
                    TxtContactName.Text    = SqlDataReader_O["Contact"].ToString();
                    TxtTVA.Text            = SqlDataReader_O["NrTVA"].ToString();
                    TxtMail.Text           = SqlDataReader_O["FournMail"].ToString();
                    TxtRem.Text            = SqlDataReader_O["FournRem"].ToString();

                    if (UInt32.TryParse(SqlDataReader_O["TypeSocID"].ToString(), out TypeSocID_UL))
                    {
                        DBComboxTypeSoc.SelectItemByID(TypeSocID_UL);
                    }
                    if (UInt32.TryParse(SqlDataReader_O["CodePostalID"].ToString(), out CPID_UL))
                    {
                        DBComboxCPFact.SelectItemByID(CPID_UL);
                        DBComboxCPLibFact.SelectItemByID(CPID_UL);
                    }
                    else
                    {
                        DBComboxCPFact.ClearSelectedItem();
                        DBComboxCPLibFact.ClearSelectedItem();
                    }
                }

                SqlDataReader_O.Close();
                mInitializingData_b = false;
            }
        }
Exemplo n.º 15
0
        private void JobClick(UInt32 ComJobID_UL)
        {
            // Load client info in each control
            String        SQLRequest_ST;
            SqlDataReader SqlDataReader_O;

            int RegieWork_i = 0;

            mInitializingJobData_b = true;

            // Fill info in panel edit controls
            ClearJobInfo();

            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                SQLRequest_ST   = "SELECT * FROM ComJobSelectPop WHERE ComJobID=" + ComJobID_UL;
                SqlDataReader_O = mDBManager_O.Select(SQLRequest_ST);

                while (SqlDataReader_O.Read())
                {
                    int.TryParse(SqlDataReader_O["ChkRegie"].ToString(), out RegieWork_i);

                    // Fill info in panel edit controls
                    ToolStripBtnJobLib.Text = SqlDataReader_O["JobLib"].ToString();
                    TxtQte.Text             = SqlDataReader_O["Qte"].ToString();
                    TxtQteProd.Text         = SqlDataReader_O["QteProd"].ToString();
                    TxtQteFact.Text         = SqlDataReader_O["QteFact"].ToString();
                    TxtHEstim.Text          = SqlDataReader_O["HTravEstim"].ToString();
                    TxtPVUnitEst.Text       = SqlDataReader_O["CoutEstim"].ToString();
                    TxtPVUnitFact.Text      = SqlDataReader_O["PVFact"].ToString();
                    TxtJobStatus.Text       = SqlDataReader_O["JobStatusLib"].ToString();

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

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

                    try
                    {
                        DTPRealisedDelay.Value   = Convert.ToDateTime(SqlDataReader_O["DelaRealise"].ToString());
                        DTPRealisedDelay.Visible = true;
                    }
                    catch (FormatException e)
                    {
                        DTPRealisedDelay.Value   = DTPRealisedDelay.MinDate;
                        DTPRealisedDelay.Visible = false;
                    }

                    TxtJobInfo.Text           = SqlDataReader_O["InfoJob"].ToString();
                    CheckBoxRegieWork.Checked = RegieWork_i > 0;

                    // Fill sum hours prested on job
                    float NbrH_f = mDBManager_O.mFunctionManager_O.SCFNC_CountPointageHoursOnJob(ComJobID_UL);

                    if (!String.IsNullOrEmpty(TxtHEstim.Text))
                    {
                        TxtHPrest.Text      = NbrH_f.ToString();
                        JobProgress.Maximum = (int)Convert.ToDecimal(TxtHEstim.Text);
                        JobProgress.Value   = Math.Min((int)NbrH_f, JobProgress.Maximum);
                    }
                }

                SqlDataReader_O.Close();

                // Fill associated departments
                SQLRequest_ST   = "SELECT TypeDepID FROM RelJobTypeDep WHERE ComJobID=" + ComJobID_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["TypeDepID"].ToString(), out ID_UL))
                    {
                        DepID_UL.Add(ID_UL);
                    }
                }

                JobAssociatedDep.CheckDepartments(DepID_UL);

                // Fill associated Send note
                FlowLayoutPaneSendNote.Controls.Clear();

                SQLRequest_ST   = "SELECT NoteEnvoiID FROM NoteEnvoiAndCertif WHERE ComJobID=" + ComJobID_UL;
                SqlDataReader_O = mDBManager_O.Select(SQLRequest_ST);

                while (SqlDataReader_O.Read())
                {
                    if (UInt32.TryParse(SqlDataReader_O["NoteEnvoiID"].ToString(), out ID_UL))
                    {
                        NECertifUC NewNECertifUC_O = new NECertifUC(mDBManager_O, mDocManager_O, ID_UL);
                        NewNECertifUC_O.Width = FlowLayoutPaneSendNote.Width;
                        FlowLayoutPaneSendNote.Controls.Add(NewNECertifUC_O);
                    }
                }
            }

            mInitializingJobData_b = false;
        }