Пример #1
0
        private void labelThuocBanChay_Click(object sender, EventArgs e)
        {
            ColumnHeader0 = "STT";
            ColumnHeader1 = "Tên Thuốc";
            ColumnHeader2 = "Số Đơn vị đã bán";
            ColumnHeader3 = "";
            SetColumnHeader(ColumnHeader0, ColumnHeader1, ColumnHeader2, ColumnHeader3);
            listViewGeneral.Columns[listViewGeneral.Columns.Count - 1].Width = 0;
            labelTen.Text       = "Tên Thuốc: " + instance.NameMedicine;
            labelSoDonHang.Text = "Tổng số bán được: " + instance.TotalSold.ToString();
            labelSoTienBan.Text = "";
            if (instance.ImageMedicine != null)
            {
                pictureBoxDetail.Image = ChangeBitmapHelper.ChangeBitMap(pictureBoxDetail, instance.ImageMedicine);
            }
            else
            {
                pictureBoxDetail.Image = ChangeBitmapHelper.ChangeBitMapResource(pictureBoxDetail, Resources.icons8_pill_240px);
            }
            listViewGeneral.Visible = true;

            List <MedicineStatistic> medicines = ThongKeHelper.GetMedicineStatistic();
            int i = 0;

            listViewGeneral.Items.Clear();
            foreach (var item in medicines)
            {
                i++;
                ListViewItem listViewItem = new ListViewItem(new string[] { i.ToString(), item.Name_Medicine,
                                                                            item.TotalSold.ToString() });
                listViewGeneral.Items.Add(listViewItem);
            }
        }
Пример #2
0
        private void ButtonChonAnh_Click(object sender, EventArgs e)
        {
            int Id;

            try
            {
                Id = int.Parse(ListShow.SelectedItems[0].SubItems[1].Text);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                return;
            }
            string path = ExtensionHelper.ChoosePath();

            if (path != string.Empty)
            {
                try
                {
                    MedicineHelper.UpdateImage(Id, path);
                    ImageShow.Image = ChangeBitmapHelper.ChangeBitMap(ImageShow, path);
                }
                catch
                {
                    MessageBox.Show("Có Lỗi Xảy Ra!");
                }
            }
        }
Пример #3
0
        public GUI_Admin()
        {
            InitializeComponent();

            PictureBoxDanhMucSanPham.Image =
                ChangeBitmapHelper.ChangeBitMap(PictureBoxDanhMucSanPham, @"C:\Users\chubo\Documents\BaiTapLon_CS\BaiTapLon_CS\Resource\Icon\LookupIcon.png");

            PictureBoxDanhSachNhanVien.Image =
                ChangeBitmapHelper.ChangeBitMap(PictureBoxDanhSachNhanVien, @"C:\Users\chubo\Documents\BaiTapLon_CS\BaiTapLon_CS\Resource\Icon\EmployeeIcon.png");;

            PictureBoxThongKe.Image =
                ChangeBitmapHelper.ChangeBitMap(PictureBoxThongKe, @"C:\Users\chubo\Documents\BaiTapLon_CS\BaiTapLon_CS\Resource\Icon\TaskIcon.png");;

            PictureBoxXuatFile.Image =
                ChangeBitmapHelper.ChangeBitMap(PictureBoxXuatFile, @"C:\Users\chubo\Documents\BaiTapLon_CS\BaiTapLon_CS\Resource\Icon\ExportFileIcon.png");;;
        }
