Beispiel #1
0
 public ActionResult Unvotingvoters(Voter model)
 {
     var ElectionId = Request.Form["ElectionId"];
     List<Voter> voters = new List<Voter>();
     foreach (var voter in m_internetDc.Voters.ToList())
     {
         if (!m_internetDc.VoteDetails.Any(h => h.ElectionId == Convert.ToInt32(ElectionId) && h.IdentityNo == voter.IdentityNo))
         {
             voters.Add(voter);
         }
     }
     ViewData["UnvotingVoters"] = voters;
     return View();
 }
Beispiel #2
0
 public VoteModel(VoteDetail VoteDetail)
 {
     try
     {
         Voter = m_internetDc.Voters.First(v => v.IdentityNo == VoteDetail.IdentityNo);
         Election = m_merkezDc.Elections.First(e => e.ElectionId == VoteDetail.ElectionId);
         Region = m_merkezDc.Regions.First(r => r.RegionId == VoteDetail.RegionId.Value);
         District = m_merkezDc.Districts.First(d => d.DistrictId == VoteDetail.DistrictId.Value);
         VotingDate = VoteDetail.VotingDate.Value;
     }
     catch (Exception)
     {
     }
  
 }
Beispiel #3
0
 partial void DeleteVoter(Voter instance);
Beispiel #4
0
 partial void UpdateVoter(Voter instance);
Beispiel #5
0
 partial void InsertVoter(Voter instance);
Beispiel #6
0
        public ActionResult Create(Voter voter)
        {
            try
            {
                if (!string.IsNullOrEmpty(voter.IdentityNo) &&
                    !string.IsNullOrEmpty(voter.Name) &&
                    !string.IsNullOrEmpty(voter.Surname) &&
                    !string.IsNullOrEmpty(voter.BirthPlace) &&
                    voter.BirthDate != null &&
                    !string.IsNullOrEmpty(voter.City) &&
                    !string.IsNullOrEmpty(voter.District)
                    )
                {
                    if (voter.Handicapped == null)
                    {
                        voter.Handicapped = false;
                    }
                    voter.CreatedAt = DateTime.Now;
                    voter.CreatedBy = User.Identity.Name;
                    voter.CreatedFrom = 1;
                    voter.VoterStatus = true;
                    //
                    //TODO
                    //voter.CreatedBy
                    //voter.CreatedFrom
                    m_internetDc.Voters.InsertOnSubmit(voter);
                    m_internetDc.SubmitChanges();
                    ViewData["Message"] = " Seçmen başarı ile kaydedildi!";
                    return View();
                }
                else
                {
                    if (m_internetDc.Voters.Any(x => x.IdentityNo == voter.IdentityNo))
                    {
                        TempData["Message"] = " Bu Aday Zaten Sistemde Kayıtlıdır, Güncellemek için Aşağıdaki Ekranı Kullanın!";
                        return RedirectToAction("Edit", "Voter", new { voter.IdentityNo });
                    }
                    else
                    {
                        var myBinding = new BasicHttpBinding();
                        var myEndpoint = new EndpointAddress("http://192.168.1.222:9999/TCNufusMudurlugu/GetData");
                        var myChannelFactory = new ChannelFactory<IService1>(myBinding, myEndpoint);

                        NufusMudurluguService.IService1 client = null;

                        try
                        {
                            client = myChannelFactory.CreateChannel();
                            EOS.Officier.NufusMudurluguService.Citizen citizen = client.GetData(voter.IdentityNo);
                            ((ICommunicationObject)client).Close();

                            ViewData["Regions"] = m_merkezDC.Regions.ToList();
                            var model = new Models.Voter();

                            var district = m_merkezDC.Districts.First(x => x.DistrictName.Contains(citizen.District));
                            if (district != null)
                            {
                                if (m_merkezDC.RegionDetails.Any(x => x.DistrictId == district.DistrictId))
                                {
                                    var region = m_merkezDC.RegionDetails.First(x => x.DistrictId == district.DistrictId);
                                    model.RegionId = region.RegionId;

                                }
                            }
                            model.IdentityNo = citizen.IdentityNo;
                            model.Name = citizen.Name;
                            model.Surname = citizen.Surname;
                            model.MotherName = citizen.MotherName;
                            model.FatherName = citizen.FatherName;
                            model.Telephone = citizen.Telephone;
                            model.BirthDate = citizen.BirthDate;
                            model.BirthPlace = citizen.BirthPlace;
                            model.Address = citizen.Address;
                            model.City = citizen.City;
                            model.District = citizen.District;
                            model.Handicapped = false;
                            voter.VoterStatus = true;

                            return View(model);
                        }
                        catch
                        {
                            if (client != null)
                            {
                                ((ICommunicationObject)client).Abort();
                            }
                            ViewData["Message"] = "Geçersiz kimlik numarası girildi!";
                            return View();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ViewData["Message"] = " Bir Hata Oluştu Lütfen Tekrar Deneyiniz!";
                return View();
            }
        }
Beispiel #7
0
 public ActionResult Edit(Voter voter)
 {
     try
     {
         ViewData["Regions"] = m_merkezDC.Regions.ToList();
         var model = m_internetDc.Voters.Where(x => x.IdentityNo == voter.IdentityNo).First();
         model.Address = voter.Address;
         model.Handicapped = voter.Handicapped == null ? false : voter.Handicapped;
         model.VoterStatus = voter.VoterStatus == null ? false : voter.VoterStatus;
         model.RegionId = voter.RegionId;
         m_internetDc.SubmitChanges();
         ViewData["Message"] = " Seçmen Bilgilieri Başarıyla Güncellendi!";
         return View(model);
     }
     catch (Exception)
     {
         ViewData["Message"] = " Bir Hata Oluştu Lütfen Tekrar Deneyiniz!";
     }
     return View();
 }