예제 #1
0
파일: ComJobUC.cs 프로젝트: ATGfx/MMSoft
        private void ToolStripBtnAddCom_Click(object sender, EventArgs e)
        {
            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                FormAskClient FormAskClient_O = new FormAskClient(mDBManager_O);

                if (FormAskClient_O.ShowDialog() == DialogResult.OK)
                {
                    UInt32 ClientID_UL = FormAskClient_O.SelectedClient_UL;

                    if (ClientID_UL > 0)
                    {
                        // Generate com internal reference number as DATE/# of job in current day/client number
                        String RefNumber_st = DateTime.Today.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).Substring(2) + "/";
                        RefNumber_st += (char)(mDBManager_O.mStoredProcedureManager_O.STPROC_CountJobByClientID(ClientID_UL) + 65) + "/";
                        RefNumber_st += mDBManager_O.GetTableField("Client", "NumClientInterne", "ClientID=" + ClientID_UL);

                        UInt32 NewComID_UL = mDBManager_O.mStoredProcedureManager_O.STPROC_CreateClientCom(ClientID_UL, RefNumber_st);
                        ComJobSelector.GetComListView().Refresh();

                        if (NewComID_UL > 0)
                        {
                            ComJobSelector.GetComListView().SelectItemByID(NewComID_UL);
                        }
                    }
                }
            }
        }
예제 #2
0
파일: ComJobUC.cs 프로젝트: ATGfx/MMSoft
 private void ComValueChanged(object sender, EventArgs e)
 {
     if (ComJobSelector.GetComListView().GetSelectedItemID() > 0 && !mInitializingComData_b && !mIgnoreComValueChangedEvent_b)
     {
         ComJobSelector.GetComListView().SetLockState(true);
         SetComEditState(true);
     }
 }
예제 #3
0
파일: ComJobUC.cs 프로젝트: ATGfx/MMSoft
 private void ToolStripBtnAddJob_Click(object sender, EventArgs e)
 {
     if (mDBManager_O != null && mDBManager_O.mConnected_b && ComJobSelector.GetComListView().GetSelectedItemID() > 0)
     {
         UInt32 NewJobID_UL = mDBManager_O.mStoredProcedureManager_O.STPROC_CreateEmptyJob(ComJobSelector.GetComListView().GetSelectedItemID());
         ComJobSelector.GetJobListView().Refresh();
         ComJobSelector.GetJobListView().SelectItemByID(NewJobID_UL);
     }
 }
예제 #4
0
파일: ComJobUC.cs 프로젝트: ATGfx/MMSoft
        public bool Activate(Control Container_O)
        {
            mParentContainer_O = Container_O;
            mParentContainer_O.Controls.Add(this);
            this.BringToFront();
            this.Dock = DockStyle.Fill;

            ComClick(ComJobSelector.GetComListView().GetSelectedItemID());
            JobClick(ComJobSelector.GetJobListView().GetSelectedItemID());

            return(true);
        }
