private void button4_Click(object sender, System.EventArgs e) { IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject(typeof(IMyRemoteObject), "http://localhost:1234/MyRemoteObject.soap"); string a = "a"; obj.history(a); // label4.Text = ("HISTORY"); label4.Visible = true; dataGridView2.Visible = true; string conn = "server=localhost;user=jon;password=jon;database=print;"; MySqlConnection myconn = new MySqlConnection(conn); string sql = "SELECT * FROM file2"; MySqlDataAdapter da = new MySqlDataAdapter(sql, myconn); DataTable dt = new DataTable(); da.Fill(dt); if ((dt == null) || (dt.Rows.Count == 0)) { dataGridView2.Visible = false; } else { dataGridView2.DataSource = dt; } myconn.Close(); t1.Text = "0"; }
private void button1_Click(object sender, EventArgs e) { string pass = t1.Text.ToString(); if (pass == "admin") { string MyConString = "SERVER=localhost;" + "DATABASE=print;" + "UID=jon;" + "PASSWORD=jon;"; MySqlConnection con = new MySqlConnection(MyConString); MySqlCommand cmd = new MySqlCommand("TRUNCATE table file2"); cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close(); this.Close(); MessageBox.Show("History Deleted"); IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject(typeof(IMyRemoteObject), "http://localhost:1234/MyRemoteObject.soap"); string a = "a"; obj.erase(a); } else { MessageBox.Show("Access Denied"); this.Close(); } }
private void button2_Click(object sender, System.EventArgs e) { label3.Text = ("Printing"); timer3.Start(); IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject(typeof(IMyRemoteObject), "http://localhost:1234/MyRemoteObject.soap"); string a = "a"; obj.resume(a); }
private void button1_Click(object sender, System.EventArgs e) { label3.Text = ("Paused"); timer3.Stop(); IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject(typeof(IMyRemoteObject), "http://localhost:1234/MyRemoteObject.soap"); string a = "a"; obj.SetValue(a); }
private void button8_Click_1(object sender, EventArgs e) { label3.Text = ("Paused"); timer3.Stop(); IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject(typeof(IMyRemoteObject), "http://localhost:1234/MyRemoteObject.soap"); string a = "a"; obj.SetValue(a); Form3 f3 = new Form3(); f3.ShowDialog(); }
static void Main(string[] args) { DateTime start = System.DateTime.Now; HttpChannel channel = new HttpChannel(); ChannelServices.RegisterChannel(channel); IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject( typeof(IMyRemoteObject), "http://localhost:1234/MyRemoteObject.soap"); Console.WriteLine("Client.Main(): Reference to rem.obj. acquired"); Console.WriteLine("Client.Main(): Will call setValue(42)"); SetValueDelegate svDelegate = new SetValueDelegate(obj.SetValue); IAsyncResult svAsyncres = svDelegate.BeginInvoke(42, null, null); Console.WriteLine("Client.Main(): Invocation done"); Console.WriteLine("Client.Main(): Will call getName()"); GetNameDelegate gnDelegate = new GetNameDelegate(obj.GetName); IAsyncResult gnAsyncres = gnDelegate.BeginInvoke(null, null); Console.WriteLine("Client.Main(): Invocation done"); Console.WriteLine("Client.Main(): EndInvoke for setValue()"); svDelegate.EndInvoke(svAsyncres); Console.WriteLine("Client.Main(): EndInvoke for getName()"); String name = gnDelegate.EndInvoke(gnAsyncres); Console.WriteLine("Client.Main(): received name {0}", name); Console.WriteLine("Client.Main(): Will now read value"); int tmp = obj.GetValue(); Console.WriteLine("Client.Main(): New server side value {0}", tmp); DateTime end = System.DateTime.Now; TimeSpan duration = end.Subtract(start); Console.WriteLine("Client.Main(): Execution took {0} seconds.", duration.Seconds); Console.ReadLine(); }
protected void Button3_Click(object sender, EventArgs e) { string name1 = (string)(Session["First"]); string MyConString = "SERVER=skyynet.cloudapp.net;" + "DATABASE=print;" + "UID=jon;" + "PASSWORD=jon;"; MySqlConnection con = new MySqlConnection(MyConString); MySqlCommand cmd = new MySqlCommand("DELETE FROM file where username='******'"); cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close(); string sql = "Select * from file where username='******'"; string MyConString1 = "SERVER=skyynet.cloudapp.net;" + "DATABASE=print;" + "UID=jon;" + "PASSWORD=jon;"; MySqlConnection connection = new MySqlConnection(MyConString1); MySqlCommand fill = new MySqlCommand(sql, connection); DataTable dt = new DataTable(); MySqlDataAdapter da = new MySqlDataAdapter(fill); da.Fill(dt); GridView1.DataSource = dt; GridView1.DataBind(); connection.Close(); //show in 2nd grid string sql1 = "Select name as 'Queue',username from file"; string MyConString2 = "SERVER=skyynet.cloudapp.net;" + "DATABASE=print;" + "UID=jon;" + "PASSWORD=jon;"; MySqlConnection connection1 = new MySqlConnection(MyConString2); MySqlCommand fill1 = new MySqlCommand(sql1, connection1); DataTable dt1 = new DataTable(); MySqlDataAdapter da1 = new MySqlDataAdapter(fill1); da1.Fill(dt1); GridView2.DataSource = dt1; GridView2.DataBind(); connection.Close(); // IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject( typeof(IMyRemoteObject), "http://localhost:1234/MyRemoteObject.soap"); string new1 = IPAdd; obj.ckill(IPAdd); }
private void button8_Click(object sender, EventArgs e) { string job = t1.Text.ToString(); string MyConString = "SERVER=localhost;" + "DATABASE=print;" + "UID=jon;" + "PASSWORD=jon;"; MySqlConnection con = new MySqlConnection(MyConString); MySqlCommand cmd = new MySqlCommand("DELETE FROM file where name='" + job + "'"); cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close(); this.Close(); IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject(typeof(IMyRemoteObject), "http://localhost:1234/MyRemoteObject.soap"); string a = "a"; obj.sdelete(job); }
private void button5_Click(object sender, System.EventArgs e) { try { decimal money = 0; money = decimal.Parse(t1.Text); dataGridView2.Visible = true; dataGridView2.DataSource = null; label4.Text = ("COST CALULATOR"); label4.Visible = true; string conn = "server=localhost;user=jon;password=jon;database=print;"; MySqlConnection myconn = new MySqlConnection(conn); string sql = "SELECT username,COUNT(username) as 'Jobs Sent to Server',COUNT(username)*" + money + " as 'Cost in Dollars' FROM file2 GROUP BY username"; MySqlDataAdapter da = new MySqlDataAdapter(sql, myconn); DataTable dt = new DataTable(); da.Fill(dt); if ((dt == null) || (dt.Rows.Count == 0)) { dataGridView2.Visible = false; } else { IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject(typeof(IMyRemoteObject), "http://localhost:1234/MyRemoteObject.soap"); string a = money.ToString(); obj.pause(a); dataGridView2.DataSource = dt; } myconn.Close(); t1.Text = "0"; }//try catch (Exception) { MessageBox.Show("No Strings"); t1.Text = "0"; } }
static void Main(string[] args) { HttpChannel channel = new HttpChannel(); ChannelServices.RegisterChannel(channel); IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject( typeof(IMyRemoteObject), "http://localhost:1234/MyRemoteObject.soap"); Console.WriteLine("Client.Main(): Reference to rem.obj. acquired"); int tmp = obj.GetValue(); Console.WriteLine("Client.Main(): Original server side value: {0}", tmp); Console.WriteLine("Client.Main(): Will set value to 42"); obj.SetValue(42); tmp = obj.GetValue(); Console.WriteLine("Client.Main(): New server side value {0}", tmp); Console.ReadLine(); }
static void Main(string[] args) { DateTime start = System.DateTime.Now; HttpChannel channel = new HttpChannel(); ChannelServices.RegisterChannel(channel); IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject( typeof(IMyRemoteObject), "http://localhost:1234/MyRemoteObject.soap"); Console.WriteLine("Client.Main(): Reference to rem.obj. acquired"); Console.WriteLine("Client.Main(): Will set value to 42"); obj.SetValue(42); Console.WriteLine("Client.Main(): Will now read value"); int tmp = obj.GetValue(); Console.WriteLine("Client.Main(): New server side value {0}", tmp); Console.WriteLine("Client.Main(): Will call getName()"); String name = obj.GetName(); Console.WriteLine("Client.Main(): received name {0}", name); DateTime end = System.DateTime.Now; TimeSpan duration = end.Subtract(start); Console.WriteLine("Client.Main(): Execution took {0} seconds.", duration.Seconds); Console.ReadLine(); }
static void Main(string[] args) { HttpChannel channel = new HttpChannel(); ChannelServices.RegisterChannel(channel); IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject( typeof(IMyRemoteObject), "http://localhost:1234/MyRemoteObject.soap"); Console.WriteLine("Client.Main(): Reference to rem.obj. acquired"); Console.WriteLine("Client.Main(): Will call setValue(42)"); try { obj.SetValue(42); Console.WriteLine("Client.Main(): Value successfully set."); } catch (Exception e) { Console.WriteLine("Client.Main(): EXCEPTION.\n{0}", e.Message); } // wait for keypress Console.ReadLine(); }
protected void Button1_Click1(object sender, EventArgs e) { string name1 = (string)(Session["First"]); if (FileUpload1.HasFile) { Label1.Text = (""); try { if (FileUpload1.PostedFile.ContentLength < 1512000) { string fileExt = System.IO.Path.GetExtension(FileUpload1.FileName); filename = Path.GetFileName(FileUpload1.FileName); FileUpload1.SaveAs(Server.MapPath("~/upload/") + name1 + "--" + filename); newname = filename; Label1.Text = FileUpload1.FileName + " sent to Print Server"; //add to DB string MyConString = "SERVER=skyynet.cloudapp.net;" + "DATABASE=print;" + "UID=jon;" + "PASSWORD=jon;"; MySqlConnection con = new MySqlConnection(MyConString); //MySqlConnection con1 = new MySqlConnection(MyConString); MySqlCommand cmd = new MySqlCommand("INSERT INTO file(name, ip,username) VALUES('" + newname + "', '" + IPAdd + "','" + name1 + "')"); MySqlCommand cmd1 = new MySqlCommand("INSERT INTO file2(name, ip,username) VALUES('" + newname + "', '" + IPAdd + "', '" + name1 + "')"); cmd.Connection = con; cmd1.Connection = con; con.Open(); //con1.Open(); cmd.ExecuteNonQuery(); cmd1.ExecuteNonQuery(); con.Close(); //show in grid string sql = "Select * from file where username='******'"; string MyConString1 = "SERVER=skyynet.cloudapp.net;" + "DATABASE=print;" + "UID=jon;" + "PASSWORD=jon;"; MySqlConnection connection = new MySqlConnection(MyConString1); MySqlCommand fill = new MySqlCommand(sql, connection); DataTable dt = new DataTable(); MySqlDataAdapter da = new MySqlDataAdapter(fill); da.Fill(dt); GridView1.DataSource = dt; GridView1.DataBind(); connection.Close(); //show in 2nd grid string sql1 = "Select name as 'Queue', username from file"; string MyConString2 = "SERVER=skyynet.cloudapp.net;" + "DATABASE=print;" + "UID=jon;" + "PASSWORD=jon;"; MySqlConnection connection1 = new MySqlConnection(MyConString2); MySqlCommand fill1 = new MySqlCommand(sql1, connection1); DataTable dt1 = new DataTable(); MySqlDataAdapter da1 = new MySqlDataAdapter(fill1); da1.Fill(dt1); GridView2.DataSource = dt1; GridView2.DataBind(); connection.Close(); }// ist if else { Label1.Text = "File maximum size over Kb"; } } catch (Exception exc) { Label1.Text = "The file could not be uploaded. The following error occured: " + exc.Message; } } else //check file { Label1.Text = "Please Choose a File"; } try { //send to server IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject( typeof(IMyRemoteObject), "http://localhost:1234/MyRemoteObject.soap"); string new1 = IPAdd; obj.Cvalue(new1, filename); } catch (Exception) { string alt = "PrintServer is not Running"; ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + alt + "');", true); Label1.Text = "Check PrintServer is Running"; } }//button