Пример #1
0
        private void toolStripButtonSaveLogs_Click(object sender, EventArgs e)
        {
            if (macDumpLogBindingSource != null)
            {
                List <MacDumpLog> lMacs1 = DTRImportForm.LoadDumpLogs();
                List <MacDumpLog> lMacs2 = ActionClass.FillMacDumpLogEnrollee(OENrollee.EnrolleeId);
                List <MacDumpLog> lMacs3 = new List <MacDumpLog>();

                foreach (var log in lMacs1)
                {
                    MacDumpLog m =
                        lMacs2.FirstOrDefault(
                            ma => ((ma.MacDumpDate.Trim() == log.MacDumpDate.Trim()) && (ma.MacDumpTime.Trim() == log.MacDumpTime.Trim())));

                    if (m != null)
                    {
                        Console.WriteLine(m.MacDumpDate.ToString());
                    }
                    else
                    {
                        lMacs3.Add(log);
                    }
                }

                if (lMacs3.Count > 0)
                {
                    int iResult = ActionClass.SaveMacDumpLogAll(lMacs3);
                    if (iResult > 0)
                    {
                        toolStripStatusLabel1.Text = "Delinquent logs ported successfully.";
                    }
                    else
                    {
                        toolStripStatusLabel1.Text = "Error Occured while saving data to database or duplicate record already exists.";
                    }
                }
                else
                {
                    toolStripStatusLabel1.Text = "Record already exists.";
                }
            }
        }
Пример #2
0
 public void InitComponents()
 {
     macDumpLogBindingSource.DataSource = DTRImportForm.LoadDumpLogs();
     toolStripStatusLabel1.Text         = "(" + macDumpLogBindingSource.Count.ToString() + ") logs loaded.";
 }