Пример #1
0
        /// <summary>
        /// Search Party  in database
        /// </summary>
        /// <param name="name"></param>
        ///
        public Parties searchPartyName(string name)
        {
            Parties party = null;

            if ("1".Equals(this.CheakParty(name.Trim())))
            {
                sqlConnection sql = sqlConnection.Instance;
                sql.sqlCommand("SearchParty");           //sql conection
                sql.InsertValstring("@partyName", name); //sending parameters
                party = new Parties(sql.GetData("SearchParty").Rows[0]);
            }
            return(party);
        }
 private void Serach_Click(object sender, EventArgs e)
 {
     try
     {
         Parties party = voter.searchPartyName(idName.Text);
         nameParty.Text = party.PartyName;
         sizeParty.Text = party.MembersSize.ToString();
         platform.Text  = party.Platform;
     }
     catch
     {
         MessageBox.Show("Not Exist such Name in System");
     }
 }
Пример #3
0
 /// <summary>
 /// The function calld when the user press on the button "search".
 /// This method using the function SerachParty.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Nbtn_Click(object sender, EventArgs e)
 {
     try
     {
         DataRow t     = manager.SerachParty(textBox4.Text); // Using the function searchParty, to find the relevent party.
         Parties party = new Parties(t);                     // Creating Party object
         //Show the party details on the screen
         textBox4.Text    = party.PartyName;
         textBox3.Text    = party.MembersSize.ToString();
         textBox2.Text    = party.Platform;
         textBox3.Enabled = true;
         textBox2.Enabled = true;
     }
     catch
     {
         MessageBox.Show("The party name not exist in the system");
     }
 }
Пример #4
0
        /// <summary>
        /// The Elections Menager updates the party details
        /// </summary>
        /// <param name="PartyName"></param> Party name
        /// <param name="membersSize"></param> size of the party
        /// <param name="platform"></param> Platform
        /// <returns></returns> The updated party
        public string UpdatePartyDetails(string PartyName, int membersSize, string platform)
        {
            Parties party1 = new Parties(PartyName, membersSize, platform); // Creating a new party object, with the current details

            return(party1.UpdateParty());                                   // Calling the function  UpdateParty in class Parties
        }
Пример #5
0
        /// <summary>
        /// This function allows Elections Manager to remove a new party from Parties DB (change 'Mode' to "flase").
        /// </summary>
        /// <returns></returns> Returns Result as int (1/0) if the action succeeded or not.
        public int removeParty(string partyName, Boolean mode)
        {
            Parties par = new Parties(partyName, mode);

            return(par.removeParty());
        }
Пример #6
0
        /// <summary>
        /// This function allows Elections Manager to create a new party to Parties DB.
        /// </summary>
        /// <returns></returns> Returns Result as int (1/0) if the action succeeded or not.
        public int newParty(string partyName, int memberSize, string platform)
        {
            Parties par = new Parties(partyName, memberSize, platform);

            return(par.newParty());
        }