/// <summary>
 /// Create a new PollDataError object.
 /// </summary>
 /// <param name="unID">Initial value of the UnID property.</param>
 public static PollDataError CreatePollDataError(global::System.Int32 unID)
 {
     PollDataError pollDataError = new PollDataError();
     pollDataError.UnID = unID;
     return pollDataError;
 }
示例#2
0
        private void SaveAttDataToPollData(List<ReadersCommLibrary.Poll> records, Int16 _RdrID)
        {
            using (var context = new TAS2013Entities())
            {
                List<Emp> emps = context.Emps.Where(aa => aa.Status == true).ToList();
                foreach (var entry in records)
                {
                    try
                    {
                        var emp = emps.Where(aa => aa.FpID == entry.ID);
                        var reader = context.Readers.Where(aa => aa.RdrID == _RdrID);
                        if (emp.Count() > 0)
                        {
                            PollData p = new PollData();
                            p.EmpID = emp.FirstOrDefault().EmpID;
                            p.EntDate = entry.EntryDateTime.Date;
                            p.EntTime = entry.EntryDateTime;
                            p.EmpDate = emp.FirstOrDefault().EmpID.ToString() + entry.EntryDateTime.Date.ToString("yyMMdd");
                            p.CardNo = emp.FirstOrDefault().CardNo;
                            p.RdrID = reader.FirstOrDefault().RdrID;
                            p.FpID = entry.ID;
                            p.RdrDuty = reader.FirstOrDefault().RdrDutyCode.RdrDutyID;
                            p.Split = false;
                            p.Process = false;
                            p.AddedDate = DateTime.Today;
                            context.PollDatas.AddObject(p);
                            context.SaveChanges();
                        }
                        else
                        {
                            PollDataError pde = new PollDataError();
                            pde.DeviceRegID = entry.ID;
                            pde.EntryDate = entry.EntryDateTime.Date;
                            pde.EntryTime = entry.EntryDateTime;
                            pde.AddedDate = DateTime.Today;
                            context.PollDataErrors.AddObject(pde);
                            context.SaveChanges();
                        }
                    }
                    catch (Exception ex)
                    {

                    }
                }
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the PollDataErrors EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPollDataErrors(PollDataError pollDataError)
 {
     base.AddObject("PollDataErrors", pollDataError);
 }