Professional Documents
Culture Documents
28/11/2023
Income
Outcome
Lợi nhuận
Source Code
cuaHang.cs using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BaiSo3
{
cmd.Connection = conn;
if ((n - i - 1) == -1)
{
label_conlai.Text = "Số máy còn lại: 0";
}
else
{
label_conlai.Text = "Số máy còn lại: " + (n - i - 1);
}
textBox_color.Text = "";
textBox_name.Text = "";
textBox_serie.Text = "";
textBox_year.Text = "";
textBox_hang.Text = "";
textBox_price.Text = "";
textBox_address.Text = "";
textBox_number.Text = "";
}
}
cmd.Connection = conn;
string id = reader.GetString(0).Trim();
string ten = reader.GetString(1).Trim();
string hang=reader.GetString(2).Trim();
string mau=reader.GetString(3).Trim();
string diaChi = reader.GetString(4).Trim();
string nam = reader.GetInt32(5).ToString().Trim();
string serie = reader.GetString(6).Trim();
string gia = reader.GetInt64(7).ToString().Trim();
string soDT = reader.GetInt64(8).ToString().Trim();
OutPut+=id+" "+ten+" "+hang+" "+" "+mau+" "+diaChi+" "+" "+nam + " " + serie + " " + gia + " " + so
}
reader.Close();
MessageBox.Show(OutPut, "Thông tin điện thoại của cửa hàng");
}
if (conn == null)
{
conn = new SqlConnection(strCon);
}
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from StorePhone where id='" + id + "'";
cmd.Connection = conn;
string id = reader.GetString(0).Trim();
string ten = reader.GetString(1).Trim();
string hang=reader.GetString(2).Trim();
string mau=reader.GetString(3).Trim();
string diaChi = reader.GetString(4).Trim();
string nam = reader.GetInt32(5).ToString().Trim();
string serie = reader.GetString(6).Trim();
string gia = reader.GetInt64(7).ToString().Trim();
string soDT = reader.GetInt64(8).ToString().Trim();
PhoneStore phone = new PhoneStore(id, ten, hang, Convert.ToInt16(nam), mau, serie, diaChi, Conv
phoneStores.Add(phone);
}
reader.Close();
phoneStores.Sort(
(p1, p2) =>
{
if (p1.Year == p2.Year) return 0;
if (p1.Year < p2.Year) return 1;
return -1;
});
string Output = "";
foreach (PhoneStore item in phoneStores)
{
Output += item.ID+" "+item.Name+" "+item.Producer+" "+item.Color+" "+item.Address+" "+item.Ye
"+item.Price.ToString()+" "+item.ContactNumber.ToString()+"\n---------------------\n";
}
MessageBox.Show(Output, "Thông tin điện thoại của cửa hàng");
}
if (conn == null)
{
conn = new SqlConnection(strCon);
}
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from StorePhone where id='" + id + "'";
cmd.Connection = conn;
string id = reader.GetString(0).Trim();
string ten = reader.GetString(1).Trim();
string hang = reader.GetString(2).Trim();
string mau = reader.GetString(3).Trim();
string diaChi = reader.GetString(4).Trim();
string nam = reader.GetInt32(5).ToString().Trim();
string serie = reader.GetString(6).Trim();
string gia = reader.GetInt64(7).ToString().Trim();
string soDT = reader.GetInt64(8).ToString().Trim();
PhoneStore phone = new PhoneStore(id, ten, hang, Convert.ToInt16(nam), mau, serie, diaChi, Conv
phoneStores.Add(phone);
}
reader.Close();
phoneStores.Sort((p1, p2) =>
{
if (p1.Price == p2.Price) return 0;
if (p1.Price < p2.Price) return 1;
return -1;
});
string Output = "";
foreach (PhoneStore item in phoneStores)
{
Output += item.ID + " " + item.Name + " " + item.Producer + " " + item.Color + " " + item.Address +
+ " " + item.Price.ToString() + " " + item.ContactNumber.ToString() + "\n---------------------\n";
}
MessageBox.Show(Output, "Thông tin điện thoại của cửa hàng");
phoneStores.Sort((p1, p2) =>
{
if (p1.Price == p2.Price) return 0;
if (p1.Price < p2.Price) return 1;
return -1;
});
}
if (conn == null)
{
conn = new SqlConnection(strCon);
}
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from StorePhone where "+comboBox_find.Text+"='" + textBox_find.Tex
cmd.Connection = conn;
string id = reader.GetString(0).Trim();
string ten = reader.GetString(1).Trim();
string hang = reader.GetString(2).Trim();
string mau = reader.GetString(3).Trim();
string diaChi = reader.GetString(4).Trim();
string nam = reader.GetInt16(5).ToString().Trim();
string serie = reader.GetString(6).Trim();
string gia = reader.GetInt64(7).ToString().Trim();
string soDT = reader.GetInt64(8).ToString().Trim();
Output += id + " " + ten + " " + hang + " " + " " + mau + " " + diaChi + " " + " " + nam + " " + serie + " "
}
reader.Close();
MessageBox.Show(Output, "Thông tin điện thoại của cửa hàng");
}
}
}
namespace BaiSo3
{
cmd.Connection = conn;
while (reader.Read())
{
string nam = reader.GetInt32(5).ToString().Trim();
string price = reader.GetInt64(7).ToString().Trim();
wrt.Write("\t" + nam + "\t" + price);
wrt.WriteLine("");
wrt.WriteLine("==================================================================");
}
reader.Close();
if (conn == null)
{
conn = new SqlConnection(strCon);
}
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
SqlCommand cmd2 = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from StorePhone where id='2'";
cmd.Connection = conn;
while (reader2.Read())
{
string nam = reader2.GetInt32(5).ToString().Trim();
string price = (reader2.GetInt32(5)).ToString().Trim();
wrt.Write("\t" + nam + "\t" + price);
wrt.WriteLine("");
wrt.WriteLine("==================================================================");
}
reader2.Close();
wrt.Close();
}
private void outComeToolStripMenuItem_Click(object sender, EventArgs e)
{
if (conn == null)
{
conn = new SqlConnection(strCon);
}
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from qlNVien";
cmd.Connection = conn;
while (reader.Read())
{
string id = reader.GetString(0).Trim();
string ten = reader.GetString(1).Trim();
string luong = (reader.GetInt64(3)*12).ToString().Trim();
wrt.WriteLine(id + " " + ten + " " + luong);
wrt.WriteLine("");
wrt.WriteLine("==================================================================");
}
wrt.Close();
reader.Close();
}
cmd.Connection = conn;
while (reader.Read())
{
reader.Close();
cmd.Connection = conn;
}
}
}
namespace BaiSo3
{
public partial class NhanVien : Form
{
qlNVien nv = new qlNVien();
nvTableDataContext db = new nvTableDataContext("Data Source=DESKTOP-S33O38P;Initial Catalog=BaiSo3;Integra
public NhanVien()
{
InitializeComponent();
}
txt_id.DataBindings.Clear();
txt_ten.DataBindings.Clear();
txt_phong.DataBindings.Clear();
txt_luong.DataBindings.Clear();
txt_tuoi.DataBindings.Clear();
// TODO: This line of code loads data into the 'baiSo3DataSet2.qlNVien' table. You can move, or remove it, as needed
this.qlNVienTableAdapter.Fill(this.baiSo3DataSet2.qlNVien);
db.qlNViens.InsertOnSubmit(nv);
db.SubmitChanges();
NhanVien_Load(sender, e);
}
namespace BaiSo3
{
public partial class NhanVienForm2 : Form
{
qlNVien nv = new qlNVien();
nvTableDataContext db = new nvTableDataContext("Data Source=DESKTOP-S33O38P;Initial Catalog=BaiSo3;Integra
public NhanVienForm2()
{
InitializeComponent();
}
wrt.Write(dataGridView1.Rows[i].Cells[j].Value.ToString()+"\t");
}
wrt.WriteLine("");
wrt.WriteLine("==================================================================");
}
wrt.Close();
}
}
}