/// <summary>
 /// calculates votes amount ,in a given kalpi, for a given party
 /// </summary>
 /// <param name="partyName">name of given party</param>
 /// <param name="kalpiCode">code of given kalpi</param>
 /// <returns></returns>
 private int partyVoteNum(string partyName, string kalpiCode)
 {
     con.sqlCommand("IsInVoteDB");
     con.InsertValstring("@partyName", partyName);
     con.InsertValstring("@kalpiCode", kalpiCode);
     return(int.Parse(con.getVal("Result").ToString()));
 }
Beispiel #2
0
 public int addNewVoterToKalpi(string kalpiCode)
 {
     con.sqlCommand("addVoterToKalpi");            //updateVoterKalpi SQL query for add exist voter to the kalpi.
     con.InsertValstring("@ID", Id);               //ID for query check.
     con.InsertValstring("@kalpiCode", KalpiCode); //Change kalpiCode to kalpi manager code.
     return(int.Parse(con.getVal("Result").ToString()));
 }
Beispiel #3
0
 /// <summary>
 /// The function removes the member from the Data Base.
 /// </summary>
 /// <returns></returns> If the reomving succeseed or not
 public string RemoveMember()
 {
     con.sqlCommand("RemovePartyMember");
     con.InsertValint("@member_code", MemberCode);
     con.InsertValstring("@mode", Mode.ToString());
     return(con.getVal("@Result").ToString());
 }
Beispiel #4
0
 /// <summary>
 /// The function updates the party details.
 /// </summary>
 /// <returns></returns> Returns if the update succseed or not
 public string UpdateParty()
 {
     con.sqlCommand("UpdatePartyDetails");
     con.InsertValstring("@partyName", PartyName.Trim());
     con.InsertValint("@member_size", membersSize);
     con.InsertValstring("@platform", platform.Trim());
     return(con.getVal("@Result"));
 }
Beispiel #5
0
        //Cheacking name of parties

        public string CheakParty(string name)
        {
            sqlConnection sql = sqlConnection.Instance; //sql conection

            sql.sqlCommand("CheakParty");               //sql Procedure
            sql.InsertValstring("@partyName", name);    //sending parameters
            return(sql.getVal("@Result"));
        }
Beispiel #6
0
        private string RemoveVoter(string id)
        {
            sqlConnection con = sqlConnection.Instance;

            con.sqlCommand("RemoveVoter");
            con.InsertValstring("@id", id);
            return(con.getVal("@result"));
        }
        public int CountMandate(string partyName)
        {
            con.sqlCommand("CountMandate");
            con.InsertValstring("@partyName", partyName);
            int res = int.Parse(con.getVal("Result").ToString());

            return(res / 3);
        }
        public string addKalpiToVoter(String id, String kalpiCode)
        {
            sqlConnection p1 = sqlConnection.Instance;   //sql conection

            p1.sqlCommand("addKalpiToVoter");            //sql Procedure
            p1.InsertValstring("@id", id);               //sending parameters
            p1.InsertValstring("@kalpiCode", kalpiCode); //sending parameters
            return(p1.getVal("@Result"));                //Updating
        }
Beispiel #9
0
        private string UpdateLastDate(string id)
        {
            sqlConnection con = sqlConnection.Instance;

            con.sqlCommand("UpdateLastDate");
            con.InsertValstring("@id", id);
            con.InsertValDate("@lastdate", DateTime.Now.Date);
            return(con.getVal("@result"));
        }
Beispiel #10
0
        public int changeKalpiVote(string kalpiC)
        {
            sqlConnection con = sqlConnection.Instance;

            con.sqlCommand("updateVoterKalpi");
            con.InsertValstring("@prev_kalpi", kalpiCode);
            con.InsertValstring("@kalpiCode", kalpiC);
            con.InsertValstring("@id", id);
            return(int.Parse(con.getVal("res").ToString()));
        }
 public int addNewKalpi(Kalpi kalpi)
 {
     con.sqlCommand("addNewKalpi");
     con.InsertValstring("@kalpiCode", kalpi.KalpiCode);
     con.InsertValstring("@kalpiName", kalpi.KalpiName);
     con.InsertValstring("@address", kalpi.Address);
     con.InsertValstring("@city", kalpi.City);
     con.InsertValstring("@area", this.Area);
     con.InsertValint("@maxVoters", kalpi.MaxVoters);
     return(int.Parse(con.getVal("Result").ToString()));
 }
        //the procedur of searching invalid kalpies
        private void butt_Click(object sender, EventArgs e)
        {
            comBox1.Text = "Select";             //show at first "select"
            con.sqlCommand("SearchKalpiByCity"); //the procedure
            con.InsertValstring("@city", voter.City);
            String result = con.getVal("@Result");

            if (result.Equals("1"))
            {
                con.sqlCommand("SearchInvalidKalpies"); //the procedure
                con.InsertValstring("@city", voter.City);
                DataTable KalpiCode = con.GetData("SearchInvalidKalpies");

                foreach (DataRow code in KalpiCode.Rows)
                {
                    comBox1.Items.Add(code["kalpiCode"].ToString()); //add kalpies codes
                }
            }
            else
            {
                MessageBox.Show("There are no kalpies with invalid access");
            }
        }
