コード例 #1
0
ファイル: fThemHangHoa.cs プロジェクト: DocongkhaiHCMUS/QLBH
        private void xlThem()
        {
            try
            {
                File.Copy(sourceImg, pathPictureFolder + nameImage);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            CHangHoa hh = new CHangHoa
                          (
                txtMa.Text,
                txtTen.Text,
                int.Parse(cbLoaiHH.EditValue.ToString()),
                lePhanLoai.EditValue.ToString(),
                leKhoMacDinh.EditValue.ToString(),
                leDonVi.EditValue.ToString(),
                nameImage,
                calcGiaSi.Text == ""? 0 :float.Parse(calcGiaSi.Text),
                calcGiaMua.Text == "" ? 0 : float.Parse(calcGiaMua.Text),
                calcGiaLe.Text == "" ? 0 : float.Parse(calcGiaLe.Text),
                leNCC.Text == ""?"":leNCC.EditValue.ToString(),
                leNCC.EditValue.ToString() == "" ? "" : leNCC.Text,
                calcTonKhoToiThieu.Text == "" ? 0 : int.Parse(calcTonKhoToiThieu.Text),
                checkConQL.Checked
                          );

            BUS_HangHoa.ThemHH(hh);
            sendHH?.Invoke();

            Action.Module     = "Hàng Hóa";
            Action.ActionName = "Thêm";
            Action.Reference  = txtMa.Text;
            Action.LuuThongTin();

            this.Close();
        }