Пример #4
0
        private void pictureBoxNhanVienXuatSac_Click_1(object sender, EventArgs e)
        {
            ColumnHeader0 = "STT";
            ColumnHeader1 = "Tên";
            ColumnHeader2 = "Đơn hàng đã bán";
            ColumnHeader3 = "Số tiền đã bán";
            SetColumnHeader(ColumnHeader0, ColumnHeader1, ColumnHeader2, ColumnHeader3);
            listViewGeneral.Columns[listViewGeneral.Columns.Count - 1].Width = 123;

            if (instance.Image_Manager != null)
            {
                try
                {
                    pictureBoxDetail.Image = ChangeBitmapHelper.ChangeBitMap(pictureBoxDetail, instance.Image_Manager);
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                try
                {
                    pictureBoxDetail.Image = ChangeBitmapHelper.ChangeBitMapResource(pictureBoxDetail, Resources.icons8_manager_100px);
                }
                catch (Exception ex)
                {
                }
            }

            labelTen.Text           = "Họ Và Tên: " + instance.Name_Manager;
            labelSoDonHang.Text     = "Số Đơn Hàng Bán: " + instance.TotalInvoiceSold.ToString();
            labelSoTienBan.Text     = "Số Tiền Bán: " + ExtensionHelper.ChangeToCurrency(instance.TotalMoneySold.ToString()) + " VND";
            listViewGeneral.Visible = true;
            List <ManagerStatistic> managers = ThongKeHelper.GetManagerStatistic();
            int i = 0;

            listViewGeneral.Items.Clear();
            foreach (var item in managers)
            {
                i++;
                ListViewItem listViewItem = new ListViewItem(new string[] { i.ToString(), item.Name_Manager,
                                                                            item.TotalInvoice.ToString(),
                                                                            ExtensionHelper.ChangeToCurrency(item.TotalMoneySold.ToString()) });
                listViewGeneral.Items.Add(listViewItem);
            }
        }
Пример #5
0
        private void SelectShowList(object sender, EventArgs e)
        {
            int Id;

            try
            {
                Id = int.Parse(ListShow.SelectedItems[0].SubItems[1].Text);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                if (e is EventArgsForMedicine)
                {
                    Id = ((EventArgsForMedicine)e).Id;
                }
                else
                {
                    return;
                }
            }
            Medicine medicine1 = new Medicine();

            medicine1 = MedicineHelper.GetMedicineWithId(Id);
            try
            {
                ImageShow.Image = ChangeBitmapHelper.ChangeBitMap(ImageShow, medicine1.Image_Medicine);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                ImageShow.Image = null;
            }
            LabelNgaySanXuat.Text = "Ngày Sản Xuất:" + medicine1.Min_Date_Of_Manufacture.Value.ToShortDateString()
                                    + " - " + medicine1.Max_Date_Of_Manufacture.Value.ToShortDateString();
            LabelDongGoi.Text            = "Đóng gói:" + medicine1.Packing;
            LabelSoLuongTrongMoiGoi.Text = "Số Lượng trong mỗi gói:" + medicine1.Unit;
            LabelGiaThanh.Text           = "Giá Thành:" + ExtensionHelper.ChangeToCurrency(medicine1.Cost.ToString());
            LabelMaDangKi.Text           = "Mã Đăng Kí:" + medicine1.Registration_Number;
            LabelXuatXu.Text             = "Xuất Xứ:" + medicine1.Source;
            labelGiaNhap.Text            = "Giá Nhập:Từ " + ExtensionHelper.ChangeToCurrency(medicine1.Min_Import_Cost.ToString()) + " tới" + ExtensionHelper.ChangeToCurrency(medicine1.Max_Import_Cost.ToString());
        }
Пример #6
0
        public ShowStatistic()
        {
            InitializeComponent();
            listViewGeneral.Visible = false;
            ColumnHeader0           = "STT";
            ColumnHeader1           = "Tên";
            ColumnHeader2           = "Đơn hàng đã bán";
            ColumnHeader3           = "Số tiền đã bán";
            SetColumnHeader(ColumnHeader0, ColumnHeader1, ColumnHeader2, ColumnHeader3);
            //foreach (ColumnHeader column in listViewGeneral.Columns)
            //{
            //    column.Width = -2;
            //}
            string query = "exec GetTop1Statistic";

            using (SqlConnection connection = new SqlConnection(Form1.connect))
            {
                using (SqlDataAdapter adapter = new SqlDataAdapter(query, connection))
                {
                    DataTable dataTable = new DataTable();
                    adapter.Fill(dataTable);
                    instance = new Top1Statistic
                    {
                        CustomerName            = dataTable.Rows[0].Field <string>("Ten khach hang"),
                        CustomerPhone           = dataTable.Rows[0].Field <string>("So dien thoai"),
                        ID_Manager              = dataTable.Rows[0].Field <int>("ID_Manager"),
                        ID_Medicine             = dataTable.Rows[0].Field <int>("ID_Medicine"),
                        ImageMedicine           = dataTable.Rows[0].Field <string>("Image_Medicine"),
                        NameMedicine            = dataTable.Rows[0].Field <string>("Name_Medicine"),
                        Name_Manager            = dataTable.Rows[0].Field <string>("Name_Manager"),
                        NumberInvoiceOfCustomer = dataTable.Rows[0].Field <int>("Tong so don hang"),
                        Salary              = dataTable.Rows[0].Field <decimal>("Luong"),
                        TotalCost           = dataTable.Rows[0].Field <decimal>("Tong so tien mua"),
                        TotalInvoiceSold    = dataTable.Rows[0].Field <int>("Total invoice"),
                        TotalMedicineBought = dataTable.Rows[0].Field <int>("Tong so hang da mua"),
                        TotalMedicineSold   = dataTable.Rows[0].Field <int>("Tong so hang ban"),
                        TotalMoneySold      = dataTable.Rows[0].Field <decimal>("Tong so tien ban"),
                        TotalSold           = dataTable.Rows[0].Field <decimal>("Tong so ban duoc"),
                        Image_Manager       = dataTable.Rows[0].Field <string>("Image")
                    };
                }
            }
            if (instance.ImageMedicine != null)
            {
                try
                {
                    pictureBoxThuocBanChay.Image = ChangeBitmapHelper.ChangeBitMap(pictureBoxThuocBanChay, instance.ImageMedicine);
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                try
                {
                    pictureBoxThuocBanChay.Image = ChangeBitmapHelper.ChangeBitMapResource(pictureBoxThuocBanChay, Resources.icons8_pill_240px);
                }
                catch (Exception ex)
                {
                }
            }


            if (instance.Image_Manager != null)
            {
                try
                {
                    pictureBoxNhanVienXuatSac.Image = ChangeBitmapHelper.ChangeBitMap(pictureBoxNhanVienXuatSac, instance.Image_Manager);
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                try
                {
                    pictureBoxNhanVienXuatSac.Image = ChangeBitmapHelper.ChangeBitMapResource(pictureBoxNhanVienXuatSac, Resources.icons8_manager_100px);
                }
                catch (Exception ex)
                {
                }
            }
            pictureBoxKhachHangThanQuen.Image = ChangeBitmapHelper.ChangeBitMapResource(pictureBoxThuocBanChay, Resources.icons8_user_100px);


            labelKhachHangThanQuen.Text = instance.CustomerName;
            labelNhanVienXuatSac.Text   = instance.Name_Manager;
            labelThuocBanChay.Text      = instance.NameMedicine;
        }