Example #1
0
        public void CheckIfElectorSignedOrNot()
        {
            using (ElectionEntities Elections = new ElectionEntities())
            {
                var Elector = Elections.Electors.Where(s => s.IdentificationNumber == txt_NationalID.Text).FirstOrDefault();
                if (Elector != null)
                {
                    // string absolutePath = @"D:\vs 19 projects\Elections_POC\Elections_POC\Electors IDs\";
                    // pictureBox1.ImageLocation = absolutePath + Elector.IdentificationImg;


                    // timer1.Start();
                    lblUserExist.Visible = true;
                    //txt_NationalID.Text = NID.ToString();
                    txt_NationalID.Enabled = false;
                    btn_Search.Enabled     = false;
                }
                else
                {
                    btn_TakeFingerPrint.Enabled = true;
                    //button2.Enabled = false;
                    // txt_NationalID.Text = NID.ToString();

                    //pictureBox1.ImageLocation = FinalPhotoName;
                    //pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
                }
                // pictureBox1.ImageLocation = FinalPhotoName;
                // pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            }
        }
Example #2
0
        public void UpdateElectorTable()
        {
            using (ElectionEntities Elections = new ElectionEntities())
            {
                var ElectionFingerPrintData = Elections.FingerPrints.Where(s => s.UserID == NID.ToString()).FirstOrDefault();
                if (ElectionFingerPrintData != null)
                {
                    Elections.Electors.Add(new Elector
                    {
                        IdentificationNumber = txt_NationalID.ToString(),
                        //PollingStationsId = 1,
                        //   IdentificationImg = txt_NationalID.ToString() + ".jpeg",
                        // IdentificationTypeId = "",
                        FingerPrintId = ElectionFingerPrintData.Serial,
                        CreateDate    = DateTime.Now
                    });

                    Elections.SaveChanges();
                }
                //else {
                //    ElectionFingerPrintData.IdentificationNumber=

                //    Elections.SaveChanges();
                //}
            }
        }
Example #3
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();
                //}
            }
        }
Example #4
0
        public void CheckIfElectorSignedOrNot()
        {
            using (ElectionEntities Elections = new ElectionEntities())
            {
                try {
                    EncryptedIdentificationNumber = Cryptography.Encrypt(txt_NationalID.Text.Trim());

                    var Elector = Elections.Electors.Where(s => s.IdentificationNumber == EncryptedIdentificationNumber).FirstOrDefault();
                    if (Elector != null)
                    {
                        btn_TakeFingerPrint.Enabled = false;
                        MessageBox.Show("هذا الناخب قد انتخب من قبل");
                        // string absolutePath = @"D:\vs 19 projects\Elections_POC\Elections_POC\Electors IDs\";
                        // pictureBox1.ImageLocation = absolutePath + Elector.IdentificationImg;


                        // timer1.Start();
                        // lblUserExist.Visible = true;rolan1
                        //txt_NationalID.Text = NID.ToString();
                        //txt_NationalID.Enabled = false;rolan3

                        //btn_Search.Enabled = false;rolan3
                        //DisableNationalID(false);
                    }
                    else
                    {
                        btn_TakeFingerPrint.Enabled = true;


                        MessageBox.Show("من فضلك قم بأخذ  البصمة");
                        //suprema = new SupremaFingerPrint(); ;
                        //string Initializescanner = suprema.Initializescanner();
                        //if (Initializescanner == "")
                        //{
                        //    FingerPrint = suprema.Enroll(pbImageFrame);

                        //}
                        //else
                        //{
                        //    MessageBox.Show(Initializescanner);
                        //}
                    }
                }
                catch (Exception) {
                }



                //button2.Enabled = false;
                // txt_NationalID.Text = NID.ToString();

                //pictureBox1.ImageLocation = FinalPhotoName;
                //pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;

                // pictureBox1.ImageLocation = FinalPhotoName;
                // pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            }
        }
Example #5
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);
            }
        }
