コード例 #1
0
        public async Task AddElector(int serial)
        {
            using (ElectionEntities Elections = new ElectionEntities())
            {
                EncryptedIdentificationNumber = Cryptography.Encrypt(txt_NationalID.Text.Trim());

                var Elector = Elections.Electors.Where(s => s.IdentificationNumber == EncryptedIdentificationNumber).FirstOrDefault();

                if (Elector == null)
                {
                    Elector elector = new Elector();
                    elector.IdentificationNumber = Cryptography.Encrypt(txt_NationalID.Text);
                    elector.PollingStationsId    = 1;
                    //elector.IdentificationImg = txt_NationalID.Text.ToString() + ".jpg";
                    elector.FingerPrintId = serial;
                    elector.CreateDate    = DateTime.Now;
                    Elections.Electors.Add(elector);
                    await Elections.SaveChangesAsync();
                }
                //else {
                //    ElectionFingerPrintData.IdentificationNumber=

                //    Elections.SaveChanges();
                //}
            }
        }
コード例 #2
0
        public async Task <int> AddFingerPrint(FingerPrint fingerPrint)
        {
            using (ElectionEntities Context = new ElectionEntities())
            {
                fingerPrint.UserID = txt_NationalID.Text;

                //ufd_res = m_Database.AddData(dlg.UserID, dlg.FingerIndex, m_Template1, m_Template1Size, null, 0, dlg.Memo);
                Context.FingerPrints.Add(fingerPrint);
                await Context.SaveChangesAsync();

                int serial = Context.FingerPrints.Where(f => f.UserID == txt_NationalID.Text).Select(s => s.Serial).FirstOrDefault();
                return(fingerPrint.Serial);
            }
        }