private void submitButton_Click(object sender, EventArgs e)
        {
            VoterId br = new VoterId();

            br.dateofIssue      = dateTimePicker1.Text;
            br.Name             = nametextBox.Text;
            br.fathersName      = FNBox.Text;
            br.mothersName      = MnBox.Text;
            br.dob              = dateTimePicker2.Text;
            br.permanentAddress = pAddressBox.Text;
            br.presentAddress   = presentaddressBox.Text;
            br.nationality      = nationalityBox.Text;
            br.VotingArea       = votingareaBox.Text;
            if (MButton.Checked == true)
            {
                Gender = "Male";
            }
            else if (fmlButton.Checked == true)
            {
                Gender = "Female";
            }
            br.gender = Gender;
            int rows = br.getVi(br);

            if (rows > 0)
            {
                MessageBox.Show("Submitted..Wait for your Registration No");
            }
            else
            {
                MessageBox.Show("Error!!!");
            }
            br.IdNo = voteridnoBox.Text;
        }
Пример #2
0
        public ActionResult NIDRegistration(VoterId voterId)
        {
            int     uid = voterId.UserId;
            VoterId vId = this.NIDservice.GetByUserID(uid);

            if (ModelState.IsValid && uid == Convert.ToInt32(Session["ID"]) && vId == null)
            {
                this.NIDservice.Insert(voterId);
                ModelState.Clear();
                return(RedirectToAction("Details"));
            }
            else if (uid != Convert.ToInt32(Session["ID"]))
            {
                ModelState.AddModelError("", "You typed wrong UserId!");
                return(View(voterId));
            }
            else if (vId != null)
            {
                ModelState.AddModelError("", "You have already registered for VoterId");
                return(View(voterId));
            }
            else
            {
                return(View(voterId));
            }
        }
Пример #3
0
        public DataTable searchVI()
        {
            VoterId c = new VoterId();;
            //DataSet ds = new DataSet();
            DataTable dt2 = new DataTable();

            SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Bishal\Desktop\Municipal management\Voter_Id.mdf;Integrated Security=True;Connect Timeout=30");

            con.Open();
            SqlCommand cmd = new SqlCommand("select * from VI", con);

            try
            {
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                adapter.Fill(dt2);
                //dt2 = ds.Tables[0];
                return(dt2);
            }

            catch
            {
                con.Close();
                throw;
            }
        }
Пример #4
0
        public static void getXML()
        {
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(VoterRecordsRequest));


            VoterRecordsRequest recordsRequest = new VoterRecordsRequest();
            Voter voter = new Voter();
            Name  name  = new Name()
            {
                FirstName = "John",
                LastName  = "Smith",
                FullName  = "John S. Smith"
            };

            name.MiddleName            = new string[1];
            name.MiddleName[0]         = "S";
            voter.Name                 = name;
            voter.DateOfBirthSpecified = true;
            voter.DateOfBirth          = Convert.ToDateTime("01/01/1999");

            VoterId voterId = new VoterId();

            voterId.DateOfIssuanceSpecified = true;
            voterId.DateOfIssuance          = Convert.ToDateTime("01/01/2015");
            voterId.StringValue             = "Z666776677";
            VoterIdType type = VoterIdType.driverslicense;

            voterId.Type = type;
            VoterId voterid2 = new VoterId();

            voterid2.StringValue = "1234";
            VoterIdType type2 = VoterIdType.ssn4;

            voterid2.Type = type2;
            voter.VoterId = new VoterId[2];

            voter.VoterId[0] = voterId;
            voter.VoterId[1] = voterid2;


            //voter.ResidenceAddress.NumberedThoroughfareAddress_type.CompleteAddressNumber = "4868";
            //voter.ResidenceAddress.NumberedThoroughfareAddress_type.CompleteStreetName = "Bonnie Brae Rd";
            //voter.ResidenceAddress.NumberedThoroughfareAddress_type.CompleteSubaddress = "Richmond, VA 23234";


            recordsRequest.Type    = new VoterRequestType[1];
            recordsRequest.Type[0] = VoterRequestType.lookup;

            recordsRequest.Issuer        = "Third-Party Issuer";
            recordsRequest.RequestMethod = RequestMethod.other;

            recordsRequest.Subject       = voter;
            recordsRequest.GeneratedDate = DateTime.Now;

            TextWriter write = new StreamWriter("C:\\dev\\vriout.xml");

            xmlSerializer.Serialize(write, recordsRequest);
        }
Пример #5
0
        public bool IsValid()
        {
            if (Candidate == null)
            {
                Logger.Debug("{field} cannot be null", nameof(Candidate));
                return(false);
            }

            if (VoterId == null)
            {
                Logger.Debug("{field} cannot be null", nameof(VoterId));
                return(false);
            }

            return(Candidate.IsValid() && VoterId.IsValid());
        }