Example #6
0
        public bool GetDataFromPollingStationAfterUpdateTxt_NationalId()
        {
            using (ElectionEntities Elections = new ElectionEntities())
            {
                var UpdatedElectorData = Elections.PollingStations.Where(s => s.ElectorIdentificationNumber == txt_NationalID.Text && s.PollingStationsAr == ElectionPollingStation).FirstOrDefault();

                if (UpdatedElectorData == null)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
Example #7
0
 public bool GetDataFromPollingStationTable()
 {
     using (ElectionEntities Elections = new ElectionEntities())
     {
         string EncryptedNationalId = Cryptography.Encrypt(txt_NationalID.Text);
         var    ElectorDataExists   = Elections.PollingStations.Where(s => s.ElectorIdentificationNumber == EncryptedNationalId && s.PollingStationsAr == ElectionPollingStation).FirstOrDefault();
         if (ElectorDataExists == null)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
 }
Example #8
0
        public void GetElectorName()
        {
            using (ElectionEntities Elections = new ElectionEntities())
            {
                var ElectorData = Elections.PollingStations.Where(s => s.ElectorIdentificationNumber == txt_NationalID.Text && s.PollingStationsAr == ElectionPollingStation).FirstOrDefault();

                if (ElectorData == null)
                {
                }
                else
                {
                    Txt_ElectorName.Visible = true;
                    lbl_ElectorName.Visible = true;
                    Txt_ElectorName.Text    = ElectorData.ElectorName;
                }
            }
        }
Example #9
0
        public void GetElectorName()
        {
            using (ElectionEntities Elections = new ElectionEntities())
            {
                EncryptedIdentificationNumber = Cryptography.Encrypt(txt_NationalID.Text.Trim());
                var ElectorData = Elections.PollingStations.Where(s => s.ElectorIdentificationNumber == EncryptedIdentificationNumber).FirstOrDefault();

                if (ElectorData == null)
                {
                }
                else
                {
                    // Txt_ElectorName.Visible = true;rolan1
                    //   lbl_ElectorName.Visible = true; rolan1
                    Txt_ElectorName.Text = Cryptography.Decrypt(ElectorData.ElectorName);
                    //    Txt_ElectorName.Text = ElectorData.ElectorName;
                }
            }
        }
Example #10
0
        public bool GetDataFromPollingStationTable()
        {
            using (ElectionEntities Elections = new ElectionEntities())
            {
                // var ElectorDataExists = Elections.PollingStations.Where(s => s.ElectorIdentificationNumber.Trim() == NID.ToString() ).FirstOrDefault();
                EncryptedIdentificationNumber = Cryptography.Encrypt(txt_NationalID.Text.Trim());

                var ElectorDataExists = Elections.PollingStations.Where(s => s.ElectorIdentificationNumber.Trim() == EncryptedIdentificationNumber).FirstOrDefault();

                if (ElectorDataExists == null)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
Example #11
0
        public void GetElectorName()
        {
            using (ElectionEntities Elections = new ElectionEntities())
            {
                string EncryptedNationalId = Cryptography.Encrypt(txt_NationalID.Text);
                var    ElectorData         = Elections.PollingStations.Where(s => s.ElectorIdentificationNumber == EncryptedNationalId && s.PollingStationsAr == ElectionPollingStation).FirstOrDefault();

                if (ElectorData == null)
                {
                }
                else
                {
                    Txt_ElectorName.Visible = true;
                    lbl_ElectorName.Visible = true;
                    Txt_ElectorName.Text    = Cryptography.Decrypt(ElectorData.ElectorName);
                    btn_Search.Enabled      = false;
                }
            }
        }
Example #12
0
        public void CheckIfElectorSignedOrNot()
        {
            using (ElectionEntities Elections = new ElectionEntities())
            {
                string EncryptedNationalId = Cryptography.Encrypt(txt_NationalID.Text);

                var Elector = Elections.Electors.Where(s => s.IdentificationNumber == EncryptedNationalId).FirstOrDefault();
                if (Elector != null)
                {
                    lblUserExist.Visible = true;
                    //txt_NationalID.Text = NID.ToString();
                    txt_NationalID.Enabled = false;
                    btn_Search.Enabled     = false;
                }
                else
                {
                    btn_TakeFingerPrint.Enabled = true;
                }
            }
        }
Example #13
0
        public void UpdateElectorTable()
        {
            using (ElectionEntities Elections = new ElectionEntities())
            {
                var ElectionFingerPrintData = Elections.FingerPrints.Where(s => s.UserID == txt_NationalID.Text).FirstOrDefault();
                if (ElectionFingerPrintData != null)
                {
                    Elections.Electors.Add(new Elector
                    {
                        IdentificationNumber = Cryptography.Encrypt(txt_NationalID.Text),
                        PollingStationsId    = int.Parse(ConfigurationManager.AppSettings["ElectionPollingStation"]),
                        //IdentificationImg = txt_NationalID.Text + ".jpg",
                        // IdentificationTypeId = "",
                        FingerPrintId = ElectionFingerPrintData.Serial,
                        CreateDate    = DateTime.Now
                    });

                    Elections.SaveChanges();
                }
            }
        }
Example #14
0
 public bool GetDataFromPollingStationTable()
 {
     using (ElectionEntities Elections = new ElectionEntities())
     {
         var ElectorDataExists = Elections.PollingStations.Where(s => s.ElectorIdentificationNumber == txt_NationalID.Text && s.PollingStationsAr == ElectionPollingStation).FirstOrDefault();
         if (ElectorDataExists == null)
         {
             return(false);
             //var UpdatedElectorData = Elections.PollingStations.Where(s => s.ElectorIdentificationNumber == txt_NationalID.ToString() && s.PollingStationsAr == ElectionPollingStation).FirstOrDefault();
             //if (UpdatedElectorData == null)
             //{
             //    return false;
             //}
             //else
             //{
             //    return true;
             //}
         }
         else
         {
             return(true);
         }
     }
 }