private void BindVoteResultByPrefReport(int districtNo, string years)
    {
        DataTable dt  = new DataTable();
        VoteBll   obj = new VoteBll();

        obj.DistrictNo = districtNo;
        obj.Years      = years;

        dt = obj.GetVoteResultByPrefReport();
        if (dt.Rows.Count > 0)
        {
            btnExporttoExcel.Visible = true;
            lblMsg.Visible           = false;
            RadGrid4.Visible         = true;

            RadGrid4.DataSource = dt;
            RadGrid4.DataBind();
        }
        else
        {
            btnExporttoExcel.Visible = false;
            lblMsg.Visible           = true;
            RadGrid4.Visible         = false;
        }
    }
Пример #2
0
 public static Vote FromVoteBll(VoteBll voteBll)
 {
     return(new Vote
     {
         Value = voteBll.Value
     });
 }
    private void BindVoteResultByClubwise(int districtNo, string years)
    {
        DataTable dt  = new DataTable();
        VoteBll   obj = new VoteBll();

        obj.DistrictNo = districtNo;
        obj.Years      = years;

        dt = obj.GetVoteResultByClubwise();
        if (dt.Rows.Count > 0)
        {
            Session["AllClubs"] = districtNo;
            lblMsg.Visible      = false;
            rbtnSort.Visible    = true;
            RadGrid1.Visible    = true;
            RadGrid1.DataSource = dt;
            RadGrid1.DataBind();
        }
        else
        {
            lblMsg.Visible   = true;
            rbtnSort.Visible = false;
            RadGrid1.Visible = false;
        }
    }
    private void BindVotingResultDistrictWise(int electionId, int districtNo)
    {
        DataTable dt  = new DataTable();
        VoteBll   obj = new VoteBll();

        obj.ElectionId = electionId;
        obj.DistrictNo = districtNo;

        dt = obj.GetVotingResultDistrictWise();
        if (dt.Rows.Count > 0)
        {
            // btnExporttoExcel.Visible = true;
            // lblMsg.Visible = false;
            RadGrid1.Visible = true;

            RadGrid1.DataSource = dt;
            RadGrid1.DataBind();
        }
        else
        {
            // btnExporttoExcel.Visible = false;
            //  lblMsg.Visible = true;
            RadGrid1.Visible = false;
        }
    }
Пример #5
0
        public void TestToVoteBll()
        {
            var voteEntity = new VoteEntity
            {
                PartitionKey = VoteEntity.BuildPartitionkey(City, date),
                RowKey       = VoteEntity.BuildRowKey(id, Nickname),
                Value        = 5
            };

            VoteBll voteBll = VoteEntity.ToVoteBll(voteEntity);

            Assert.AreEqual(5, voteBll.Value);
        }
Пример #6
0
        public void TestFromVoteBll()
        {
            var voteBll = new VoteBll
            {
                Value = 5
            };

            VoteEntity voteEntity = VoteEntity.FromVoteBll(City, date, id, Nickname, voteBll);

            Assert.AreEqual(string.Format("{0};{1}", City, date.ToString("yyyy-MM-dd")), voteEntity.PartitionKey);
            Assert.AreEqual(string.Format("VOTE;{0};{1}", id, Nickname), voteEntity.RowKey);
            Assert.AreEqual(5, voteEntity.Value);
        }
Пример #7
0
        private async Task <HttpResponseMessage> ExecuteGetAsync(params object[] parameters)
        {
            var city     = (string)parameters[0];
            var date     = (string)parameters[1];
            var newsId   = (string)parameters[2];
            var nickname = (string)parameters[3];

            await this.ValidateGetOperation(city, date, newsId, nickname);

            VoteBll vote = await this.voteRepository.GetVote(city, DateTime.Parse(date), Guid.Parse(newsId), nickname);

            HttpResponseMessage response = this.Request.CreateResponse(HttpStatusCode.OK, Vote.FromVoteBll(vote));

            return(response);
        }
    private void BindVoteResultByPref1(int electionId)
    {
        DataTable dt  = new DataTable();
        VoteBll   obj = new VoteBll();

        obj.ElectionId = electionId;
        // obj.Years = years;

        dt = obj.GetVoteResultByPref1();
        if (dt.Rows.Count > 0)
        {
            lblMessage.Visible = false;
            RadGrid1.Visible   = true;

            RadGrid1.DataSource = dt;
            RadGrid1.DataBind();
        }
        else
        {
            lblMessage.Visible = true;
            RadGrid1.Visible   = false;
        }
    }
Пример #9
0
    private void SubmitVote(int candidateId, string candidate)
    {
        try
        {
            int voterId = 0;
            voterId = int.Parse(Session["VoterId"].ToString().Trim());
            string email = Session["EmailId"].ToString().Trim();

            /************Code for find IP address of user's machine**********/
            string ipaddress;
            ipaddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            if (ipaddress == "" || ipaddress == null)
            {
                ipaddress = Request.ServerVariables["REMOTE_ADDR"];
            }
            /***************************************************************/

            VoteBll obj = new VoteBll();
            obj.VoterId     = voterId;
            obj.CandidateId = candidateId;
            obj.Ipaddress   = ipaddress;

            int i = obj.SubmitVote();

            if (i > 0)
            {
                SendMailtoClient(email, candidate, ipaddress);
                Session.Abandon();
                //  showmsg("You Have Successfully Submited Your Vote.", "Default.aspx");

                lblMsg.Text = "You Have Successfully Submited Your Vote.";
                showmsg("You Have Successfully Submited Your Vote.");
            }
        }
        catch (Exception ex)
        { showmsg("Server Error: Please Try Again!", "Login.aspx"); }
    }
Пример #10
0
    private void BindVoteResultByNonePref2(int districtNo, string years)
    {
        DataTable dt  = new DataTable();
        VoteBll   obj = new VoteBll();

        obj.DistrictNo = districtNo;
        obj.Years      = years;

        dt = obj.GetVoteResultByNonePref2();
        if (dt.Rows.Count > 0)
        {
            lblPref2Head.Visible = true;
            lblMsg.Visible       = false;
            RadGrid1.Visible     = true;
            RadGrid1.DataSource  = dt;
            RadGrid1.DataBind();
        }
        else
        {
            lblPref2Head.Visible = false;
            lblMsg.Visible       = true;
            RadGrid1.Visible     = false;
        }
    }
Пример #11
0
 public async Task UpdateVote(string city, DateTime date, Guid id, string nickname, VoteBll votingBll)
 {
     await this.tableTableStore.UpdateTableEntity(VoteEntity.FromVoteBll(city, date, id, nickname, votingBll));
 }
Пример #12
0
 public static VoteEntity FromVoteBll(string city, DateTime date, Guid id, string username, VoteBll voteBll)
 {
     return(new VoteEntity
     {
         PartitionKey = VoteEntity.BuildPartitionkey(city, date),
         RowKey = VoteEntity.BuildRowKey(id, username),
         Value = voteBll.Value
     });
 }