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 Customer_management_system
{
public partial class Form1 : Form
{
struct customer
{
public int customerID;
public string firstname;
public string lastname;
public DateTime dateofbirth;
}
customer[] cus = new customer[1];
int index = 0;
public Form1()
{
InitializeComponent();
}
private void btnadd_Click(object sender, EventArgs e)
{
cus[index].customerID = Convert.ToInt32(txtcusid.Text);
cus[index].firstname = txtfirstname.Text;
cus[index].lastname = txtlastname.Text;
cus[index].dateofbirth = Convert.ToDateTime(txtdateofbirth.Text);
index++;
Array.Resize(ref cus, cus.Length + 1);
MessageBox.Show("customer added successfuly");
}
private void btnsearch_Click(object sender, EventArgs e)
{
for (int i = 0; i < index; i++)
{
if(cus[i].customerID==Convert.ToInt32(txtcusid.Text))
{
txtfirstname.Text = cus[i].firstname;
txtlastname.Text=cus[i].lastname;
txtdateofbirth.Text=cus[i].dateofbirth.ToString();
return;
}
}
MessageBox.Show("cus id not found");
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Customer_management_system
{
public partial class Form1 : Form
{
struct customer
{
public int customerID;
public string firstname;
public string lastname;
public DateTime dateofbirth;
}
customer[] cus = new customer[1];
int index = 0;
public Form1()
{
InitializeComponent();
}
private void btnadd_Click(object sender, EventArgs e)
{
cus[index].customerID = Convert.ToInt32(txtcusid.Text);
cus[index].firstname = txtfirstname.Text;
cus[index].lastname = txtlastname.Text;
cus[index].dateofbirth = Convert.ToDateTime(txtdateofbirth.Text);
index++;
Array.Resize(ref cus, cus.Length + 1);
MessageBox.Show("customer added successfuly");
}
private void btnsearch_Click(object sender, EventArgs e)
{
for (int i = 0; i < index; i++)
{
if(cus[i].customerID==Convert.ToInt32(txtcusid.Text))
{
txtfirstname.Text = cus[i].firstname;
txtlastname.Text=cus[i].lastname;
txtdateofbirth.Text=cus[i].dateofbirth.ToString();
return;
}
}
MessageBox.Show("cus id not found");
}
}
}
No comments:
Post a Comment