Beispiel #13
0
        public string UpdateVoterDetails(string Id, string fname, string lName, string addres, string area, string city, string tell)
        {
            sqlConnection p1 = sqlConnection.Instance;     //sql conection

            p1.sqlCommand("UpdateVoterDetails");           //sql Procedure
            p1.InsertValstring("@Id", Id);                 //sending parameters
            p1.InsertValstring("@fname", fname.Trim());    //sending parameters
            p1.InsertValstring("@lname", lName.Trim());    //sending parameters
            p1.InsertValstring("@address", addres.Trim()); //sending parameters
            p1.InsertValstring("@area", area.Trim());      //sending parameters
            p1.InsertValstring("@city", city.Trim());      //sending parameters
            p1.InsertValstring("@tell", tell.Trim());      //sending parameters
            return(p1.getVal("@Result").ToString());
            //   p1.NonQueryE(); //Updating
        }
 //Update worker to Commissioner
 public string DeleteWorker(Voter worker)
 {
     try
     {
         sqlConnection con = sqlConnection.Instance;
         con.sqlCommand("RemoveWorker");
         con.InsertValstring("@id", worker.Id);
         string value = con.getVal("@Result");
         return(value);
     }
     catch
     {
         return("Data Base id Filed");
     }
 }
Beispiel #15
0
 public int countWhiteNots(KalpiManager kalpiManager)
 {
     try
     {
         int           count = 0;
         sqlConnection con   = sqlConnection.Instance;
         con.sqlCommand("getNumOfWhiteNotes");
         con.InsertValstring("@kalpiCode", kalpiManager.KalpiCode);
         count = int.Parse(con.getVal("@Result"));
         return(count);
     }
     catch
     {
         return(0);
     }
 }
        public string updateAreaManager(string id, string name, string lastname, string username, string password, DateTime birthDay, string addres, string area, string city, string tell)
        {
            sqlConnection con = sqlConnection.Instance;

            con.sqlCommand("updateAreaManager");
            con.InsertValstring("@idVoter", id);
            con.InsertValstring("@name", name);
            con.InsertValstring("@lastname", lastname);
            con.InsertValstring("@username", username);
            con.InsertValstring("@password", password);
            con.InsertValDate("@birthDay", birthDay);
            con.InsertValstring("@address", addres);
            con.InsertValstring("@area", area);
            con.InsertValstring("@city", city);
            con.InsertValstring("@tell", tell);
            return(con.getVal("@Result"));
        }
        //Update worker to Commissioner
        public string updateWorker(string id, string kalpiCode, string name, string lastname, string username, string password, string permission, DateTime birthDay, string addres, string area, string city, string tell)
        {
            Voter         worker = new Voter(id, kalpiCode, name, lastname, username, password, permission, birthDay, addres, area, city, tell, "Commissioner", true, false, true);
            sqlConnection con    = sqlConnection.Instance;

            con.sqlCommand("updateWorker");
            con.InsertValstring("@idVoter", worker.Id);
            con.InsertValstring("@kalpiCode", worker.KalpiCode);
            con.InsertValstring("@name", worker.FName);
            con.InsertValstring("@lastname", worker.LName);
            con.InsertValstring("@username", worker.username);
            con.InsertValstring("@password", worker.Passowrd);
            con.InsertValstring("@permission", worker.Permission);
            con.InsertValstring("@address", worker.Address);
            con.InsertValstring("@area", worker.Area);
            con.InsertValstring("@city", worker.City);
            con.InsertValDate("@birthDay", worker.DOB);
            con.InsertValstring("@tell", worker.Tell);
            return(con.getVal("@Result"));
        }
        private void button1_Click(object sender, EventArgs e)
        {
            comboBox1.Text = "Select";                       //show at first "select"
            con.sqlCommand("SearchKalpiesByArea");           //the procedure
            con.InsertValstring("@area", area_manager.Area); //pass the area manager area
            String result = con.getVal("@Result");

            if (result.Equals("1"))
            {
                con.sqlCommand("ReturnKalpiCode"); //the procedure
                DataTable KalpiCode = con.GetData("ReturnKalpiCode");

                foreach (DataRow code in KalpiCode.Rows)
                {
                    comboBox1.Items.Add(code["kalpiCode"].ToString()); //add kalpies codes
                }
            }
            else
            {
                MessageBox.Show("There are no kalpies who don't hava manager");
            }
        }