ndex.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class index : Form { public index() { InitializeComponent(); } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { user_login user = new user_login(); user.Show(); } private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { admin_login admin = new admin_login(); admin.Show(); } private void label2_Click(object sender, EventArgs e) { } private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { register reg = new register(); reg.Show(); } private void panel1_Paint(object sender, PaintEventArgs e) { } private void index_Load(object sender, EventArgs e) { } } } User Login.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace WindowsFormsApplication1 { public partial class user_login : Form { public user_login() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management"); Con.Open(); SqlCommand cmd = new SqlCommand("Select * from reg WHERE uname='"+textBox1.Text+"' and pass='"+textBox2.Text+"' ",Con); SqlDataReader dr = cmd.ExecuteReader(); //String a = textBox1.Text; //String b = textBox2.Text; if (dr.HasRows) { MessageBox.Show("Success"); main m = new main(); m.Show(); this.Hide(); } else { MessageBox.Show("Failed"); } } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { register reg = new register(); reg.Show(); this.Hide(); } } } Register.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace WindowsFormsApplication1 { public partial class register : Form { public register() { InitializeComponent(); } private void label2_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management"); Con.Open(); if (textBox1.Text != "" && textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" && textBox7.Text != "" && textBox8.Text != "" && textBox9.Text != "" && textBox10.Text != "") { SqlCommand cmd6 = new SqlCommand(@"insert into reg values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox10.Text + "')", Con); int x = cmd6.ExecuteNonQuery(); if (x > 0) { MessageBox.Show("Registered Successfully"); main m = new main(); m.Show(); this.Hide(); } else { MessageBox.Show("Not Registered"); } } else { MessageBox.Show("Please fill all the details"); } } private void textBox1_TextChanged(object sender, EventArgs e) { } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { user_login log = new user_login(); log.Show(); this.Hide(); } } } Main.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class main : Form { public main() { InitializeComponent(); } private void label1_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { birthday bd = new birthday(); bd.Show(); } private void button5_Click(object sender, EventArgs e) { fam_reunion fam = new fam_reunion(); fam.Show(); } private void button2_Click(object sender, EventArgs e) { new_year nw = new new_year(); nw.Show(); } private void button3_Click(object sender, EventArgs e) { musical_concert mc = new musical_concert(); mc.Show(); } private void button4_Click(object sender, EventArgs e) { wedding wd = new wedding(); wd.Show(); } private void button6_Click(object sender, EventArgs e) { baby_shower bs = new baby_shower(); bs.Show(); } } } Birthday Party.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace WindowsFormsApplication1 { public partial class birthday : Form { public birthday() { InitializeComponent(); } private void label4_Click(object sender, EventArgs e) { } private void label5_Click(object sender, EventArgs e) { } private void birthday_Load(object sender, EventArgs e) { label12.Text = DateTime.Now.ToLongTimeString(); label13.Text = DateTime.Now.ToLongDateString(); } private void label12_Click(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { main m=new main(); m.Show(); this.Hide(); } private void button1_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management"); Con.Open(); if(textBox1.Text!="" &&textBox1.Text!="" &&textBox2.Text!=""&&dateTimePicker1.Text!=""&& textBox3.Text!="" &&textBox4.Text!=""&& textBox5.Text!="" &&textBox6.Text!=""&&textBox7.Text!="" && comboBox1.Text!="" ) { SqlCommand cmd = new SqlCommand(@"insert into birthday values('" + textBox1.Text + "','" + textBox2.Text + "','" + dateTimePicker1.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + comboBox1.Text + "')", Con); int x = cmd.ExecuteNonQuery(); if (x > 0) { MessageBox.Show("Registered Successfully"); } else { MessageBox.Show("Not Registered"); } } else{ MessageBox.Show("Please fill all the details"); } } } } New Year.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace WindowsFormsApplication1 { public partial class new_year : Form { public new_year() { InitializeComponent(); } private void new_year_Load(object sender, EventArgs e) { label12.Text = DateTime.Now.ToLongTimeString(); label13.Text = DateTime.Now.ToLongDateString(); } private void button1_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management"); Con.Open(); if (textBox1.Text != "" && textBox1.Text != "" && textBox2.Text != "" && dateTimePicker1.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" && textBox7.Text != "" && comboBox1.Text != "") { SqlCommand cmd3 = new SqlCommand(@"insert into new_year values('" + textBox1.Text + "','" + textBox2.Text + "','" + dateTimePicker1.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + comboBox1.Text + "')", Con); int x = cmd3.ExecuteNonQuery(); if (x > 0) { MessageBox.Show("Registered Successfully"); } else { MessageBox.Show("Not Registered"); } } else { MessageBox.Show("Please fill all the details"); } } private void button2_Click(object sender, EventArgs e) { main m = new main(); m.Show(); this.Hide(); } } } Musical Concert.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace WindowsFormsApplication1 { public partial class musical_concert : Form { public musical_concert() { InitializeComponent(); } private void musical_concert_Load(object sender, EventArgs e) { label12.Text = DateTime.Now.ToLongTimeString(); label13.Text = DateTime.Now.ToLongDateString(); } private void button1_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management"); Con.Open(); if(textBox1.Text!="" &&textBox1.Text!="" &&textBox2.Text!=""&&dateTimePicker1.Text!=""&& textBox3.Text!="" &&textBox4.Text!=""&& textBox5.Text!="" &&textBox6.Text!=""&&textBox7.Text!="" && comboBox1.Text!="" ) { SqlCommand cmd2 = new SqlCommand(@"insert into music values('" + textBox1.Text + "','" + textBox2.Text + "','" + dateTimePicker1.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + comboBox1.Text + "')", Con); int x = cmd2.ExecuteNonQuery(); if (x > 0) { MessageBox.Show("Registered Successfully"); } else { MessageBox.Show("Not Registered"); } } else{ MessageBox.Show("Please fill all the details"); } } private void button2_Click(object sender, EventArgs e) { main m = new main(); m.Show(); this.Hide(); } } } Wedding.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace WindowsFormsApplication1 { public partial class wedding : Form { public wedding() { InitializeComponent(); } private void wedding_Load(object sender, EventArgs e) { label12.Text = DateTime.Now.ToLongTimeString(); label13.Text = DateTime.Now.ToLongDateString(); } private void button1_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management"); Con.Open(); if (textBox1.Text != "" && textBox1.Text != "" && textBox2.Text != "" && dateTimePicker1.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" && textBox7.Text != "" && comboBox1.Text != "") { SqlCommand cmd1 = new SqlCommand(@"insert into wedding values('" + textBox1.Text + "','" + textBox2.Text + "','" + dateTimePicker1.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + comboBox1.Text + "')", Con); int x = cmd1.ExecuteNonQuery(); if (x > 0) { MessageBox.Show("Registered Successfully"); } else { MessageBox.Show("Not Registered"); } } else { MessageBox.Show("Please fill all the details"); } } private void button2_Click(object sender, EventArgs e) { main m = new main(); m.Show(); this.Hide(); } } } Family Reunion.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace WindowsFormsApplication1 { public partial class fam_reunion : Form { public fam_reunion() { InitializeComponent(); } private void fam_reunion_Load(object sender, EventArgs e) { label12.Text = DateTime.Now.ToLongTimeString(); label13.Text = DateTime.Now.ToLongDateString(); } private void label1_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management"); Con.Open(); if (textBox1.Text != "" && textBox1.Text != "" && textBox2.Text != "" && dateTimePicker1.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" && textBox7.Text != "" && comboBox1.Text != "") { SqlCommand cmd4 = new SqlCommand(@"insert into fam_reunion values('" + textBox1.Text + "','" + textBox2.Text + "','" + dateTimePicker1.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + comboBox1.Text + "')", Con); int x = cmd4.ExecuteNonQuery(); if (x > 0) { MessageBox.Show("Registered Successfully"); } else { MessageBox.Show("Not Registered"); } } else { MessageBox.Show("Please fill all the details"); } } private void button2_Click(object sender, EventArgs e) { main m = new main(); m.Show(); this.Hide(); } } } Baby Shower.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace WindowsFormsApplication1 { public partial class baby_shower : Form { public baby_shower() { InitializeComponent(); } private void baby_shower_Load(object sender, EventArgs e) { label12.Text = DateTime.Now.ToLongTimeString(); label13.Text = DateTime.Now.ToLongDateString(); } private void button1_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management"); Con.Open(); if(textBox1.Text!="" &&textBox1.Text!="" &&textBox2.Text!=""&&dateTimePicker1.Text!=""&& textBox3.Text!="" &&textBox4.Text!=""&& textBox5.Text!="" &&textBox6.Text!=""&&textBox7.Text!="" && comboBox1.Text!="" ) { SqlCommand cmd5= new SqlCommand(@"insert into baby_shower values('" + textBox1.Text + "','" + textBox2.Text + "','" + dateTimePicker1.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + comboBox1.Text + "')", Con); int x = cmd5.ExecuteNonQuery(); if (x > 0) { MessageBox.Show("Registered Successfully"); } else { MessageBox.Show("Not Registered"); } } else{ MessageBox.Show("Please fill all the details"); } } private void button2_Click(object sender, EventArgs e) { main m = new main(); m.Show(); this.Hide(); } } } Admin Login.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace WindowsFormsApplication1 { public partial class admin_login : Form { public admin_login() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { String a = textBox1.Text; String b = textBox2.Text; if ((a == "admin") && (b == "dotnet")) { MessageBox.Show("Success"); data_view data = new data_view(); data.Show(); this.Hide(); } else { MessageBox.Show("Failed"); } } } } View data.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace WindowsFormsApplication1 { public partial class data_view : Form { public data_view() { InitializeComponent(); } private void label1_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management"); Con.Open(); SqlCommand cmd = new SqlCommand(("Select*from birthday"), Con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; Con.Close(); } private void data_view_Load(object sender, EventArgs e) { } private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e) { } private void button2_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management"); Con.Open(); SqlCommand cmd = new SqlCommand(("Select*from wedding"), Con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); dataGridView2.DataSource = ds.Tables[0]; Con.Close(); } private void button3_Click(object sender, EventArgs e) { data_view1 data1 = new data_view1(); data1.Show(); } } } View Data1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace WindowsFormsApplication1 { public partial class data_view1 : Form { public data_view1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management"); Con.Open(); SqlCommand cmd = new SqlCommand(("Select*from new_year"), Con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; Con.Close(); } private void button2_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management"); Con.Open(); SqlCommand cmd = new SqlCommand(("Select*from baby_shower"), Con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); dataGridView2.DataSource = ds.Tables[0]; Con.Close(); } private void button3_Click(object sender, EventArgs e) { data_view2 data2 = new data_view2(); data2.Show(); } } } View Data2.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace WindowsFormsApplication1 { public partial class data_view2 : Form { public data_view2() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management"); Con.Open(); SqlCommand cmd = new SqlCommand(("Select*from music"), Con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; Con.Close(); } private void button2_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management"); Con.Open(); SqlCommand cmd = new SqlCommand(("Select*from fam_reunion"), Con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); dataGridView2.DataSource = ds.Tables[0]; Con.Close(); } private void button3_Click(object sender, EventArgs e) { } } }
Write, Run & Share Javascript code online using OneCompiler's JS online compiler for free. It's one of the robust, feature-rich online compilers for Javascript language. Getting started with the OneCompiler's Javascript editor is easy and fast. The editor shows sample boilerplate code when you choose language as Javascript and start coding.
Javascript(JS) is a object-oriented programming language which adhere to ECMA Script Standards. Javascript is required to design the behaviour of the web pages.
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
rl.on('line', function(line){
console.log("Hello, " + line);
});
Keyword | Description | Scope |
---|---|---|
var | Var is used to declare variables(old way of declaring variables) | Function or global scope |
let | let is also used to declare variables(new way) | Global or block Scope |
const | const is used to declare const values. Once the value is assigned, it can not be modified | Global or block Scope |
let greetings = `Hello ${name}`
const msg = `
hello
world!
`
An array is a collection of items or values.
let arrayName = [value1, value2,..etc];
// or
let arrayName = new Array("value1","value2",..etc);
let mobiles = ["iPhone", "Samsung", "Pixel"];
// accessing an array
console.log(mobiles[0]);
// changing an array element
mobiles[3] = "Nokia";
Arrow Functions helps developers to write code in concise way, it’s introduced in ES6.
Arrow functions can be written in multiple ways. Below are couple of ways to use arrow function but it can be written in many other ways as well.
() => expression
const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
const squaresOfEvenNumbers = numbers.filter(ele => ele % 2 == 0)
.map(ele => ele ** 2);
console.log(squaresOfEvenNumbers);
let [firstName, lastName] = ['Foo', 'Bar']
let {firstName, lastName} = {
firstName: 'Foo',
lastName: 'Bar'
}
const {
title,
firstName,
lastName,
...rest
} = record;
//Object spread
const post = {
...options,
type: "new"
}
//array spread
const users = [
...adminUsers,
...normalUsers
]
function greetings({ name = 'Foo' } = {}) { //Defaulting name to Foo
console.log(`Hello ${name}!`);
}
greet() // Hello Foo
greet({ name: 'Bar' }) // Hi Bar
IF is used to execute a block of code based on a condition.
if(condition){
// code
}
Else part is used to execute the block of code when the condition fails.
if(condition){
// code
} else {
// code
}
Switch is used to replace nested If-Else statements.
switch(condition){
case 'value1' :
//code
[break;]
case 'value2' :
//code
[break;]
.......
default :
//code
[break;]
}
For loop is used to iterate a set of statements based on a condition.
for(Initialization; Condition; Increment/decrement){
//code
}
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while (condition) {
// code
}
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
do {
// code
} while (condition);
ES6 introduced classes along with OOPS concepts in JS. Class is similar to a function which you can think like kind of template which will get called when ever you initialize class.
class className {
constructor() { ... } //Mandatory Class method
method1() { ... }
method2() { ... }
...
}
class Mobile {
constructor(model) {
this.name = model;
}
}
mbl = new Mobile("iPhone");