예제 #5
0
파일: ComJobUC.cs 프로젝트: ATGfx/MMSoft
        private void BtnCancelComChanges_Click(object sender, EventArgs e)
        {
            if (mComEditState_b)
            {
                DialogResult DlgRes_O = MessageBox.Show("Les modifications effectuées sur la commande seront perdues, continuer ?", "Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (DlgRes_O == DialogResult.Yes)
                {
                    ComJobSelector.GetComListView().SetLockState(false);
                    SetComEditState(false);
                    ComJobSelector.GetComListView().SelectItemByID(ComJobSelector.GetComListView().GetSelectedItemID());
                }
            }
        }
예제 #6
0
파일: ComJobUC.cs 프로젝트: ATGfx/MMSoft
        private void BtnSaveComChanges_Click(object sender, EventArgs e)
        {
            if (mJobEditState_b)
            {
                MessageBox.Show("Des modifications sont en cours sur un job associé à la commande. Enregistez d'abord les modifications sur le job, ensuite celles sur la commande.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (mComEditState_b)
            {
                UInt32 ComID_UL = ComJobSelector.GetComListView().GetSelectedItemID();

                //Build update request
                if (mDBManager_O != null && mDBManager_O.mConnected_b)
                {
                    List <String> Param_O  = new List <String>();
                    List <Object> Values_O = new List <Object>();

                    String SqlCommand_st = @"UPDATE Com SET NumRefInterne=@NumRefInterne, NumCmdClient=@NumCmdClient, LibelleCmd=@LibelleCmd, Info=@Info, NoteEnvoi=@NoteEnvoi, Certif=@Certif, RappConf=@RappConf
                                                 WHERE ComID=@ComID";

                    Param_O.Add("@NumRefInterne");
                    Param_O.Add("@NumCmdClient");
                    Param_O.Add("@LibelleCmd");
                    Param_O.Add("@Info");
                    Param_O.Add("@NoteEnvoi");
                    Param_O.Add("@Certif");
                    Param_O.Add("@RappConf");
                    Param_O.Add("@ComID");

                    Values_O.Add(TxtComNumber.Text);
                    Values_O.Add(TxtNumComClient.Text);
                    Values_O.Add(TxtComLib.Text);
                    Values_O.Add(TxtComInfos.Text);
                    Values_O.Add(CheckBoxNE.Checked);
                    Values_O.Add(CheckBoxCertif.Checked);
                    Values_O.Add(CheckBoxRappConf.Checked);
                    Values_O.Add((int)ComID_UL);

                    mDBManager_O.ExecuteRequest(SqlCommand_st, Param_O, Values_O);
                }

                SetComEditState(false);
                ComJobSelector.GetComListView().SetLockState(false);
                ComJobSelector.GetComListView().Refresh();
                ComJobSelector.GetComListView().SelectItemByID(ComID_UL);
            }
        }
예제 #7
0
파일: ComJobUC.cs 프로젝트: ATGfx/MMSoft
        public ComJobUC(DatabaseManager DBManager_O, DocumentManager DocManager_O)
        {
            InitializeComponent();

            this.ComJobSelector.AddComToolStripBtn(this.ToolStripBtnCancelCmd);
            this.ComJobSelector.AddComToolStripBtn(this.ToolStripBtnAddCom);
            this.ToolStripCom.Visible = false;
            this.ComJobSelector.AddJobToolStripBtn(this.ToolStripBtnCancelJob);
            this.ComJobSelector.AddJobToolStripBtn(this.ToolStripBtnAddJob);
            this.ToolStripJob.Visible = false;

            mDBManager_O  = DBManager_O;
            mDocManager_O = DocManager_O;

            ComJobSelector.Initialize(mDBManager_O);

            SetComEditState(false);
            SetJobEditState(false);

            ComJobSelector.GetComListView().SelectionChanged += new DBListView.SelectionChangedHandler(this.ComClick);
            ComJobSelector.GetJobListView().SelectionChanged += new DBListView.SelectionChangedHandler(this.JobClick);

            JobAssociatedDep.Initialize(mDBManager_O);
            JobAssociatedDep.DepartmentsModified += new DepartmentSelector.DepartmentsModifiedHandler(this.JobValueChanged);

            ToolStripComTools.Renderer     = new BorderlessToolStripRenderer();
            ToolStripJobTools.Renderer     = new BorderlessToolStripRenderer();
            ToolStripComHeader.Renderer    = new BorderlessToolStripRenderer();
            ToolStripJobHeader.Renderer    = new BorderlessToolStripRenderer();
            ToolStripJobDocuments.Renderer = new BorderlessToolStripRenderer();
            ToolStripNEAndCertif.Renderer  = new BorderlessToolStripRenderer();
            ControlStyle.SetBackgroundStyle(this);
            ControlStyle.SetFrameHeaderStyle(this.ToolStripComTools);
            ControlStyle.SetFrameHeaderStyle(this.ToolStripJobTools);
            ControlStyle.SetBackgroundStyle(this.splitContainer1.Panel2);
            ControlStyle.SetFrameHeaderStyle(this.splitContainer2.Panel1);
            ControlStyle.SetFrameHeaderStyle(this.splitContainer2.Panel2);
            ControlStyle.SetFrameStyle(this.ToolStripComEditFooter);
            ControlStyle.SetFrameStyle(this.PanelCmdInfo);
            ControlStyle.SetFrameStyle(this.PanelJobInfo);
            ControlStyle.SetFrameStyle(this.ToolStripJobEditFooter);
            ControlStyle.SetFrameStyle(this.JobAssociatedDep);
            ControlStyle.SetFrameStyle(this.ToolStripJobDocuments);
            ControlStyle.SetFrameStyle(this.ToolStripNEAndCertif);
        }
예제 #8
0
파일: ComJobUC.cs 프로젝트: ATGfx/MMSoft
        private void JobValueChanged(object sender, EventArgs e)
        {
            if (ComJobSelector.GetJobListView().GetSelectedItemID() > 0 && !mInitializingJobData_b && !mIgnoreJobValueChangedEvent_b)
            {
                // Handle special case : if delai client is changed, change delais promis with it
                if (sender.GetType() == typeof(DateTimePicker) && ((DateTimePicker)sender).Equals(DTPClientDelay))
                {
                    DTPPromiseDelay.Value = DTPClientDelay.Value;
                }

                // When edit a job, lock com selection
                ComJobSelector.GetComListView().SetLockState(true);
                ComJobSelector.GetJobListView().SetLockState(true);
                SetJobEditState(true);

                if (sender.GetType() == typeof(DepartmentSelector))
                {
                    mUpdateDepartmentAssociation_b = true;
                }
            }
        }
예제 #9
0
파일: ComJobUC.cs 프로젝트: ATGfx/MMSoft
        private void LoadClientPref()
        {
            UInt32 ComID_UL = ComJobSelector.GetComListView().GetSelectedItemID();

            if (mDBManager_O != null && mDBManager_O.mConnected_b && ComID_UL > 0)
            {
                UInt32 ClientID_UL;

                if (UInt32.TryParse(mDBManager_O.GetTableField("Com", "ClientID", "ComID=" + ComID_UL), out ClientID_UL))
                {
                    bool CanParseNE_b, CanParseCertif_b, CanParseRappConf_b;
                    int  CheckNE_i, CheckCertif_i, CheckRappConf_i;
                    bool CheckNE_b, CheckCertif_b, CheckRappConf_b;

                    CanParseNE_b       = int.TryParse(mDBManager_O.GetTableField("Client", "NoteEnvoi", "ClientID=" + ClientID_UL), out CheckNE_i);
                    CanParseCertif_b   = int.TryParse(mDBManager_O.GetTableField("Client", "Certif", "ClientID=" + ClientID_UL), out CheckCertif_i);
                    CanParseRappConf_b = int.TryParse(mDBManager_O.GetTableField("Client", "RappConf", "ClientID=" + ClientID_UL), out CheckRappConf_i);

                    if (CanParseNE_b && CanParseCertif_b && CanParseRappConf_b)
                    {
                        CheckNE_b       = Convert.ToBoolean(CheckNE_i);
                        CheckCertif_b   = Convert.ToBoolean(CheckCertif_i);
                        CheckRappConf_b = Convert.ToBoolean(CheckRappConf_i);

                        if (CheckNE_b != CheckBoxNE.Checked)
                        {
                            CheckBoxNE.Checked = CheckNE_b;
                        }
                        if (CheckCertif_b != CheckBoxCertif.Checked)
                        {
                            CheckBoxCertif.Checked = CheckCertif_b;
                        }
                        if (CheckRappConf_b != CheckBoxRappConf.Checked)
                        {
                            CheckBoxRappConf.Checked = CheckRappConf_b;
                        }
                    }
                }
            }
        }
예제 #10
0
파일: ComJobUC.cs 프로젝트: ATGfx/MMSoft
        private void ToolStripBtnCancelCmd_Click(object sender, EventArgs e)
        {
            if (mDBManager_O != null && mDBManager_O.mConnected_b && ComJobSelector.GetComListView().GetSelectedItemID() > 0)
            {
                UInt32 NbJobsInCom_UL = mDBManager_O.mFunctionManager_O.SCFNC_CountJobInCom(ComJobSelector.GetComListView().GetSelectedItemID());

                // If no job is recorded on command, it can be deleted
                if (NbJobsInCom_UL == 0)
                {
                    DialogResult DlgRes_O = MessageBox.Show("La suppression d'une commande est une action irréversible (les données seront perdues), êtes-vous certain de vouloir continuer ?", "Attention !", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                    if (DlgRes_O == DialogResult.Yes)
                    {
                        mDBManager_O.mStoredProcedureManager_O.STPROC_DeleteCom(ComJobSelector.GetComListView().GetSelectedItemID());
                        ComJobSelector.GetComListView().Refresh();
                        ClearComInfo();
                    }
                }
                else
                {
                    MessageBox.Show("Impossible de supprimer la commande car des jobs sont enregistrés sur celle-ci.", "Erreur !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #11
0
파일: ComJobUC.cs 프로젝트: ATGfx/MMSoft
        private void BtnSaveJobChanges_Click(object sender, EventArgs e)
        {
            if (mJobEditState_b)
            {
                UInt32 JobID_UL = ComJobSelector.GetJobListView().GetSelectedItemID();
                //Build update request
                if (mDBManager_O != null && mDBManager_O.mConnected_b)
                {
                    List <String> Param_O  = new List <String>();
                    List <Object> Values_O = new List <Object>();

                    String SQLCommand_st = @"UPDATE ComJob SET JobLib=@JobLib, Qte=@Qte, QteProd=@QteProd, HTravEstim=@HTravEstim, CoutEstim=@CoutEstim, DelaiClient=@DelaiClient," +
                                           "DelaiPromis=@DelaiPromis, ChkRegie=@ChkRegie, InfoJob=@InfoJob " +
                                           "WHERE ComJobID=@ComJobID";

                    Param_O.Add("@JobLib");
                    Param_O.Add("@Qte");
                    Param_O.Add("@QteProd");
                    Param_O.Add("@HTravEstim");
                    Param_O.Add("@CoutEstim");
                    Param_O.Add("@DelaiClient");
                    Param_O.Add("@DelaiPromis");
                    Param_O.Add("@ChkRegie");
                    Param_O.Add("@InfoJob");
                    Param_O.Add("@ComJobID");

                    Values_O.Add(ToolStripBtnJobLib.Text);
                    Values_O.Add(TxtQte.Text);
                    Values_O.Add(TxtQteProd.Text);
                    Values_O.Add(TxtHEstim.Text);
                    Values_O.Add(TxtPVUnitEst.Text);
                    Values_O.Add(DTPClientDelay.Value);
                    Values_O.Add(DTPPromiseDelay.Value);
                    Values_O.Add(CheckBoxRegieWork.Checked);
                    Values_O.Add(TxtJobInfo.Text);
                    Values_O.Add((int)JobID_UL);

                    mDBManager_O.ExecuteRequest(SQLCommand_st, Param_O, Values_O);
                    Param_O.Clear();
                    Values_O.Clear();

                    if (mUpdateDepartmentAssociation_b)
                    {
                        // Remove all association
                        SQLCommand_st = @"DELETE FROM RelJobTypeDep WHERE ComJobID=@ComJobID";
                        Param_O.Add("@ComJobID"); Values_O.Add((int)ComJobSelector.GetJobListView().GetSelectedItemID());
                        mDBManager_O.ExecuteRequest(SQLCommand_st, Param_O, Values_O);
                        Param_O.Clear();
                        Values_O.Clear();

                        // Add them back plus new ones
                        List <UInt32> IdList_UL = JobAssociatedDep.GetSelectedDepartmentsID();

                        for (int i = 0; i < IdList_UL.Count; i++)
                        {
                            SQLCommand_st = @"INSERT INTO RelJobTypeDep(TypeDepID, ComJobID) VALUES (@TypeDepID, @ComJobID)";
                            Param_O.Add("@TypeDepID"); Values_O.Add((int)IdList_UL[i]);
                            Param_O.Add("@ComJobID"); Values_O.Add((int)ComJobSelector.GetJobListView().GetSelectedItemID());
                            mDBManager_O.ExecuteRequest(SQLCommand_st, Param_O, Values_O);
                            Param_O.Clear();
                            Values_O.Clear();
                        }

                        mUpdateDepartmentAssociation_b = false;
                    }
                }

                SetJobEditState(false);
                ComJobSelector.GetJobListView().SetLockState(false);

                if (!mComEditState_b)
                {
                    ComJobSelector.GetComListView().SetLockState(false);
                }

                ComJobSelector.GetJobListView().Refresh();
                ComJobSelector.GetJobListView().SelectItemByID(JobID_UL);
            }
        }