Ejemplo n.º 1
0
        private void tsmiViewTM_Click(object sender, EventArgs e)
        {
            //Select
            if (dgvAlerts.SelectedRows.Count > 0)
            {
                int         dgvIndex   = dgvAlerts.SelectedRows[0].Index;
                int         Id         = Convert.ToInt32(dgvAlerts.SelectedRows[0].Cells["tmp_Id"].Value.ToString());
                TempRecords thisTmpRec = new TempRecords(Id);

                QuickInsert frmViewTmpRec = new QuickInsert(thisTmpRec);

                frmViewTmpRec.MakeAllControlsReadOnly(frmViewTmpRec);
                frmViewTmpRec.GetFromGridOnlyChecked();

                frmViewTmpRec.btnSave.Enabled = false;
                frmViewTmpRec.ShowDialog();
            }
        }
Ejemplo n.º 2
0
        private void tsmiUpdate_Click(object sender, EventArgs e)
        {
            // Update
            if (dgvTempRecs.SelectedRows.Count > 0)
            {
                int         dgvIndex   = dgvTempRecs.SelectedRows[0].Index;
                int         Id         = Convert.ToInt32(dgvTempRecs.SelectedRows[0].Cells["tmp_Id"].Value.ToString());
                TempRecords thisTmpRec = tempRecList.Where(i => i.Id == Id).First();

                QuickInsert frmUpdateTmpRec = new QuickInsert(thisTmpRec);
                frmUpdateTmpRec.ShowDialog();

                if (frmUpdateTmpRec.success)
                {
                    //refresh
                    tempRecList[tempRecList.FindIndex(w => w.Id == Id)] = frmUpdateTmpRec.NewRecord;

                    FillDataGridView(dgvTempRecs, frmUpdateTmpRec.NewRecord, dgvIndex);
                }
            }
        }
Ejemplo n.º 3
0
        private bool CreateFinalizationAlarms(Trademark TMRec, TM_Status TMStatus)
        {
            bool ret = true;

            Task TaskToInsert = new Task();

            TaskToInsert.EventTypesId = 3; //Οριστικοποίηση σε εκκρεμότητα
            TaskToInsert.TM_StatusId  = TMStatus.Id;

            Tasks_EventType task_EventType = new Tasks_EventType(TaskToInsert.EventTypesId, TMRec.NationalPowerId);

            DateTime ExpDate = TMStatus.DecisionPublDt.AddMonths(task_EventType.ExpMonths); //3 months

            TaskToInsert.TrademarksId = TMStatus.TmId;
            TaskToInsert.ExpDate      = ExpDate;
            TaskToInsert.IsActive     = true;

            string EventTypeName = EventType.getEventTypeName(TaskToInsert.EventTypesId);

            //new form to show alarms before insert!
            //move to contructor??
            Alarms frmAlarms = new Alarms();

            frmAlarms.txtTMId.Text   = TMRec.TMNo;
            frmAlarms.txtTMName.Text = TMRec.TMName;

            foreach (Responsible recipient in responsibleList)
            {
                bool IsChecked = false;
                if (recipient.Id == TMRec.ResponsibleLawyerId)
                {
                    IsChecked = true;
                }
                frmAlarms.dgvRecipients.Rows.Add(new object[] { recipient.Id, IsChecked, recipient.FullName, recipient.Email });
            }

            foreach (Responsible recipient in secretariesList)
            {
                frmAlarms.dgvRecipients.Rows.Add(new object[] { recipient.Id, true, recipient.FullName, recipient.Email });
                frmAlarms.dgvRecipients.Rows[frmAlarms.dgvRecipients.Rows.Count - 1].ReadOnly = true;
                frmAlarms.dgvRecipients.Rows[frmAlarms.dgvRecipients.Rows.Count - 1].DefaultCellStyle.BackColor = Color.LightGray;
            }

            frmAlarms.dtpExpDt.Value   = ExpDate;
            frmAlarms.dtpExpTime.Value = ExpDate;

            foreach (myIntAndStr months in task_EventType.AlertMonths)
            {
                TaskToInsert.NotificationDate = ExpDate.AddMonths(-months.myInt);

                frmAlarms.dgvAlarms.Rows.Add(new object[] { TMRec.Id, true, TaskToInsert.NotificationDate.ToString("dd.MM.yyyy HH:mm"), EventTypeName, months.myStr });

                if (TaskToInsert.NotificationDate < DateTime.Now)
                {
                    frmAlarms.dgvAlarms.Rows[frmAlarms.dgvAlarms.Rows.Count - 1].Cells["Alarm_Active"].Value = false;
                    frmAlarms.dgvAlarms.Rows[frmAlarms.dgvAlarms.Rows.Count - 1].DefaultCellStyle.BackColor  = Color.Red;
                }
            }

            foreach (myIntAndStr days in task_EventType.AlertDays)
            {
                TaskToInsert.NotificationDate = ExpDate.AddDays(-days.myInt);

                frmAlarms.dgvAlarms.Rows.Add(new object[] { TMRec.Id, true, TaskToInsert.NotificationDate.ToString("dd.MM.yyyy HH:mm"), EventTypeName, days.myStr });

                if (TaskToInsert.NotificationDate < DateTime.Now)
                {
                    frmAlarms.dgvAlarms.Rows[frmAlarms.dgvAlarms.Rows.Count - 1].Cells["Alarm_Active"].Value = false;
                    frmAlarms.dgvAlarms.Rows[frmAlarms.dgvAlarms.Rows.Count - 1].DefaultCellStyle.BackColor  = Color.Red;
                }
            }

            frmAlarms.ShowDialog();

            bool foundSomething = false;

            foreach (DataGridViewRow dgvr in frmAlarms.dgvAlarms.Rows)
            {
                if (Convert.ToBoolean(dgvr.Cells["Alarm_Active"].Value))
                {
                    TaskToInsert.NotificationDate = Convert.ToDateTime(dgvr.Cells["Alarm_NotificationDate"].Value);
                    TaskToInsert.AlertDescr       = dgvr.Cells["Alarm_Period"].Value.ToString();
                    if (QuickInsert.InsertTask(TaskToInsert) == false)
                    {
                        ret = false;
                    }
                    else
                    {
                        foundSomething = true;
                    }
                }
            }

            if (foundSomething == false)
            {
                return(ret);
            }

            Recipient rec = new Recipient();

            rec.TrademarksId = TaskToInsert.TrademarksId;
            rec.TM_StatusId  = TaskToInsert.TM_StatusId;
            rec.EventTypesId = TaskToInsert.EventTypesId;
            foreach (DataGridViewRow dgvr in frmAlarms.dgvRecipients.Rows)
            {
                if (Convert.ToBoolean(dgvr.Cells["Rec_Checked"].Value))
                {
                    rec.FullName = dgvr.Cells["Rec_Name"].Value.ToString();
                    rec.Email    = dgvr.Cells["Rec_Email"].Value.ToString();
                    if (QuickInsert.InsertRecipients(rec) == false)
                    {
                        ret = false;
                    }
                }
            }

            return(ret);
        }