code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231
values | license stringclasses 13
values | size int64 1 2.01M |
|---|---|---|---|---|---|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.Data.SqlClient;
namespace DAO
{
public partial class CTPhieuNhap_DAO
{
CTPhieuNhap_DAO ctpn_dao;
public bool ThemCTPhieuNhap(CTPhieuNhap ctphieunhap_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[6];
Parameter[0] = new SqlParameter("@MaPN", ctphieunhap_dto.MaPhieuNhap);
Parameter[1] = new SqlParameter("@MaNVL", ctphieunhap_dto.MaNVL);
Parameter[2] = new SqlParameter("@MaNCC", ctphieunhap_dto.MaNCC);
Parameter[3] = new SqlParameter("@DonGia", ctphieunhap_dto.DonGiaNhap);
Parameter[4] = new SqlParameter("@SoLuong", ctphieunhap_dto.SoLuong);
Parameter[5] = new SqlParameter("@SoLuongTonHT", ctphieunhap_dto.SoLuongTonHienTai);
return dp.ExecutenonQuery("sp_ThemChiTietPhieuNhap", Parameter);
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/CTPhieuNhap_DAO.cs | C# | asf20 | 1,047 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using DTO;
namespace DAO
{
public partial class DiemCong_DAO
{
public DataTable getDanhSachDiemCong()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_getDanhSachDiemCong");
return dt;
}
public DataTable getDiemCongTheoHoadon(float giatriphaitra)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@giatriphaitra", giatriphaitra);
dt = dp.ExecuteQuery("sp_getDiemCongTheoHoadon", Parameter);
return dt;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/DiemCong_DAO.cs | C# | asf20 | 936 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using DTO;
namespace DAO
{
public partial class Ve_HoaDon_DAO
{
public bool insertThanhToanVeBuffet(Ve_HoaDon vehoadon)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[11];
Parameter[0] = new SqlParameter("@manv", vehoadon.MaNV);
Parameter[1] = new SqlParameter("@makh", vehoadon.MaKH);
Parameter[2] = new SqlParameter("@buoianbuffet", vehoadon.BuoiAnBuffet);
Parameter[3] = new SqlParameter("@ngay", vehoadon.Ngay);
Parameter[4] = new SqlParameter("@venguoilon", vehoadon.VeNguoiLon);
Parameter[5] = new SqlParameter("@vetreem", vehoadon.VeTreEm);
Parameter[6] = new SqlParameter("@hinhthucthanhtoan", vehoadon.HinhThucThanhToan);
Parameter[7] = new SqlParameter("@tong", vehoadon.Tong);
Parameter[8] = new SqlParameter("@giamgia", vehoadon.GiamGia);
Parameter[9] = new SqlParameter("@thanhtien", vehoadon.ThanhTien);
Parameter[10] = new SqlParameter("@ngaylap", vehoadon.NgayLap);
return dp.ExecutenonQuery("sp_insertThanhToanVeBuffer", Parameter);
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/Ve_HoaDon_DAO.cs | C# | asf20 | 1,396 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.Data.SqlClient;
using System.Data;
namespace DAO
{
public partial class PhieuXuat_Dao
{
public bool ThemPhieuXuat(PhieuXuat phieuxuat_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[3];
Parameter[0] = new SqlParameter("@MaPX", phieuxuat_dto.MaPX);
Parameter[1] = new SqlParameter("@NgayLap", phieuxuat_dto.NgayLap);
Parameter[2] = new SqlParameter("@MaNV", phieuxuat_dto.MaNV);
return dp.ExecutenonQuery("sp_ThemPhieuXuat", Parameter);
}
public string MaPXTang()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_MaPX_Tang");
return dt.Rows[0][0].ToString();
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/PhieuXuat_Dao.cs | C# | asf20 | 991 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
namespace DAO
{
public class DataProvider
{
#region
SqlConnection connect;
string sqlConnectionstring;
public string _error;
#endregion
public DataProvider()
{
sqlConnectionstring = ConfigurationManager.ConnectionStrings["Nhom16pttkpmConnectionString"].ConnectionString;
connect = new SqlConnection(sqlConnectionstring);
}
public bool OpenConnect()// ham mo ket noi
{
try
{
// kiem tra xem da connect chua, neu chua thi khoi tao no
if (connect == null)
{
connect = new SqlConnection(sqlConnectionstring);
}
if (connect.State == ConnectionState.Open)//neu trang thai la dang mo
{
connect.Close();// dong no
}
connect.Open();
return true;
}
catch (SqlException ex)
{
_error = ex.Message;
return false;
}
}
public bool CloseConnect()// Ham dong ket noi
{
if (connect != null)
{
if (connect.State == ConnectionState.Open)
{
connect.Close();
}
return true;
}
return false;
}
public bool ExecutenonQuery(string StoreName, SqlParameter[] sqlparam)// thuc thi cau truy van co thay doi du lieu
{
try
{
if (OpenConnect() == true)
{
SqlCommand cmd = connect.CreateCommand();// doi tuong nhan cau sql
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = StoreName;
if (sqlparam != null)
{
cmd.Parameters.AddRange(sqlparam);
}
cmd.ExecuteNonQuery();
_error = string.Empty;
}
return true;
}
catch (SqlException ex)
{
_error = ex.Message;
return false;
}
finally
{
CloseConnect();
}
}
public bool ExecutenonQuery(string StoreName)// thuc thi cau truy van co thay doi du lieu
{
try
{
if (OpenConnect() == true)
{
SqlCommand cmd = connect.CreateCommand();// doi tuong nhan cau sql
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = StoreName;
cmd.ExecuteNonQuery();
_error = string.Empty;
}
return true;
}
catch (SqlException ex)
{
_error = ex.Message;
return false;
}
finally
{
CloseConnect();
}
}
public DataTable ExecuteQuery(string StoreName, SqlParameter[] sqlparam) // Thuc thi cau truy van khong lam thay doi du lieu
{
DataTable dtb = null;
try
{
if (OpenConnect() == true)
{
SqlCommand cmd = connect.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = StoreName;
if (sqlparam != null)
{
cmd.Parameters.AddRange(sqlparam);
}
SqlDataAdapter da = new SqlDataAdapter(cmd);
dtb = new DataTable();
da.Fill(dtb);
_error = "";
}
}
catch (SqlException ex)
{
_error = ex.Message;
}
finally
{
CloseConnect();
}
return dtb;
}
public DataTable ExecuteQuery(string StoreName) // Thuc thi cau truy van khong lam thay doi du lieu, khong co tham so dau vao
{
DataTable dtb = null;
try
{
if (OpenConnect() == true)
{
SqlCommand cmd = connect.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = StoreName;
SqlDataAdapter da = new SqlDataAdapter(cmd);
dtb = new DataTable();
da.Fill(dtb);
_error = "";
}
}
catch (SqlException ex)
{
_error = ex.Message;
}
finally
{
CloseConnect();
}
return dtb;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/DataProvider.cs | C# | asf20 | 5,434 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DAO;
using DTO;
namespace DAO
{
public partial class NCC_DAO
{
public bool ThemNCC(NCC ncc_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[4];
Parameter[0] = new SqlParameter("@MaNCC", ncc_dto.MaNCC);
Parameter[1] = new SqlParameter("@TenNCC", ncc_dto.TenNCC);
Parameter[2] = new SqlParameter("@DiaChi", ncc_dto.DiaChi);
Parameter[3] = new SqlParameter("@DienThoai", ncc_dto.DienThoai);
return dp.ExecutenonQuery("sp_ThemNCC", Parameter);
}
public bool CapNhatNCC(NCC ncc_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[4];
Parameter[0] = new SqlParameter("@MaNCC", ncc_dto.MaNCC);
Parameter[1] = new SqlParameter("@TenNCC", ncc_dto.TenNCC);
Parameter[2] = new SqlParameter("@DiaChi", ncc_dto.DiaChi);
Parameter[3] = new SqlParameter("@DienThoai", ncc_dto.DienThoai);
return dp.ExecutenonQuery("sp_CapNhatNCC", Parameter);
}
public bool XoaNCC(NCC ncc_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaNCC", ncc_dto.MaNCC);
return dp.ExecutenonQuery("sp_XoaNCC", Parameter);
}
public DataTable DanhSachNCC()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_DanhSachNCC");
return dt;
}
public string MaNCCTang()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_MaNCC_Tang");
return dt.Rows[0][0].ToString();
}
public DataTable DanhSachNCC_Ma(string strMa)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaNCC", strMa);
dt = dp.ExecuteQuery("sp_DanhSachNCC_Ma", Parameter);
return dt;
}
public DataTable DanhSachNCC_MaNVL(string strMa)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaNVL", strMa);
dt = dp.ExecuteQuery("sp_DanhSachNCC_MaNVL", Parameter);
return dt;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/NCC_DAO.cs | C# | asf20 | 2,908 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data;
using System.Data.SqlClient;
namespace DAO
{
public partial class PhanCong_DAO
{
public DataTable LayDanhSachPhanCong()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("LayDanhSachPhanCong");
return dt;
}
public DataTable ThemMoiPhanCong(PhanCong PhanCong)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[2];
Parameter[0] = new SqlParameter("@NgayBatDau", PhanCong.NgayBatDau);
Parameter[1] = new SqlParameter("@NgayketThuc", PhanCong.NgayKetThuc);
dt = dp.ExecuteQuery("ThemMoiPhanCong",Parameter);
return dt;
}
public DataTable ChiTietPhanCong(string MaPhanCong, string MaNhanVien)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[2];
Parameter[0] = new SqlParameter("@MaPhanCong", MaPhanCong);
Parameter[1] = new SqlParameter("@MaNhanVien", MaNhanVien);
dt = dp.ExecuteQuery("ChiTietPhanCong", Parameter);
return dt;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/PhanCong_DAO.cs | C# | asf20 | 1,477 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DAO
{
public class Class1
{
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/Class1.cs | C# | asf20 | 162 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DAO
{
public partial class CTThucDon_DAO
{
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/CTThucDon_DAO.cs | C# | asf20 | 170 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.Data;
using System.Data.SqlClient;
namespace DAO
{
public partial class PhieuNhap_DAO
{
PhieuNhap_DAO pn_dao;
public bool ThemPhieuNhap(PhieuNhap phieunhap_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[3];
Parameter[0] = new SqlParameter("@MaPN", phieunhap_dto.MaPhieuNhap);
Parameter[1] = new SqlParameter("@NgayLap", phieunhap_dto.NgayLap);
Parameter[2] = new SqlParameter("@MaNV", phieunhap_dto.MaNV);
return dp.ExecutenonQuery("sp_ThemPhieuNhap", Parameter);
}
public string MaPNTang()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_MaPN_Tang");
return dt.Rows[0][0].ToString();
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/PhieuNhap_DAO.cs | C# | asf20 | 1,031 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.Data.SqlClient;
using System.Data;
namespace DAO
{
public partial class LoaiVe_DAO
{
/// Thêm mới một nhan viên
/// </summary>
/// <param name="nhanvien"></param>
/// <returns></returns>
public bool ThemLoaiVe(LoaiVe loaive_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[3];
Parameter[0] = new SqlParameter("@TenLoaiVe", loaive_dto.TenLoaiVe);
Parameter[1] = new SqlParameter("@Gia", loaive_dto.Gia);
Parameter[2] = new SqlParameter("@isdelete ", loaive_dto.IsDelete);
return dp.ExecutenonQuery("sp_ThemLoaiVe", Parameter);
}
public bool SuaLoaiVe(LoaiVe loaive_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[3];
Parameter[0] = new SqlParameter("@MaLoaiVe", loaive_dto.MaLoaiVe);
Parameter[1] = new SqlParameter("@TenLoaiVe", loaive_dto.TenLoaiVe);
Parameter[2] = new SqlParameter("@Gia", loaive_dto.Gia);
return dp.ExecutenonQuery("sp_SuaLoaiVe", Parameter);
}
public bool XoaLoaiVe(string MaLoaiVe)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaLoaiVe",MaLoaiVe);
return dp.ExecutenonQuery("sp_XoaLoaiVe", Parameter);
}
public DataTable DanhSachLoaiVe()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_DanhSachLoaiVe");
return dt;
}
public DataTable DanhSachLoaiVe_Ma(string strMa)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaLoaiVe", strMa);
dt = dp.ExecuteQuery("sp_DanhSachLoaiVeTheoMa", Parameter);
return dt;
}
public DataTable getGiaVeNguoiLon(string strBuoi, string strNgay)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[2];
Parameter[0] = new SqlParameter("@buoi", strBuoi);
Parameter[1] = new SqlParameter("@ngay", strNgay);
dt = dp.ExecuteQuery("sp_getGiaVeNguoiLon", Parameter);
return dt;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/LoaiVe_DAO.cs | C# | asf20 | 2,799 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.Data.SqlClient;
using System.Data;
namespace DAO
{
public partial class LoaiNVL_DAO
{
/// <summary>
/// Thêm mới một nhan viên
/// </summary>
/// <param name="nhanvien"></param>
/// <returns></returns>
public bool ThemLoaiNVL(LoaiNVL loainvl_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[2];
Parameter[0] = new SqlParameter("@MaLoaiNVL", loainvl_dto.MaLoaiNVL);
Parameter[1] = new SqlParameter("@TenLoaiNVL", loainvl_dto.TenLoaiNVL);
return dp.ExecutenonQuery("sp_ThemLoaiNVL", Parameter);
}
public bool CapNhatLoaiNVL(LoaiNVL loainvl_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[2];
Parameter[0] = new SqlParameter("@MaLoaiNVL", loainvl_dto.MaLoaiNVL);
Parameter[1] = new SqlParameter("@TenLoaiNVL", loainvl_dto.TenLoaiNVL);
return dp.ExecutenonQuery("sp_CapNhatLoaiNVL", Parameter);
}
public bool XoaLoaiNVL(LoaiNVL loainvl_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaLoaiNVL", loainvl_dto.MaLoaiNVL);
return dp.ExecutenonQuery("sp_XoaLoaiNVL", Parameter);
}
public DataTable DanhSachLoaiNVL( )
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_DanhSachLoaiNVL");
return dt;
}
public string MaLoaiNVLTang()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_MaLoaiNVL_Tang");
return dt.Rows[0][0].ToString();
}
public DataTable DanhSachLoaiNVL_Ma(string strMa)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaLoaiNVL", strMa);
dt = dp.ExecuteQuery("sp_DanhSachLoaiNVL_Ma",Parameter);
return dt;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/LoaiNVL_DAO.cs | C# | asf20 | 2,523 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data;
using System.Data.SqlClient;
namespace DAO
{
public partial class NhanVien_DAO
{
/// <summary>
/// Hàm đăng nhập của nhân viên
/// </summary>
/// <param name="TenDangNhap"></param>
/// <returns></returns>
public DataTable DangNhap(string TenDangNhap)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@TenDangNhap", TenDangNhap);
dt = dp.ExecuteQuery("DangNhap", Parameter);
return dt;
}
/// <summary>
/// Thêm mới một nhan viên
/// </summary>
/// <param name="nhanvien"></param>
/// <returns></returns>
public bool ThemMoiNhanVien(NhanVien nhanvien)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[7];
Parameter[0] = new SqlParameter("@TenNhanVien", nhanvien.TenNV);
Parameter[1] = new SqlParameter("@DiaChi", nhanvien.DiaChi);
Parameter[2] = new SqlParameter("@Email", nhanvien.Email);
Parameter[3] = new SqlParameter("@DienThoai", nhanvien.DienThoai);
Parameter[4] = new SqlParameter("@TenDangNhap", nhanvien.TenDN);
Parameter[5] = new SqlParameter("@MatKhau", nhanvien.MatKhau);
Parameter[6] = new SqlParameter("@maChucVu", nhanvien.MaChucVu);
return dp.ExecutenonQuery("ThemMoiNhanVien", Parameter);
}
/// <summary>
/// Lấy danh sách nhân viên
/// </summary>
/// <returns></returns>
public DataTable LayDanhSachNhanVien()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("LoadDanhSachNhanVien");
return dt;
}
/// <summary>
/// xem chi tiết nhân viên
/// </summary>
/// <param name="MaNhanVien"></param>
/// <returns></returns>
public DataTable XemChiTietNhanVien(string MaNhanVien)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaNhanVien", MaNhanVien);
dt = dp.ExecuteQuery("ChiTietNhanVien", Parameter);
return dt;
}
/// <summary>
/// Cập nhật mật khẩu
/// </summary>
/// <param name="MaNhanVien"></param>
/// <returns></returns>
public bool CapNhatMatKhau(string MaNhanVien,string MatKhau)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[2];
Parameter[0] = new SqlParameter("@MaNhanVien", MaNhanVien);
Parameter[1] = new SqlParameter("@MatKhau", MatKhau);
return dp.ExecutenonQuery("CapNhatMatKhau", Parameter);
}
/// <summary>
/// Cập nhật thông tin
/// </summary>
/// <param name="MaNhanVien"></param>
/// <returns></returns>
public bool CapNhatThongTinNhaVien(NhanVien NhanVien)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[8];
Parameter[0] = new SqlParameter("@MaNhanVien", NhanVien.MaNV);
Parameter[1] = new SqlParameter("@HoTen", NhanVien.TenNV);
Parameter[2] = new SqlParameter("@DiaChi", NhanVien.DiaChi);
Parameter[3] = new SqlParameter("@Email", NhanVien.Email);
Parameter[4] = new SqlParameter("@DienThoai", NhanVien.DienThoai);
Parameter[5] = new SqlParameter("@TenDangNhap", NhanVien.TenDN);
Parameter[6] = new SqlParameter("@MaChucVu", NhanVien.MaChucVu);
Parameter[7] = new SqlParameter("@IsDelete", NhanVien.IsDelete);
return dp.ExecutenonQuery("CapNhatThongTinNhanVien", Parameter);
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/Duy_NhanVien_DAO.cs | C# | asf20 | 4,423 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using DTO;
namespace DAO
{
public partial class Ban_DAO
{
public DataTable getKiemTraTinhTrangBan(string maban)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@maban", maban);
dt = dp.ExecuteQuery("sp_getKiemTraTinhTrangBan", Parameter);
return dt;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/Ban_DAO.cs | C# | asf20 | 658 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data.SqlClient;
namespace DAO
{
public partial class CTPhieuXuat_DAO
{
public bool ThemCTPhieuXuat(CTPhieuXuat ctphieuxuat_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[4];
Parameter[0] = new SqlParameter("@MaPX", ctphieuxuat_dto.MaPX);
Parameter[1] = new SqlParameter("@MaNVL", ctphieuxuat_dto.MaNVL);
Parameter[2] = new SqlParameter("@SoLuong", ctphieuxuat_dto.SoLuong);
Parameter[3] = new SqlParameter("@SoLuongTonHT", ctphieuxuat_dto.SoLuongTonHienTai);
return dp.ExecutenonQuery("sp_ThemChiTietPhieuXuat", Parameter);
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/CTPhieuXuat_DAO.cs | C# | asf20 | 831 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DAO
{
public partial class ThucDon_DAO
{
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/ThucDon_DAO.cs | C# | asf20 | 168 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DAO
{
public partial class DonXinNghi_DAO
{
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/DonXinNghi_DAO.cs | C# | asf20 | 171 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using DAO;
using System.Data.SqlClient;
namespace DAO
{
public partial class CTNCC_DAO
{
public bool ThemCTNCC(CTNCC ctncc_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[2];
Parameter[0] = new SqlParameter("@MaNCC", ctncc_dto.MaNCC);
Parameter[1] = new SqlParameter("@MaNVL", ctncc_dto.MaNVL);
return dp.ExecutenonQuery("sp_CTNCC", Parameter);
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/CTNCC_DAO.cs | C# | asf20 | 611 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using DTO;
namespace DAO
{
public partial class GiamGia_DAO
{
public DataTable getDanhSachTiLeGiam()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_getDanhSachGiamGia");
return dt;
}
public DataTable getPhanTramGiamGia(float diemtichluy)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@diemtichluy", diemtichluy);
dt = dp.ExecuteQuery("sp_getPhanTramGiamGia", Parameter);
return dt;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/GiamGia_DAO.cs | C# | asf20 | 935 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DAO
{
public partial class NhanVien_DAO
{
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/NhanVien_DAO.cs | C# | asf20 | 169 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DAO
{
public partial class BangLuong_DAO
{
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/BangLuong_DAO.cs | C# | asf20 | 170 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.Data.SqlClient;
using System.Data;
namespace DAO
{
public partial class MonAn_DAO
{
public bool ThemMonAn(MonAn mon_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[4];
Parameter[0] = new SqlParameter("@MaMonAn", mon_dto.MaMonAn);
Parameter[1] = new SqlParameter("@MaLoaiMonAn", mon_dto.MaLoaiMonAn);
Parameter[2] = new SqlParameter("@TenMonAn", mon_dto.TenMonAn);
Parameter[3] = new SqlParameter("@Gia", mon_dto.Gia);
return dp.ExecutenonQuery("sp_ThemMonAn", Parameter);
}
public bool ThemMonAn_NVL(MonAn_NVL monNVL_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[3];
Parameter[0] = new SqlParameter("@MaNVL", monNVL_dto.MaNVL);
Parameter[1] = new SqlParameter("@MaMonAn", monNVL_dto.MaMonAn);
Parameter[2] = new SqlParameter("@SoLuong", monNVL_dto.SoLuong);
return dp.ExecutenonQuery("sp_ThemMonAn_NVL", Parameter);
}
public string MaMonTang()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_MaMonAn_Tang");
return dt.Rows[0][0].ToString();
}
//public bool SuaLoaiMon(LoaiMonAn loaimon_dto)
//{
// DataProvider dp = new DataProvider();
// SqlParameter[] Parameter = new SqlParameter[2];
// Parameter[0] = new SqlParameter("@MaLoaiMon", loaimon_dto.MaLoaiMonAn);
// Parameter[1] = new SqlParameter("@TenLoaiMon", loaimon_dto.TenLoaiMonAn);
// return dp.ExecutenonQuery("sp_SuaLoaiMonAn", Parameter);
//}
public bool XoaMon(string MaLoaiMon)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaMonAn", MaLoaiMon);
return dp.ExecutenonQuery("sp_XoaMonAn", Parameter);
}
public bool XoaMonAn_NVL(string MaNVL)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaNVL", MaNVL);
return dp.ExecutenonQuery("sp_XoaMonAn_NVL", Parameter);
}
public bool SuaMonAn(MonAn ma_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[4];
Parameter[0] = new SqlParameter("@MaMonAn", ma_dto.MaMonAn);
Parameter[1] = new SqlParameter("@MaLoaiMonAn", ma_dto.MaLoaiMonAn);
Parameter[2] = new SqlParameter("@TenMonAn", ma_dto.TenMonAn);
Parameter[3] = new SqlParameter("@Gia", ma_dto.Gia);
return dp.ExecutenonQuery("sp_SuaMonAn", Parameter);
}
public DataTable DanhSachMonAn()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_DanhSachMonAn");
return dt;
}
public DataTable DanhSachMon_Ma(string strMa)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaMonAn", strMa);
dt = dp.ExecuteQuery("sp_ChiTiet_NVL", Parameter);
return dt;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/MonAn_DAO.cs | C# | asf20 | 3,816 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using DTO;
namespace DAO
{
public class ThucDonDichVuKhach_DAO
{
public DataTable getDanhSachDichVuKhac()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_getDanhSachDichVuKhac");
return dt;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/ThucDonDichVuKhach_DAO.cs | C# | asf20 | 512 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DAO")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DAO")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1910a130-7a79-4ee0-8276-dd728801aeb8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/Properties/AssemblyInfo.cs | C# | asf20 | 1,418 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data;
using System.Data.SqlClient;
namespace DAO
{
public partial class CTPhanCong_DAO
{
public bool ThemMoiPhanCong(CTPhanCong ctpc)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[4];
Parameter[0] = new SqlParameter("@MaPhanCong", ctpc.MaPhanCong);
Parameter[1] = new SqlParameter("@NgayPhanCong", ctpc.NgayPhanCong);
Parameter[2] = new SqlParameter("@MaCa", ctpc.MaCa);
Parameter[3] = new SqlParameter("@MaNV", ctpc.MaNV);
return dp.ExecutenonQuery("ThemChiTietPhanCong", Parameter);
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/CTPhanCong_DAO.cs | C# | asf20 | 789 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DAO
{
public partial class ChucVu_DAO
{
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/ChucVu_DAO.cs | C# | asf20 | 167 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DAO
{
public partial class HoaDonDichVu_DAO
{
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/HoaDonDichVu_DAO.cs | C# | asf20 | 173 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data;
namespace DAO
{
public partial class Ca_DAO
{
public DataTable LayDanhSachCa()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("LayDanhSachCa");
return dt;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/Ca_DAO.cs | C# | asf20 | 431 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DAO
{
public partial class CTHDDVu_DAO
{
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/CTHDDVu_DAO.cs | C# | asf20 | 168 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.Data.SqlClient;
using System.Data;
namespace DAO
{
public partial class NguyenVatLieu_DAO
{
public bool ThemNVL(NguyenVatLieu nguyenvatlieu_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[5];
Parameter[0] = new SqlParameter("@MaNVL", nguyenvatlieu_dto.MaNuyenVatLieu);
Parameter[1] = new SqlParameter("@MaLoaiNVL", nguyenvatlieu_dto.MaLoaiNVL);
Parameter[2] = new SqlParameter("@TenNVL", nguyenvatlieu_dto.TenNVl);
Parameter[3] = new SqlParameter("@SoLuongTon", nguyenvatlieu_dto.SoLuongTon);
Parameter[4] = new SqlParameter("@DVT", nguyenvatlieu_dto.DonViTinh);
return dp.ExecutenonQuery("sp_ThemNguyenVatLieu", Parameter);
}
public bool CapNhatNVL(NguyenVatLieu nguyenvatlieu_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[5];
Parameter[0] = new SqlParameter("@MaNVL", nguyenvatlieu_dto.MaNuyenVatLieu);
Parameter[1] = new SqlParameter("@MaLoaiNVL", nguyenvatlieu_dto.MaLoaiNVL);
Parameter[2] = new SqlParameter("@TenNVL", nguyenvatlieu_dto.TenNVl);
Parameter[3] = new SqlParameter("@SoLuongTon", nguyenvatlieu_dto.SoLuongTon);
Parameter[4] = new SqlParameter("@DVT", nguyenvatlieu_dto.DonViTinh);
return dp.ExecutenonQuery("sp_CapNhatNVL", Parameter);
}
public bool XoaNVL(NguyenVatLieu nguyenvatlieu_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaNVL", nguyenvatlieu_dto.MaNuyenVatLieu);
return dp.ExecutenonQuery("sp_XoaNVL", Parameter);
}
public DataTable DanhSachNVL()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_DanhSachNVL");
return dt;
}
public string MaNVLTang()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_MaNVL_Tang");
return dt.Rows[0][0].ToString();
}
public DataTable DanhSachNVL_Ma(string strMa)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaNVL", strMa);
dt = dp.ExecuteQuery("sp_DanhSachNVL_Ma", Parameter);
return dt;
}
public DataTable DanhSachNVL_MaLoaiNVL(string strMa)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaLoaiNVL", strMa);
dt = dp.ExecuteQuery("sp_DanhSachNVL_MaLoaiNVL", Parameter);
return dt;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/NguyenVatLieu_DAO.cs | C# | asf20 | 3,299 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using DTO;
namespace DAO
{
public partial class KhachHang_DAO
{
KhachHang_DAO kh_dao;
public bool insertKhachHang(KhachHang khachhang_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[8];
//Parameter[0] = new SqlParameter("@makh", khachhang_dto.MaKH);
Parameter[0] = new SqlParameter("@tenkh", khachhang_dto.TenKH);
Parameter[1] = new SqlParameter("@cmnd", khachhang_dto.CMND);
Parameter[2] = new SqlParameter("@diachi", khachhang_dto.DiaChi);
Parameter[3] = new SqlParameter("@dienthoai", khachhang_dto.DienThoai);
Parameter[4] = new SqlParameter("@ngaylapthe", khachhang_dto.NgayLapThe);
Parameter[5] = new SqlParameter("@diemtichluy", khachhang_dto.DiemTichLuy);
Parameter[6] = new SqlParameter("@tongdiem", khachhang_dto.TongDiem);
Parameter[7] = new SqlParameter("@ngaycapnhatsaucung",khachhang_dto.NgayCapNhatSauCung);
return dp.ExecutenonQuery("sp_insertKhachHang", Parameter);
}
public bool updateKhachHang(KhachHang khachhang_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[9];
Parameter[0] = new SqlParameter("@makh", khachhang_dto.MaKH);
Parameter[1] = new SqlParameter("@tenkh", khachhang_dto.TenKH);
Parameter[2] = new SqlParameter("@cmnd", khachhang_dto.CMND);
Parameter[3] = new SqlParameter("@diachi", khachhang_dto.DiaChi);
Parameter[4] = new SqlParameter("@dienthoai", khachhang_dto.DienThoai);
Parameter[5] = new SqlParameter("@ngaylapthe", khachhang_dto.NgayLapThe);
Parameter[6] = new SqlParameter("@diemtichluy", khachhang_dto.DiemTichLuy);
Parameter[7] = new SqlParameter("@tongdiem", khachhang_dto.TongDiem);
Parameter[8] = new SqlParameter("@ngaycapnhatsaucung", khachhang_dto.NgayCapNhatSauCung);
return dp.ExecutenonQuery("sp_updateKhachHang", Parameter);
}
public DataTable getDanhSachKhachHang()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_getDanhSachKhachHang");
return dt;
}
public DataTable getDanhSachKhachHangSearch(string cmnd)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@cmnd", cmnd);
dt = dp.ExecuteQuery("sp_searchKhachHang", Parameter);
return dt;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/KhachHang_DAO.cs | C# | asf20 | 2,995 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.Data.SqlClient;
using System.Data;
namespace DAO
{
public partial class LoaiMonAn_DAO
{
public bool ThemLoaiMon(LoaiMonAn loaimon_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[2];
Parameter[0] = new SqlParameter("@TenLoaiMonAn", loaimon_dto.TenLoaiMonAn);
Parameter[1] = new SqlParameter("@isdelete ", loaimon_dto.IsDelete);
return dp.ExecutenonQuery("sp_ThemLoaiMonAn", Parameter);
}
public bool SuaLoaiMon(LoaiMonAn loaimon_dto)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[2];
Parameter[0] = new SqlParameter("@MaLoaiMon", loaimon_dto.MaLoaiMonAn);
Parameter[1] = new SqlParameter("@TenLoaiMon", loaimon_dto.TenLoaiMonAn);
return dp.ExecutenonQuery("sp_SuaLoaiMonAn", Parameter);
}
public bool XoaLoaiMon(string MaLoaiMon)
{
DataProvider dp = new DataProvider();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaLoaiMonAn", MaLoaiMon);
return dp.ExecutenonQuery("sp_XoaLoaiMonAn", Parameter);
}
public DataTable DanhSachLoaiMon()
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
dt = dp.ExecuteQuery("sp_DanhSachLoaiMonAn");
return dt;
}
public DataTable DanhSachLoaiMon_Ma(string strMa)
{
DataProvider dp = new DataProvider();
DataTable dt = new DataTable();
SqlParameter[] Parameter = new SqlParameter[1];
Parameter[0] = new SqlParameter("@MaLoaiMon", strMa);
dt = dp.ExecuteQuery("sp_DanhSachLoaiMonTheoMa", Parameter);
return dt;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DAO/LoaiMonAn_DAO.cs | C# | asf20 | 2,090 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class LoaiNVL
{
private string _maLoaiNVL;
public string MaLoaiNVL
{
get { return _maLoaiNVL; }
set { _maLoaiNVL = value; }
}
private string _tenLoaiNVL;
public string TenLoaiNVL
{
get { return _tenLoaiNVL; }
set { _tenLoaiNVL = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/LoaiNVL.cs | C# | asf20 | 508 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class LoaiMonAn
{
private string _maLoaiMonAn;
private string _IsDelete;
public string IsDelete
{
get { return _IsDelete; }
set { _IsDelete = value; }
}
public string MaLoaiMonAn
{
get { return _maLoaiMonAn; }
set { _maLoaiMonAn = value; }
}
private string _tenLoaiMonAn;
public string TenLoaiMonAn
{
get { return _tenLoaiMonAn; }
set { _tenLoaiMonAn = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/LoaiMonAn.cs | C# | asf20 | 694 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class LoaiVe
{
private string _maLoaiVe;
private string _TenLoaiVe;
public string TenLoaiVe
{
get { return _TenLoaiVe; }
set { _TenLoaiVe = value; }
}
public string MaLoaiVe
{
get { return _maLoaiVe; }
set { _maLoaiVe = value; }
}
private string _doiTuong;
public string DoiTuong
{
get { return _doiTuong; }
set { _doiTuong = value; }
}
private string _ngay;
public string Ngay
{
get { return _ngay; }
set { _ngay = value; }
}
private string _buoi;
public string Buoi
{
get { return _buoi; }
set { _buoi = value; }
}
private decimal _gia;
public decimal Gia
{
get { return _gia; }
set { _gia = value; }
}
private string _IsDelete;
public string IsDelete
{
get { return _IsDelete; }
set { _IsDelete = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/LoaiVe.cs | C# | asf20 | 1,297 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class PhanCong
{
private string _maPhanCong;
public string MaPhanCong
{
get { return _maPhanCong; }
set { _maPhanCong = value; }
}
private DateTime _ngayBatDau;
public DateTime NgayBatDau
{
get { return _ngayBatDau; }
set { _ngayBatDau = value; }
}
private DateTime _ngayKetThuc;
public DateTime NgayKetThuc
{
get { return _ngayKetThuc; }
set { _ngayKetThuc = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/PhanCong.cs | C# | asf20 | 703 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class NguyenVatLieu
{
private string _maNuyenVatLieu;
public string MaNuyenVatLieu
{
get { return _maNuyenVatLieu; }
set { _maNuyenVatLieu = value; }
}
private string _maLoaiNVL;
public string MaLoaiNVL
{
get { return _maLoaiNVL; }
set { _maLoaiNVL = value; }
}
private string _tenNVl;
public string TenNVl
{
get { return _tenNVl; }
set { _tenNVl = value; }
}
private int _soLuongTon;
public int SoLuongTon
{
get { return _soLuongTon; }
set { _soLuongTon = value; }
}
private string _donViTinh;
public string DonViTinh
{
get { return _donViTinh; }
set { _donViTinh = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/NguyenVatLieu.cs | C# | asf20 | 1,042 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class KhachHang
{
private string _maKH;
public string MaKH
{
get { return _maKH; }
set { _maKH = value; }
}
private string _tenKH;
public string TenKH
{
get { return _tenKH; }
set { _tenKH = value; }
}
private string _cMND;
public string CMND
{
get { return _cMND; }
set { _cMND = value; }
}
private string _diaChi;
public string DiaChi
{
get { return _diaChi; }
set { _diaChi = value; }
}
private string _dienThoai;
public string DienThoai
{
get { return _dienThoai; }
set { _dienThoai = value; }
}
private DateTime _ngayLapThe;
public DateTime NgayLapThe
{
get { return _ngayLapThe; }
set { _ngayLapThe = value; }
}
private float _diemTichLuy;
public float DiemTichLuy
{
get { return _diemTichLuy; }
set { _diemTichLuy = value; }
}
private float _tongDiem;
public float TongDiem
{
get { return _tongDiem; }
set { _tongDiem = value; }
}
private DateTime _ngayCapNhatSauCung;
public DateTime NgayCapNhatSauCung
{
get { return _ngayCapNhatSauCung; }
set { _ngayCapNhatSauCung = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/KhachHang.cs | C# | asf20 | 1,704 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class CTThucDon
{
private string _maThucDon;
public string MaThucDon
{
get { return _maThucDon; }
set { _maThucDon = value; }
}
private string _maMonAn;
public string MaMonAn
{
get { return _maMonAn; }
set { _maMonAn = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/CTThucDon.cs | C# | asf20 | 498 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
class CTHDDVu
{
private string _maHDDVu;
public string MaHDDVu
{
get { return _maHDDVu; }
set { _maHDDVu = value; }
}
private string _maMonAn;
public string MaMonAn
{
get { return _maMonAn; }
set { _maMonAn = value; }
}
private int _soLuong;
public int SoLuong
{
get { return _soLuong; }
set { _soLuong = value; }
}
private int _donGia;
public int DonGia
{
get { return _donGia; }
set { _donGia = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/CTHDDVu.cs | C# | asf20 | 797 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class Ca
{
private string _maCa;
public string MaCa
{
get { return _maCa; }
set { _maCa = value; }
}
private int _thoiGianBatDau;
public int ThoiGianBatDau
{
get { return _thoiGianBatDau; }
set { _thoiGianBatDau = value; }
}
private int _thoiGianKetThuc;
public int ThoiGianKetThuc
{
get { return _thoiGianKetThuc; }
set { _thoiGianKetThuc = value; }
}
private bool _isDelete;
public bool IsDelete
{
get { return _isDelete; }
set { _isDelete = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/Ca.cs | C# | asf20 | 851 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class Ve_HoaDon
{
private int _maHDVe;
public int MaHDVe
{
get { return _maHDVe; }
set { _maHDVe = value; }
}
private string _maNV;
public string MaNV
{
get { return _maNV; }
set { _maNV = value; }
}
private int _maKH;
public int MaKH
{
get { return _maKH; }
set { _maKH = value; }
}
private string _buoiAnBuffet;
public string BuoiAnBuffet
{
get { return _buoiAnBuffet; }
set { _buoiAnBuffet = value; }
}
private string _ngay;
public string Ngay
{
get { return _ngay; }
set { _ngay = value; }
}
private int _veNguoiLon;
public int VeNguoiLon
{
get { return _veNguoiLon; }
set { _veNguoiLon = value; }
}
private int _veTreEm;
public int VeTreEm
{
get { return _veTreEm; }
set { _veTreEm = value; }
}
private int _hinhThucThanhToan;
public int HinhThucThanhToan
{
get { return _hinhThucThanhToan; }
set { _hinhThucThanhToan = value; }
}
private float _tong;
public float Tong
{
get { return _tong; }
set { _tong = value; }
}
private int _giamGia;
public int GiamGia
{
get { return _giamGia; }
set { _giamGia = value; }
}
private float _thanhTien;
public float ThanhTien
{
get { return _thanhTien; }
set { _thanhTien = value; }
}
private DateTime _ngayLap;
public DateTime NgayLap
{
get { return _ngayLap; }
set { _ngayLap = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/Ve_HoaDon.cs | C# | asf20 | 2,142 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
class HoaDonDichVu
{
private string _maHDDVu;
public string MaHDDVu
{
get { return _maHDDVu; }
set { _maHDDVu = value; }
}
private string _maNV;
public string MaNV
{
get { return _maNV; }
set { _maNV = value; }
}
private string _maKH;
public string MaKH
{
get { return _maKH; }
set { _maKH = value; }
}
private DateTime _ngayLap;
public DateTime NgayLap
{
get { return _ngayLap; }
set { _ngayLap = value; }
}
private decimal _thanhTien;
public decimal ThanhTien
{
get { return _thanhTien; }
set { _thanhTien = value; }
}
private string _maBan;
public string MaBan
{
get { return _maBan; }
set { _maBan = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/HoaDonDichVu.cs | C# | asf20 | 1,132 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class Class1
{
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/Class1.cs | C# | asf20 | 155 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class CTPhieuNhap
{
private string _maPhieuNhap;
public string MaPhieuNhap
{
get { return _maPhieuNhap; }
set { _maPhieuNhap = value; }
}
private string _maNVL;
public string MaNVL
{
get { return _maNVL; }
set { _maNVL = value; }
}
private string _maNCC;
public string MaNCC
{
get { return _maNCC; }
set { _maNCC = value; }
}
private decimal _donGiaNhap;
public decimal DonGiaNhap
{
get { return _donGiaNhap; }
set { _donGiaNhap = value; }
}
private int _soLuong;
public int SoLuong
{
get { return _soLuong; }
set { _soLuong = value; }
}
private int _soLuongTonHienTai;
public int SoLuongTonHienTai
{
get { return _soLuongTonHienTai; }
set { _soLuongTonHienTai = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/CTPhieuNhap.cs | C# | asf20 | 1,198 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class DiemCong
{
private int _maCapDo;
public int MaCapDo
{
get { return _maCapDo; }
set { _maCapDo = value; }
}
private float _giaTriMin;
public float GiaTriMin
{
get { return _giaTriMin; }
set { _giaTriMin = value; }
}
private float _giaTriMax;
public float GiaTriMax
{
get { return _giaTriMax; }
set { _giaTriMax = value; }
}
private int _diemCong;
public int DiemCong1
{
get { return _diemCong; }
set { _diemCong = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/DiemCong.cs | C# | asf20 | 826 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class PhieuXuat
{
private string _maPX;
public string MaPX
{
get { return _maPX; }
set { _maPX = value; }
}
private DateTime _ngayLap;
public DateTime NgayLap
{
get { return _ngayLap; }
set { _ngayLap = value; }
}
private string _maNV;
public string MaNV
{
get { return _maNV; }
set { _maNV = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/PhieuXuat.cs | C# | asf20 | 636 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class MonAn_NVL
{
private string _MaNVL;
private string _MaMonAn;
private int _SoLuong;
public int SoLuong
{
get { return _SoLuong; }
set { _SoLuong = value; }
}
public string MaNVL
{
get { return _MaNVL; }
set { _MaNVL = value; }
}
public string MaMonAn
{
get { return _MaMonAn; }
set { _MaMonAn = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/MonAn_NVL.cs | C# | asf20 | 652 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class NCC
{
private string _maNCC;
public string MaNCC
{
get { return _maNCC; }
set { _maNCC = value; }
}
private string _tenNCC;
public string TenNCC
{
get { return _tenNCC; }
set { _tenNCC = value; }
}
private string _diaChi;
public string DiaChi
{
get { return _diaChi; }
set { _diaChi = value; }
}
private string _dienThoai;
public string DienThoai
{
get { return _dienThoai; }
set { _dienThoai = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/NCC.cs | C# | asf20 | 808 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class CTPhieuXuat
{
private string _maPX;
public string MaPX
{
get { return _maPX; }
set { _maPX = value; }
}
private string _maNVL;
public string MaNVL
{
get { return _maNVL; }
set { _maNVL = value; }
}
private int _soLuong;
public int SoLuong
{
get { return _soLuong; }
set { _soLuong = value; }
}
private int _soLuongTonHienTai;
public int SoLuongTonHienTai
{
get { return _soLuongTonHienTai; }
set { _soLuongTonHienTai = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/CTPhieuXuat.cs | C# | asf20 | 832 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class MonAn
{
private decimal _Gia;
public decimal Gia
{
get { return _Gia; }
set { _Gia = value; }
}
private string _maMonAn;
public string MaMonAn
{
get { return _maMonAn; }
set { _maMonAn = value; }
}
private string _maLoaiMonAn;
public string MaLoaiMonAn
{
get { return _maLoaiMonAn; }
set { _maLoaiMonAn = value; }
}
private string _tenMonAn;
public string TenMonAn
{
get { return _tenMonAn; }
set { _tenMonAn = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/MonAn.cs | C# | asf20 | 824 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class BangLuong
{
private string _maBangLuong;
public string MaBangLuong
{
get { return _maBangLuong; }
set { _maBangLuong = value; }
}
private string _maNV;
public string MaNV
{
get { return _maNV; }
set { _maNV = value; }
}
private int _soCaPhanCong;
public int SoCaPhanCong
{
get { return _soCaPhanCong; }
set { _soCaPhanCong = value; }
}
private int _soNgayNghi;
public int SoNgayNghi
{
get { return _soNgayNghi; }
set { _soNgayNghi = value; }
}
private int _soNgayTangCa;
public int SoNgayTangCa
{
get { return _soNgayTangCa; }
set { _soNgayTangCa = value; }
}
private decimal _thanhTien;
public decimal ThanhTien
{
get { return _thanhTien; }
set { _thanhTien = value; }
}
private DateTime _ngayPhatLuong;
public DateTime NgayPhatLuong
{
get { return _ngayPhatLuong; }
set { _ngayPhatLuong = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/BangLuong.cs | C# | asf20 | 1,396 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class ChucVu
{
private string _maChucVu;
public string MaChucVu
{
get { return _maChucVu; }
set { _maChucVu = value; }
}
private string _tenChucVu;
public string TenChucVu
{
get { return _tenChucVu; }
set { _tenChucVu = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/ChucVu.cs | C# | asf20 | 499 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class GiamGia
{
private string _maCapDo;
public string MaCapDo
{
get { return _maCapDo; }
set { _maCapDo = value; }
}
private float _diemMin;
public float DiemMin
{
get { return _diemMin; }
set { _diemMin = value; }
}
private float _diemMax;
public float DiemMax
{
get { return _diemMax; }
set { _diemMax = value; }
}
private int _tiLeGiam;
public int TiLeGiam
{
get { return _tiLeGiam; }
set { _tiLeGiam = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/GiamGia.cs | C# | asf20 | 816 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class CTNCC
{
private string _maNCC;
public string MaNCC
{
get { return _maNCC; }
set { _maNCC = value; }
}
private string _maNVL;
public string MaNVL
{
get { return _maNVL; }
set { _maNVL = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/CTNCC.cs | C# | asf20 | 470 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class PhieuNhap
{
private string _maPhieuNhap;
public string MaPhieuNhap
{
get { return _maPhieuNhap; }
set { _maPhieuNhap = value; }
}
private DateTime _ngayLap;
public DateTime NgayLap
{
get { return _ngayLap; }
set { _ngayLap = value; }
}
private string _maNV;
public string MaNV
{
get { return _maNV; }
set { _maNV = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/PhieuNhap.cs | C# | asf20 | 664 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DTO")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DTO")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e78238fb-dbdc-44d1-af1d-3e28f5de3f02")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/Properties/AssemblyInfo.cs | C# | asf20 | 1,418 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class DonXinNghi
{
private string _maNV;
public string MaNV
{
get { return _maNV; }
set { _maNV = value; }
}
private string _maPhanCong;
public string MaPhanCong
{
get { return _maPhanCong; }
set { _maPhanCong = value; }
}
private string _lyDo;
public string LyDo
{
get { return _lyDo; }
set { _lyDo = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/DonXinNghi.cs | C# | asf20 | 645 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class ThucDonDichVuKhach
{
private string _maNuoc;
public string MaNuoc
{
get { return _maNuoc; }
set { _maNuoc = value; }
}
private string _tenNuoc;
public string TenNuoc
{
get { return _tenNuoc; }
set { _tenNuoc = value; }
}
private string _dVT;
public string DVT
{
get { return _dVT; }
set { _dVT = value; }
}
private float _gia;
public float Gia
{
get { return _gia; }
set { _gia = value; }
}
private int _soLuongCon;
public int SoLuongCon
{
get { return _soLuongCon; }
set { _soLuongCon = value; }
}
private int _idelete;
public int idelete
{
get { return _idelete; }
set { _idelete = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/ThucDonDichVuKhach.cs | C# | asf20 | 1,125 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class NhanVien
{
private string _maNV;
public string MaNV
{
get { return _maNV; }
set { _maNV = value; }
}
private string _tenNV;
public string TenNV
{
get { return _tenNV; }
set { _tenNV = value; }
}
private string _diaChi;
public string DiaChi
{
get { return _diaChi; }
set { _diaChi = value; }
}
private string _email;
public string Email
{
get { return _email; }
set { _email = value; }
}
private string _dienThoai;
public string DienThoai
{
get { return _dienThoai; }
set { _dienThoai = value; }
}
private string _tenDN;
public string TenDN
{
get { return _tenDN; }
set { _tenDN = value; }
}
private string _matKhau;
public string MatKhau
{
get { return _matKhau; }
set { _matKhau = value; }
}
private string _maChucVu;
public string MaChucVu
{
get { return _maChucVu; }
set { _maChucVu = value; }
}
private bool _isDelete;
public bool IsDelete
{
get { return _isDelete; }
set { _isDelete = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/NhanVien.cs | C# | asf20 | 1,625 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class CTPhanCong
{
private string _maPhanCong;
public string MaPhanCong
{
get { return _maPhanCong; }
set { _maPhanCong = value; }
}
private DateTime _ngayPhanCong;
public DateTime NgayPhanCong
{
get { return _ngayPhanCong; }
set { _ngayPhanCong = value; }
}
private string _maCa;
public string MaCa
{
get { return _maCa; }
set { _maCa = value; }
}
private string _maNV;
public string MaNV
{
get { return _maNV; }
set { _maNV = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/CTPhanCong.cs | C# | asf20 | 847 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class ThucDon
{
private string _maThucDon;
public string MaThucDon
{
get { return _maThucDon; }
set { _maThucDon = value; }
}
private DateTime _ngayApDung;
public DateTime NgayApDung
{
get { return _ngayApDung; }
set { _ngayApDung = value; }
}
private DateTime _ngayKeThuc;
public DateTime NgayKeThuc
{
get { return _ngayKeThuc; }
set { _ngayKeThuc = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/ThucDon.cs | C# | asf20 | 694 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class Ban
{
private string _maBan;
public string MaBan
{
get { return _maBan; }
set { _maBan = value; }
}
private int _tinhTrang;
public int TinhTrang
{
get { return _tinhTrang; }
set { _tinhTrang = value; }
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/DTO/Ban.cs | C# | asf20 | 478 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Nhom16_PTTKHTTT_12HCB
{
public class BienToanCuc
{
public string makh = "";
public float diemtichluy;
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/BienToanCuc.cs | C# | asf20 | 247 |
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 DevComponents.DotNetBar;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmCaiDat : DevComponents.DotNetBar.Office2007Form
{
public frmCaiDat()
{
InitializeComponent();
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmCaiDat.cs | C# | asf20 | 445 |
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 DTO;
using BUS;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmThemNCC_NVL : Form
{
NguyenVatLieu_BUS nvl_bus;
NCC_BUS ncc_bus;
CTNCC ctncc_dto;
CTNCC_BUS ctncc_bus;
public frmThemNCC_NVL()
{
InitializeComponent();
}
private void btnThoat_Click(object sender, EventArgs e)
{
this.Close();
}
private void frmThemNCC_NVL_Load(object sender, EventArgs e)
{
//load ten nguyen vat lieu
nvl_bus = new NguyenVatLieu_BUS();
cbxTenNVL_PN.DataSource = nvl_bus.DanhSachNVL();
cbxTenNVL_PN.DisplayMember = "TenNVL";
cbxTenNVL_PN.ValueMember = "MaNVL";
//load danh sach nha cung cap
ncc_bus = new NCC_BUS();
cbxNCC_PNPX.DataSource = ncc_bus.DanhSachNCC();
cbxNCC_PNPX.DisplayMember = "TenNCC";
cbxNCC_PNPX.ValueMember = "MaNCC";
}
private void btnThem_Click(object sender, EventArgs e)
{
ctncc_bus = new CTNCC_BUS();
ctncc_dto = new CTNCC();
ctncc_dto.MaNCC = cbxNCC_PNPX.SelectedValue.ToString();
ctncc_dto.MaNVL = cbxTenNVL_PN.SelectedValue.ToString();
if (ctncc_bus.ThemCTNCC(ctncc_dto) == true)
{
MessageBox.Show("Thêm thành công", "Thông báo");
}
else
MessageBox.Show("Nguyên vật liệu này đã được cung cấp bởi nhà cung cấp này","Thông báo");
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmThemNCC_NVL.cs | C# | asf20 | 1,843 |
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 BUS;
using DTO;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmThem_Sua_NVL : Form
{
public delegate void ThemMoi();
public delegate void CapNhat();
public event ThemMoi KhiThemMoiNVL = null;
public event CapNhat KhiCapNhatNVL = null;
public string Action = "";
public string ID = null;
LaoiNVL_BUS loainvl_bus;
NguyenVatLieu_BUS nvl_bus;
NguyenVatLieu nvl_dto;
public frmThem_Sua_NVL()
{
InitializeComponent();
}
private void frmThem_Sua_NVL_Load(object sender, EventArgs e)
{
//load loai nguyen vat lieu vao combobox nguyen vat lieu
LoadComboboxLoaiNVL();
//
//set man hinh luc loadform
SetBounds(Screen.GetWorkingArea(this).Width / 2, Screen.GetWorkingArea(this).Height / 2, Width, Height);
//them loai nguyen vat lieu
if (Action.Equals("Insert"))
{
nvl_bus = new NguyenVatLieu_BUS();
txtMaNVL.Text = nvl_bus.MaNVLTang();
}
//cap nhat scah
if (Action.Equals("Update"))
{
nvl_bus = new NguyenVatLieu_BUS();
DataTable nvl = new DataTable();
nvl = nvl_bus.DanhSachNVL_Ma(ID);
txtMaNVL.Text = nvl.Rows[0]["MaNVL"].ToString();
txtTenNVL.Text = nvl.Rows[0]["TenNVL"].ToString();
txtDVT.Text = nvl.Rows[0]["DVT"].ToString();
txtSoLuongTon.Text = nvl.Rows[0]["SoLuongTon"].ToString();
cbxLoaiNVL.SelectedValue = nvl.Rows[0]["MaLoaiNVL"].ToString();
}
}
void LoadComboboxLoaiNVL()
{
loainvl_bus = new LaoiNVL_BUS();
cbxLoaiNVL.DataSource = loainvl_bus.DanhSachLoaiNVL();
cbxLoaiNVL.DisplayMember = "TenLoaiNVL";
cbxLoaiNVL.ValueMember = "MaLoaiNVL";
}
private void btnLuu_Click(object sender, EventArgs e)
{
if (txtTenNVL.Text == "")
{
MessageBox.Show("Chưa nhập tên nguyên vật liệu");
txtTenNVL.Select();
return;
}
nvl_bus = new NguyenVatLieu_BUS();
nvl_dto = new NguyenVatLieu();
nvl_dto.MaNuyenVatLieu = txtMaNVL.Text;
nvl_dto.MaLoaiNVL = cbxLoaiNVL.SelectedValue.ToString();
nvl_dto.TenNVl = txtTenNVL.Text;
nvl_dto.SoLuongTon = int.Parse(txtSoLuongTon.Text);
nvl_dto.DonViTinh = txtDVT.Text;
//them moi
if (Action.Equals("Insert"))
{
if (nvl_bus.ThemNVL(nvl_dto) == true)
{
MessageBox.Show("Thêm thành công", "Thống báo");
if (KhiThemMoiNVL != null)
{
KhiThemMoiNVL();
txtMaNVL.Text = nvl_bus.MaNVLTang();
}
}
else
MessageBox.Show("Thêm thất bại", "Thông báo");
}
if (Action.Equals("Update"))
{
if (nvl_bus.CapNhatNVL(nvl_dto) == true)
{
MessageBox.Show("Cập nhật thành công", "Thống báo");
if (KhiCapNhatNVL != null)
{
KhiCapNhatNVL();
this.Close();
}
}
else
MessageBox.Show("Cập nhật thất bại", "Thông báo");
}
}
private void btnThoat_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmThem_Sua_NVL.cs | C# | asf20 | 4,136 |
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 BUS;
using DTO;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmLoaiVe : Form
{
public frmLoaiVe()
{
InitializeComponent();
}
private void frmLoaiVe_Load(object sender, EventArgs e)
{
//DanhSachLoaiVe();
}
public void DanhSachLoaiVe()
{
//LoaiVe_BUS lv = new LoaiVe_BUS();
//DataTable dt = new DataTable();
//dt = lv.DanhSachLoaiVe();
//dgvLoaiVe.AutoGenerateColumns = false;
//dgvLoaiVe.DataSource = dt;
}
public void frmKhiLoaiVeThayDoi()
{
//DanhSachLoaiVe();
}
frmThem_Sua_LoaiVe frmThemSuaLoaiVe;
private void btnThem_Click(object sender, EventArgs e)
{
//frmThemSuaLoaiVe = new frmThem_Sua_LoaiVe();
//frmThemSuaLoaiVe.KhiThemMoiLoaiVe += frmKhiLoaiVeThayDoi;
//frmThemSuaLoaiVe.Action = "insert";
//frmThemSuaLoaiVe.ShowDialog();
}
private void btnXoa_Click(object sender, EventArgs e)
{
//LoaiVe_BUS lv = new LoaiVe_BUS();
//string ma = dgvLoaiVe.CurrentRow.Cells["MaLoaiVe"].Value.ToString();
//lv.XoaLoaiVe(ma);
//DanhSachLoaiVe();
}
private void btnSua_Click(object sender, EventArgs e)
{
//string ma = dgvLoaiVe.CurrentRow.Cells["MaLoaiVe"].Value.ToString();
//frmThemSuaLoaiVe = new frmThem_Sua_LoaiVe();
//frmThemSuaLoaiVe.ID = ma;
//frmThemSuaLoaiVe.KhiCapNhatLoaiVe += frmKhiLoaiVeThayDoi;
//frmThemSuaLoaiVe.Action = "edit";
//frmThemSuaLoaiVe.ShowDialog();
}
private void dgvLoaiVe_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
//if (e.RowIndex > -1)
//{
// string command = dgvLoaiVe.Columns[e.ColumnIndex].Name;
// if (command == "buttona") // colbtn là tên cột chứa button
// {
// // gọi form ở trong này
// MessageBox.Show("2");
// }
//}
}
private void groupPanel6_Click(object sender, EventArgs e)
{
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmLoaiVe.cs | C# | asf20 | 2,640 |
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 DevComponents.DotNetBar;
using DTO;
using BUS;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmKhoHang : DevComponents.DotNetBar.Office2007Form
{
public delegate void ThemMoi();
public delegate void CapNhat();
public string Action = "";
public string ID = null;
frmThem_Sua_LoaiNVL frmThemSuaLoaiNVL;
frmThem_Sua_NVL frmthemnvl;
frmThem_Sua_NCC frmthemsuancc;
LaoiNVL_BUS loainvl_bus;
LoaiNVL loainvl_dto;
NguyenVatLieu_BUS nvl_bus;
NguyenVatLieu nvl_dto;
NCC_BUS ncc_bus;
NCC ncc_dto;
PhieuNhap_BUS phieunhap_bus;
PhieuNhap phieunhap_dto;
CTPhieuNhap ctpn_dto;
CTPhieuNhap_BUS ctpn_bus;
PhieuXuat phieuxuat_dto;
PhieuXuat_BUS phieuxuat_bus;
CTPhieuXuat ctpx_dto;
CTPhieuXuat_BUS ctpx_bus;
public frmKhoHang()
{
InitializeComponent();
}
private void tabControl1_SelectedTabChanged(object sender, TabStripTabChangedEventArgs e)
{
}
private void frmKhoHang_Load(object sender, EventArgs e)
{
comboBoxExLoaiTK.SelectedIndex = 0;
cbxTKNhap.Enabled = true;
//load trong phan quan ly nguyen vat lieu, loai nguyen vat lieu.
Load_DSLoaiNVL();
LoadComboboxLoaiNVL();
Load_DSNVL();
cbxLoaiNVL_PN.SelectedIndex = 1;
cbxLoaiNVL_PX.SelectedIndex = 1;
//PHAN PHIEU NHAP
//load cot trong data gridview
//phieu nhap
nvl_bus = new NguyenVatLieu_BUS();
colTenNVL_PN.DataSource = nvl_bus.DanhSachNVL();
colTenNVL_PN.DisplayMember = "TenNVL";
colTenNVL_PN.ValueMember = "MaNVL";
loainvl_bus = new LaoiNVL_BUS();
colLoaiNVL_PN.DataSource = loainvl_bus.DanhSachLoaiNVL();
colLoaiNVL_PN.DisplayMember = "TenLoaiNVL";
colLoaiNVL_PN.ValueMember = "MaLoaiNVL";
ncc_bus = new NCC_BUS();
colNhaCungCap.DataSource = ncc_bus.DanhSachNCC() ;
colNhaCungCap.DisplayMember = "TenNCC";
colNhaCungCap.ValueMember = "MaNCC";
//phieu xuat
nvl_bus = new NguyenVatLieu_BUS();
colTenNVL_PX.DataSource = nvl_bus.DanhSachNVL();
colTenNVL_PX.DisplayMember = "TenNVL";
colTenNVL_PX.ValueMember = "MaNVL";
loainvl_bus = new LaoiNVL_BUS();
colLoaiNVL_PX.DataSource = loainvl_bus.DanhSachLoaiNVL();
colLoaiNVL_PX.DisplayMember = "TenLoaiNVL";
colLoaiNVL_PX.ValueMember = "MaLoaiNVL";
//load cac combobox trong datagridview trong phan quan ly dat loai nguyen vat lieu
ncc_bus = new NCC_BUS();
colTenNCC_DatNVL.DataSource = ncc_bus.DanhSachNCC();
colTenNCC_DatNVL.DisplayMember = "TenNCC";
colTenNCC_DatNVL.ValueMember = "MaNCC";
//phieu xuat
nvl_bus = new NguyenVatLieu_BUS();
colTenNVL_DatNVL.DataSource = nvl_bus.DanhSachNVL();
colTenNVL_DatNVL.DisplayMember = "TenNVL";
colTenNVL_DatNVL.ValueMember = "MaNVL";
loainvl_bus = new LaoiNVL_BUS();
colLoaiNVL_DatNVL.DataSource = loainvl_bus.DanhSachLoaiNVL();
colLoaiNVL_DatNVL.DisplayMember = "TenLoaiNVL";
colLoaiNVL_DatNVL.ValueMember = "MaLoaiNVL";
//load danh sach nha cung cap
LoadDanhSachNCC();
//load combobox trong phan quan ly dat nguyen vat lieu
LoadDSLoaiNVL_DatNVL();
//load combobox trong phan thong ke nhap nguyen vat lieu
loainvl_bus = new LaoiNVL_BUS();
cbxTKNhap.DataSource = loainvl_bus.DanhSachLoaiNVL();
cbxTKNhap.DisplayMember = "TenLoaiNVL";
cbxTKNhap.ValueMember = "MaLoaiNVL";
}
int dong_LoaiNVL;
private void dtgLoaiNVL_RowEnter(object sender, DataGridViewCellEventArgs e)
{
dong_LoaiNVL = e.RowIndex;
}
void LoadComboboxLapDSNCC()
{
ncc_bus = new NCC_BUS();
colTenNCC_DatNVL.DataSource = ncc_bus.DanhSachNCC();
colTenNCC_DatNVL.DisplayMember = "TenNCC";
colTenNCC_DatNVL.ValueMember = "MaNCC";
//phieu xuat
nvl_bus = new NguyenVatLieu_BUS();
colTenNVL_DatNVL.DataSource = nvl_bus.DanhSachNVL();
colTenNVL_DatNVL.DisplayMember = "TenNVL";
colTenNVL_DatNVL.ValueMember = "MaNVL";
loainvl_bus = new LaoiNVL_BUS();
colLoaiNVL_DatNVL.DataSource = loainvl_bus.DanhSachLoaiNVL();
colLoaiNVL_DatNVL.DisplayMember = "TenLoaiNVL";
colLoaiNVL_DatNVL.ValueMember = "MaLoaiNVL";
}
void LoadComboboxLoaiNVL()
{
loainvl_bus = new LaoiNVL_BUS();
//combobox trong quan ly nguyen vat lieu
cbxLoaiNVL.DataSource = loainvl_bus.DanhSachLoaiNVL();
cbxLoaiNVL.DisplayMember = "TenLoaiNVL";
cbxLoaiNVL.ValueMember = "MaLoaiNVL";
//combobox trong phieu nhap
cbxLoaiNVL_PN.DataSource = loainvl_bus.DanhSachLoaiNVL();
cbxLoaiNVL_PN.DisplayMember = "TenLoaiNVL";
cbxLoaiNVL_PN.ValueMember = "MaLoaiNVL";
//cbxLoaiNVL_PN.SelectedIndex = 0;
//combobox trong phieu xuat
cbxLoaiNVL_PX.DataSource = loainvl_bus.DanhSachLoaiNVL();
cbxLoaiNVL_PX.DisplayMember = "TenLoaiNVL";
cbxLoaiNVL_PX.ValueMember = "MaLoaiNVL";
//cbxLoaiNVL_PX.SelectedIndex = 0;
}
private void btnLapPhieuNhap_Click(object sender, EventArgs e)
{
if (txtSoLuong_PN.Text == "")
{
MessageBox.Show("Chưa nhập số lượng", "Thông báo");
txtSoLuong_PN.Select();
return;
}
if (txtDonGia_PN.Text == "")
{
MessageBox.Show("Chưa nhập số lượng", "Thông báo");
txtSoLuong_PN.Select();
return;
}
bool flag = true;
//1. luu vao phieu nhap
phieunhap_bus = new PhieuNhap_BUS();
phieunhap_dto = new PhieuNhap();
phieunhap_dto.MaPhieuNhap = phieunhap_bus.MaPNTang();
phieunhap_dto.MaNV = ThongTinDangNhap.MaNV;
phieunhap_dto.NgayLap = DateTime.Now;
flag = phieunhap_bus.ThemPhieuNhap(phieunhap_dto);
//2. luu vào bang chi tiet phieu nhap
for (int i = 0; i < dtgLapPhieuNhap.Rows.Count; i++)
{
//2.1 cap nhat lai thong tin so luong ton hien tai cua nguyen vat lieu
nvl_bus = new NguyenVatLieu_BUS();
nvl_dto = new NguyenVatLieu();
nvl_dto.MaNuyenVatLieu = dtgLapPhieuNhap.Rows[i].Cells["colTenNVL_PN"].Value.ToString();
System.Data.DataTable nvl = nvl_bus.DanhSachNVL_Ma(nvl_dto.MaNuyenVatLieu);
nvl_dto.MaLoaiNVL = nvl.Rows[0]["MaLoaiNVL"].ToString();
nvl_dto.TenNVl = nvl.Rows[0]["TenNVL"].ToString();
int temp = int.Parse(nvl.Rows[0]["SoLuongTon"].ToString()) + int.Parse(txtSoLuong_PN.Text);
nvl_dto.SoLuongTon = temp;
nvl_dto.DonViTinh = nvl.Rows[0]["DVT"].ToString();
flag = nvl_bus.CapNhatNVL(nvl_dto);
//2.2 them vao bang chi tiet phieu nhap
ctpn_bus = new CTPhieuNhap_BUS();
ctpn_dto = new CTPhieuNhap();
ctpn_dto.MaPhieuNhap = phieunhap_dto.MaPhieuNhap;
ctpn_dto.MaNVL = dtgLapPhieuNhap.Rows[i].Cells["colTenNVL_PN"].Value.ToString();
ctpn_dto.MaNCC = dtgLapPhieuNhap.Rows[i].Cells["colNhaCungCap"].Value.ToString();
ctpn_dto.DonGiaNhap = decimal.Parse(txtDonGia_PN.Text);
ctpn_dto.SoLuong = int.Parse(txtSoLuong_PN.Text);
ctpn_dto.SoLuongTonHienTai = nvl_dto.SoLuongTon;
flag = ctpn_bus.ThemCTPhieuNhap(ctpn_dto);
}
//3. cap nhat lai nguyen vat lieu
if (flag == true)
{
MessageBox.Show("Lập thành công", "Thông báo");
frm_KhiNVLThayDoi();
}
if (MessageBoxEx.Show("Bạn có muốn xuất ra file excel không?", "Xuất file", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
//ExportToExcel ex = new ExportToExcel();
//ex.Export(dtgLapPhieuNhap, "Phiếu nhập");
}
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
frmThemNCC_NVL frm = new frmThemNCC_NVL();
frm.ShowDialog();
}
private void cbxTenNVL_PN_SelectedIndexChanged(object sender, EventArgs e)
{
ncc_bus = new NCC_BUS();
cbxNCC_PN.DataSource = ncc_bus.DanhSachNCC_MaNVL(cbxTenNVL_PN.SelectedValue.ToString());
cbxNCC_PN.DisplayMember = "TenNCC";
cbxNCC_PN.ValueMember = "MaNCC";
}
private void cbxLoaiNVL_PX_SelectedIndexChanged(object sender, EventArgs e)
{
nvl_bus = new NguyenVatLieu_BUS();
cbxTenNVL_PX.DataSource = nvl_bus.DanhSachNVL_MaLoaiNVL(cbxLoaiNVL_PX.SelectedValue.ToString());
cbxTenNVL_PX.DisplayMember = "TenNVL";
cbxTenNVL_PX.ValueMember = "MaNVL";
}
private void btnThoat_NVL_Click(object sender, EventArgs e)
{
this.Close();
}
#region "QUAN LY LOAI NGUYEN VAT LIEU"
//THEM LOAI NGUYEN VAT LIEU
private void btnThem_Click(object sender, EventArgs e)
{
frmThemSuaLoaiNVL = new frmThem_Sua_LoaiNVL();
frmThemSuaLoaiNVL.KhiThemMoi += frm_KhiLoaiNVLThayDoi;
frmThemSuaLoaiNVL.Action = "Insert";
frmThemSuaLoaiNVL.ShowDialog();
}
//CAP NHAT LOAI NGUYEN VAT LIEU
private void btnSua_Click(object sender, EventArgs e)
{
frmThemSuaLoaiNVL = new frmThem_Sua_LoaiNVL();
frmThemSuaLoaiNVL.KhiCapNhat += frm_KhiLoaiNVLThayDoi;
frmThemSuaLoaiNVL.Action = "Update";
frmThemSuaLoaiNVL.ID = dtgLoaiNVL.Rows[dong_LoaiNVL].Cells["MaLoaiNVL"].Value.ToString();
frmThemSuaLoaiNVL.ShowDialog();
}
private void btnXoa_Click(object sender, EventArgs e)
{
loainvl_bus = new LaoiNVL_BUS();
loainvl_dto = new LoaiNVL();
loainvl_dto.MaLoaiNVL = dtgLoaiNVL.Rows[dong_LoaiNVL].Cells["MaLoaiNVL"].Value.ToString();
if (loainvl_bus.XoaLoaiNVL(loainvl_dto) == true)
{
MessageBox.Show("Xóa thành công", "Thông báo");
frm_KhiLoaiNVLThayDoi();
}
else
MessageBox.Show("Xóa thất bại", "Thông báo");
}
private void dtgLoaiNVL_DoubleClick(object sender, EventArgs e)
{
btnSua_Click(sender, e);
}
void frm_KhiLoaiNVLThayDoi()
{
Load_DSLoaiNVL();
LoadComboboxLoaiNVL();
}
void Load_DSLoaiNVL()
{
loainvl_bus = new LaoiNVL_BUS();
dtgLoaiNVL.AutoGenerateColumns = false;
dtgLoaiNVL.DataSource = loainvl_bus.DanhSachLoaiNVL();
}
void Load_DSNVL()
{
nvl_bus = new NguyenVatLieu_BUS();
dtgNVL.AutoGenerateColumns = false;
dtgNVL.DataSource = nvl_bus.DanhSachNVL();
}
#endregion
#region"QUAN LY NGUYEN VAT LIEU"
//---------------------------------- NGUYEN VAT LIEU------------------------------------
int dong_NVL;
private void dtgNVL_RowEnter(object sender, DataGridViewCellEventArgs e)
{
dong_NVL = e.RowIndex;
nvl_bus = new NguyenVatLieu_BUS();
System.Data.DataTable nvl = new System.Data.DataTable();
nvl = nvl_bus.DanhSachNVL_Ma(dtgNVL.Rows[dong_NVL].Cells["MaNVL"].Value.ToString());
txtMaNVL.Text = nvl.Rows[0]["MaNVL"].ToString();
txtTenNVL.Text = nvl.Rows[0]["TenNVL"].ToString();
txtSoLuongTon.Text = nvl.Rows[0]["SoLuongTon"].ToString();
cbxLoaiNVL.SelectedValue = nvl.Rows[0]["MaLoaiNVL"].ToString();
}
void frm_KhiNVLThayDoi()
{
Load_DSNVL();
}
private void btnThem_NVL_Click(object sender, EventArgs e)
{
frmthemnvl = new frmThem_Sua_NVL();
frmthemnvl.KhiThemMoiNVL += frm_KhiNVLThayDoi;
frmthemnvl.Action = "Insert";
frmthemnvl.ShowDialog();
}
private void btnXoa_NVL_Click(object sender, EventArgs e)
{
nvl_bus = new NguyenVatLieu_BUS();
nvl_dto = new NguyenVatLieu();
nvl_dto.MaNuyenVatLieu = dtgNVL.Rows[dong_NVL].Cells["MaNVL"].Value.ToString();
if (nvl_bus.XoaNVL(nvl_dto) == true)
{
MessageBox.Show("Xóa thành công", "Thông báo");
frm_KhiNVLThayDoi();
}
else
MessageBox.Show("Xóa thát bại","Thông báo");
}
private void btnSua_NVL_Click(object sender, EventArgs e)
{
frmthemnvl = new frmThem_Sua_NVL();
frmthemnvl.KhiCapNhatNVL += frm_KhiNVLThayDoi;
frmthemnvl.Action = "Update";
frmthemnvl.ID = dtgNVL.Rows[dong_NVL].Cells["MaNVL"].Value.ToString();
frmthemnvl.ShowDialog();
}
private void dtgNVL_DoubleClick(object sender, EventArgs e)
{
btnSua_NVL_Click(sender, e);
}
#endregion
#region"QUAN LY PHIEU NHAP"
private void cbxLoaiNVL_PN_SelectedIndexChanged(object sender, EventArgs e)
{
nvl_bus = new NguyenVatLieu_BUS();
cbxTenNVL_PN.DataSource = nvl_bus.DanhSachNVL_MaLoaiNVL(cbxLoaiNVL_PN.SelectedValue.ToString());
cbxTenNVL_PN.DisplayMember = "TenNVL";
cbxTenNVL_PN.ValueMember = "MaNVL";
}
private void txtSoLuong_PN_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
e.Handled = true;
}
private void txtDonGia_PN_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
e.Handled = true;
}
private void txtSoLuong_PX_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
e.Handled = true;
}
//themthong tin nguyen vat lieu vao trong gridview
private void txtThem_PN_Click(object sender, EventArgs e)
{
if (txtSoLuong_PN.Text == "")
{
MessageBox.Show("Chưa nhập số lượng","Thông báo");
txtSoLuong_PX.Select();
return;
}
if (txtDonGia_PN.Text == "")
{
MessageBox.Show("Chưa nhập đơn giá", "Thông báo");
txtDonGia_PN.Select();
return;
}
////truong hop co roi lai them nua thi cap nhat lai dong đó.
int flag = -1;//ko trung
for (int i = 0; i < dtgLapPhieuNhap.Rows.Count; i++)
{
if (dtgLapPhieuNhap.Rows[i].Cells["colTenNVL_PN"].Value == cbxTenNVL_PN.SelectedValue
&& dtgLapPhieuNhap.Rows[i].Cells["colNhaCungCap"].Value == cbxNCC_PN.SelectedValue)
flag = i;//trung thi cap nhat lai so luong va gia
}
if (flag != -1)//da trung thi cap nhat lai so luong va gia
{
int i_SoLuong = int.Parse(dtgLapPhieuNhap.Rows[flag].Cells["SoLuong_PN"].Value.ToString());
dtgLapPhieuNhap.Rows[flag].Cells["SoLuong_PN"].Value = i_SoLuong + int.Parse(txtSoLuong_PN.Text);
}
else
{
//thong tin nguyen vat lieu
nvl_bus = new NguyenVatLieu_BUS();
System.Data.DataTable nvl = nvl_bus.DanhSachNVL_Ma(cbxTenNVL_PN.SelectedValue.ToString());
string dvt = nvl.Rows[0]["DVT"].ToString();
dtgLapPhieuNhap.Rows.Add(cbxTenNVL_PN.SelectedValue, cbxNCC_PN.SelectedValue, cbxLoaiNVL_PN.SelectedValue, txtSoLuong_PN.Text, txtDonGia_PN.Text, dvt);
}
}
private void btnXoa_PN_Click(object sender, EventArgs e)
{
dtgLapPhieuNhap.Rows.RemoveAt(dong_dtgLapPhieuNhap);
}
int dong_dtgLapPhieuNhap;
private void dtgLapPhieuNhap_RowEnter(object sender, DataGridViewCellEventArgs e)
{
dong_dtgLapPhieuNhap = e.RowIndex;
}
private void btnPhieuNhapMoi_Click(object sender, EventArgs e)
{
dtgLapPhieuNhap.Rows.Clear();
}
private void LuuExcel(string strTieude)
{
}
#endregion
#region"QUAN LY NHA CUNG CAP"
private void btnThem_NCC_Click(object sender, EventArgs e)
{
frmthemsuancc = new frmThem_Sua_NCC();
frmthemsuancc.KhiThemMoiNCC += frm_KhiNCCThayDoi;
frmthemsuancc.Action = "Insert";
frmthemsuancc.ShowDialog();
}
private void btnXoa_NCC_Click(object sender, EventArgs e)
{
ncc_dto = new NCC();
ncc_bus = new NCC_BUS();
ncc_dto.MaNCC = dtgNCC.Rows[dong_ncc].Cells["MaNCC"].Value.ToString();
if (ncc_bus.XoaNCC(ncc_dto) == true)
{
MessageBox.Show("Xóa thành công", "Thông báo");
frm_KhiNCCThayDoi();
}
else
MessageBox.Show("Xóa thất bại","Thông báo");
}
private void bntSua_NCC_Click(object sender, EventArgs e)//ncc
{
frmthemsuancc = new frmThem_Sua_NCC();
frmthemsuancc.KhiCapNhatNCC += frm_KhiNCCThayDoi;
frmthemsuancc.Action = "Update";
frmthemsuancc.ID = dtgNCC.Rows[dong_ncc].Cells["MaNCC"].Value.ToString();
frmthemsuancc.ShowDialog();
}
void frm_KhiNCCThayDoi()
{
LoadDanhSachNCC();
}
void LoadDanhSachNCC()
{
ncc_bus = new NCC_BUS();
dtgNCC.AutoGenerateColumns = false;
dtgNCC.DataSource = ncc_bus.DanhSachNCC();
}
int dong_ncc;
private void dtgNCC_RowEnter(object sender, DataGridViewCellEventArgs e)
{
dong_ncc = e.RowIndex;
}
#endregion
private void btnThem_PX_Click(object sender, EventArgs e)
{
if (txtSoLuong_PX.Text == "")
{
MessageBox.Show("Chưa nhập số lượng","Thông báo");
txtSoLuong_PX.Select();
return;
}
//
//kiem tra so luong xuat ra.
nvl_bus = new NguyenVatLieu_BUS();
nvl_dto = new NguyenVatLieu();
System.Data.DataTable dt = nvl_bus.DanhSachNVL_Ma(cbxTenNVL_PX.SelectedValue.ToString());
nvl_dto.DonViTinh = dt.Rows[0]["DVT"].ToString();
if (int.Parse(txtSoLuong_PX.Text) > int.Parse(dt.Rows[0]["SoLuongTon"].ToString()))
{
MessageBox.Show("Số lượng xuất không được lớn hơn số lượng hiện tại", "Thông báo");
txtSoLuong_PX.Select();
return;
}
//
int flag = -1;//ko trung
for (int i = 0; i < dtgLapPhieuXuat.Rows.Count; i++)
{
if (dtgLapPhieuXuat.Rows[i].Cells["colTenNVL_PX"].Value == cbxTenNVL_PX.SelectedValue
&& dtgLapPhieuXuat.Rows[i].Cells["colLoaiNVL_PX"].Value == cbxLoaiNVL_PX.SelectedValue)
flag = i;//trung thi cap nhat lai so luong va gia
}
if (flag != -1)//da trung thi cap nhat lai so luong va gia
{
int i_SoLuong = int.Parse(dtgLapPhieuXuat.Rows[flag].Cells["SoLuong_PX"].Value.ToString());
dtgLapPhieuXuat.Rows[flag].Cells["SoLuong_PX"].Value = i_SoLuong + int.Parse(txtSoLuong_PX.Text);
}
else
dtgLapPhieuXuat.Rows.Add(cbxTenNVL_PX.SelectedValue, cbxLoaiNVL_PX.SelectedValue, txtSoLuong_PX.Text, nvl_dto.DonViTinh);
}
private void btnXoa_PX_Click(object sender, EventArgs e)
{
dtgLapPhieuXuat.Rows.RemoveAt(dong_dtgLapPhieuXuat);
}
int dong_dtgLapPhieuXuat;
private void dtgLapPhieuXuat_RowEnter(object sender, DataGridViewCellEventArgs e)
{
dong_dtgLapPhieuXuat = e.RowIndex;
}
private void btnPhieuXuatMoi_Click(object sender, EventArgs e)
{
dtgLapPhieuXuat.Rows.Clear();
}
private void btnThoat_PX_Click(object sender, EventArgs e)
{
this.Close();
}
private void txtSoLuong_PX_KeyPress_1(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
e.Handled = true;
}
private void btnLapPhieuXuat_PX_Click(object sender, EventArgs e)
{
bool flag = true;
//1. them vao phieu xuat.
phieuxuat_bus = new PhieuXuat_BUS();
phieuxuat_dto = new PhieuXuat();
phieuxuat_dto.MaPX = phieuxuat_bus.MaPXTang();
phieuxuat_dto.NgayLap = DateTime.Now;
phieuxuat_dto.MaNV = ThongTinDangNhap.MaNV;
flag = phieuxuat_bus.ThemPhieuXuat(phieuxuat_dto);
//2.
for (int i = 0; i < dtgLapPhieuXuat.Rows.Count; i++)
{
//2.1 cap nhat lai thong tin so luong ton hien tai cua nguyen vat lieu
nvl_bus = new NguyenVatLieu_BUS();
nvl_dto = new NguyenVatLieu();
nvl_dto.MaNuyenVatLieu = dtgLapPhieuXuat.Rows[i].Cells["colTenNVL_PX"].Value.ToString();
System.Data.DataTable nvl = nvl_bus.DanhSachNVL_Ma(nvl_dto.MaNuyenVatLieu);
nvl_dto.MaLoaiNVL = nvl.Rows[0]["MaLoaiNVL"].ToString();
nvl_dto.TenNVl = nvl.Rows[0]["TenNVL"].ToString();
int temp = int.Parse(nvl.Rows[0]["SoLuongTon"].ToString()) - int.Parse(txtSoLuong_PX.Text);
nvl_dto.SoLuongTon = temp;
nvl_dto.DonViTinh = nvl.Rows[0]["DVT"].ToString();
flag = nvl_bus.CapNhatNVL(nvl_dto);
//2.2 them vao bang chi tiet phieu xuat
ctpx_bus = new CTPhieuXuat_BUS();
ctpx_dto = new CTPhieuXuat();
ctpx_dto.MaPX = phieuxuat_dto.MaPX;
ctpx_dto.MaNVL = nvl_dto.MaNuyenVatLieu;
ctpx_dto.SoLuong = int.Parse(txtSoLuong_PX.Text);
ctpx_dto.SoLuongTonHienTai = nvl_dto.SoLuongTon;
flag = ctpx_bus.ThemCTPhieuXuat(ctpx_dto);
}
if (flag == true)
{
MessageBox.Show("Lập phiếu xuất thành công", "Thông báo");
frm_KhiNVLThayDoi();
}
if (MessageBoxEx.Show("Bạn có muốn xuất ra file excel không?", "Xuất file", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
//ExportToExcel ex = new ExportToExcel();
//ex.Export(dtgLapPhieuXuat, "Phiếu xuất");
}
}
private void txtSoLuong_DatNVL_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
e.Handled = true;
}
private void btnThem_DatNVL_Click(object sender, EventArgs e)
{
if (txtSoLuong_DatNVL.Text == "")
{
MessageBox.Show("Chưa nhập số lượng","Thông báo");
txtSoLuong_DatNVL.Select();
return;
}
//
int flag = -1;//ko trung
for (int i = 0; i < dtgDSDatNVL.Rows.Count; i++)
{
if (dtgDSDatNVL.Rows[i].Cells["colLoaiNVL_DatNVL"].Value == cbxLoaiNVL_DatNVL.SelectedValue
&& dtgDSDatNVL.Rows[i].Cells["colTenNVL_DatNVL"].Value == cbxTenNVL_DatNVL.SelectedValue
&& dtgDSDatNVL.Rows[i].Cells["colTenNCC_DatNVL"].Value == cbxTenNCC_DatNVL.SelectedValue)
flag = i;//trung thi cap nhat lai so luong va gia
}
if (flag != -1)//da trung thi cap nhat lai so luong va gia
{
int i_SoLuong = int.Parse(dtgDSDatNVL.Rows[flag].Cells["SoLuong_DatNVL"].Value.ToString());
dtgDSDatNVL.Rows[flag].Cells["SoLuong_DatNVL"].Value = i_SoLuong + int.Parse(txtSoLuong_DatNVL.Text);
}
else
dtgDSDatNVL.Rows.Add(cbxTenNVL_DatNVL.SelectedValue.ToString(),cbxLoaiNVL_DatNVL.SelectedValue.ToString(),cbxTenNCC_DatNVL.SelectedValue.ToString(), txtSoLuong_DatNVL.Text, txtDVT_DatNVL.Text);
//
}
void LoadDSLoaiNVL_DatNVL()
{
loainvl_bus = new LaoiNVL_BUS();
cbxLoaiNVL_DatNVL.DataSource = loainvl_bus.DanhSachLoaiNVL();
cbxLoaiNVL_DatNVL.DisplayMember = "TenLoaiNVL";
cbxLoaiNVL_DatNVL.ValueMember = "MaLoaiNVL";
}
private void cbxLoaiNVL_DatNVL_SelectedIndexChanged(object sender, EventArgs e)
{
nvl_bus = new NguyenVatLieu_BUS();
cbxTenNVL_DatNVL.DataSource = nvl_bus.DanhSachNVL_MaLoaiNVL(cbxLoaiNVL_DatNVL.SelectedValue.ToString());
cbxTenNVL_DatNVL.DisplayMember = "TenNVL";
cbxTenNVL_DatNVL.ValueMember = "MaNVL";
}
private void cbxTenLoaiNVL_DatNVL_SelectedIndexChanged(object sender, EventArgs e)
{
ncc_bus = new NCC_BUS();
cbxTenNCC_DatNVL.DataSource = ncc_bus.DanhSachNCC_MaNVL(cbxTenNVL_DatNVL.SelectedValue.ToString());
cbxTenNCC_DatNVL.DisplayMember = "TenNCC";
cbxTenNCC_DatNVL.ValueMember = "MaNCC";
//lay thuoc tinh don vi tinh
nvl_bus = new NguyenVatLieu_BUS();
System.Data.DataTable dt = nvl_bus.DanhSachNVL_Ma(cbxTenNVL_DatNVL.SelectedValue.ToString());
txtDVT_DatNVL.Text = dt.Rows[0]["DVT"].ToString();
}
private void btnThoatLapDS_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnPhieuMoi_Click(object sender, EventArgs e)
{
dtgDSDatNVL.Rows.Clear();
}
private void btnXuatPhieuDat_Click(object sender, EventArgs e)
{
ExportToExcel ex = new ExportToExcel();
ex.Export(dtgDSDatNVL, "Danh sách nguyên vật liệu cần đặt");
}
#region"THONG KE PHIEU NHAP VA XUAT NGUEYN VAT LIEU"
private void btnThoat_TKNhap_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnHienThi_TKNhap_Click(object sender, EventArgs e)
{
TimeSpan ts = datTKNhapNgayKT.Value - datTKNhapNgayBD.Value;
if (ts.Days <= 0)
{
MessageBoxEx.Show("Ngày kết thúc phải lớn hơn ngày bắt đầu","Thông báo");
datTKNhapNgayKT.Select();
return;
}
DateTime bd = new DateTime(datTKNhapNgayBD.Value.Year, datTKNhapNgayBD.Value.Month, datTKNhapNgayBD.Value.Day, 0, 0, 0);
DateTime kt = new DateTime(datTKNhapNgayKT.Value.Year, datTKNhapNgayKT.Value.Month, datTKNhapNgayKT.Value.Day, 0, 0, 0);
ReportDocument cryRpt = new ReportDocument();
if (comboBoxExLoaiTK.SelectedIndex == 0)
{
string str = @"..\\..\\Report\\TK_TinhHinhNhapNVL.rpt";
cryRpt.Load(str);
}
if (comboBoxExLoaiTK.SelectedIndex == 1)
{
string str = @"..\\..\\Report\\TK_TinhHinhXuatNVL.rpt";
cryRpt.Load(str);
}
string MaNVL = "";
if (checkBoxXNVL_Nhap.Checked == true)
MaNVL = cbxTKNhap.SelectedValue.ToString();
if (checkBoxXNVL_Nhap.Checked == false)
MaNVL = "null";
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
//truyen tham so loai nguyen vat lieu
crParameterDiscreteValue.Value = MaNVL;
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["@MaLoaiNVL"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
//truyen tham so ngay bat dau
crParameterDiscreteValue.Value = bd;
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["@NgayBD"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
////truyen tham so ngay ket thuc
crParameterDiscreteValue.Value = kt;
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["@NgayKT"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
//load report
crystalReportViewerTKNhapNVL.ReportSource = cryRpt;
crystalReportViewerTKNhapNVL.Refresh();
}
private void checkBoxXNVL_Nhap_CheckedChanged(object sender, EventArgs e)
{
if (checkBoxXNVL_Nhap.Checked == true)
{
cbxTKNhap.Enabled = true;
}
else
{
cbxTKNhap.Enabled = false;
}
}
#endregion
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmKhoHang.cs | C# | asf20 | 32,520 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
namespace Nhom16_PTTKHTTT_12HCB
{
public static class Functions
{
public static string ToMD5(this string chuoi)
{
string str_md5 = "";
byte[] mang = System.Text.Encoding.UTF8.GetBytes(chuoi);
MD5CryptoServiceProvider my_md5 = new MD5CryptoServiceProvider();
mang = my_md5.ComputeHash(mang);
foreach (byte b in mang)
{
str_md5 += b.ToString("x2");//Nếu là "X2" thì kết quả sẽ tự chuyển sang ký tự in Hoa
}
return str_md5;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/Functions.cs | C# | asf20 | 748 |
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 DTO;
using BUS;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmThem_Sua_NCC : Form
{
public delegate void ThemMoi();
public delegate void CapNhat();
public event ThemMoi KhiThemMoiNCC = null;
public event CapNhat KhiCapNhatNCC = null;
public string Action = "";
public string ID = null;
NCC_BUS ncc_bus;
NCC ncc_dto;
public frmThem_Sua_NCC()
{
InitializeComponent();
}
private void frmThem_Sua_NCC_Load(object sender, EventArgs e)
{
//load loai nguyen vat lieu vao combobox nguyen vat lieu
//LoadComboboxLoaiNVL();
////
//set man hinh luc loadform
SetBounds(Screen.GetWorkingArea(this).Width / 2, Screen.GetWorkingArea(this).Height / 2, Width, Height);
//them loai nguyen vat lieu
if (Action.Equals("Insert"))
{
ncc_bus = new NCC_BUS();
txtMaNCC.Text = ncc_bus.MaNCCTang();
}
//cap nhat scah
if (Action.Equals("Update"))
{
ncc_bus = new NCC_BUS();
DataTable ncc = new DataTable();
ncc = ncc_bus.DanhSachNCC_Ma(ID);
txtMaNCC.Text = ncc.Rows[0]["MaNCC"].ToString();
txtTenNCC.Text = ncc.Rows[0]["TenNCC"].ToString();
txtDiaChi.Text = ncc.Rows[0]["DiaChi"].ToString();
txtDienThoai.Text = ncc.Rows[0]["DienThoai"].ToString();
}
}
private void btnThoat_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnLuu_Click(object sender, EventArgs e)
{
//if (txtTenNVL.Text == "")
//{
// MessageBox.Show("Chưa nhập tên nguyên vật liệu");
// txtTenNVL.Select();
// return;
//}
ncc_bus = new NCC_BUS();
ncc_dto = new NCC();
ncc_dto.MaNCC = txtMaNCC.Text;
ncc_dto.TenNCC = txtTenNCC.Text;
ncc_dto.DiaChi = txtDiaChi.Text;
ncc_dto.DienThoai = txtDienThoai.Text;
////them moi
if (Action.Equals("Insert"))
{
if (ncc_bus.ThemNCC(ncc_dto) == true)
{
MessageBox.Show("Thêm thành công", "Thống báo");
if (KhiThemMoiNCC != null)
{
KhiThemMoiNCC();
txtMaNCC.Text = ncc_bus.MaNCCTang();
}
}
else
MessageBox.Show("Thêm thất bại", "Thông báo");
}
if (Action.Equals("Update"))
{
if (ncc_bus.CapNhatNCC(ncc_dto) == true)
{
MessageBox.Show("Cập nhật thành công", "Thống báo");
if (KhiCapNhatNCC != null)
{
KhiCapNhatNCC();
this.Close();
}
}
else
MessageBox.Show("Cập nhật thất bại", "Thông báo");
}
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmThem_Sua_NCC.cs | C# | asf20 | 3,626 |
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;
using System.Data.Sql;
using System.Data.SqlClient;
using BUS;
using DTO;
using DevComponents.DotNetBar;
using System.Collections;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmPhucVu : DevComponents.DotNetBar.Office2007Form
{
DataTable dt = new DataTable();
DataTable td = new DataTable();
BUS.GiamGia_BUS ggb;
BUS.DiemCong_BUS dcb;
BUS.Ve_HoaDon_BUS vehoadon_bus;
BUS.Ban_BUS ban_bus;
BUS.ThucDonDichVuKhach_BUS thucdon;
DTO.ThucDonDichVuKhach thucdondichvu_dto;
bool flagThanToan = true;
//BienToanCuc bien = new BienToanCuc();
public frmPhucVu()
{
InitializeComponent();
}
private void button12_Click(object sender, EventArgs e)
{
this.Close();
}
private void frmPhucVu_Load(object sender, EventArgs e)
{
//cboBuoi.Items.Add("chọn");
cboBuoi.Items.Add("Trưa");
cboBuoi.Items.Add("Tối");
cboNgay.Items.Add("Thường");
cboNgay.Items.Add("Đặc biệt");
// load dữ liệu danh sách tỷ lệ giảm giá % lên combobox;
ggb = new BUS.GiamGia_BUS();
dt = ggb.getDanhSachTiLeGiam();
cboGiamGia.DisplayMember = "TiLeGiam";
cboGiamGia.ValueMember = "TiLeGiam";
cboGiamGia.DataSource = dt;
KiemTraTinhTrangBan1();
KiemTraTinhTrangBan2();
KiemTraTinhTrangBan3();
KiemTraTinhTrangBan4();
KiemTraTinhTrangBan5();
KiemTraTinhTrangBan6();
KiemTraTinhTrangBan7();
KiemTraTinhTrangBan8();
KiemTraTinhTrangBan9();
KiemTraTinhTrangBan10();
thucdon = new ThucDonDichVuKhach_BUS();
td = thucdon.getDanhSachDichVuKhac();
dgvDanhSachThucDon.DataSource = td;
}
private void KiemTraTinhTrangBan1()
{
ban_bus = new Ban_BUS();
DataTable ban = new DataTable();
ban = ban_bus.getKiemTraTinhTrangBan(btnBan1.Text.Trim());
string tinhtrang = ban.Rows[0]["TinhTrang"].ToString();
if (tinhtrang == "0")
{
btnBan1.ColorTable = eButtonColor.MagentaWithBackground;
}
else if (tinhtrang == "1")
{
btnBan1.ColorTable = eButtonColor.Magenta;
}
else if (tinhtrang == "2")
{
btnBan1.ColorTable = eButtonColor.BlueOrb;
}
}
private void KiemTraTinhTrangBan2()
{
ban_bus = new Ban_BUS();
DataTable ban = new DataTable();
ban = ban_bus.getKiemTraTinhTrangBan(btnBan2.Text.Trim());
string tinhtrang = ban.Rows[0]["TinhTrang"].ToString();
if (tinhtrang == "0")
{
btnBan2.ColorTable = eButtonColor.MagentaWithBackground;
}
else if (tinhtrang == "1")
{
btnBan2.ColorTable = eButtonColor.Magenta;
}
else if (tinhtrang == "2")
{
btnBan2.ColorTable = eButtonColor.BlueOrb;
}
}
private void KiemTraTinhTrangBan3()
{
ban_bus = new Ban_BUS();
DataTable ban = new DataTable();
ban = ban_bus.getKiemTraTinhTrangBan(btnBan3.Text.Trim());
string tinhtrang = ban.Rows[0]["TinhTrang"].ToString();
if (tinhtrang == "0")
{
btnBan3.ColorTable = eButtonColor.MagentaWithBackground;
}
else if (tinhtrang == "1")
{
btnBan3.ColorTable = eButtonColor.Magenta;
}
else if (tinhtrang == "2")
{
btnBan3.ColorTable = eButtonColor.BlueOrb;
}
}
private void KiemTraTinhTrangBan4()
{
ban_bus = new Ban_BUS();
DataTable ban = new DataTable();
ban = ban_bus.getKiemTraTinhTrangBan(btnBan4.Text.Trim());
string tinhtrang = ban.Rows[0]["TinhTrang"].ToString();
if (tinhtrang == "0")
{
btnBan4.ColorTable = eButtonColor.MagentaWithBackground;
}
else if (tinhtrang == "1")
{
btnBan4.ColorTable = eButtonColor.Magenta;
}
else if (tinhtrang == "2")
{
btnBan4.ColorTable = eButtonColor.BlueOrb;
}
}
private void KiemTraTinhTrangBan5()
{
ban_bus = new Ban_BUS();
DataTable ban = new DataTable();
ban = ban_bus.getKiemTraTinhTrangBan(btnBan5.Text.Trim());
string tinhtrang = ban.Rows[0]["TinhTrang"].ToString();
if (tinhtrang == "0")
{
btnBan5.ColorTable = eButtonColor.MagentaWithBackground;
}
else if (tinhtrang == "1")
{
btnBan5.ColorTable = eButtonColor.Magenta;
}
else if (tinhtrang == "2")
{
btnBan5.ColorTable = eButtonColor.BlueOrb;
}
}
private void KiemTraTinhTrangBan6()
{
ban_bus = new Ban_BUS();
DataTable ban = new DataTable();
ban = ban_bus.getKiemTraTinhTrangBan(btnBan6.Text.Trim());
string tinhtrang = ban.Rows[0]["TinhTrang"].ToString();
if (tinhtrang == "0")
{
btnBan6.ColorTable = eButtonColor.MagentaWithBackground;
}
else if (tinhtrang == "1")
{
btnBan6.ColorTable = eButtonColor.Magenta;
}
else if (tinhtrang == "2")
{
btnBan6.ColorTable = eButtonColor.BlueOrb;
}
}
private void KiemTraTinhTrangBan7()
{
ban_bus = new Ban_BUS();
DataTable ban = new DataTable();
ban = ban_bus.getKiemTraTinhTrangBan(btnBan7.Text.Trim());
string tinhtrang = ban.Rows[0]["TinhTrang"].ToString();
if (tinhtrang == "0")
{
btnBan7.ColorTable = eButtonColor.MagentaWithBackground;
}
else if (tinhtrang == "1")
{
btnBan7.ColorTable = eButtonColor.Magenta;
}
else if (tinhtrang == "2")
{
btnBan7.ColorTable = eButtonColor.BlueOrb;
}
}
private void KiemTraTinhTrangBan8()
{
ban_bus = new Ban_BUS();
DataTable ban = new DataTable();
ban = ban_bus.getKiemTraTinhTrangBan(btnBan8.Text.Trim());
string tinhtrang = ban.Rows[0]["TinhTrang"].ToString();
if (tinhtrang == "0")
{
btnBan8.ColorTable = eButtonColor.MagentaWithBackground;
}
else if (tinhtrang == "1")
{
btnBan8.ColorTable = eButtonColor.Magenta;
}
else if (tinhtrang == "2")
{
btnBan8.ColorTable = eButtonColor.BlueOrb;
}
}
private void KiemTraTinhTrangBan9()
{
ban_bus = new Ban_BUS();
DataTable ban = new DataTable();
ban = ban_bus.getKiemTraTinhTrangBan(btnBan9.Text.Trim());
string tinhtrang = ban.Rows[0]["TinhTrang"].ToString();
if (tinhtrang == "0")
{
btnBan9.ColorTable = eButtonColor.MagentaWithBackground;
}
else if (tinhtrang == "1")
{
btnBan9.ColorTable = eButtonColor.Magenta;
}
else if (tinhtrang == "2")
{
btnBan9.ColorTable = eButtonColor.BlueOrb;
}
}
private void KiemTraTinhTrangBan10()
{
ban_bus = new Ban_BUS();
DataTable ban = new DataTable();
ban = ban_bus.getKiemTraTinhTrangBan(btnBan10.Text.Trim());
string tinhtrang = ban.Rows[0]["TinhTrang"].ToString();
if (tinhtrang == "0")
{
btnBan10.ColorTable = eButtonColor.MagentaWithBackground;
}
else if (tinhtrang == "1")
{
btnBan10.ColorTable = eButtonColor.Magenta;
}
else if (tinhtrang == "2")
{
btnBan10.ColorTable = eButtonColor.BlueOrb;
}
}
private void cboBuoi_TextChanged(object sender, EventArgs e)
{
if (cboBuoi.Text == "" || cboNgay.Text == "")
{
txtSoVeNguoiLon.ReadOnly = true;
}
else
txtSoVeNguoiLon.ReadOnly = false;
if (cboBuoi.Text == "" || cboNgay.Text == "")
{
txtSoVeTreEm.ReadOnly = true;
}
else
txtSoVeTreEm.ReadOnly = false;
if (cboBuoi.Text == "Tối")
{
if (cboNgay.Text == "Thường")
{
lbGiaVeNguoiLon.Text = "200000";
lbTreEm.Text = "100000";
lbTongVeNguoiLon.Text = (float.Parse(txtSoVeNguoiLon.Text)*(float.Parse(lbGiaVeNguoiLon.Text))).ToString();
lbTongVeTreEm.Text = (float.Parse(txtSoVeTreEm.Text)*(float.Parse(lbTreEm.Text))).ToString();
lbTongTien.Text = (float.Parse(lbTongVeNguoiLon.Text) + (float.Parse(lbTongVeTreEm.Text))).ToString();
}
else
if (cboNgay.Text == "Đặc biệt")
{
lbGiaVeNguoiLon.Text = "250000";
lbTreEm.Text = "150000";
lbTongVeNguoiLon.Text = (float.Parse(txtSoVeNguoiLon.Text) * (float.Parse(lbGiaVeNguoiLon.Text))).ToString();
lbTongVeTreEm.Text = (float.Parse(txtSoVeTreEm.Text) * (float.Parse(lbTreEm.Text))).ToString();
lbTongTien.Text = (float.Parse(lbTongVeNguoiLon.Text) + (float.Parse(lbTongVeTreEm.Text))).ToString();
}
}
else
{
if (cboNgay.Text == "Thường")
{
lbGiaVeNguoiLon.Text = "200000";
lbTreEm.Text = "100000";
lbTongVeNguoiLon.Text = (float.Parse(txtSoVeNguoiLon.Text) * (float.Parse(lbGiaVeNguoiLon.Text))).ToString();
lbTongVeTreEm.Text = (float.Parse(txtSoVeTreEm.Text) * (float.Parse(lbTreEm.Text))).ToString();
lbTongTien.Text = (float.Parse(lbTongVeNguoiLon.Text) + (float.Parse(lbTongVeTreEm.Text))).ToString();
}
else
if (cboNgay.Text == "Đặc biệt")
{
lbGiaVeNguoiLon.Text = "230000";
lbTreEm.Text = "100000";
lbTongVeNguoiLon.Text = (float.Parse(txtSoVeNguoiLon.Text) * (float.Parse(lbGiaVeNguoiLon.Text))).ToString();
lbTongVeTreEm.Text = (float.Parse(txtSoVeTreEm.Text) * (float.Parse(lbTreEm.Text))).ToString();
lbTongTien.Text = (float.Parse(lbTongVeNguoiLon.Text) + (float.Parse(lbTongVeTreEm.Text))).ToString();
}
}
//}
}
private void cboNgay_TextChanged(object sender, EventArgs e)
{
if (cboBuoi.Text == "" || cboNgay.Text == "")
{
txtSoVeNguoiLon.ReadOnly = true;
}
else
txtSoVeNguoiLon.ReadOnly = false;
if (cboBuoi.Text == "" || cboNgay.Text == "")
{
txtSoVeTreEm.ReadOnly = true;
}
else
txtSoVeTreEm.ReadOnly = false;
if (cboBuoi.Text == "Tối")
{
if (cboNgay.Text == "Thường")
{
lbGiaVeNguoiLon.Text = "200000";
lbTreEm.Text = "100000";
lbTongVeNguoiLon.Text = (float.Parse(txtSoVeNguoiLon.Text) * (float.Parse(lbGiaVeNguoiLon.Text))).ToString();
lbTongVeTreEm.Text = (float.Parse(txtSoVeTreEm.Text) * (float.Parse(lbTreEm.Text))).ToString();
lbTongTien.Text = (float.Parse(lbTongVeNguoiLon.Text) + (float.Parse(lbTongVeTreEm.Text))).ToString();
}
else
if (cboNgay.Text == "Đặc biệt")
{
lbGiaVeNguoiLon.Text = "250000";
lbTreEm.Text = "150000";
lbTongVeNguoiLon.Text = (float.Parse(txtSoVeNguoiLon.Text) * (float.Parse(lbGiaVeNguoiLon.Text))).ToString();
lbTongVeTreEm.Text = (float.Parse(txtSoVeTreEm.Text) * (float.Parse(lbTreEm.Text))).ToString();
lbTongTien.Text = (float.Parse(lbTongVeNguoiLon.Text) + (float.Parse(lbTongVeTreEm.Text))).ToString();
}
}
else
{
if (cboNgay.Text == "Thường")
{
lbGiaVeNguoiLon.Text = "200000";
lbTreEm.Text = "100000";
lbTongVeNguoiLon.Text = (float.Parse(txtSoVeNguoiLon.Text) * (float.Parse(lbGiaVeNguoiLon.Text))).ToString();
lbTongVeTreEm.Text = (float.Parse(txtSoVeTreEm.Text) * (float.Parse(lbTreEm.Text))).ToString();
lbTongTien.Text = (float.Parse(lbTongVeNguoiLon.Text) + (float.Parse(lbTongVeTreEm.Text))).ToString();
}
else
if (cboNgay.Text == "Đặc biệt")
{
lbGiaVeNguoiLon.Text = "230000";
lbTreEm.Text = "100000";
lbTongVeNguoiLon.Text = (float.Parse(txtSoVeNguoiLon.Text) * (float.Parse(lbGiaVeNguoiLon.Text))).ToString();
lbTongVeTreEm.Text = (float.Parse(txtSoVeTreEm.Text) * (float.Parse(lbTreEm.Text))).ToString();
lbTongTien.Text = (float.Parse(lbTongVeNguoiLon.Text) + (float.Parse(lbTongVeTreEm.Text))).ToString();
}
}
}
private void txtSoVeNguoiLon_TextChanged(object sender, EventArgs e)
{
if (txtSoVeNguoiLon.Text == "")
{
txtSoVeNguoiLon.Text = 0.ToString();
}
float sove = float.Parse(txtSoVeNguoiLon.Text);
float giatien = float.Parse(lbGiaVeNguoiLon.Text);
float tongtien = sove * giatien;
lbTongVeNguoiLon.Text = tongtien.ToString();
lbTongTien.Text = (tongtien + float.Parse(lbTongVeTreEm.Text)).ToString();
}
private void txtSoVeTreEm_TextChanged(object sender, EventArgs e)
{
if (txtSoVeTreEm.Text == "")
{
txtSoVeTreEm.Text = 0.ToString();
}
float sove = float.Parse(txtSoVeTreEm.Text);
float giatien = float.Parse(lbTreEm.Text);
float tongtien = sove * giatien;
lbTongVeTreEm.Text = tongtien.ToString();
lbTongTien.Text = (tongtien + float.Parse(lbTongVeNguoiLon.Text)).ToString();
}
private void lbTongTien_TextChanged(object sender, EventArgs e)
{
lbPhaiTra.Text = lbTongTien.Text;
if (float.Parse(lbTongTien.Text) >= 500000)
{
linkLabel1.Enabled = true;
}
}
private void txtKHDua_TextChanged(object sender, EventArgs e)
{
if (txtKHDua.Text == "")
{
txtKHDua.Text = 0.ToString();
btnThanhToan.Enabled = false;
}
float tienKHDua = float.Parse(txtKHDua.Text.Trim());
float tienphaitra = float.Parse(lbPhaiTra.Text);
float tienthoilai = tienKHDua - tienphaitra;
lbThoiLai.Text = tienthoilai.ToString();
}
private void txtKHDua_Click(object sender, EventArgs e)
{
btnThanhToan.Enabled = true;
}
private void btnThanhToan_Click(object sender, EventArgs e)
{
Ve_HoaDon vhd = new Ve_HoaDon();
vhd.MaNV = lbMaNV.Text.Trim();
if (txtMaKH1.Text.Trim() == "")
{
vhd.MaKH = 0;
}
else
{
vhd.MaKH = int.Parse(txtMaKH1.Text.Trim());
}
vhd.BuoiAnBuffet = cboBuoi.Text.Trim();
vhd.Ngay = cboNgay.Text.Trim();
vhd.VeNguoiLon = int.Parse(txtSoVeNguoiLon.Text);
vhd.VeTreEm = int.Parse(txtSoVeTreEm.Text);
vhd.HinhThucThanhToan = 1;
vhd.Tong = float.Parse(lbTongTien.Text);
vhd.GiamGia = int.Parse(cboGiamGia.Text);
vhd.ThanhTien = float.Parse(lbPhaiTra.Text);
vhd.NgayLap = DateTime.Now;
vehoadon_bus = new Ve_HoaDon_BUS();
flagThanToan = vehoadon_bus.insertThanhToanVeBuffet(vhd);
if (flagThanToan == true)
{
MessageBox.Show("Thanh toán thành công!", "Thông báo", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
}
else
MessageBox.Show("Thanh toán thất bại, vui lòng kiểm tra lại thông tin!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
frmKhachHang frm = new frmKhachHang();
frm.KhiSetMaKhachHang += frm_KhiSetMaKhachHang;
frm.Show();
}
void frm_KhiSetMaKhachHang(string MaKH, float diem)
{
txtMAKH.Text = MaKH;
txtDiemTichLuyCon.Text = diem.ToString();
txtMaKH1.Text = MaKH;
txtMaKHDichVu.Text = MaKH;
txtDiemCongDichVu.Text = diem.ToString();
}
private void txtMaKH1_TextChanged(object sender, EventArgs e)
{
if (txtMaKH1.Text.Trim() == "")
{
return;
}
else
{
if (txtDiemTichLuyCon.Text == "")
{
return;
}
else{
float diemtichluycon = float.Parse(txtDiemTichLuyCon.Text.Trim());
DataTable phantramgiamgia = ggb.getPhanTramGiamGia(diemtichluycon);
int phantram = int.Parse(phantramgiamgia.Rows[0]["TiLeGiam"].ToString());
//cboGiamGia.SelectedItem = phantram;
cboGiamGia.SelectedValue = phantram;
}
}
}
private void cboGiamGia_TextChanged(object sender, EventArgs e)
{
if (linkLabel1.Enabled == false)
{
lbPhaiTra.Text = lbTongTien.Text;
}
else
{
float giatri = float.Parse(lbTongTien.Text);
float giamgia = float.Parse( cboGiamGia.Text);
//float phaitra = giatri * (100 - giamgia);
float phaitra = giatri - giatri * (giamgia/100);
lbPhaiTra.Text = string.Format("{0:0}", phaitra);
}
}
private void txtSoVeNguoiLon_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && (!Char.IsControl(e.KeyChar)))
{
e.Handled = true;
MessageBox.Show("Chỉ được nhập số", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txtSoVeNguoiLon.Focus();
}
}
private void txtSoVeTreEm_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && (!Char.IsControl(e.KeyChar)))
{
e.Handled = true;
MessageBox.Show("Chỉ được nhập số", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txtSoVeTreEm.Focus();
}
}
private void txtKHDua_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && (!Char.IsControl(e.KeyChar)))
{
e.Handled = true;
MessageBox.Show("Chỉ được nhập số", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txtKHDua.Focus();
}
}
private void lbPhaiTra_TextChanged(object sender, EventArgs e)
{
float giatrihoadonphaitra = float.Parse(lbPhaiTra.Text.Trim());
if (giatrihoadonphaitra >= 500000)
{
dcb = new DiemCong_BUS();
DataTable diemcongtheohoadon = dcb.getDiemCongTheoHoadon(giatrihoadonphaitra);
int diemcong = int.Parse(diemcongtheohoadon.Rows[0]["DiemCong"].ToString());
//DialogResult dr = MessageBox.Show("Khách hàng đủ điền kiện để áp dụng các chính sách ưu đãi của chúng ta!", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
//if (DialogResult.OK == dr)
//{
linkKhachHangCongDiem.Enabled = true;
frmKhachHang frm = new frmKhachHang();
frm.diemcong = diemcong;
//}
}
}
private void linkKhachHangCongDiem_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
frmKhachHang frm = new frmKhachHang();
frm.KhiSetMaKhachHang += frm_KhiSetMaKHGiamGia;
frm.Show();
}
void frm_KhiSetMaKHGiamGia(string MaKH, float diem)
{
txtMaKH1.Text = MaKH;
}
private bool ValidateLuhn(string value)
{
int CheckSum = 0;
bool DoubleFlag = (value.Length % 2 == 0);
char[] buf;
char Digit;
int DigitValue;
// chuyển chuỗi thành ký tự
buf = value.ToCharArray();
// duyệt từng ký tự trong mảng
for(int i = 0; i < value.Length; i++)
{
Digit = buf[i]; // đọc ký tự thứ i và gán vào biến Digit
DigitValue = int.Parse( Digit.ToString());
if(DoubleFlag)
{
DigitValue *= 2;
if(DigitValue > 9)
{
DigitValue -= 9;
}
}
CheckSum += DigitValue;
DoubleFlag = !DoubleFlag;
}
return (CheckSum % 10 == 0);
}
private void btnThanhToanATM_Click(object sender, EventArgs e)
{
MessageBox.Show("Vui lòng kiểm tra hệ thống thanh toán qua ATM", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
private void txtMaTheATM_TextChanged(object sender, EventArgs e)
{
if (txtMaTheATM.Text == "")
{
btnThanhToanATM.Enabled = false;
}
else {
if (ValidateLuhn(txtMaTheATM.Text.Trim()))
{
btnThanhToanATM.Enabled = true;
//5191701142626689 ---> đây là một mã hợp lệ
}
}
}
private void btnBan2_Click(object sender, EventArgs e)
{
lbBan.Text = btnBan2.Text;
}
int soluong = 1;
private void dgvDanhSachThucDon_DoubleClick(object sender, EventArgs e)
{
string tenthucdon = dgvDanhSachThucDon.CurrentRow.Cells[0].Value.ToString();
string donvitinh = dgvDanhSachThucDon.CurrentRow.Cells[1].Value.ToString();
string gia = dgvDanhSachThucDon.CurrentRow.Cells[2].Value.ToString();
// cap nhat lai so luong
int flag = -1;
string Tenthucdon = dgvDanhSachThucDon.CurrentRow.Cells[0].Value.ToString();
try
{
for (int i = 0; i < dgvDanhSachThucDonDaChon.Rows.Count; i++)
{
if (Tenthucdon == dgvDanhSachThucDonDaChon.Rows[i].Cells[1].Value.ToString())
flag = i;
}
}
catch(Exception ex)
{
}
if (flag != -1)
{
soluong = soluong + 1;
dgvDanhSachThucDonDaChon.Rows[flag].Cells[2].Value = soluong.ToString();
dgvDanhSachThucDonDaChon.Rows[flag].Cells[5].Value = (soluong * float.Parse(gia)).ToString();
}
else
{
soluong = 1;
float tong = float.Parse(gia) * soluong;
dgvDanhSachThucDonDaChon.Rows.Add(dgvDanhSachThucDonDaChon.Rows.Count.ToString(), tenthucdon, soluong, donvitinh, gia, tong.ToString());
}
}
private void dgvDanhSachThucDonDaChon_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
//string soluong = dgvDanhSachThucDonDaChon.CurrentRow.Cells[2].Value.ToString();
//if (soluong != "")
//{
// string gia = dgvDanhSachThucDonDaChon.CurrentRow.Cells[4].Value.ToString();
// float tongtien = float.Parse(soluong) * float.Parse(gia);
// dgvDanhSachThucDonDaChon.CurrentRow.Cells[5].Value = tongtien.ToString();
//}
// MessageBox.Show("s");
}
private void btnTongTien_Click(object sender, EventArgs e)
{
float tongtien = 0;
for (int i = 0; i < dgvDanhSachThucDonDaChon.Rows.Count; i++)
{
string tong = dgvDanhSachThucDonDaChon.Rows[i].Cells[5].Value.ToString();
tongtien += float.Parse(tong.Trim());
}
lbTongTienDichVuKhac.Text = tongtien.ToString();
}
private void btnXoa_Click(object sender, EventArgs e)
{
int index = dgvDanhSachThucDonDaChon.CurrentRow.Index;
dgvDanhSachThucDonDaChon.Rows.RemoveAt(index);
}
private void lbTongTienDichVuKhac_TextChanged(object sender, EventArgs e)
{
if (float.Parse(lbTongTienDichVuKhac.Text) >= 500000)
{
linkMaKHDichVu.Enabled = true;
}
}
private void linkMaKHDichVu_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
frmKhachHang frm = new frmKhachHang();
frm.KhiSetMaKhachHang += frm_KhiSetMaKhachHang;
frm.Show();
}
private void txtKHDuaDichVu_TextChanged(object sender, EventArgs e)
{
float tongtien = float.Parse(lbTongTienDichVuKhac.Text.Trim());
float khdua = float.Parse(txtKHDuaDichVu.Text.Trim());
lbThoiLaiDichVu.Text = (khdua - tongtien).ToString();
}
private void txtKHDuaDichVu_Click(object sender, EventArgs e)
{
btnThanhToanDichVu.Enabled = true;
}
private void txtMaTheATMDichVu_TextChanged(object sender, EventArgs e)
{
if (txtMaTheATMDichVu.Text == "")
{
btnThanhToanDichVuATM.Enabled = false;
}
else {
if (ValidateLuhn(txtMaTheATMDichVu.Text.Trim()))
{
btnThanhToanDichVuATM.Enabled = true;
//5191701142626689 ---> đây là một mã hợp lệ
}
}
}
private void btnThanhToanDichVuATM_Click(object sender, EventArgs e)
{
MessageBox.Show("Vui lòng kiểm tra hệ thống thanh toán qua ATM", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
private void txtMaTheATM_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && (!Char.IsControl(e.KeyChar)))
{
e.Handled = true;
MessageBox.Show("Chỉ được nhập số", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txtMaTheATM.Focus();
}
}
private void txtKHDuaDichVu_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && (!Char.IsControl(e.KeyChar)))
{
e.Handled = true;
MessageBox.Show("Chỉ được nhập số", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txtKHDuaDichVu.Focus();
}
}
private void txtMaTheATMDichVu_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && (!Char.IsControl(e.KeyChar)))
{
e.Handled = true;
MessageBox.Show("Chỉ được nhập số", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txtMaTheATMDichVu.Focus();
}
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmPhucVu.cs | C# | asf20 | 30,649 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace Nhom16_PTTKHTTT_12HCB
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmDangNhap());
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/Program.cs | C# | asf20 | 519 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Nhom16_PTTKHTTT_12HCB
{
public static class ThongTinDangNhap
{
private static string _maNV;
public static string MaNV
{
get { return _maNV; }
set { _maNV = value; }
}
private static string _tenNV;
public static string TenNV
{
get { return _tenNV; }
set { _tenNV = value; }
}
private static string _diaChi;
public static string DiaChi
{
get { return _diaChi; }
set { _diaChi = value; }
}
private static string _email;
public static string Email
{
get { return _email; }
set { _email = value; }
}
private static string _dienThoai;
public static string DienThoai
{
get { return _dienThoai; }
set { _dienThoai = value; }
}
private static string _tenDN;
public static string TenDN
{
get { return _tenDN; }
set { _tenDN = value; }
}
private static string _matKhau;
public static string MatKhau
{
get { return _matKhau; }
set { _matKhau = value; }
}
private static string _maChucVu;
public static string MaChucVu
{
get { return _maChucVu; }
set { _maChucVu = value; }
}
public static void DangXuat()
{
MaNV = string.Empty;
TenNV = string.Empty;
DiaChi = string.Empty;
Email = string.Empty;
DienThoai = string.Empty;
TenDN = string.Empty;
MatKhau = string.Empty;
MaChucVu = string.Empty;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/ThongTinDangNhap.cs | C# | asf20 | 1,954 |
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 DevComponents.DotNetBar;
using BUS;
using DTO;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmKhachHang : DevComponents.DotNetBar.Office2007Form
{
public delegate void SetMaKhachHang(string MaKH, float DiemTichLuy);
public event SetMaKhachHang KhiSetMaKhachHang = null;
public int diemcong = 0;
DataTable dt = new DataTable();
DataTable dtsearch = new DataTable();
DiemCong_BUS diemcong_bus;
//DiemCong diemcong_dto;
KhachHang_BUS khachhang_bus;
KhachHang khachhang_dto;
bool flagKiemTraControl = true;
bool flagKiemTraThemXoaSua = true;
int index = 0;
public frmKhachHang()
{
InitializeComponent();
}
private bool kiemtra()
{
if (txtTenKH.Text.Trim() == "")
{
MessageBox.Show("Tên khách hàng không được bỏ trống","Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
flagKiemTraControl = false;
txtTenKH.Focus();
}
else if (txtDiaChi.Text.Trim() == "")
{
MessageBox.Show("Vui lòng nhập địa chỉ khách hàng", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
flagKiemTraControl = false;
txtDiaChi.Focus();
}
else if (txtSoDienThoai.Text.Trim() == "")
{
MessageBox.Show("Vui lòng nhập số điện thoại của khách hàng để tiện liên lạc khi cần", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
flagKiemTraControl = false;
txtSoDienThoai.Focus();
}
else
{
flagKiemTraControl = true;
}
return flagKiemTraControl;
}
private void loadDanhSachKhachHang()
{
dt = khachhang_bus.getDanhSachKhachHang();
dgvDanhSachKH.DataSource = dt;
}
private void loadDanhSachKhachHangSearch(string cmnd)
{
dtsearch = khachhang_bus.getDanhSachKhachHangSearch(cmnd);
dgvDanhSachKH.DataSource = dtsearch;
}
private void frmKhachHang_Load(object sender, EventArgs e)
{
khachhang_bus = new KhachHang_BUS();
diemcong_bus = new DiemCong_BUS();
cboCongDiem.DisplayMember = "DiemCong";
cboCongDiem.ValueMember = "DiemCong";
cboCongDiem.DataSource = diemcong_bus.getDanhSachDiemCong();
loadDanhSachKhachHang();
cboCongDiem.SelectedValue = diemcong;
}
private void btnThem_Click(object sender, EventArgs e)
{
kiemtra();
if (flagKiemTraControl == true)
{
khachhang_dto = new KhachHang();
khachhang_dto.TenKH = txtTenKH.Text;
khachhang_dto.CMND = txtCMND.Text;
khachhang_dto.DiaChi = txtDiaChi.Text;
khachhang_dto.DienThoai = txtSoDienThoai.Text;
khachhang_dto.NgayLapThe = DateTime.Now;
if (txtMaKH.Text.Trim() == "")
{
khachhang_dto.DiemTichLuy = float.Parse("20");
khachhang_dto.TongDiem = float.Parse("20");
}
else
{
khachhang_dto.DiemTichLuy = float.Parse(cboCongDiem.Text)+ float.Parse(lbDiemTichLuyCon.Text);
khachhang_dto.TongDiem = float.Parse(lbTongDiem.Text) + float.Parse(cboCongDiem.Text);
}
khachhang_dto.NgayCapNhatSauCung = DateTime.Now;
flagKiemTraThemXoaSua = khachhang_bus.insertKhachHang(khachhang_dto);
if (flagKiemTraThemXoaSua == true)
{
MessageBox.Show("Thêm khách hàng thành công", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information);
loadDanhSachKhachHang();
dgvDanhSachKH.Rows[index].Selected = true;
}
else
MessageBox.Show("Thất bại! Vui lòng kiểm tra CMND đã tồn tại chưa?", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void dgvDanhSachKH_CellClick(object sender, DataGridViewCellEventArgs e)
{
index = dgvDanhSachKH.CurrentRow.Index;
}
private void dgvDanhSachKH_SelectionChanged(object sender, EventArgs e)
{
txtMaKH.Text = dgvDanhSachKH.CurrentRow.Cells[0].Value.ToString();
txtTenKH.Text = dgvDanhSachKH.CurrentRow.Cells[1].Value.ToString();
txtCMND.Text = dgvDanhSachKH.CurrentRow.Cells[2].Value.ToString();
txtDiaChi.Text = dgvDanhSachKH.CurrentRow.Cells[3].Value.ToString();
txtSoDienThoai.Text = dgvDanhSachKH.CurrentRow.Cells[4].Value.ToString();
dateNgayLap.Text = dgvDanhSachKH.CurrentRow.Cells[5].Value.ToString();
dateNgayLap.Enabled = false;
lbDiemTichLuyCon.Text = dgvDanhSachKH.CurrentRow.Cells[6].Value.ToString();
lbTongDiem.Text = dgvDanhSachKH.CurrentRow.Cells[7].Value.ToString();
dateNgayCapNhat.Text = dgvDanhSachKH.CurrentRow.Cells[8].Value.ToString();
}
private void btnCapnhat_Click(object sender, EventArgs e)
{
kiemtra();
if (flagKiemTraControl == true)
{
khachhang_dto = new KhachHang();
khachhang_dto.MaKH = txtMaKH.Text;
khachhang_dto.TenKH = txtTenKH.Text;
khachhang_dto.CMND = txtCMND.Text;
khachhang_dto.DiaChi = txtDiaChi.Text;
khachhang_dto.DienThoai = txtSoDienThoai.Text;
khachhang_dto.NgayLapThe = DateTime.Parse(dateNgayLap.Text);
if (txtMaKH.Text.Trim() == "")
{
khachhang_dto.DiemTichLuy = float.Parse("20");
}
else
{
khachhang_dto.DiemTichLuy = float.Parse(cboCongDiem.Text) + float.Parse(lbDiemTichLuyCon.Text);
}
khachhang_dto.TongDiem = float.Parse(lbTongDiem.Text) + float.Parse(cboCongDiem.Text);
khachhang_dto.NgayCapNhatSauCung = DateTime.Now;
flagKiemTraThemXoaSua = khachhang_bus.updateKhachHang(khachhang_dto);
if (flagKiemTraThemXoaSua == true)
{
MessageBox.Show("Cập nhật thông tin khách hàng thành công", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information);
loadDanhSachKhachHang();
dgvDanhSachKH.Rows[index].Selected = true;
}
else
MessageBox.Show("Thất bại! Vui lòng kiểm tra thông tin", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void txtTimKiemKhachHang_TextChanged(object sender, EventArgs e)
{
if (txtTimKiemKhachHang.Text.Trim() == "")
loadDanhSachKhachHang();
else
loadDanhSachKhachHangSearch(txtTimKiemKhachHang.Text.Trim());
}
private void btnLamMoi_Click(object sender, EventArgs e)
{
txtMaKH.Clear();
txtTenKH.Clear();
txtCMND.Clear();
txtDiaChi.Clear();
txtSoDienThoai.Clear();
dateNgayLap.Enabled = true;
lbDiemTichLuyCon.Text = "0";
lbTongDiem.Text = "0";
dateNgayLap.Text = DateTime.Now.ToString();
dateNgayCapNhat.Text = DateTime.Now.ToString();
}
private void btnThoat_Click(object sender, EventArgs e)
{
int makh = int.Parse(dgvDanhSachKH.CurrentRow.Cells[0].Value.ToString());
float diem = float.Parse(dgvDanhSachKH.CurrentRow.Cells[6].Value.ToString());
if (KhiSetMaKhachHang != null)
{
KhiSetMaKhachHang(makh.ToString(), diem);
}
this.Close();
}
private void dgvDanhSachKH_DoubleClick(object sender, EventArgs e)
{
int makh = int.Parse( dgvDanhSachKH.CurrentRow.Cells[0].Value.ToString());
float diem = float.Parse(dgvDanhSachKH.CurrentRow.Cells[6].Value.ToString());
if (KhiSetMaKhachHang != null)
{
KhiSetMaKhachHang(makh.ToString(), diem);
}
this.Close();
}
private void dgvDanhSachKH_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void txtCMND_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && (!Char.IsControl(e.KeyChar)))
{
e.Handled = true;
MessageBox.Show("Chỉ được nhập số", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txtCMND.Focus();
}
}
private void txtSoDienThoai_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && (!Char.IsControl(e.KeyChar)))
{
e.Handled = true;
MessageBox.Show("Chỉ được nhập dạng số", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txtSoDienThoai.Focus();
}
}
private void txtTimKiemKhachHang_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && (!Char.IsControl(e.KeyChar)))
{
e.Handled = true;
MessageBox.Show("Chỉ được nhập số", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txtTimKiemKhachHang.Focus();
}
}
}
} | 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmKhachHang.cs | C# | asf20 | 10,464 |
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 BUS;
using DTO;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmCapNhatMatKhau : Form
{
public frmCapNhatMatKhau()
{
InitializeComponent();
}
private void btnCapNhatMatKhau_Click(object sender, EventArgs e)
{
if (txtMatKhauCu.Text == string.Empty)
{
MessageBox.Show("Chưa nhập mật khẩu cũ.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtMatKhauCu.Focus();
}
else if (txtMatKhauMoi.Text == string.Empty)
{
MessageBox.Show("Chưa nhập mật khẩu mới.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtMatKhauMoi.Focus();
}
else if (txtXacNhanMatKhau.Text == string.Empty)
{
MessageBox.Show("Chưa nhập xác nhận mật khẩu.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtXacNhanMatKhau.Focus();
}
else if (txtMatKhauCu.Text.CompareTo(ThongTinDangNhap.MatKhau) != 0)
{
MessageBox.Show("Mật khẩu cũ không chính xác.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtMatKhauCu.Focus();
}
else if (txtMatKhauMoi.Text.CompareTo(txtXacNhanMatKhau.Text) != 0)
{
MessageBox.Show("Nhập lại mật khẩu không chính xác.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtXacNhanMatKhau.Focus();
}
else
{
NhanVien_BUS nvb = new NhanVien_BUS();
if (nvb.CapNhatMatKhau(ThongTinDangNhap.MaNV, Functions.ToMD5(txtMatKhauMoi.Text)))
{
MessageBox.Show("Cập nhật mật khẩu thành công.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
ThongTinDangNhap.MatKhau = txtMatKhauMoi.Text;
}
else
{
MessageBox.Show("Cập nhật mật khẩu không thành công, vui lòng thử lại sau.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void btnThoat_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmCapNhatMatKhau.cs | C# | asf20 | 2,681 |
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 BUS;
using DTO;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmLenDanhSachMonAn : Form
{
public frmLenDanhSachMonAn()
{
InitializeComponent();
DanhSachLoaiMon();
}
LoaiMonAn_BUS lm_bus = new LoaiMonAn_BUS();
private void txtThem_PN_Click(object sender, EventArgs e)
{
LoaiMonAn lm = new LoaiMonAn();
lm.TenLoaiMonAn = txtTenLoaiMon.Text;
lm.IsDelete = "true";
if (lm_bus.ThemLoaiMon(lm) == true)
{
MessageBox.Show("Thêm thành công");
DanhSachLoaiMon();
LoadLoaiMonAn();
}
}
void DanhSachLoaiMon()
{
DataTable dt = new DataTable();
dt = lm_bus.DanhSachLoaiMon();
dgvLoaiMon.AutoGenerateColumns = false;
dgvLoaiMon.DataSource = dt;
}
private void dgvLoaiMon_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
dgvLoaiMon.Rows[e.RowIndex].Cells["STTs"].Value = e.RowIndex + 1;
}
private void btnXoa_LoaiMon_Click(object sender, EventArgs e)
{
string ma = dgvLoaiMon.CurrentRow.Cells[1].Value.ToString();
lm_bus.XoaLoaiMon(ma);
DanhSachLoaiMon();
}
private void btnSuaLoaiMon_Click(object sender, EventArgs e)
{
LoaiMonAn lm = new LoaiMonAn();
lm.MaLoaiMonAn = txtMaLoaiMon.Text;
lm.TenLoaiMonAn = txtTenLoaiMon.Text;
lm_bus.SuaLoaiMon(lm);
DanhSachLoaiMon();
}
private void dgvLoaiMon_CellClick(object sender, DataGridViewCellEventArgs e)
{
string ma = dgvLoaiMon.CurrentRow.Cells[1].Value.ToString();
txtMaLoaiMon.Text = ma;
txtTenLoaiMon.Text = dgvLoaiMon.CurrentRow.Cells[2].Value.ToString();
}
private void btnThoatLoaiMon_Click(object sender, EventArgs e)
{
this.Close();
}
public void LoadLoaiMonAn()
{
lm_bus = new LoaiMonAn_BUS();
cbxLoaiMon.DataSource = lm_bus.DanhSachLoaiMon();
cbxLoaiMon.DisplayMember = "TenLoaiMonAn";
cbxLoaiMon.ValueMember = "MaLoaiMonAn";
}
void LoadDSNguyenVatLieu()
{
NguyenVatLieu_BUS nvl_bus = new NguyenVatLieu_BUS();
cbxTenNguyenVatLieu.DisplayMember = "TenNVL";
cbxTenNguyenVatLieu.ValueMember = "MaNVL";
cbxTenNguyenVatLieu.DataSource = nvl_bus.DanhSachNVL();
}
private void frmLenDanhSachMonAn_Load(object sender, EventArgs e)
{
LoadLoaiMonAn();
LoadDSNguyenVatLieu();
DanhSachMonAn();
}
private void dtgLoaiNVL_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
dgvChiTietMon.Rows[e.RowIndex].Cells["STT"].Value = e.RowIndex + 1;
}
private void btnThem_Click(object sender, EventArgs e)
{
if (active.Equals("ChiTiet"))
{
if (txtSoLuong.Text.Equals(""))
MessageBox.Show("Vui lòng nhập số lượng");
else
{
MonAn_NVL manvl = new MonAn_NVL();
manvl.MaMonAn = dgvMonAn.CurrentRow.Cells[1].Value.ToString();
manvl.MaNVL = cbxTenNguyenVatLieu.SelectedValue.ToString();
manvl.SoLuong = int.Parse(txtSoLuong.Text);
MonAn_BUS mab = new MonAn_BUS();
if (mab.ThemMonAn_NVL(manvl))
{
DataTable dt = new DataTable();
dt = mab.DanhSachMonAn_Ma(manvl.MaMonAn);
dgvChiTietMon.DataSource = dt;
}
else
{
MessageBox.Show("thất bại", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
else
if(active.Equals("ko"))
{
if (txtSoLuong.Text.Equals(""))
MessageBox.Show("Vui lòng nhập số lượng");
else
{
int flag = -1;
for (int i = 0; i < dgvChiTietMon.Rows.Count; i++)
{
if (dgvChiTietMon.Rows[i].Cells[1].Value.ToString() == cbxTenNguyenVatLieu.SelectedValue.ToString())
{
flag = i;
}
}
if (flag != -1)
{
int sl = int.Parse(dgvChiTietMon.Rows[flag].Cells[3].Value.ToString());
sl = sl + int.Parse(txtSoLuong.Text);
dgvChiTietMon.Rows[flag].Cells[3].Value = sl;
}
else
{
dgvChiTietMon.Rows.Add("", cbxTenNguyenVatLieu.SelectedValue, cbxTenNguyenVatLieu.Text, txtSoLuong.Text);
}
}
}
}
private void btnXoa_Click(object sender, EventArgs e)
{
try
{
MonAn_BUS ma_bus = new MonAn_BUS();
dgvChiTietMon.Rows.RemoveAt(dgvChiTietMon.CurrentRow.Index);
ma_bus.XoaMonAn_NVL(dgvChiTietMon.CurrentRow.Cells[1].Value.ToString());
}
catch (Exception ex)
{
MessageBox.Show("Món ăn phải có nguyên vật liệu");
}
}
private void dgvMonAn_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
dgvLoaiMon.Rows[e.RowIndex].Cells["STTMon"].Value = e.RowIndex + 1;
}
public void DanhSachMonAn()
{
DataTable dt = new DataTable();
MonAn_BUS ma = new MonAn_BUS();
dgvMonAn.AutoGenerateColumns = false;
dgvMonAn.DataSource = ma.DanhSachMonAn();
}
private void btnThemMon_Click(object sender, EventArgs e)
{
try
{
MonAn_BUS ma_bus = new MonAn_BUS();
MonAn ma_dto = new MonAn();
string maMon = ma_bus.MaNVLTang();
ma_dto.MaMonAn = maMon;
ma_dto.MaLoaiMonAn = cbxLoaiMon.SelectedValue.ToString();
ma_dto.TenMonAn = txtTenMonAn.Text;
ma_dto.Gia = decimal.Parse(txtGia.Text);
if (ma_bus.ThemMonAn(ma_dto) == true)
{
for (int i = 0; i < dgvChiTietMon.Rows.Count; i++)
{
MonAn_NVL monannvl_dto = new MonAn_NVL();
monannvl_dto.MaMonAn = maMon;
monannvl_dto.MaNVL = dgvChiTietMon.Rows[i].Cells[1].Value.ToString();
monannvl_dto.SoLuong = int.Parse(dgvChiTietMon.Rows[i].Cells[3].Value.ToString());
ma_bus.ThemMonAn_NVL(monannvl_dto);
}
MessageBox.Show("Thêm món ăn thành công");
DanhSachMonAn();
}
}
catch (Exception ex)
{
}
}
private void dgvMonAn_RowPrePaint_1(object sender, DataGridViewRowPrePaintEventArgs e)
{
dgvMonAn.Rows[e.RowIndex].Cells["STTMonAn"].Value = e.RowIndex + 1;
}
private void btnXoaMon_Click(object sender, EventArgs e)
{
MonAn_BUS ma_bus = new MonAn_BUS();
string ma = dgvMonAn.CurrentRow.Cells[1].Value.ToString();
if (ma_bus.XoaMon(ma) == true)
{
MessageBox.Show("Xóa thành công");
DanhSachMonAn();
}
}
private void dgvMonAn_SelectionChanged(object sender, EventArgs e)
{
//MessageBox.Show(ma.ToString());
}
string active = "ko";
private void dgvMonAn_CellClick(object sender, DataGridViewCellEventArgs e)
{
string ma = dgvMonAn.CurrentRow.Cells[1].Value.ToString();
MonAn_BUS ma_bus = new MonAn_BUS();
DataTable dt = new DataTable();
dt = ma_bus.DanhSachMonAn_Ma(ma);
txtMaMonAn.Text = dt.Rows[0][0].ToString();
txtTenMonAn.Text = dt.Rows[0][4].ToString();
cbxLoaiMon.Text = dt.Rows[0][5].ToString();
txtGia.Text = dt.Rows[0][6].ToString();
dgvChiTietMon.AutoGenerateColumns = false;
dgvChiTietMon.DataSource = dt;
active = "ChiTiet";
}
private void btnRefresh_Click(object sender, EventArgs e)
{
txtGia.Text = "";
txtMaMonAn.Text = "";
txtSoLuong.Text = "";
txtTenMonAn.Text = "";
txtSoLuong.Text = "";
active = "ko";
dgvChiTietMon.DataSource = null;
}
private void btnSuaMon_Click(object sender, EventArgs e)
{
MonAn ma_dto = new MonAn();
MonAn_BUS ma_bus = new MonAn_BUS();
ma_dto.MaMonAn = txtMaMonAn.Text;
ma_dto.TenMonAn = txtTenMonAn.Text;
ma_dto.MaLoaiMonAn = cbxLoaiMon.SelectedValue.ToString();
ma_dto.Gia = decimal.Parse(txtGia.Text);
if (ma_bus.SuaMonAn(ma_dto) == true)
{
MessageBox.Show("Sửa thành công");
DanhSachMonAn();
}
}
private void cbxTenNguyenVatLieu_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
string str = cbxTenNguyenVatLieu.SelectedValue.ToString();
//MessageBox.Show(str);
//lay thuoc tinh don vi tinh
NguyenVatLieu_BUS nvl_bus = new NguyenVatLieu_BUS();
NguyenVatLieu nvl = new NguyenVatLieu();
System.Data.DataTable dt = new DataTable();
dt = nvl_bus.DanhSachNVL_Ma(cbxTenNguyenVatLieu.SelectedValue.ToString());
lblDVT.Text = dt.Rows[0].ItemArray[4].ToString();
}
catch (Exception ex)
{
}
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmLenDanhSachMonAn.cs | C# | asf20 | 11,074 |
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 Nhom16_PTTKHTTT_12HCB
{
public partial class frmThucDon : Form
{
public frmThucDon()
{
InitializeComponent();
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmThucDon.cs | C# | asf20 | 381 |
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 BUS;
using DTO;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmNhanVien : Form
{
public frmNhanVien()
{
InitializeComponent();
}
public frmNhanVien(int Tabindex)
{
InitializeComponent();
tabThongTinCaNhan.SelectedTabIndex = Tabindex;
}
private void frmNhanVien_Load(object sender, EventArgs e)
{
ThongTinNhanVien();
LoadDanhSachChucVu();
LayDanhSachPhanCong();
ChiTietPhanCong(dgvDanhsachPhanCong.Rows.Count - 1);
}
private void ThongTinNhanVien()
{
txtMaNhanVien.Text = ThongTinDangNhap.MaNV; ;
txtHoTen.Text = ThongTinDangNhap.TenNV;
txtDiaChi.Text = ThongTinDangNhap.DiaChi;
txtEmail.Text = ThongTinDangNhap.Email;
txtDienThoai.Text = ThongTinDangNhap.DienThoai;
txtTenDangNhap.Text = ThongTinDangNhap.TenDN;
txtMatKhau.Text = ThongTinDangNhap.MatKhau;
cbxChucVu.SelectedValue = ThongTinDangNhap.MaChucVu;
}
private void LoadDanhSachChucVu()
{
ChucVu_BUS cvb = new ChucVu_BUS();
DataTable dt = cvb.LoadDanhSachChucVu();
cbxChucVu.DataSource = dt;
cbxChucVu.DisplayMember = "TenChucVu";
cbxChucVu.ValueMember = "MaChucVu";
}
private void LayDanhSachPhanCong()
{
PhanCong_BUS pcb = new PhanCong_BUS();
dgvDanhsachPhanCong.DataSource = pcb.LayDanhSachPhanCong();
}
private void btncapNhat_Click(object sender, EventArgs e)
{
if (txtHoTen.Text == string.Empty)
{
MessageBox.Show("Chưa nhập họ tên.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtHoTen.Focus();
}
else if (txtDiaChi.Text == string.Empty)
{
MessageBox.Show("Chưa nhập địa chỉ.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtDiaChi.Focus();
}
else if (txtEmail.Text == string.Empty)
{
MessageBox.Show("Chưa nhập email.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtEmail.Focus();
}
else if (txtDienThoai.Text == string.Empty)
{
MessageBox.Show("Chưa nhập số điện thoại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtDienThoai.Focus();
}
else
{
NhanVien NhanVien = new NhanVien();
NhanVien.MaNV = txtMaNhanVien.Text;
NhanVien.TenNV = txtHoTen.Text;
NhanVien.DiaChi = txtDiaChi.Text;
NhanVien.Email = txtEmail.Text;
NhanVien.DienThoai = txtDienThoai.Text;
NhanVien.TenDN = txtTenDangNhap.Text;
NhanVien.MaChucVu = cbxChucVu.SelectedValue.ToString();
NhanVien.IsDelete = false;
NhanVien_BUS nvb = new NhanVien_BUS();
if (nvb.CapNhatThongTinNhaVien(NhanVien))
{
MessageBox.Show("Cập nhật thông tin thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
ThongTinDangNhap.MaNV = txtMaNhanVien.Text;
ThongTinDangNhap.TenNV = txtHoTen.Text;
ThongTinDangNhap.DiaChi = txtDiaChi.Text;
ThongTinDangNhap.Email = txtEmail.Text;
ThongTinDangNhap.DienThoai = txtDienThoai.Text;
ThongTinDangNhap.TenDN = txtTenDangNhap.Text;
ThongTinDangNhap.MaChucVu = cbxChucVu.SelectedValue.ToString();
ThongTinNhanVien();
}
else
{
MessageBox.Show("Cập nhật thông tin không thành công, vui lòng thử lại sau.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void dgvDanhsachPhanCong_CellClick(object sender, DataGridViewCellEventArgs e)
{
int index = dgvDanhsachPhanCong.CurrentRow.Index;
ChiTietPhanCong(index);
}
private void ChiTietPhanCong(int index)
{
string MaPhanCong = dgvDanhsachPhanCong.Rows[index].Cells[0].Value.ToString();
PhanCong_BUS pcb = new PhanCong_BUS();
dgvChiTietPhanCong.DataSource = pcb.ChiTietPhanCong(MaPhanCong,ThongTinDangNhap.MaNV);
}
private void lbCapNhatMatKhau_Click(object sender, EventArgs e)
{
frmCapNhatMatKhau frmCapNhatMatKhau = new frmCapNhatMatKhau();
frmCapNhatMatKhau.ShowDialog();
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmNhanVien.cs | C# | asf20 | 5,333 |
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 BUS;
using DTO;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmDangNhap : Form
{
public frmDangNhap()
{
InitializeComponent();
}
private void btnDangNhap_Click(object sender, EventArgs e)
{
DangNhap();
}
private void DangNhap()
{
string TenDangNhap = txtTenDangNhap.Text;
string MatKhau = txtMatKhau.Text;
NhanVien_BUS nvb = new NhanVien_BUS();
DataTable dt = new DataTable();
dt = nvb.DangNhap(TenDangNhap);
if (dt.Rows.Count != 0)
{
if (Functions.ToMD5(MatKhau).Equals(dt.Rows[0].ItemArray[6].ToString()))
{
ThongTinDangNhap.MaNV = dt.Rows[0].ItemArray[0].ToString();
ThongTinDangNhap.TenNV = dt.Rows[0].ItemArray[1].ToString();
ThongTinDangNhap.DiaChi = dt.Rows[0].ItemArray[2].ToString();
ThongTinDangNhap.Email = dt.Rows[0].ItemArray[3].ToString();
ThongTinDangNhap.DienThoai = dt.Rows[0].ItemArray[4].ToString();
ThongTinDangNhap.TenDN = dt.Rows[0].ItemArray[5].ToString();
ThongTinDangNhap.MatKhau = MatKhau;
string MaChucVu = dt.Rows[0].ItemArray[7].ToString();
ThongTinDangNhap.MaChucVu = MaChucVu;
this.Hide();
frmMain MainForm = new frmMain();
MainForm.ShowDialog();
}
else
{
MessageBox.Show("Mật khẩu không chính xác", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtMatKhau.Focus();
}
}
else
{
MessageBox.Show("Tên đăng nhập không chính xác", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtTenDangNhap.Focus();
}
}
private void btnNhapLai_Click(object sender, EventArgs e)
{
this.txtTenDangNhap.Clear();
this.txtMatKhau.Clear();
this.txtTenDangNhap.Focus();
}
private void btnThoat_Click(object sender, EventArgs e)
{
this.Close();
}
private void txtMatKhau_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == Convert.ToChar(Keys.Enter))
{
DangNhap();
}
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmDangNhap.cs | C# | asf20 | 2,940 |
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 BUS;
using DTO;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmThemMoiChucVu : Form
{
public frmThemMoiChucVu()
{
InitializeComponent();
}
private void btnThemMoiChucVu_Click(object sender, EventArgs e)
{
ChucVu_BUS cvb = new ChucVu_BUS();
bool kq = cvb.ThemMoiChucVu(txttenChucVu.Text);
if (kq)
{
MessageBox.Show("Thêm mới chức vụ thành công.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Có lỗi sảy ra, vui lòng thử lại sau.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btnThoat_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmThemMoiChucVu.cs | C# | asf20 | 1,121 |
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 BUS;
using DTO;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmThem_Sua_LoaiVe : Form
{
public delegate void ThemMoi();
public delegate void CapNhat();
public event ThemMoi KhiThemMoiLoaiVe = null;
public event CapNhat KhiCapNhatLoaiVe = null;
public string Action = "";
public string ID = null;
LoaiVe_BUS lv_bus;
LoaiVe lv_dto;
public frmThem_Sua_LoaiVe()
{
InitializeComponent();
}
private void btnLuu_Click(object sender, EventArgs e)
{
//them loai nguyen vat lieu
if (Action.Equals("insert"))
{
lv_bus = new LoaiVe_BUS();
lv_dto = new LoaiVe();
lv_dto.TenLoaiVe = txtTenLoaive.Text;
lv_dto.Gia = decimal.Parse(txtGia.Text);
lv_dto.IsDelete = "true";
if (lv_bus.ThemLoaiVe(lv_dto) == true)
{
MessageBox.Show("Thêm loại vé thành công");
if (KhiThemMoiLoaiVe != null)
{
KhiThemMoiLoaiVe();
}
}
else
MessageBox.Show("Thêm thất bại", "Thông báo");
}
if (Action.Equals("edit"))
{
lv_bus = new LoaiVe_BUS();
lv_dto = new LoaiVe();
lv_dto.MaLoaiVe = ID;
lv_dto.TenLoaiVe = txtTenLoaive.Text;
lv_dto.Gia = decimal.Parse(txtGia.Text);
if (lv_bus.SuaLoaiVe(lv_dto) == true)
{
MessageBox.Show("Sửa loại vé thành công","Thông báo");
if (KhiCapNhatLoaiVe != null)
{
KhiCapNhatLoaiVe();
}
}
else
MessageBox.Show("Sửa loại vé thất bại", "Thông báo");
}
}
private void btnThoat_Click(object sender, EventArgs e)
{
this.Close();
}
private void frmThem_Sua_LoaiVe_Load(object sender, EventArgs e)
{
if (Action.Equals("edit"))
{
lv_bus = new LoaiVe_BUS();
DataTable dt = lv_bus.DanhSachLoaiVe_Ma(ID);
txtMaLoaiVe.Text = dt.Rows[0]["MaLoaiVe"].ToString();
txtTenLoaive.Text = dt.Rows[0]["TenLoaiVe"].ToString();
txtGia.Text = dt.Rows[0]["Gia"].ToString();
}
}
private void txtGia_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
e.Handled = true;
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmThem_Sua_LoaiVe.cs | C# | asf20 | 3,172 |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Data;
using System.Windows.Forms;
using Microsoft.Office.Interop.Excel;
using Excel_12 = Microsoft.Office.Interop.Excel;
namespace Nhom16_PTTKHTTT_12HCB
{
class ExportToExcel
{
public void Export(DataGridView dt, string strTieude)
{
try
{
Excel_12.Application excel = new Excel_12.Application();
excel.Application.Workbooks.Add(true);
Excel_12.Application oExcel_12 = null; // Excel_12 Application
Excel_12.Workbook oBook = null; // Excel_12 Workbook
Excel_12.Sheets oSheetsColl = null; // Excel_12 Worksheets collection
Excel_12.Worksheet oSheet = null; // Excel_12 Worksheet
Excel_12.Range oRange = null; // Cell or Range in worksheet
Object oMissing = System.Reflection.Missing.Value;
oExcel_12 = new Excel_12.Application();
// tao moi 1 excel
oExcel_12.Visible = true;//hien thi chuong trinh excel
// mo mot excel
oExcel_12.UserControl = true;
//System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US");
// them vao 1 workbook.
oBook = oExcel_12.Workbooks.Add(oMissing);
// Get worksheets collection
oSheetsColl = oExcel_12.Worksheets;
oSheet = (Excel_12.Worksheet)oSheetsColl.get_Item("Sheet1");//ghi vao sheet 1
//ghi ten cua phieu
oRange = (Excel_12.Range)oSheet.Cells[1, 2];//dong bat dau, cot bat dau
oRange.Value2 = strTieude;//lay tieu de
oRange.Columns.AutoFit();
oRange = (Excel_12.Range)oSheet.Cells[2, 1];//dong 2,ghi o cot 2
oRange.Value2 = "Ngày lập";
oRange.Columns.AutoFit();
//ghi ngay nhap
oRange = (Excel_12.Range)oSheet.Cells[2, 2];//dong 2,ghi o cot 2
oRange.Value2 = DateTime.Now.ToShortDateString();
oRange.Columns.AutoFit();
//ghi dau tien trong datagridview
for (int j = 0; j < dt.Columns.Count; j++)
{
//ghi dong dau tien o dong thu 2 cua excel
oRange = (Excel_12.Range)oSheet.Cells[3, j + 1];//d3 c0 ghi masp,d3 c1 ghi ten sp.....
oRange.Value2 = dt.Columns[j].HeaderText;
oRange.Columns.AutoFit();//gian cot
}
//ghi noi dung cua datagridview
for (int i = 0; i < dt.Rows.Count; i++)//duet dong
{
for (int j = 0; j < dt.Columns.Count; j++)//duyet cot
{
//bat dau ghi tren excel tu dong thu 3 cot thu 1
oRange = (Excel_12.Range)oSheet.Cells[i + 4, j + 1];//Cells[i + 2, j + 1]
oRange.Value2 = dt.Rows[i].Cells[j].EditedFormattedValue.ToString();
oRange.Columns.AutoFit();
}
}
////muc giam
//oRange = (Excel_12.Range)oSheet.Cells[dataGridViewXHienThi.Rows.Count + 4, 2];//dong bd, cot bd
//oRange.Value2 = "Mức giảm";
//oRange = (Excel_12.Range)oSheet.Cells[dataGridViewXHienThi.Rows.Count + 4, 3];//dong bd, cot bd
//khachhangBlo.Khachhang.MaKH = txtMaKH_TT.Text.Trim().ToString();
//if (khachhangBlo.KiemTraKHTonTai() == true)
// oRange.Value2 = Session_QuiDinh.MucGiam;
//else
// oRange.Value2 = "0";
//oRange = (Excel_12.Range)oSheet.Cells[dataGridViewXHienThi.Rows.Count + 4, 4];//dong bd, cot bd
//oRange.Value2 = "%";
////tong tien
//oRange = (Excel_12.Range)oSheet.Cells[dataGridViewXHienThi.Rows.Count + 6, 2];//dong bd, cot bd
//oRange.Value2 = "Tổng tiền";
//oRange = (Excel_12.Range)oSheet.Cells[dataGridViewXHienThi.Rows.Count + 6, 3];//dong bd, cot bd
//oRange.Value2 = txtTongTien.Text;
//oRange = (Excel_12.Range)oSheet.Cells[dataGridViewXHienThi.Rows.Count + 6, 4];//dong bd, cot bd
//oRange.Value2 = "VNĐ";
////nhan vien xuat
//oRange = (Excel_12.Range)oSheet.Cells[dataGridViewXHienThi.Rows.Count + 7, 2];//dong bd, cot bd
//oRange.Value2 = "Người xuất";
////nhan vien xuat
//oRange = (Excel_12.Range)oSheet.Cells[dataGridViewXHienThi.Rows.Count + 8, 2];//dong bd, cot bd
//oRange.Value2 = Session.ChucVu;
////nhan vien xuat
//oRange = (Excel_12.Range)oSheet.Cells[dataGridViewXHienThi.Rows.Count + 8, 3];//dong bd, cot bd
//oRange.Value2 = Session.TenNV;
oRange.Columns.AutoFit();
excel.Quit();
oExcel_12.Quit();
}
catch (Exception ex)
{
}
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/ExportToExcel.cs | C# | asf20 | 5,547 |
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 BUS;
using DevComponents.DotNetBar;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmMain : DevComponents.DotNetBar.Office2007Form
{
frmPhucVu frmphucvu = null;
frmThucDon frmthucdon = null;
frmKhoHang frmkhohang = null;
frmHoaDon frmhoadon = null;
frmNhanVien frmNhanVien = null;
frmQuanLyNhanVien frmQuanLyNhanVien = null;
frmLenDanhSachMonAn frmLenDSmonAn = null;
frmKhachHang frmkhachhang = null;
public frmMain()
{
InitializeComponent();
}
private void menuKhachHang_Click(object sender, EventArgs e)
{
if (frmkhachhang == null || frmkhachhang.IsDisposed)
{
frmkhachhang = new frmKhachHang();
frmkhachhang.MdiParent = frmMain.ActiveForm;
frmkhachhang.Show();
}
else
frmkhachhang.Activate();
}
private void menuPhucVu_Click(object sender, EventArgs e)
{
if (frmphucvu == null || frmphucvu.IsDisposed)
{
frmphucvu = new frmPhucVu();
frmphucvu.MdiParent = frmMain.ActiveForm;
frmphucvu.Show();
}
else
frmphucvu.Activate(); ;
}
private void menuThucDon_Click(object sender, EventArgs e)
{
}
private void menuKhoHang_Click(object sender, EventArgs e)
{
if (frmkhohang == null || frmkhohang.IsDisposed)
{
frmkhohang = new frmKhoHang();
frmkhohang.MdiParent = frmMain.ActiveForm;
frmkhohang.Show();
}
else
frmkhohang.Activate();
}
private void menuHoaDon_Click(object sender, EventArgs e)
{
if (frmhoadon == null || frmhoadon.IsDisposed)
{
frmhoadon = new frmHoaDon();
frmhoadon.MdiParent = frmMain.ActiveForm;
frmhoadon.Show();
}
else
frmphucvu.Activate();
}
private void menuThongKe_Click(object sender, EventArgs e)
{
}
private void menuNhanVien_Click(object sender, EventArgs e)
{
if (frmNhanVien == null || frmNhanVien.IsDisposed)
{
frmNhanVien = new frmNhanVien(1);
frmNhanVien.MdiParent = frmMain.ActiveForm;
frmNhanVien.Show();
}
else
frmNhanVien.Activate();
}
private void đĂNGXUẤTToolStripMenuItem_Click(object sender, EventArgs e)
{
if(MessageBox.Show("Bạn có chắc chắn muốn thoát chuong trình không","Thông Báo",MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes)
{
ThongTinDangNhap.DangXuat();
this.Close();
Application.Exit();
}
}
public void HT()
{
}
void MacDinh()
{
menuPhucVu.Enabled = false;
menuThucDon.Enabled = false;
menuKhoHang.Enabled = false;
menuHoaDon.Enabled = false;
menuNhanVien.Enabled = false;
menuKhachHang.Enabled = false;
}
private void frmMain_Load(object sender, EventArgs e)
{
}
private void pHỤCVỤToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void qUẢNLÝToolStripMenuItem_Click(object sender, EventArgs e)
{
if (frmQuanLyNhanVien == null || frmQuanLyNhanVien.IsDisposed)
{
frmQuanLyNhanVien = new frmQuanLyNhanVien();
frmQuanLyNhanVien.MdiParent = frmMain.ActiveForm;
frmQuanLyNhanVien.Show();
}
else
frmQuanLyNhanVien.Activate();
}
private void lênDanhSáchMónToolStripMenuItem_Click(object sender, EventArgs e)
{
if (frmQuanLyNhanVien == null || frmQuanLyNhanVien.IsDisposed)
{
frmLenDSmonAn = new frmLenDanhSachMonAn();
frmLenDSmonAn.MdiParent = frmMain.ActiveForm;
frmLenDSmonAn.Show();
}
else
frmLenDSmonAn.Activate();
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmMain.cs | C# | asf20 | 4,857 |
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 DevComponents.DotNetBar;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmHoaDon : DevComponents.DotNetBar.Office2007Form
{
public frmHoaDon()
{
InitializeComponent();
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmHoaDon.cs | C# | asf20 | 447 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Nhom16_PTTKHTTT_12HCB")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Nhom16_PTTKHTTT_12HCB")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4b530224-8b6f-4dd6-bfd0-14513e955d54")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/Properties/AssemblyInfo.cs | C# | asf20 | 1,454 |
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 DTO;
using BUS;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmThem_Sua_LoaiNVL : Form
{
public delegate void ThemMoi();
public delegate void CapNhat();
public event ThemMoi KhiThemMoi = null;
public event CapNhat KhiCapNhat = null;
public string Action = "";
public string ID = null;
LaoiNVL_BUS loainvl_bus;
LoaiNVL loainvl_dto;
public frmThem_Sua_LoaiNVL()
{
InitializeComponent();
}
private void btnThoat_Click(object sender, EventArgs e)
{
this.Close();
}
private void frmThem_Sua_LoaiNVL_Load(object sender, EventArgs e)
{
//set man hinh luc loadform
SetBounds(Screen.GetWorkingArea(this).Width / 2, Screen.GetWorkingArea(this).Height / 2, Width, Height);
//them loai nguyen vat lieu
if (Action.Equals("Insert"))
{
loainvl_bus = new LaoiNVL_BUS();
txtMaLoaiNVL.Text = loainvl_bus.MaLoaiNVLTang();
}
//cap nhat scah
if (Action.Equals("Update"))
{
loainvl_bus = new LaoiNVL_BUS();
loainvl_dto = new LoaiNVL();
DataTable loainvl = new DataTable();
loainvl = loainvl_bus.DanhSachLoaiNVL_Ma(ID);
int i = loainvl.Rows.Count;
txtMaLoaiNVL.Text = loainvl.Rows[0]["MaLoaiNVL"].ToString();
txtTenLoaiNVL.Text = loainvl.Rows[0]["TenLoaiNVL"].ToString();
}
}
private void btnLuu_Click(object sender, EventArgs e)
{
if (txtTenLoaiNVL.Text == "")
{
MessageBox.Show("Chưa nhập tên loại nguyên vật liệu");
txtTenLoaiNVL.Select();
return;
}
loainvl_bus = new LaoiNVL_BUS();
loainvl_dto = new LoaiNVL();
loainvl_dto.MaLoaiNVL = txtMaLoaiNVL.Text;
loainvl_dto.TenLoaiNVL = txtTenLoaiNVL.Text;
//them moi
if (Action.Equals("Insert"))
{
if (loainvl_bus.ThemLoaiNVL(loainvl_dto) == true)
{
MessageBox.Show("Thêm thành công", "Thống báo");
if (KhiThemMoi != null)
{
KhiThemMoi();
txtMaLoaiNVL.Text = loainvl_bus.MaLoaiNVLTang();
}
}
else
MessageBox.Show("Thêm thất bại", "Thông báo");
}
if (Action.Equals("Update"))
{
if (loainvl_bus.CapNhatLoaiNVL(loainvl_dto) == true)
{
MessageBox.Show("Cập nhật thành công", "Thống báo");
if (KhiCapNhat != null)
{
KhiCapNhat();
this.Close();
}
}
else
MessageBox.Show("Cập nhật thất bại", "Thông báo");
}
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmThem_Sua_LoaiNVL.cs | C# | asf20 | 3,490 |
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 BUS;
using DevComponents.DotNetBar;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class Form1 : DevComponents.DotNetBar.Office2007Form
{
public Form1()
{
InitializeComponent();
}
private void menuCaiDat_Click(object sender, EventArgs e)
{
frmCaiDat frm = new frmCaiDat();
frm.Show();
}
private void menuKhachHang_Click(object sender, EventArgs e)
{
frmKhachHang frm = new frmKhachHang();
frm.Show();
}
private void menuNhanVien_Click(object sender, EventArgs e)
{
frmNhanVien frm = new frmNhanVien();
frm.Show();
}
private void menuThongKe_Click(object sender, EventArgs e)
{
frmThongKe frm = new frmThongKe();
frm.Show();
}
private void menuHoaDon_Click(object sender, EventArgs e)
{
frmHoaDon frm = new frmHoaDon();
frm.Show();
}
private void menuKhoHang_Click(object sender, EventArgs e)
{
frmKhoHang frm = new frmKhoHang();
frm.Show();
}
private void menuThucDon_Click(object sender, EventArgs e)
{
frmThucDon frm = new frmThucDon();
frm.Show();
}
private void menuPhucVu_Click(object sender, EventArgs e)
{
frmPhucVu frm = new frmPhucVu();
frm.Show();
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/Form1.cs | C# | asf20 | 1,784 |
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 DevComponents.DotNetBar;
using BUS;
using DTO;
namespace Nhom16_PTTKHTTT_12HCB
{
public partial class frmQuanLyNhanVien : DevComponents.DotNetBar.Office2007Form
{
public frmQuanLyNhanVien()
{
InitializeComponent();
}
private void frmNhanVien_Load(object sender, EventArgs e)
{
LoadDanhSachNhanVienGrid();
LoadDanhSachCa();
LoadDanhSachChucVu();
LoadDanhSachNhanVien();
if (dgvDanhSachNhanVien.Rows.Count != 0)
{
dgvDanhSachNhanVien.Rows[0].Selected = true;
XemChiTietNhanVien(0);
}
}
private void LoadDanhSachNhanVien()
{
NhanVien_BUS nvb = new NhanVien_BUS();
DataTable dt = nvb.LoadDanhSachNhanVien();
dgvDanhSachNhanVien.DataSource = dt;
}
private void LoadDanhSachChucVu()
{
ChucVu_BUS cvb = new ChucVu_BUS();
DataTable dt = cvb.LoadDanhSachChucVu();
cbxChucVu.DataSource = dt;
cbxChucVu.DisplayMember = "TenChucVu";
cbxChucVu.ValueMember = "MaChucVu";
}
private void dgvDanhSachNhanVien_CellClick(object sender, DataGridViewCellEventArgs e)
{
int Rowindex = dgvDanhSachNhanVien.SelectedRows[0].Index;
XemChiTietNhanVien(Rowindex);
}
private void XemChiTietNhanVien(int RowIndexx)
{
string MaNhanVien = dgvDanhSachNhanVien.Rows[dgvDanhSachNhanVien.SelectedRows[0].Index].Cells[0].Value.ToString();
NhanVien_BUS nvb = new NhanVien_BUS();
DataTable dt = new DataTable();
dt = nvb.XemChiTietNhanVien(MaNhanVien);
txtMaNhanVien.Text = dt.Rows[0].ItemArray[0].ToString();
txtHoTen.Text = dt.Rows[0].ItemArray[1].ToString();
txtDiaChi.Text = dt.Rows[0].ItemArray[2].ToString();
txtEmail.Text = dt.Rows[0].ItemArray[3].ToString();
txtDienThoai.Text = dt.Rows[0].ItemArray[4].ToString();
txtTenDangNhap.Text = dt.Rows[0].ItemArray[5].ToString();
txtMatKhau.ReadOnly = true;
txtMatKhau.Text = "************";
cbxChucVu.SelectedValue = dt.Rows[0].ItemArray[7].ToString();
}
private void LoadDanhSachCa()
{
Ca_BUS cb = new Ca_BUS();
dgvCa.DataSource = cb.LayDanhSachCa();
}
private void LoadDanhSachNhanVienGrid()
{
NhanVien_BUS nvb = new NhanVien_BUS();
DataTable dt = new DataTable();
dt = nvb.LoadDanhSachNhanVien();
Ca_BUS cb = new Ca_BUS();
dgvPhanCong.Columns.Clear();
DataGridViewTextBoxColumn columnMaNhanVien = new DataGridViewTextBoxColumn();
columnMaNhanVien.HeaderText = "Mã Nhân Viên";
DataGridViewTextBoxColumn columnTenNhanVien = new DataGridViewTextBoxColumn();
columnTenNhanVien.HeaderText = "Họ Tên";
DataGridViewTextBoxColumn columnChucVu = new DataGridViewTextBoxColumn();
columnChucVu.HeaderText = "Chức Vụ";
dgvPhanCong.Columns.Add(columnMaNhanVien);
dgvPhanCong.Columns.Add(columnTenNhanVien);
dgvPhanCong.Columns.Add(columnChucVu);
for (int i = 0; i < dt.Rows.Count; i++)
{
string[] arr = new string[] { dt.Rows[i].ItemArray[0].ToString(), dt.Rows[i].ItemArray[1].ToString(), dt.Rows[i].ItemArray[2].ToString()};
dgvPhanCong.Rows.Add(arr);
}
}
private void dipDenNgay_ValueChanged(object sender, EventArgs e)
{
XetPhanCong();
}
private void XetPhanCong()
{
dgvPhanCong.Columns.Clear();
DataGridViewTextBoxColumn columnMaNhanVien = new DataGridViewTextBoxColumn();
columnMaNhanVien.HeaderText = "Mã Nhân Viên";
DataGridViewTextBoxColumn columnTenNhanVien = new DataGridViewTextBoxColumn();
columnTenNhanVien.HeaderText = "Họ Tên";
DataGridViewTextBoxColumn columnChucVu = new DataGridViewTextBoxColumn();
columnChucVu.HeaderText = "Chức Vụ";
dgvPhanCong.Columns.Add(columnMaNhanVien);
dgvPhanCong.Columns.Add(columnTenNhanVien);
dgvPhanCong.Columns.Add(columnChucVu);
NhanVien_BUS nvb = new NhanVien_BUS();
DataTable dt = new DataTable();
dt = nvb.LoadDanhSachNhanVien();
Ca_BUS cb = new Ca_BUS();
for (int i = 0; i < dt.Rows.Count; i++)
{
string[] arr = new string[] { dt.Rows[i].ItemArray[0].ToString(), dt.Rows[i].ItemArray[1].ToString(), dt.Rows[i].ItemArray[2].ToString() };
dgvPhanCong.Rows.Add(arr);
}
TimeSpan TimeSpan = new TimeSpan();
TimeSpan = dipDenNgay.Value - DateTime.Now;
int KhoangThoiGianToiNgay = TimeSpan.Days;
if(KhoangThoiGianToiNgay < 0)
{
MessageBox.Show(" Giá trị tới ngày không đúng.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
TimeSpan time = dipDenNgay.Value - dipTuNgay.Value;
int SoNgay = time.Days;
if (SoNgay > 7)
{
MessageBox.Show("Một phân công không quá một tuần", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else if (SoNgay <= 0)
{
MessageBox.Show("Chọn sai khoảng thời gian.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
DateTime NgayBatDau = dipTuNgay.Value;
for (int i = 0; i < SoNgay; i++)
{
DataGridViewComboBoxColumn column = new DataGridViewComboBoxColumn();
column.HeaderText = NgayBatDau.ToShortDateString();
column.DataSource = cb.LayDanhSachCa();
column.DisplayMember = "TenCa";
column.ValueMember = "MaCa";
dgvPhanCong.Columns.Add(column);
NgayBatDau = TimNgayTiepTheo(NgayBatDau);
}
}
}
}
private DateTime TimNgayTiepTheo(DateTime NgayHienTai)
{
DateTime NgayTiepTheo = new DateTime();
int Ngay = NgayHienTai.Day;
int Thang = NgayHienTai.Month;
int Nam = NgayHienTai.Year;
if (Thang == 1 || Thang == 3 || Thang == 5 || Thang == 7 || Thang == 8 || Thang == 10 || Thang == 12)
{
if (Ngay < 31)
{
Ngay += 1;
}
else
{
if (Thang == 12)
{
Ngay = 1;
Thang = 1;
Nam += 1;
}
else
{
Ngay = 1;
Thang += 1;
}
}
}
else if (Thang == 2 || Thang == 4 || Thang == 6 || Thang == 9 || Thang == 11)
{
if (Ngay < 30)
{
Ngay += 1;
}
else
{
Ngay = 1;
Thang += 1;
}
}
else if (Thang == 2)
{
if ((Nam % 4 == 0 && Nam % 100 != 0) || (Nam % 400 == 0))
{
if (Ngay < 29)
{
Ngay += 1;
}
else
{
Ngay = 1;
Thang = 3;
}
}
else
{
if (Ngay < 28)
{
Ngay += 1;
}
else
{
Ngay = 1;
Thang = 3;
}
}
}
string strDate = Thang + "/" + Ngay + "/" + Nam;
NgayTiepTheo = DateTime.Parse(strDate);
return NgayTiepTheo;
}
private void btnPhanCong_Click(object sender, EventArgs e)
{
PhanCong_BUS pcb = new PhanCong_BUS();
DataTable dt = new DataTable();
PhanCong PhanCong = new DTO.PhanCong();
PhanCong.NgayBatDau = dipTuNgay.Value;
PhanCong.NgayKetThuc = dipDenNgay.Value;
dt = pcb.ThemMoiPhanCong(PhanCong);
string MaPhanCong = dt.Rows[0].ItemArray[0].ToString();
for (int i = 0; i < dgvPhanCong.Rows.Count; i++)
{
string MaNhanVien = dgvPhanCong.Rows[i].Cells[0].Value.ToString();
for (int j = 3; j < dgvPhanCong.Columns.Count; j++)
{
DateTime NgayPhanCong = DateTime.Parse(dgvPhanCong.Columns[j].HeaderText);
if (dgvPhanCong.Rows[i].Cells[j].Value != null)
{
string MaCa = dgvPhanCong.Rows[i].Cells[j].Value.ToString();
CTPhanCong_BUS ctpcb = new CTPhanCong_BUS();
CTPhanCong ctpc = new CTPhanCong();
ctpc.MaPhanCong = MaPhanCong;
ctpc.NgayPhanCong = NgayPhanCong;
ctpc.MaCa = MaCa;
ctpc.MaNV = MaNhanVien;
ctpcb.ThemMoiPhanCong(ctpc);
}
}
}
MessageBox.Show("Phân công thành công.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void btnNhapLai_Click(object sender, EventArgs e)
{
txtMaNhanVien.Text = string.Empty;
txtHoTen.Text = string.Empty;
txtDiaChi.Text = string.Empty;
txtEmail.Text = string.Empty;
txtDienThoai.Text = string.Empty;
txtTenDangNhap.Text = string.Empty;
txtMatKhau.Text = string.Empty;
txtMatKhau.ReadOnly = false;
cbxChucVu.SelectedItem = 0;
}
private void btnThemMoi_Click(object sender, EventArgs e)
{
if(txtHoTen.Text == string.Empty)
{
MessageBox.Show("Chưa nhập họ tên.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtHoTen.Focus();
}
else if(txtDiaChi.Text == string.Empty)
{
MessageBox.Show("Chưa nhập địa chỉ.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtDiaChi.Focus();
}
else if (txtEmail.Text == string.Empty)
{
MessageBox.Show("Chưa nhập email.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtEmail.Focus();
}
else if (txtDienThoai.Text == string.Empty)
{
MessageBox.Show("Chưa nhập số điện thoại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtDienThoai.Focus();
}
else if (txtTenDangNhap.Text == string.Empty)
{
MessageBox.Show("Chưa nhập tên đăng nhập.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtTenDangNhap.Focus();
}
else if (txtMatKhau.Text == string.Empty)
{
MessageBox.Show("Chưa nhập mật khẩu.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtMatKhau.Focus();
}
else
{
NhanVien NhanVien = new NhanVien();
NhanVien.MaNV = txtMaNhanVien.Text;
NhanVien.TenNV = txtHoTen.Text;
NhanVien.DiaChi = txtDiaChi.Text;
NhanVien.Email = txtEmail.Text;
NhanVien.DienThoai = txtDienThoai.Text;
NhanVien.TenDN = txtTenDangNhap.Text;
NhanVien.MatKhau = Functions.ToMD5(txtMatKhau.Text);
NhanVien.MaChucVu = cbxChucVu.SelectedValue.ToString();
NhanVien_BUS nvb = new NhanVien_BUS();
if (nvb.ThemMoiNhanVien(NhanVien))
{
MessageBox.Show("Thêm mới nhân viên thành công.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
LoadDanhSachNhanVien();
dgvDanhSachNhanVien.Rows[dgvDanhSachNhanVien.Rows.Count - 1].Selected = true;
XemChiTietNhanVien(dgvDanhSachNhanVien.Rows.Count - 1);
}
}
}
private void lbThemMoiLoaiNhanVien_Click(object sender, EventArgs e)
{
frmThemMoiChucVu FormThemMoiChucVu = new frmThemMoiChucVu();
FormThemMoiChucVu.ShowDialog();
LoadDanhSachChucVu();
}
private void dipTuNgay_ValueChanged(object sender, EventArgs e)
{
TimeSpan TimeSpan = new TimeSpan();
TimeSpan = dipTuNgay.Value - DateTime.Now;
int KhoangTuNgay = TimeSpan.Days;
if (KhoangTuNgay < 0)
{
MessageBox.Show("Chỉ được phân cồng bắt đầu từ hôm nay.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
}
| 12hcb-nhom16-pttkhttt | trunk/Sources/Nhom16_PTTKHTTT_12HCB/Nhom16_PTTKHTTT_12HCB/frmQuanLyNhanVien.cs | C# | asf20 | 14,606 |
---------- Thêm loại vé---------------
create proc sp_ThemLoaiVe
@TenLoaiVe nchar(10),
@Gia decimal(18,0),
@isdelete bit
as
begin transaction
begin try
-- Mã tự tăng
declare @ma_next nvarchar(10) -- max 7 ki tu
declare @max int
select @max = count(MaLoaiVe) + 1 -- MACV ke tiep dang 'CVxxxxx'
from dbo.LoaiVe
where MaLoaiVe like 'LV%'
-- tao maloaive ke tiep
if(@max >0 and @max <10)
set @ma_next = 'LV'+ right( '00' + cast(@max as nvarchar(10)) , 5)
if(@max >=10 and @max <100)
set @ma_next = 'LV'+ right( '0' + cast(@max as nvarchar(10)) , 5)
if(@max >=100 and @max <1000)
set @ma_next = 'LV'+ right( '' + cast(@max as nvarchar(10)) , 5)
-- kiem ta ton tai
while(exists(select MaLoaiVe from dbo.LoaiVe where MaLoaiVe = @ma_next))
begin
set @max = @max + 1
set @ma_next = 'LV'+ right( '0' + cast(@max as nvarchar(5)) , 5)
end
insert into LoaiVe values(@ma_next,@TenLoaiVe,@Gia,@isdelete)
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print ERROR_MESSAGE()
rollback transaction
end catch
commit
go
--Danh Sách Loại vé
create proc sp_DanhSachLoaiVe
as
begin transaction
begin try
select * from LoaiVe where iDelete='true'
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print ERROR_MESSAGE()
rollback transaction
end catch
commit
go
--Xóa loại vé
create procedure sp_XoaLoaiVe
@MaLoaiVe nvarchar(5)
as
begin transaction
begin try
update LoaiVe set isdelete='false' where MaLoaiVe=@MaLoaiVe
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print ERROR_MESSAGE()
rollback transaction
end catch
commit
go
-- Sửa loại vé
create procedure sp_SuaLoaiVe
@MaLoaiVe nvarchar(5),
@TenLoaiVe nchar(10),
@Gia decimal(18,0)
as
begin transaction
begin try
update LoaiVe set TenLoaiVe=@TenLoaiVe,Gia=@Gia,isdelete='true' where MaLoaiVe=@MaLoaiVe
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print ERROR_MESSAGE()
rollback transaction
end catch
commit
go
-- Lấy danh sách loại vé theo mã
create proc sp_DanhSachLoaiVeTheoMa
@MaLoaiVe nvarchar(5)
as
Begin tran
begin try
select * from LoaiVe where MaLoaiVe = @MaLoaiVe
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print Error_message()
rollback tran
end catch
commit
go
---------------------------LOẠI MÓN ĂN-----------------------------------
-- Thêm loại món ăn.
create proc sp_ThemLoaiMonAn
@TenLoaiMonAn nvarchar(50),
@isdelete bit
as
begin transaction
begin try
-- Mã tự tăng
declare @ma_next nvarchar(10) -- max 7 ki tu
declare @max int
select @max = count(MaLoaiMonAn) + 1 -- MACV ke tiep dang 'CVxxxxx'
from dbo.LoaiMonAn
where MaLoaiMonAn like 'LM%'
-- tao maloaive ke tiep
if(@max >0 and @max <10)
set @ma_next = 'LM'+ right( '00' + cast(@max as nvarchar(10)) , 5)
if(@max >=10 and @max <100)
set @ma_next = 'LM'+ right( '0' + cast(@max as nvarchar(10)) , 5)
if(@max >=100 and @max <1000)
set @ma_next = 'LM'+ right( '' + cast(@max as nvarchar(10)) , 5)
-- kiem ta ton tai
while(exists(select MaLoaiMonAn from dbo.LoaiMonAn where MaLoaiMonAn = @ma_next))
begin
set @max = @max + 1
set @ma_next = 'LM'+ right( '0' + cast(@max as nvarchar(5)) , 5)
end
insert into LoaiMonAn values(@ma_next,@TenLoaiMonAn,@isdelete)
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print ERROR_MESSAGE()
rollback transaction
end catch
commit
go
--Danh Sách Loại Món ăn
create proc sp_DanhSachLoaiMonAn
as
begin transaction
begin try
select * from LoaiMonAn where isdelete='true'
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print ERROR_MESSAGE()
rollback transaction
end catch
commit
go
--Xóa loại món ăn
create procedure sp_XoaLoaiMonAn
@MaLoaiMonAn nvarchar(6)
as
begin transaction
begin try
update LoaiMonAn set isdelete='false' where MaLoaiMonAn=@MaLoaiMonAn
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print ERROR_MESSAGE()
rollback transaction
end catch
commit
go
-- Sửa loại món ăn
create procedure sp_SuaLoaiMonAn
@MaLoaiMon nvarchar(6),
@TenLoaiMon nvarchar(50)
as
begin transaction
begin try
update LoaiMonAn set TenLoaiMonAn=@TenLoaiMon,isdelete='true' where MaLoaiMonAn=@MaLoaiMon
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print ERROR_MESSAGE()
rollback transaction
end catch
commit
go
-- Lấy danh sách loại món theo mã
create proc sp_DanhSachLoaiMonTheoMa
@MaLoaiMon nvarchar(6)
as
Begin tran
begin try
select * from LoaiMonAn where MaLoaiMonAn=@MaLoaiMon
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print Error_message()
rollback tran
end catch
commit
go
-------------------------------------MÓN ĂN------------------------------
create proc sp_MaMonAn_Tang
as
declare @ma_next nvarchar(10) -- max 7 ki tu
declare @max int
select @max = count(MaMonAn) + 1 -- MACV ke tiep dang 'CVxxxxx'
from dbo.MonAn
where MaMonAn like 'MA%'
-- tao makh ke tiep
if(@max >0 and @max <10)
set @ma_next = 'MA'+ right( '00' + cast(@max as nvarchar(10)) , 5)
if(@max >=10 and @max <100)
set @ma_next = 'MA'+ right( '0' + cast(@max as nvarchar(10)) , 5)
if(@max >=100 and @max <1000)
set @ma_next = 'MA'+ right( '' + cast(@max as nvarchar(10)) , 5)
-- kiem ta ton tai
while(exists(select MaMonAn from dbo.MonAn where MaMonAn = @ma_next))
begin
set @max = @max + 1
set @ma_next = 'MA'+ right( '0' + cast(@max as nvarchar(5)) , 5)
end
select @ma_next as Ma
go
-- Thêm món ăn
create proc sp_ThemMonAn
@MaMonAn nvarchar(10),
@MaLoaiMonAn nvarchar(5),
@TenMonAn nvarchar(50),
@Gia decimal(18,0)
as
insert into MonAn
values(@MaMonAn,@MaLoaiMonAn,@TenMonAn,1,@Gia)
go
-- Thêm loại món ăn_NVL.
create
--alter
proc sp_ThemMonAn_NVL
@MaNVL nvarchar(10),
@MaMonAn nvarchar(5),
@SoLuong int
as
begin transaction
begin try
if exists(select * from MonAn_NVL where MaNVL = @MaNVL and MaMonAn = @MaMonAn)
begin
declare @SoLuongCu int = (select SoLuong from MonAn_NVL where MaNVL = @MaNVL and MaMonAn = @MaMonAn)
update MonAn_NVL set SoLuong = @SoLuongCu + @SoLuong where MaNVL = @MaNVL and MaMonAn = @MaMonAn
update NguyenVatLieu set SoLuongTon = SoLuongTon - (@SoLuongCu + @SoLuong) where MaNVL = @MaNVL
end
else
begin
insert into MonAn_NVL values(@MaNVL,@MaMonAn,@SoLuong)
update NguyenVatLieu set SoLuongTon = SoLuongTon-@SoLuong where MaNVL = @MaNVL
end
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print ERROR_MESSAGE()
rollback transaction
end catch
commit
go
-- Xóa món ăn_NVL (xóa nguyên vật liệu ra khỏi món)
create proc sp_XoaMonAn_NVL
@MaNVL nvarchar(10)
as
begin transaction
begin try
delete MonAn_NVL where MaNVL = @MaNVL
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print ERROR_MESSAGE()
rollback transaction
end catch
commit
go
-- Lên danh sach món ăn
--xoa mon an
create proc [dbo].[sp_XoaMonAn]
@MaMonAn nvarchar(5)
as
begin transaction
begin try
delete MonAn_NVL where MaMonAn = @MaMonAn
delete MonAn where MaMonAn = @MaMonAn
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print ERROR_MESSAGE()
rollback transaction
end catch
commit
go
-- Danh sách nguyên vật liệu món ăn theo mã
create
--alter
proc sp_ChiTiet_NVL
@MaMonAn nvarchar(5)
as
begin transaction
begin try
select m.MaMonAn, nvl.MaNVL,TenNVL,SoLuong,m.TenMonAn,l.TenLoaiMonAn,m.Gia from LoaiMonAn l, NguyenVatLieu nvl, MonAn_NVL mnvl, MonAn m where m.MaMonAn=mnvl.MaMonAn and mnvl.MaNVL=nvl.MaNVL and l.MaLoaiMonAn = m.MaLoaiMonAn and m.MaMonAn = @MaMonAn
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print ERROR_MESSAGE()
rollback transaction
end catch
commit
go
--- Danh sách món ăn
create proc sp_DanhSachMonAn
as
begin transaction
begin try
select m.MaMonAn,m.TenMonAn,l.TenLoaiMonAn,Gia from MonAn m, LoaiMonAn l where l.MaLoaiMonAn=m.MaLoaiMonAn
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print ERROR_MESSAGE()
rollback transaction
end catch
commit
go
-- Sửa món ăn
create proc sp_SuaMonAn
@MaMonAn nvarchar(5),
@MaLoaiMonAn nvarchar(6),
@TenMonAn nvarchar(50),
@Gia decimal(18, 0)
as
begin transaction
begin try
update MonAn set MaLoaiMonAn=@MaLoaiMonAn, TenMonAn=@TenMonAn,Gia=@Gia where MaMonAn=@MaMonAn
end try
begin catch
raiserror(N'Lỗi CSDL',16,1)
print ERROR_MESSAGE()
rollback transaction
end catch
commit
go
| 12hcb-nhom16-pttkhttt | trunk/Store Procedure/Phuong_httt.sql | TSQL | asf20 | 8,753 |
create
proc sp_MaNVL_Tang
as
declare @ma_next nvarchar(10) -- max 7 ki tu
declare @max int
select @max = count(MaNVL) + 1 -- MACV ke tiep dang 'CVxxxxx'
from dbo.NguyenVatLieu
where MaNVL like 'NVL%'
-- tao makh ke tiep
if(@max >0 and @max <10)
set @ma_next = 'NVL'+ right( '00' + cast(@max as nvarchar(10)) , 5)
if(@max >=10 and @max <100)
set @ma_next = 'NVL'+ right( '0' + cast(@max as nvarchar(10)) , 5)
if(@max >=100 and @max <1000)
set @ma_next = 'NVL'+ right( '' + cast(@max as nvarchar(10)) , 5)
-- kiem ta ton tai
while(exists(select MaNVL from dbo.NguyenVatLieu where MaNVL = @ma_next))
begin
set @max = @max + 1
set @ma_next = 'NVL'+ right( '0' + cast(@max as nvarchar(5)) , 5)
end
select @ma_next as Ma
go
create
proc sp_MaLoaiNVL_Tang
as
declare @ma_next nvarchar(10) -- max 7 ki tu
declare @max int
select @max = count(MaLoaiNVL) + 1 -- MACV ke tiep dang 'CVxxxxx'
from dbo.LoaiNVL
where MaLoaiNVL like 'LVL%'
-- tao makh ke tiep
if(@max >0 and @max <10)
set @ma_next = 'LVL'+ right( '00' + cast(@max as nvarchar(10)) , 5)
if(@max >=10 and @max <100)
set @ma_next = 'LVL'+ right( '0' + cast(@max as nvarchar(10)) , 5)
if(@max >=100 and @max <1000)
set @ma_next = 'LVL'+ right( '' + cast(@max as nvarchar(10)) , 5)
-- kiem ta ton tai
while(exists(select MaLoaiNVL from dbo.LoaiNVL where MaLoaiNVL = @ma_next))
begin
set @max = @max + 1
set @ma_next = 'LVL'+ right( '0' + cast(@max as nvarchar(5)) , 5)
end
select @ma_next as Ma
go
create
proc sp_MaPN_Tang
as
declare @ma_next nvarchar(10) -- max 7 ki tu
declare @max int
select @max = count(MaPN) + 1 -- MACV ke tiep dang 'CVxxxxx'
from dbo.PhieuNhap
where MaPN like 'PN%'
-- tao makh ke tiep
if(@max >0 and @max <10)
set @ma_next = 'PN'+ right( '00' + cast(@max as nvarchar(10)) , 5)
if(@max >=10 and @max <100)
set @ma_next = 'PN'+ right( '0' + cast(@max as nvarchar(10)) , 5)
if(@max >=100 and @max <1000)
set @ma_next = 'PN'+ right( '' + cast(@max as nvarchar(10)) , 5)
-- kiem ta ton tai
while(exists(select MaPN from dbo.PhieuNhap where MaPN = @ma_next))
begin
set @max = @max + 1
set @ma_next = 'PN'+ right( '0' + cast(@max as nvarchar(5)) , 5)
end
select @ma_next as Ma
go
--ma phieu xuat tang
create
proc sp_MaPX_Tang
as
declare @ma_next nvarchar(10) -- max 7 ki tu
declare @max int
select @max = count(MaPX) + 1 -- MACV ke tiep dang 'CVxxxxx'
from dbo.PhieuXuat
where MaPX like 'PX%'
-- tao makh ke tiep
if(@max >0 and @max <10)
set @ma_next = 'PX'+ right( '00' + cast(@max as nvarchar(10)) , 5)
if(@max >=10 and @max <100)
set @ma_next = 'PX'+ right( '0' + cast(@max as nvarchar(10)) , 5)
if(@max >=100 and @max <1000)
set @ma_next = 'PX'+ right( '' + cast(@max as nvarchar(10)) , 5)
-- kiem ta ton tai
while(exists(select MaPX from dbo.PhieuXuat where MaPX = @ma_next))
begin
set @max = @max + 1
set @ma_next = 'PX'+ right( '0' + cast(@max as nvarchar(5)) , 5)
end
select @ma_next as Ma
go
--ma nha cung cap tang
create
proc sp_MaNCC_Tang
as
declare @ma_next nvarchar(10) -- max 7 ki tu
declare @max int
select @max = count(MaNCC) + 1 -- MACV ke tiep dang 'CVxxxxx'
from dbo.NCC
where MaNCC like 'NCC%'
-- tao makh ke tiep
--if(@max >0 and @max <10)
-- set @ma_next = 'NCC'+ right( '00' + cast(@max as nvarchar(10)) , 5)
if(@max >=0 and @max <10)
set @ma_next = 'NCC'+ right( '0' + cast(@max as nvarchar(10)) , 5)
if(@max >=10 and @max <100)
set @ma_next = 'NCC'+ right( '' + cast(@max as nvarchar(10)) , 5)
-- kiem ta ton tai
while(exists(select MaNCC from dbo.NCC where MaNCC = @ma_next))
begin
set @max = @max + 1
set @ma_next = 'NCC'+ right( '0' + cast(@max as nvarchar(5)) , 5)
end
select @ma_next as Ma
---------------------------------------------------------------------------------------------------------------------
go
--------------------------------------LOAI NGUYEN VAT LIEU------------------------------------------------
create
proc sp_ThemLoaiNVL @MaLoaiNVL nvarchar(10),@TenLoaiNVL nvarchar(50)
as
insert into LoaiNVL (MaLoaiNVL,TenLoaiNVL,isdelete)
values(@MaLoaiNVL,@TenLoaiNVL,'false')
go
create
proc sp_DanhSachLoaiNVL
as
select * from LoaiNVL where isdelete = 'false'
go
create
proc sp_DanhSachLoaiNVL_Ma @MaLoaiNVL nvarchar(10)
as
select * from LoaiNVL where MaLoaiNVL = @MaLoaiNVL and isdelete = 'false'
go
create
proc sp_CapNhatLoaiNVL @MaLoaiNVL nvarchar(10),@TenLoaiNVL nvarchar(50)
as
update LoaiNVL
set TenLoaiNVL = @TenLoaiNVL
where MaLoaiNVL = @MaLoaiNVL
go
create
proc sp_XoaLoaiNVL @MaLoaiNVL nvarchar(10)
as
update LoaiNVL
set isdelete = 'true'
where MaLoaiNVL = @MaLoaiNVL
----------------------------------------------NGUYEN VAT LIEU----------------------------------------------------------
go
create
proc sp_ThemNguyenVatLieu @MaNVL nvarchar(10),@MaLoaiNVL nvarchar(10),
@TenNVL nvarchar(50),@SoLuong int, @SoLuongTon int, @DVT nvarchar(50)
as
insert into NguyenVatLieu(MaNVL,MaLoaiNVL,TenNVL,SoLuongTon,DVT,isdelete)
values(@MaNVL,@MaLoaiNVL,@TenNVL,@SoLuongTon,@DVT,'false')
go
--exec sp_ThemNguyenVatLieu'NVL002','LVL001','chưa biết',100,40,
create
proc sp_DanhSachNVL
as
select * from NguyenVatLieu where isdelete = 'false'
go
create
proc sp_DanhSachNVL_Ma @MaNVL nvarchar(10)
as
select * from NguyenVatLieu where MaNVL = @MaNVL and isdelete = 'false'
go
create
proc sp_CapNhatNVL @MaNVL nvarchar(10),@MaLoaiNVL nvarchar(10),
@TenNVL nvarchar(50),@SoLuongTon int, @DVT nvarchar(50)
as
update NguyenVatLieu
set MaLoaiNVL = @MaLoaiNVL,TenNVL = @TenNVL,SoLuongTon = @SoLuongTon,
DVT = @DVT
where MaNVL = @MaNVL
go
create
proc sp_XoaNVL @MaNVL nvarchar(10)
as
update NguyenVatLieu
set isdelete = 'true'
where MaNVL = @MaNVL
go
create
proc sp_DanhSachNVL_MaLoaiNVL @MaLoaiNVL nvarchar(10)
as
select * from NguyenVatLieu where MaLoaiNVL = @MaLoaiNVL and isdelete = 'false'
---------------------------------------QUAN LY NHA CUNG CAP---------------------------------------------
go
create
proc sp_ThemNCC @MaNCC nvarchar(5),@TenNCC nvarchar(50),@DiaChi nvarchar(50), @DienThoai nvarchar(50)
as
insert into NCC(MaNCC,TenNCC,DiaChi,DienThoai,isdelete)
values(@MaNCC,@TenNCC,@DiaChi,@DienThoai,'false')
go
create
proc sp_DanhSachNCC
as
select * from NCC where isdelete = 'false'
go
create
proc sp_DanhSachNCC_Ma @MaNCC nvarchar(5)
as
select * from NCC where MaNCC = @MaNCC and isdelete = 'false'
go
create
proc sp_CapNhatNCC @MaNCC nvarchar(5),@TenNCC nvarchar(50),@DiaChi nvarchar(50), @DienThoai nvarchar(50)
as
update NCC
set TenNCC = @TenNCC,DiaChi = @DiaChi,DienThoai = @DienThoai
where MaNCC = @MaNCC
go
create
proc sp_XoaNCC @MaNCC nvarchar(5)
as
update NCC
set isdelete = 'true'
where MaNCC = @MaNCC
-----------------------------QUAN LY CHI TIET NHA CUNG CAP--------------------------------
go
create
proc sp_CTNCC @MaNCC nvarchar(5),@MaNVL nvarchar(10)
as
insert into CTNCC(MaNCC,MaNVL)
values(@MaNCC,@MaNVL)
go
--danh sach nha cung cap theo nguyen vat lieu
create
proc sp_DanhSachNCC_MaNVL @MaNVL nvarchar(10)
as
select * from NCC ncc, CTNCC ct, NguyenVatLieu n
where n.MaNVL = ct.MaNVL and ct.MaNCC = ncc.MaNCC and n.MaNVL = @MaNVL and ncc.isdelete = 'false'
go
-------------------------------QUAN LY PHIEU NHAP VA CHI TIET PHIEU NHAP--------------------------
create
proc sp_ThemChiTietPhieuNhap @MaPN nvarchar(5),@MaNVL nvarchar(10), @MaNCC nvarchar(5),@DonGia decimal(18,0)
,@SoLuong int, @SoLuongTonHT int
as
insert into CTPhieuNhap(MaPN,MaNVL,MaNCC,DonGiaNhap,SoLuong,SoLuongTonHT)
values(@MaPN,@MaNVL,@MaNCC,@DonGia,@SoLuong,@SoLuongTonHT)
GO
create
proc sp_ThemPhieuNhap @MaPN nvarchar(5),@NgayLap date, @MaNV nvarchar(5)
as
insert into PhieuNhap(MaPN,NgayLap,MaNV)
values(@MaPN,@NgayLap,@MaNV)
go
------------------------------QUAN LY PHIEU XUAT VA CHI TIET PHIEU XUAT---------------------------
create
proc sp_ThemChiTietPhieuXuat @MaPX nvarchar(5),@MaNVL nvarchar(10),@SoLuong int, @SoLuongTonHT int
as
insert into CTPhieuXuat(MaPX,MaNVL,SoLuong,SoLuongTonHT)
values(@MaPX,@MaNVL,@SoLuong,@SoLuongTonHT)
GO
create
proc sp_ThemPhieuXuat @MaPX nvarchar(5),@NgayLap date, @MaNV nvarchar(5)
as
insert into PhieuXuat(MaPX,NgayLap,MaNV)
values(@MaPX,@NgayLap,@MaNV)
go
-----------------------------THONG KE -----------------------------------------------------------
--bao cao tinh hinh xuat nguyen vat lieu....tu ngay .... den ngay
create
proc TK_TinhHinhXuatNVL @MaLoaiNVL nvarchar(10),@NgayBD date,@NgayKT date
as
if(@MaLoaiNVL = 'null')
begin
select px.MaPX,n.MaNVL,n.TenNVL, l.MaLoaiNVL,l.TenLoaiNVL,px.NgayLap,ct.SoLuong,ct.SoLuongTonHT
from PhieuXuat px, CTPhieuXuat ct, NguyenVatLieu n, LoaiNVL l
where px.MaPX = ct.MaPX and ct.MaNVL = n.MaNVL and n.MaLoaiNVL = l.MaLoaiNVL
and px.NgayLap between @NgayBD and @NgayKT
end
else
begin
select px.MaPX,n.MaNVL,n.TenNVL, l.MaLoaiNVL,l.TenLoaiNVL,px.NgayLap,ct.SoLuong,ct.SoLuongTonHT
from PhieuXuat px, CTPhieuXuat ct, NguyenVatLieu n, LoaiNVL l
where px.MaPX = ct.MaPX and ct.MaNVL = n.MaNVL and n.MaLoaiNVL = l.MaLoaiNVL
and px.NgayLap between @NgayBD and @NgayKT and l.MaLoaiNVL = @MaLoaiNVL
end
--exec TK_TinhHinhXuatNVL 'LVL002','1-1-2013','4-4-2014'
--bao cao tinh hinh nhap nguyen vat lieu....tu ngay...den ngay
go
create
proc TK_TinhHinhNhapNVL @MaLoaiNVL nvarchar(10),@NgayBD date,@NgayKT date
as
if(@MaLoaiNVL = 'null')--null
begin
select pn.MaPN,n.MaNVL,n.TenNVL,l.MaLoaiNVL,l.TenLoaiNVL,ncc.MaNCC,ncc.TenNCC,pn.NgayLap,ctpn.SoLuong,ctpn.SoLuongTonHT
from PhieuNhap pn, CTPhieuNhap ctpn, NCC ncc,NguyenVatLieu n, LoaiNVL l,CTNCC ctncc
where l.MaLoaiNVL = n.MaLoaiNVL and n.MaNVL = ctpn.MaNVL and ctpn.MaPN = pn.MaPN
and ctpn.MaNCC = ncc.MaNCC and ncc.MaNCC = ctncc.MaNCC and ctncc.MaNVL = n.MaNVL
and pn.NgayLap between @NgayBD and @NgayKT
end
else
begin
select pn.MaPN,n.MaNVL,n.TenNVL,l.MaLoaiNVL,l.TenLoaiNVL,ncc.MaNCC,ncc.TenNCC,pn.NgayLap,ctpn.SoLuong,ctpn.SoLuongTonHT
from PhieuNhap pn, CTPhieuNhap ctpn, NCC ncc,NguyenVatLieu n, LoaiNVL l,CTNCC ctncc
where l.MaLoaiNVL = n.MaLoaiNVL and n.MaNVL = ctpn.MaNVL and ctpn.MaPN = pn.MaPN
and ctpn.MaNCC = ncc.MaNCC and ncc.MaNCC = ctncc.MaNCC and ctncc.MaNVL = n.MaNVL
and pn.NgayLap between @NgayBD and @NgayKT and l.MaLoaiNVL = @MaLoaiNVL
end
--exec TK_TinhHinhNhapNVL 'LVL001','1-1-2013','4-4-2014'
--thong ke danh sach nguyen vat lieu theo loai nguyen vat lieu
go
create
proc TK_DanhSachNVL_LoaiNVL @MaLoaiNVL nvarchar(10)
as
select * from NguyenVatLieu where MaLoaiNVL = @MaLoaiNVL
--exec TK_DanhSachNVL_LoaiNVL 'LVL002'
| 12hcb-nhom16-pttkhttt | trunk/Store Procedure/Du_httt.sql | TSQL | asf20 | 10,840 |
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
This is my JSP page. <br>
</body>
</html>
| 09accp2 | trunk/09accp2/WebRoot/index.jsp | Java Server Pages | epl | 834 |
/*
* Copyright (c) 2011
* Spoken Language Systems Group
* MIT Computer Science and Artificial Intelligence Laboratory
* Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package edu.mit.csail.wami.client
{
import edu.mit.csail.wami.audio.AudioFormat;
import edu.mit.csail.wami.utils.External;
import flash.media.Microphone;
import flash.utils.ByteArray;
import flash.utils.Endian;
/**
* A class documents the possible parameters and sets a few defaults.
* The defaults are set up to stream to localhost.
*/
public class WamiParams
{
private var mic:Microphone;
// Show the debug interface.
public var visible:Boolean = true;
// Append this many milliseconds of audio before
// and after calls to startRecording/stopRecording.
public var paddingMillis:uint = 250;
// Send the audio using multiple HTTP Posts.
public var stream:Boolean = false;
// The URLs used in the debugging interface.
public var testRecordUrl:String = "https://wami-recorder.appspot.com/audio";
public var testPlayUrl:String = "https://wami-recorder.appspot.com/audio";
// Callbacks for loading the client.
public var loadedCallback:String;
public var format:AudioFormat;
public function WamiParams(params:Object):void
{
mic = Microphone.getMicrophone();
External.addCallback("setSettings", setSettings);
External.addCallback("getSettings", getSettings);
if (params.stream != undefined)
{
stream = params.stream == "true";
}
if (params.visible != undefined)
{
visible = params.visible == "true";
}
if (params.console != undefined) {
External.debugToConsole = params.console == "true";
}
// Override to allow recording at 8000 and 16000 as well.
// Note that playback at these sample-rates will be sped up.
if (params.allrates != undefined) {
AudioFormat.allrates = params.allrates == "true";
}
loadedCallback = params.loadedCallback;
var rate:uint = 22050;
if (params.rate != undefined)
{
rate = uint(params.rate);
}
format = new AudioFormat(rate, 1, 16, Endian.LITTLE_ENDIAN);
}
public function getMicrophone():Microphone {
return mic;
}
// Settings (including microphone security) are passed back here.
internal function getSettings():Object
{
var json:Object = {
"container" : (stream) ? "au" : "wav",
"encoding" : "pcm",
"signed" : true,
"sampleSize" : format.bits,
"bigEndian" : format.endian == Endian.BIG_ENDIAN,
"sampleRate" : format.rate,
"numChannels" : format.channels,
"interleaved" : true,
"microphone" : {
"granted" : (mic != null && !mic.muted)
}
};
return json;
}
internal function setSettings(json:Object):void
{
if (json)
{
// For now the type also specifies streaming or not.
if (json.container == "au")
{
stream = true;
}
else if (json.container == "wav")
{
stream = false;
}
if (json.encoding)
{
throw new Error("Encodings such as mu-law could be implemented.");
}
if (json.signed)
{
throw new Error("Not implemented yet.");
}
if (json.bigEndian)
{
throw new Error("Automatically determined.");
}
if (json.numChannels)
{
format.channels = json.numChannels;
}
if (json.sampleSize)
{
format.bits = json.sampleSize;
}
if (json.interleaved)
{
throw new Error("Always true.");
}
if (json.microphone)
{
throw new Error("Only the user can change the microphone security settings.");
}
if (json.sampleRate)
{
format.rate = json.sampleRate;
}
}
}
}
} | 0930meixiaodong-wami-recorder | src/edu/mit/csail/wami/client/WamiParams.as | ActionScript | mit | 4,788 |
/*
* Copyright (c) 2011
* Spoken Language Systems Group
* MIT Computer Science and Artificial Intelligence Laboratory
* Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package edu.mit.csail.wami.client
{
import edu.mit.csail.wami.utils.External;
import edu.mit.csail.wami.utils.StateListener;
/**
* Translates audio events into Javascript callbacks.
*/
public class WamiListener implements StateListener
{
private var startCallback:String, finishedCallback:String, failedCallback:String;
function WamiListener(startCallback:String, finishedCallback:String, failedCallback:String)
{
this.startCallback = startCallback;
this.finishedCallback = finishedCallback;
this.failedCallback = failedCallback;
}
public function started():void
{
External.call(startCallback);
}
public function finished():void
{
External.call(finishedCallback);
}
public function failed(error:Error):void
{
External.call(failedCallback, error.message);
}
}
} | 0930meixiaodong-wami-recorder | src/edu/mit/csail/wami/client/WamiListener.as | ActionScript | mit | 2,051 |
/*
* Copyright (c) 2011
* Spoken Language Systems Group
* MIT Computer Science and Artificial Intelligence Laboratory
* Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package edu.mit.csail.wami.client
{
import edu.mit.csail.wami.play.IPlayer;
import edu.mit.csail.wami.play.WamiPlayer;
import edu.mit.csail.wami.record.IRecorder;
import edu.mit.csail.wami.record.WamiRecorder;
import edu.mit.csail.wami.utils.External;
import flash.display.MovieClip;
public class WamiAudio extends MovieClip
{
private var recorder:IRecorder;
private var player:IPlayer;
private var checkSettingsIntervalID:int = 0;
private var checkSettingsInterval:int = 1000;
function WamiAudio(params:WamiParams)
{
recorder = new WamiRecorder(params.getMicrophone(), params);
player = new WamiPlayer();
External.addCallback("startListening", startListening);
External.addCallback("stopListening", stopListening);
External.addCallback("startRecording", startRecording);
External.addCallback("stopRecording",stopRecording);
External.addCallback("getRecordingLevel", getRecordingLevel);
External.addCallback("startPlaying",startPlaying);
External.addCallback("stopPlaying",stopPlaying);
External.addCallback("getPlayingLevel", getPlayingLevel);
}
internal function startPlaying(url:String,
startedCallback:String = null,
finishedCallback:String = null,
failedCallback:String = null):void
{
recorder.stop(true);
player.start(url, new WamiListener(startedCallback, finishedCallback, failedCallback));
}
internal function stopPlaying():void
{
player.stop();
}
internal function getPlayingLevel():int
{
return player.level();
}
private function startListening(paddingMillis:uint = 200):void
{
recorder.listen(paddingMillis);
}
private function stopListening():void
{
recorder.unlisten();
}
internal function startRecording(url:String,
startedCallback:String = null,
finishedCallback:String = null,
failedCallback:String = null):void
{
recorder.start(url, new WamiListener(startedCallback, finishedCallback, failedCallback));
}
internal function stopRecording():void
{
recorder.stop();
}
internal function getRecordingLevel():int
{
return recorder.level();
}
}
}
| 0930meixiaodong-wami-recorder | src/edu/mit/csail/wami/client/WamiAudio.as | ActionScript | mit | 3,423 |
/*
* Copyright (c) 2011
* Spoken Language Systems Group
* MIT Computer Science and Artificial Intelligence Laboratory
* Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package edu.mit.csail.wami.play
{
import edu.mit.csail.wami.audio.AuContainer;
import edu.mit.csail.wami.audio.DecodePipe;
import edu.mit.csail.wami.audio.IAudioContainer;
import edu.mit.csail.wami.audio.WaveContainer;
import edu.mit.csail.wami.utils.BytePipe;
import edu.mit.csail.wami.utils.External;
import edu.mit.csail.wami.utils.Pipe;
import edu.mit.csail.wami.utils.StateListener;
import flash.events.Event;
import flash.events.HTTPStatusEvent;
import flash.events.IOErrorEvent;
import flash.events.ProgressEvent;
import flash.events.SampleDataEvent;
import flash.events.SecurityErrorEvent;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.utils.ByteArray;
public class WamiPlayer implements IPlayer
{
private var currentChannel:SoundChannel = null;
private var currentAudio:ByteArray;
private var listener:StateListener;
public function start(url:String, listener:StateListener):void
{
this.listener = listener;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE, completeHandler);
loader.addEventListener(Event.OPEN, openHandler);
loader.addEventListener(ProgressEvent.PROGRESS, progressHandler);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
var request:URLRequest = new URLRequest(url);
request.method = URLRequestMethod.GET;
try {
loader.load(request);
} catch (error:Error) {
listener.failed(error);
}
function completeHandler(event:Event):void {
listener.started();
loader.removeEventListener(Event.COMPLETE, completeHandler);
loader.removeEventListener(Event.OPEN, openHandler);
loader.removeEventListener(ProgressEvent.PROGRESS, progressHandler);
loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
loader.removeEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
loader.removeEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler)
play(loader.data);
}
function openHandler(event:Event):void {
External.debug("openHandler: " + event);
}
function progressHandler(event:ProgressEvent):void {
//External.debug("progressHandler loaded:" + event.bytesLoaded + " total: " + event.bytesTotal);
}
function securityErrorHandler(event:SecurityErrorEvent):void {
listener.failed(new Error("Security error while playing: " + event.errorID));
}
function httpStatusHandler(event:HTTPStatusEvent):void {
External.debug("httpStatusHandler: " + event);
}
function ioErrorHandler(event:IOErrorEvent):void {
listener.failed(new Error("IO error while playing: " + event.errorID));
}
}
public function stop():void
{
if (currentChannel != null)
{
External.debug("Stop playing.");
currentChannel.removeEventListener(Event.SOUND_COMPLETE, stop);
currentChannel.stop();
External.debug("Listener finished.");
listener.finished();
currentChannel = null;
}
}
public function level():int
{
if (currentChannel != null) {
return 100 * ((currentChannel.leftPeak + currentChannel.rightPeak) / 2.0);
}
return 0;
}
protected function play(audio:ByteArray):void
{
stop(); // Make sure we're stopped
var containers:Vector.<IAudioContainer> = new Vector.<IAudioContainer>();
containers.push(new WaveContainer());
containers.push(new AuContainer());
External.debug("Playing audio of " + audio.length + " bytes.");
var decoder:Pipe = new DecodePipe(containers);
var pipe:BytePipe = new BytePipe();
decoder.setSink(pipe);
decoder.write(audio);
decoder.close();
currentAudio = pipe.getByteArray();
External.debug("Playing audio with " + currentAudio.length/4 + " samples.");
var sound:Sound = new Sound();
sound.addEventListener(SampleDataEvent.SAMPLE_DATA, handleSampleEvent);
currentChannel = sound.play();
currentChannel.addEventListener(Event.SOUND_COMPLETE, function(event:Event):void {
sound.removeEventListener(SampleDataEvent.SAMPLE_DATA, handleSampleEvent);
stop();
});
}
private function handleSampleEvent(event:SampleDataEvent):void
{
if (currentAudio == null) return;
var MAX_SAMPLES_PER_EVENT:uint = 4000;
var count:uint = 0;
// External.debug("Audio " + currentAudio.bytesAvailable + " " + event.data.endian);
while (currentAudio.bytesAvailable && count < MAX_SAMPLES_PER_EVENT)
{
event.data.writeFloat(currentAudio.readFloat());
event.data.writeFloat(currentAudio.readFloat());
count += 1;
}
}
}
} | 0930meixiaodong-wami-recorder | src/edu/mit/csail/wami/play/WamiPlayer.as | ActionScript | mit | 6,181 |
/*
* Copyright (c) 2011
* Spoken Language Systems Group
* MIT Computer Science and Artificial Intelligence Laboratory
* Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package edu.mit.csail.wami.play
{
import edu.mit.csail.wami.utils.StateListener;
public interface IPlayer
{
function start(url:String, listener:StateListener):void;
function stop():void;
// Audio level (between 0 and 100)
function level():int;
}
} | 0930meixiaodong-wami-recorder | src/edu/mit/csail/wami/play/IPlayer.as | ActionScript | mit | 1,488 |
/*
* Copyright (c) 2011
* Spoken Language Systems Group
* MIT Computer Science and Artificial Intelligence Laboratory
* Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package edu.mit.csail.wami.utils
{
public interface StateListener
{
function started():void;
function finished():void;
function failed(error:Error):void;
}
} | 0930meixiaodong-wami-recorder | src/edu/mit/csail/wami/utils/StateListener.as | ActionScript | mit | 1,390 |
/*
* Copyright (c) 2011
* Spoken Language Systems Group
* MIT Computer Science and Artificial Intelligence Laboratory
* Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package edu.mit.csail.wami.utils
{
import flash.utils.ByteArray;
/**
* Accumulates the written bytes into an array. If a max number of bytes
* is specified this will act as a circular buffer.
*/
public class BytePipe extends Pipe
{
private var buffer:ByteArray = new ByteArray();
private var done:Boolean = false;
private var maxBytes:uint;
private var start:uint = 0;
function BytePipe(maxBytes:uint = uint.MAX_VALUE):void
{
this.maxBytes = maxBytes;
}
override public function write(bytes:ByteArray):void
{
if (maxBytes <= 0) return; // no room!
var available:uint = Math.min(maxBytes - buffer.length, bytes.bytesAvailable);
if (available > 0)
{
bytes.readBytes(buffer, buffer.length, available);
}
while (bytes.bytesAvailable)
{
// Read bytes into the circular buffer.
available = Math.min(buffer.length - start, bytes.bytesAvailable);
bytes.readBytes(buffer, start, available);
start = (start + available) % maxBytes;
}
buffer.position = 0;
}
override public function close():void
{
super.close();
done = true;
}
public function getByteArray():ByteArray
{
if (!done)
{
throw new Error("BytePipe should be done before accessing byte array.");
}
var array:ByteArray = new ByteArray();
buffer.position = start;
buffer.readBytes(array);
buffer.position = 0;
if (start > 0)
{
buffer.readBytes(array, array.length, start);
}
array.position = 0;
return array;
}
}
} | 0930meixiaodong-wami-recorder | src/edu/mit/csail/wami/utils/BytePipe.as | ActionScript | mit | 2,763 |
/*
* Copyright (c) 2011
* Spoken Language Systems Group
* MIT Computer Science and Artificial Intelligence Laboratory
* Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package edu.mit.csail.wami.utils
{
import flash.external.ExternalInterface;
import flash.utils.ByteArray;
/**
* Make external calls only if available.
*/
public class External
{
public static var debugToConsole:Boolean = false;
public static function call(functionName:String, ... arguments):void
{
if (ExternalInterface.available && functionName)
{
try
{
trace("External.call: " + functionName + "(" + arguments + ")");
ExternalInterface.call(functionName, arguments);
}
catch (e:Error)
{
trace("Error calling external function: " + e.message);
}
}
else
{
trace("No ExternalInterface - External.call: " + functionName + "(" + arguments + ")");
}
}
public static function addCallback(functionName:String, closure:Function):void
{
if (ExternalInterface.available && functionName)
{
try
{
External.debug("External.addCallback: " + functionName);
ExternalInterface.addCallback(functionName, closure);
}
catch (e:Error)
{
External.debug("Error calling external function: " + e.message);
}
}
else
{
External.debug("No ExternalInterface - External.addCallback: " + functionName);
}
}
public static function debug(msg:String):void
{
if (debugToConsole) {
ExternalInterface.call("console.log", "FLASH: " + msg);
}
else
{
trace(msg);
}
}
public static function debugBytes(bytes:ByteArray):void
{
debug(bytesToHex(bytes));
}
public static function bytesToHex(bytes:ByteArray):String
{
var position:int = bytes.position;
var count:int = 0;
var str:String = "<";
while (bytes.bytesAvailable)
{
if (count%4 == 0)
{
str += " 0x";
}
var byte:uint = bytes.readUnsignedByte();
var nib1:uint = byte/16;
var nib2:uint = byte%16;
str += getHex(nib1) + getHex(nib2);
count++;
}
str += " >";
// Reset position
bytes.position = position;
return str;
}
private static function getHex(nibble:uint):String
{
switch(nibble)
{
case 0: return '0';
case 1: return '1';
case 2: return '2';
case 3: return '3';
case 4: return '4';
case 5: return '5';
case 6: return '6';
case 7: return '7';
case 8: return '8';
case 9: return '9';
case 10: return 'a';
case 11: return 'b';
case 12: return 'c';
case 13: return 'd';
case 14: return 'e';
case 15: return 'f';
}
return "ERROR(" + nibble + ")";
}
}
} | 0930meixiaodong-wami-recorder | src/edu/mit/csail/wami/utils/External.as | ActionScript | mit | 3,768 |