This class uses singleton pattern;
コード例 #1
0
ファイル: Client.cs プロジェクト: kborling/.Net
        }// End Client EVC

        public int Match(Client c)
        {

            int total = 0;
            // Prevents Client from being null, Clients Matching with themselves, and only matching with opposite sex
            if (c == null || this.ID == c.ID || this.Sex == c.Sex)
                return 0;
            // Max Interest Points = 3
            if (this.Hobby == c.Hobby)
                total += 3;
            if (this.Other == c.Other)
                total += 2;
            if (this.Hobby == c.Other)
                total += 1;
            // Max Color Point = 1
            if (this.Color == c.Color)
                total += 1;
            // Max Age Points = 5
            if (this.Age / c.Age == 1)
                total += 5;
            if (this.Age - c.Age == 1 || c.Age - this.Age == 1)
                total += 4;
            if (this.Age - c.Age == 2 || c.Age - this.Age == 2)
                total += 3;
            if (this.Age - c.Age == 3 || c.Age - this.Age == 3)
                total += 2;
            if (this.Age - c.Age == 4 || c.Age - this.Age == 4)
                total += 1;

            return total;
        }// End Match Tool
コード例 #2
0
ファイル: VirtSettings.cs プロジェクト: bemk/rhc
 public VirtSettings(VirtBike b, Client c)
 {
     InitializeComponent();
     bike = b;
     this.c = c;
     setValues();
 }
コード例 #3
0
ファイル: Clients.cs プロジェクト: kborling/.Net
        public Clients(String database)
        {
            ClientList = new ArrayList();
 
            OleDbConnection conn = new OleDbConnection();
            conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + database;
            conn.Open();
            OleDbCommand cmd = new OleDbCommand("SELECT * FROM Clients ORDER BY LastName, FirstName", conn);
            OleDbDataReader read = cmd.ExecuteReader();
            while (read.Read())
                {
                    Client c = new Client(read["FirstName"].ToString(),
                    read["LastName"].ToString(),
                    read["Sex"].ToString(),
                    int.Parse(read["Age"].ToString()),
                    read["FavoriteColor"].ToString(),
                    read["Hobby1"].ToString(),
                    read["Hobby2"].ToString(),
                    read["Photo"].ToString(),
                    int.Parse(read["ClientID"].ToString()));

                    ClientList.Add(c);
                }
                read.Close();
                conn.Close();
            
        }// End EVC
コード例 #4
0
ファイル: Chart.cs プロジェクト: bemk/rhc
 public Chart(Client c)
 {
     this.c = c;
     SetStyle(ControlStyles.UserPaint, true);
     SetStyle(ControlStyles.AllPaintingInWmPaint, true);
     SetStyle(ControlStyles.DoubleBuffer, true);
     oldPoint = new Point(c.GetPanel1().Width, (int)-(25 / 2.3));
     UpdateStyles();
     this.DoubleBuffered = true;
 }
コード例 #5
0
 public Client(string login, string password, string host)
 {
     this.login = login;
     this.password = password;
     this.host = host;
     manager = new RedmineManager(host, login, password);
     cacheissue = this.GetTotalIssue();
     totalissue = this.GetTotalIssue();
     totalproject = this.GetTotalProject();
     projects = this.GetProjects();
     _instance = this;
 }
コード例 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            DbClients db = new DbClients();

            WindowsFormsApplication1.Client w = new WindowsFormsApplication1.Client();
            try
            {
                w.Id        = int.Parse(textBox1.Text);
                w.FirstName = textBox3.Text;
                w.LastName  = textBox2.Text;
                w.Address   = textBox4.Text;
                w.Phone     = textBox5.Text;
            }
            catch (Exception exception)
            {
                MessageBox.Show("Invalid parameters", "Error");
                return;
            }
            db.InsertClient(w);
            MessageBox.Show("add workstation Success");
        }
コード例 #7
0
ファイル: MatchForm.cs プロジェクト: kborling/.Net
        public MatchForm(Client fish, Client shark1, Client shark2, Client shark3)
        {
            InitializeComponent();

            Image f, s1, s2, s3;

            f = (Image)(Bitmap)(DatingForm.resources.GetObject(DatingForm.photo));


            s1 = (Image)(Bitmap)(DatingForm.resources.GetObject(shark1.Photo + "t"));
            s2 = (Image)(Bitmap)(DatingForm.resources.GetObject(shark2.Photo + "t"));
            s3 = (Image)(Bitmap)(DatingForm.resources.GetObject(shark3.Photo + "t"));
            
            Bitmap img = (Bitmap)f;
            Bitmap img2 = (Bitmap)s1;
            Bitmap img3 = (Bitmap)s2;
            Bitmap img4 = (Bitmap)s3;


            // Client
            fishy.Image = img;

            // Matches
            sharky1.Image = img2;
            shark1Text.Text = "Best Match:\r\n" + shark1.Fname + " " + shark1.Lname;
            sharky2.Image = img3;
            shark2Text.Text = "Great Match:\r\n" + shark2.Fname + " " + shark2.Lname;
            sharky3.Image = img4;
            shark3Text.Text = "Good Match:\r\n" + shark3.Fname + " " + shark3.Lname;


            System.Threading.ThreadPool.QueueUserWorkItem((o) =>
            {
                sharky1.Image = img2;
            });
            ClientMatchStatus.Text = "Here are the top 3 matches for " + fish.Fname + " " + fish.Lname + " based on age and common interest!";
        }
コード例 #8
0
ファイル: Clients.cs プロジェクト: kborling/.Net
 public void AddAClient(Client p_client)
 {
     ClientList.Add(p_client);
     return;
 }
コード例 #9
0
 private void RLogin_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         teststruct t = (teststruct)e.Argument;
         client = new Client(t.login, t.password, t.host);
     }
     catch
     {
         e.Result = "InvalidLogin";
     }
 }