Пример #6
0
        //voterid
        public int insertVI(VoterId b)
        {
            SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Bishal\Desktop\Municipal management\Voter_Id.mdf;Integrated Security=True;Connect Timeout=30");

            con.Open();
            SqlCommand cmd = new SqlCommand("insert into VI(Dateofissue,Name,FathersName,MothersName,DOB,Permanentaddress,Nationality,votingarea,Gender)values('" + b.dateofIssue + "','" + b.Name + "','" + b.fathersName + "','" + b.mothersName + "','" + b.dob + "','" + b.permanentAddress + "','" + b.VotingArea + "','" + b.nationality + "','" + b.gender + "')", con);

            try
            {
                return(cmd.ExecuteNonQuery());
            }
            catch
            {
                con.Close();
                throw;
            }
        }
        private void voterBtn_Click(object sender, EventArgs e)
        {
            VoterId b = new VoterId();

            dataGridView1.DataSource = b.getdata1();
        }
Пример #8
0
        public static XmlDocument EPBOutboundRecords(List <DemoRecords> vr)
        {
            XmlDocument             response = new XmlDocument();
            XmlSerializerNamespaces ns       = new XmlSerializerNamespaces();

            ns.Add("addr", "http://www.fgdc.gov/schemas/address/addr");
            ns.Add("addr_type", "http://www.fgdc.gov/schemas/address/addr_type");
            XmlSerializer      xmlSerializer = new XmlSerializer(typeof(VoterRecordsResponse));
            VoterRecordResults records       = new VoterRecordResults();

            records.VoterRecord   = new VoterRecord[vr.Count];
            records.TransactionId = "VRI-EPB-Example_" + DateTime.Now.ToString();
            int rec = 0;

            foreach (DemoRecords d in vr)
            {
                VoterRecord voter = new VoterRecord();
                voter.Voter = new Voter();
                voter.Voter.DateOfBirthSpecified = true;
                voter.Voter.DateOfBirth          = Convert.ToDateTime(d.DATE_OF_BIRTH);
                Name votername = new Name()
                {
                    FirstName = d.FIRST_NAME,
                    LastName  = d.LAST_NAME,
                    FullName  = BuildFullName(d.FIRST_NAME, d.MIDDLE_NAME, d.LAST_NAME, d.SUFFIX)
                };
                string[] midname = new string[] { d.MIDDLE_NAME };
                votername.MiddleName         = midname;
                voter.Voter.Name             = votername;
                voter.Voter.ResidenceAddress = BuildAddress(d.HOUSE_NUMBER, d.PRE_DIRECTION, d.STREET_NAME, d.STREETTYPE,
                                                            d.POST_DIRECTION, d.APT_NUM, d.CITY, d.STATE, d.ZIP, d.COUNTRY);
                //This example does not specify a party, but this is where it would be added

                Party p = new Party();
                p.Name            = "Not-specified";
                voter.Voter.Party = p;
                //Known Voter ID Type
                VoterId vid = new VoterId();
                VoterId dmv = new VoterId();
                vid.Type        = VoterIdType.statevoterregistrationid;
                dmv.Type        = VoterIdType.driverslicense;
                vid.StringValue = d.VOTERID;
                dmv.StringValue = d.DMV_NUMBER;

                voter.Voter.VoterId    = new VoterId[2];
                voter.Voter.VoterId[0] = vid;
                voter.Voter.VoterId[1] = dmv;

                //adding districts - this exammple includes congressional, state senate and state house
                voter.District    = new ReportingUnit[3];
                voter.District[0] = BuildReportingUnit("congressional", d.CONGRESSIONAL_DISTRICT);
                voter.District[1] = BuildReportingUnit("state-senate", d.ST_LEG_UPPER_HOUSE);
                voter.District[2] = BuildReportingUnit("state-house", d.ST_LEG_LOWER_HOUSE);

                //Adding locality, precinct and splits
                voter.Locality    = new ReportingUnit[3];
                voter.Locality[0] = BuildReportingUnit("county", d.LOCALITY_NAME);
                voter.Locality[1] = BuildReportingUnit("precinct", d.PRECINCT_NAME);
                voter.Locality[2] = BuildReportingUnit("split-precinct", d.PRECINCT_SPLIT_NAME);

                //other information about voter
                voter.Voter.Gender = d.GENDER;

                //Protected voter
                VoterClassification prot = new VoterClassification();
                if (d.PROTECTED != "")
                {
                    prot.Type = VoterClassificationType.protectedvoter;
                }
                else
                {
                    prot.OtherType = "not protected";
                    prot.Type      = VoterClassificationType.other;
                }
                //UOCAVA Voter
                VoterClassification uocava = new VoterClassification();
                if (d.UOCAVA_VOTER != "")
                {
                    uocava.Type = VoterClassificationType.activeduty;
                }
                else
                {
                    uocava.OtherType = "not uocava";
                    uocava.Type      = VoterClassificationType.other;
                }

                //absentee ballot status
                VoterClassification ab = new VoterClassification();
                if (d.VOTEBYMAIL_STATUS != "")
                {
                    ab.OtherType = "absentee ballots sent";
                    ab.Type      = VoterClassificationType.other;
                }
                else
                {
                    ab.OtherType = "no absentee ballot sent";
                    ab.Type      = VoterClassificationType.other;
                }
                //NVRA Status
                VoterClassification nvra = new VoterClassification();
                nvra.OtherType = d.VOTER_STATUS;
                nvra.Type      = VoterClassificationType.other;

                //NVRA Confirmation mailing sent
                VoterClassification conf = new VoterClassification();
                if (d.NVRA_CONFIRMATION != "")
                {
                    conf.OtherType = "Confirmation sent";
                    conf.Type      = VoterClassificationType.other;
                }
                else
                {
                    conf.OtherType = "No confirmation";
                    conf.Type      = VoterClassificationType.other;
                }

                voter.Voter.VoterClassification    = new VoterClassification[5];
                voter.Voter.VoterClassification[0] = prot;
                voter.Voter.VoterClassification[1] = uocava;
                voter.Voter.VoterClassification[2] = ab;
                voter.Voter.VoterClassification[3] = nvra;
                voter.Voter.VoterClassification[4] = conf;

                //Election specific information using the VoterParticipation Object
                VoterParticipation participation = new VoterParticipation();
                Election           el            = new Election();
                el.Name                = d.ELECTION_NAME;
                el.StartDate           = Convert.ToDateTime(d.ELECTION_DATE);
                participation.Election = el;
                //for ballot style we will need to create an external identifier
                ExternalIdentifier bsiden = new ExternalIdentifier();
                bsiden.Type  = IdentifierType.locallevel;
                bsiden.Value = d.BALLOT_STYLE_NAME;
                BallotStyle bs = new BallotStyle();
                bs.ExternalIdentifier     = new ExternalIdentifier[1];
                bs.ExternalIdentifier[0]  = bsiden;
                participation.BallotStyle = bs;

                voter.VoterParticipation    = new VoterParticipation[1];
                voter.VoterParticipation[0] = participation;

                records.VoterRecord[rec] = voter;
                rec++;
            }

            VoterRecordsResponse vrresp = records;

            vrresp.TransactionId = "epb-vri-example";

            TextWriter write = new StreamWriter("C:\\dev\\epb_example.xml");

            xmlSerializer.Serialize(write, vrresp, ns);
            return(response);
        }
