示例#1
0
 public changePass(Voter vot)
 {
     this.vot = vot;
     InitializeComponent();
 }
 public SearchPartyMemberByName(Voter voter)
 {
     InitializeComponent();
     this.voter     = voter;
     comboBox1.Text = "Select Name From List";
 }
示例#3
0
 public VoterMenu(Voter temp)
 {
     InitializeComponent();
     voter = temp;
 }
示例#4
0
 public WatchKalpi(Voter v)
 {
     InitializeComponent();
     voter = v;
     con   = sqlConnection.Instance;
 }
示例#5
0
 public showDetails(Voter vot)
 {
     InitializeComponent();
     this.Text = "Personal Details: " + vot.FName;
     show(vot);
 }
 public SearchInvaildAccess(Voter v)
 {
     InitializeComponent();
     voter = v;
     con   = sqlConnection.Instance;
 }
示例#7
0
        private void Form1_Load(object sender, EventArgs e)
        {
            using (Login login = new Login())              //open login window.
            {
                if (login.ShowDialog() == DialogResult.OK) //if all details of the user are matched to data base.
                {
                    voter = (Voter)login.get();
                    var factory = new FactroryVoter() as ICreateVoters; //factory that creates voters
                    voter = factory.createVoter(voter);                 //create a user according to permission
                    if (voter.LastConnection.AddMonths(2) < DateTime.Now.Date)
                    {
                        try
                        {
                            String val = RemoveVoter(voter.Id);
                            if (val == "1")
                            {
                                MessageBox.Show("The user can not enter to system , due the fact that the user not enter to system more then 2 months ");
                                this.Close();
                            }
                            else
                            {
                                this.Close();
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                    else if (Math.Abs((voter.LastConnection - DateTime.Now.Date).TotalDays) <= 61 && Math.Abs((voter.LastConnection - DateTime.Now.Date).TotalDays) >= 29)
                    {
                        using (changePass changepass = new changePass(voter))
                        {
                            if (!(changepass.ShowDialog() == DialogResult.OK))
                            {
                                this.Close();
                            }
                            else
                            {
                                UpdateLastDate(voter.Id);
                            }
                        }
                    }
                    else
                    {
                        //update date lsat
                        try
                        {
                            UpdateLastDate(voter.Id);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                            this.Close();
                        }
                    }
                }
            }

            try
            {
                OpenMenu command = new OpenMenu(); //create a new command, that opens user menues
                command.execute(voter);            //open the correct menu of current user
            }
            catch
            {
            }
            finally
            {
                this.Close();
            }
        }
示例#8
0
 /// <summary>
 /// copy constructor
 /// </summary>
 /// <param name="v">another voter</param>
 public KalpiManager(Voter v)
     : base(v)
 {
     con = sqlConnection.Instance;
 }