Пример #1
0
        private void decision_Approval_or_Rejected(TM_Status StRec, Trademark TmRec, int Status_Id)
        {
            //delete previous alerts (not only old decisions)
            //Task.DisableNotSentTasks(givenTM.Id);
            //first decision / ins: decision Task
            //other(new) decision (ins) or upd: prosf & orist Tasks


            StRec = new TM_Status();

            StRec.TmId           = TmRec.Id;
            StRec.StatusId       = Status_Id; //apofasi: (2) egkritiki, (3) merikws aporriptiki, (4) olikws aporriptiki
            StRec.DecisionNo     = txtDecisionNo.Text;
            StRec.DecisionPublDt = dtpPublicationDate.Value.Date;
            StRec.Remarks        = txtDescription.Text;

            StRec.Id = TempRecUpdId;

            if (isInsert)
            {
                //delete previous alerts (not only old decisions)
                Task.DisableNotSentTasks(givenTM.Id);

                //Save
                bool successful = true;

                StRec.Id = TM_Status.InsertTM_Status_Decision(StRec);
                if (StRec.Id <= 0)
                {
                    //TM_Status ins error
                    successful = false;
                }
                else
                {
                    if (frmAttachments.success)
                    {
                        frmAttachments.saveAttachments(StRec.Id);
                    }
                }

                //Alarms
                if (successful)
                {
                    if (StRec.StatusId == 2 || StRec.StatusId == 3) //egkritiki || merikws aporriptiki : oristikopoiisi
                    {
                        if (CreateFinalizationAlarms(TmRec, StRec) == false)
                        {
                            MessageBox.Show("Σφάλμα κατα την καταχώρηση ειδοποιήσεων οριστικοποίησης!");
                            return;
                        }
                    }

                    if (StRec.StatusId == 3 || StRec.StatusId == 4)      //merikws aporriptiki || olikws aporriptiki : oristikopoiisi
                    {
                        if (CreateProsfygiAlarms(TmRec, StRec) == false) //prosfygi
                        {
                            MessageBox.Show("Σφάλμα κατα την καταχώρηση ειδοποιήσεων προσφυγής!");
                            return;
                        }
                    }

                    MessageBox.Show("Η εγγραφή καταχωρήθηκε επιτυχώς!");
                    success = true;
                    Close();
                }
                else
                {
                    MessageBox.Show("Σφάλμα κατα την καταχώρηση της εγγραφής!");
                }
            }
            else
            {
                //Save
                bool successful = true;

                if (TM_Status.UpdateTM_Status_Decision(StRec) == false)
                {
                    //TM ins error
                    successful = false;
                }
                else
                {
                    if (frmAttachments.success)
                    {
                        frmAttachments.saveAttachments(StRec.Id);
                    }
                }

                //Alarms
                if (successful)
                {
                    TmLog.Insert_TMLog(OldRecord, StRec, "Απόφαση", 2);

                    if (OldRecord.DecisionPublDt != StRec.DecisionPublDt || OldRecord.StatusId != StRec.StatusId)
                    {
                        //disable old Alarms first...
                        Task.DisableNotSentTasks(StRec.TmId);

                        //delete recipients
                        Recipient.DeleteRecipients(StRec.TmId, OldRecord.Id, 3); //oristikop
                        Recipient.DeleteRecipients(StRec.TmId, OldRecord.Id, 4); //prosf

                        if (StRec.StatusId == 2 || StRec.StatusId == 3)          //egkritiki || merikws aporriptiki : oristikopoiisi
                        {
                            if (CreateFinalizationAlarms(TmRec, StRec) == false)
                            {
                                MessageBox.Show("Σφάλμα κατα την καταχώρηση ειδοποιήσεων οριστικοποίησης!");
                                return;
                            }
                        }

                        if (StRec.StatusId == 3 || StRec.StatusId == 4)      //merikws aporriptiki || olikws aporriptiki : oristikopoiisi
                        {
                            if (CreateProsfygiAlarms(TmRec, StRec) == false) //prosfygi
                            {
                                MessageBox.Show("Σφάλμα κατα την καταχώρηση ειδοποιήσεων προσφυγής!");
                                return;
                            }
                        }
                    }

                    MessageBox.Show("Η εγγραφή καταχωρήθηκε επιτυχώς!");
                    success = true;
                    Close();
                }
                else
                {
                    MessageBox.Show("Σφάλμα κατα την καταχώρηση της εγγραφής!");
                }
            }
        }