Пример #9
0
        public static XmlDocument responseRecord(VoterRecordsRequest lookuprecord)
        {
            XmlDocument             response = new XmlDocument();
            XmlSerializerNamespaces ns       = new XmlSerializerNamespaces();

            ns.Add("addr", "http://www.fgdc.gov/schemas/address/addr");
            ns.Add("addr_type", "http://www.fgdc.gov/schemas/address/addr_type");
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(VoterRecordsResponse));


            VoterRecordResults records = new VoterRecordResults();

            records.TransactionId = lookuprecord.TransactionId;
            VoterRecord vr = new VoterRecord();

            vr.Voter = new Voter();
            vr.Voter.DateOfBirthSpecified = true;
            vr.Voter.DateOfBirth          = Convert.ToDateTime(lookuprecord.Subject.DateOfBirth);
            Name votername = new Name()
            {
                FirstName = lookuprecord.Subject.Name.FirstName,
                LastName  = lookuprecord.Subject.Name.LastName,
                FullName  = lookuprecord.Subject.Name.FullName
            };

            vr.Voter.Name             = votername;
            vr.Voter.ResidenceAddress = voterAddress(lookuprecord.Subject);
            vr.Voter.MailingAddress   = mailingAddress(lookuprecord.Subject);
            Party p = new Party();

            p.Name         = "Not-specified";
            vr.Voter.Party = p;
            VoterId vid = new VoterId();

            vid.Type        = VoterIdType.statevoterregistrationid;
            vid.StringValue = "99998888991";

            vr.Voter.VoterId    = new VoterId[1];
            vr.Voter.VoterId[0] = vid;

            vr.District    = new ReportingUnit[1];
            vr.District[0] = ru("congressional", "7");
            vr.Locality    = new ReportingUnit[2];

            vr.Locality[0] = ru("county", "Richmond City");
            vr.Locality[1] = ru("precinct", "111 - One Hundred Eleven");

            records.VoterRecord = new VoterRecord[1];

            records.VoterRecord[0] = vr;

            VoterRecordsResponse vrresp = records;

            vrresp.TransactionId = "vri-resp" + DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "").Replace("AM", "").Replace("PM", "");

            TextWriter write = new StreamWriter("C:\\dev\\nvraresponse.xml");

            xmlSerializer.Serialize(write, vrresp, ns);

            //Simple acknowledgement example
            RequestAcknowledgement ack     = new RequestAcknowledgement();
            VoterRecordsResponse   vrresp2 = ack;

            vrresp2.TransactionId = "vri-validation" + DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "").Replace("AM", "").Replace("PM", "");

            TextWriter write2 = new StreamWriter("C:\\dev\\vriack.xml");

            xmlSerializer.Serialize(write2, vrresp2, ns);

            //Rejection request
            RequestRejection rejection = new RequestRejection();
            Error            e         = new Error();

            e.OtherError       = "There was an error in processing this request";
            rejection.Error    = new Error[1];
            rejection.Error[0] = e;
            VoterRecordsResponse resperr = rejection;

            resperr.TransactionId = "vri-validation" + DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "").Replace("AM", "").Replace("PM", "");

            TextWriter writeerr = new StreamWriter("C:\\dev\\vrierr.xml");

            xmlSerializer.Serialize(writeerr, resperr, ns);



            return(response);
        }
