COLLECTIONS
COLLECTION IS OF TWO TYPE
1.
GENERIC
COLLECTION
2.
NON GENERIC
COLLECTIONS
NON-GENERIC
COLLECTION
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.Collections;
namespace
complete__hotel_billing
{
public partial class Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void Form1_Load(object
sender, EventArgs e)
{
comboBox1.Items.Add("DELUX ROOM");
comboBox1.Items.Add("AC ROOM");
comboBox1.Items.Add("NON AC ROOM");
comboBox1.Items.Add("SUPER DELUX ROOM");
for
(int i = 1; i <=31; i++)
{
comboBox2.Items.Add(DateTime.Now.AddDays(i).ToString("dd"));
}
for
(int i = 1; i <= 12; i++)
{
comboBox3.Items.Add(DateTime.Now.AddMonths(i).ToString("MMM"));
}
for
(int i = 0; i <= 10; i++)
{
comboBox4.Items.Add(DateTime.Now.AddYears(i).ToString("yyyy"));
}
for
(int i = 1; i <= 31; i++)
{
comboBox5.Items.Add(DateTime.Now.AddDays(i).ToString("dd"));
}
for
(int i = 1; i <= 12; i++)
{
comboBox6.Items.Add(DateTime.Now.AddMonths(i).ToString("MMM"));
}
for
(int i = 0; i <= 10; i++)
{
comboBox7.Items.Add(DateTime.Now.AddYears(i).ToString("yyyy"));
}
}
ArrayList
ar = new ArrayList();
private void
submit_Click(object sender, EventArgs e)
{
Class1
cls = new Class1();
cls.name = name.Text;
cls.fathersname = fathersname.Text;
cls.age = Convert.ToInt32(age.Text);
cls.advance = Convert.ToInt32(advance.Text);
cls.address = address.Text;
cls.email = email.Text;
cls.mob = Convert.ToDouble(mob.Text);
cls.room = room.Text;
cls.roomno = Convert.ToInt32(roomno.Text);
cls.checkin = checkin.Text;
cls.email = email.Text;
ar.Add(cls);
label1.Text = ar.Count.ToString();
}
private
void search1_MouseMove(object
sender, MouseEventArgs e)
{
}
private
void search1_MouseClick(object sender, MouseEventArgs
e)
{
MessageBox.Show("ENTER THE NAME OF THE CUSTOMER");
}
int aa;
private
void search_Click(object
sender, EventArgs e)
{
for
(int a = 0; a < ar.Count; a++)
{
Class1
cls = (Class1)ar[a];
if
(cls.name.ToString() == search1.Text)
{
name.Text =
cls.name.ToString();
mob.Text =
cls.mob.ToString();
age.Text =
cls.age.ToString();
room.Text =
cls.room.ToString();
advance.Text =
cls.advance.ToString();
roomno.Text = cls.roomno.ToString();
checkin.Text =
cls.checkin.ToString();
address.Text =
cls.address.ToString();
email.Text =
cls.email.ToString();
fathersname.Text =
cls.fathersname.ToString();
label1.Text = a.ToString();
}
}
}
private
void button1_Click(object
sender, EventArgs e)
{
aa = 0;
Class1
cls = (Class1)ar[0];
name.Text = cls.name.ToString();
mob.Text = cls.mob.ToString();
age.Text = cls.age.ToString();
room.Text = cls.room.ToString();
advance.Text =
cls.advance.ToString();
roomno.Text =
cls.roomno.ToString();
checkin.Text =
cls.checkin.ToString();
address.Text =
cls.address.ToString();
fathersname.Text =
cls.fathersname.ToString();
email.Text = cls.email.ToString();
label1.Text = aa.ToString();
}
private
void last_Click(object
sender, EventArgs e)
{
}
private
void next_Click(object
sender, EventArgs e)
{
}
private
void previous_Click(object
sender, EventArgs e)
{
}
private
void next_Click_1(object
sender, EventArgs e)
{
if
(aa < ar.Count - 1)
{
aa++;
Class1
cls = (Class1)ar[aa];
name.Text =
cls.name.ToString();
mob.Text = cls.mob.ToString();
age.Text = cls.age.ToString();
room.Text =
cls.room.ToString();
advance.Text =
cls.advance.ToString();
roomno.Text = cls.roomno.ToString();
checkin.Text =
cls.checkin.ToString();
address.Text =
cls.address.ToString();
email.Text =
cls.email.ToString();
fathersname.Text =
cls.fathersname.ToString();
label1.Text = aa.ToString();
}
}
private
void previous_Click_1(object
sender, EventArgs e)
{
if
(aa > 0)
{
aa--;
Class1
cls = (Class1)ar[aa];
name.Text =
cls.name.ToString();
mob.Text = cls.mob.ToString();
age.Text = cls.age.ToString();
room.Text =
cls.room.ToString();
advance.Text =
cls.advance.ToString();
roomno.Text =
cls.roomno.ToString();
checkin.Text =
cls.checkin.ToString();
address.Text =
cls.address.ToString();
fathersname.Text = cls.fathersname.ToString();
email.Text =
cls.email.ToString();
label1.Text = aa.ToString();
}
}
private
void last_Click_1(object
sender, EventArgs e)
{
if
(aa >= 0)
{
aa = ar.Count - 1;
Class1
cls = (Class1)ar[aa];
name.Text =
cls.name.ToString();
mob.Text = cls.mob.ToString();
age.Text = cls.age.ToString();
room.Text =
cls.room.ToString();
fathersname.Text =
cls.fathersname.ToString();
advance.Text =
cls.advance.ToString();
roomno.Text =
cls.roomno.ToString();
checkin.Text =
cls.checkin.ToString();
address.Text =
cls.address.ToString();
email.Text =
cls.email.ToString();
label1.Text = aa.ToString();
}
}
private
void comboBox4_SelectedIndexChanged(object sender, EventArgs
e)
{
string
str = comboBox2.SelectedItem.ToString() + "/"
+ comboBox3.SelectedItem.ToString() + "/"
+ comboBox4.SelectedItem.ToString();
DateTime
dd = Convert.ToDateTime(str);
label7.Text =
dd.DayOfWeek.ToString();
}
private
void comboBox7_SelectedIndexChanged(object sender, EventArgs
e)
{
string
str1 = comboBox5.SelectedItem.ToString() + "/"
+ comboBox6.SelectedItem.ToString() + "/"
+ comboBox7.SelectedItem.ToString();
DateTime
dd1 = Convert.ToDateTime(str1);
label8.Text =
dd1.DayOfWeek.ToString();
}
private
void comboBox1_SelectedIndexChanged(object sender, EventArgs
e)
{
Class1
cls = new Class1();
if
(comboBox1.SelectedIndex == 0)
{
textBox4.Text = "2000";
}
else
if(comboBox1.SelectedIndex==1)
{
textBox4.Text="1500";
}
else
if(comboBox1.SelectedIndex==2)
{
textBox4.Text="1000";
}
else
if(comboBox1.SelectedIndex==3)
{
textBox4.Text="2500";
}
}
private
void groupBox1_Enter(object
sender, EventArgs e)
{
}
private
void button2_Click(object
sender, EventArgs e)
{
string
str = comboBox2.SelectedItem.ToString() + "/"
+ comboBox3.SelectedItem.ToString() + "/"
+ comboBox4.SelectedItem.ToString();
DateTime
dd = Convert.ToDateTime(str);
string
str1= comboBox5.SelectedItem.ToString() + "/"
+ comboBox6.SelectedItem.ToString() + "/"
+ comboBox7.SelectedItem.ToString();
DateTime
dd1=Convert.ToDateTime(str1);
TimeSpan
tt=dd1.Subtract(dd);
totaldays.Text=tt.Days.ToString();
int
fair = Convert.ToInt32(textBox4.Text);
int
td = Convert.ToInt32(totaldays.Text);
int
gg = fair * td;
totalamount.Text = gg.ToString();
int
advan = Convert.ToInt32(advance.Text);
int
cd = Convert.ToInt32(totalamount.Text);
int
bal = cd - advan;
balance.Text = bal.ToString();
}
}
}
No comments:
Post a Comment