Пример #10
0
        public static XmlDocument lookup(string json)
        {
            XmlDocument             output      = null;
            JObject                 voterlookup = JObject.Parse(json);
            string                  firstname   = (string)voterlookup["VoterRequest"]["Subject"]["FirstName"];
            XmlSerializerNamespaces ns          = new XmlSerializerNamespaces();

            ns.Add("addr", "http://www.fgdc.gov/schemas/address/addr");
            ns.Add("addr_type", "http://www.fgdc.gov/schemas/address/addr_type");

            XmlSerializer xmlSerializer = new XmlSerializer(typeof(VoterRecordsRequest));

            VoterRecordsRequest recordsRequest = new VoterRecordsRequest();
            Voter voter = new Voter();
            Name  name  = new Name()
            {
                FirstName = (string)voterlookup["VoterRequest"]["Subject"]["FirstName"],
                LastName  = (string)voterlookup["VoterRequest"]["Subject"]["LastName"],
                FullName  = (string)voterlookup["VoterRequest"]["Subject"]["FullName"],
            };

            name.MiddleName            = new string[1];
            name.MiddleName[0]         = (string)voterlookup["VoterRequest"]["Subject"]["MiddleName"];
            voter.Name                 = name;
            voter.DateOfBirthSpecified = true;
            voter.DateOfBirth          = Convert.ToDateTime((string)voterlookup["VoterRequest"]["Subject"]["DateOfBirth"]);

            int ids = voterlookup["VoterRequest"]["Subject"]["VoterId"].Count();

            voter.VoterId = new VoterId[ids];
            for (int i = 0; i < ids; i++)
            {
                VoterId vid = new VoterId();
                if (voterlookup["VoterRequest"]["Subject"]["VoterId"][i]["DateOfIssuance"] != null)
                {
                    vid.DateOfIssuanceSpecified = true;
                    vid.DateOfIssuance          = Convert.ToDateTime((string)voterlookup["VoterRequest"]["Subject"]["VoterId"][i]["DateOfIssuance"]);
                }
                vid.StringValue  = (string)voterlookup["VoterRequest"]["Subject"]["VoterId"][i]["StringValue"];
                vid.Type         = getVoterType((string)voterlookup["VoterRequest"]["Subject"]["VoterId"][i]["type"]);
                voter.VoterId[i] = vid;
            }

            voter.ResidenceAddress = voterAddress(voter);

            recordsRequest.Type    = new VoterRequestType[1];
            recordsRequest.Type[0] = VoterRequestType.lookup;

            recordsRequest.Issuer        = "NVRA Agency";
            recordsRequest.RequestMethod = RequestMethod.motorvehicleoffice;

            recordsRequest.Subject       = voter;
            recordsRequest.GeneratedDate = DateTime.Now;
            recordsRequest.TransactionId = "vri-request" + DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "").Replace("AM", "").Replace("PM", "");

            TextWriter write = new StreamWriter("C:\\dev\\nvraout.xml");

            xmlSerializer.Serialize(write, recordsRequest, ns);

            XmlDocument res = responseRecord(recordsRequest);

            using (MemoryStream ms = new MemoryStream())
            {
                xmlSerializer.Serialize(ms, recordsRequest, ns);
                ms.Position = 0;
                XmlReaderSettings settings = new XmlReaderSettings();
                settings.IgnoreWhitespace = true;

                using (var xtr = XmlReader.Create(ms, settings)) {
                    output = new XmlDocument();
                    output.Load(xtr);
                }
            }

            return(res);
        }