コード例 #1
0
ファイル: FrmInPhieu.cs プロジェクト: hynguyen2610/OlympicGym
 public FrmInPhieu(KhachLe kl)
     : base()
 {
     InitializeComponent();
     rp = new BaoCao();
     printControl1.PrintingSystem = rp.PrintingSystem;
     rp.Parameters["LoaiVe"].Value = kl.LoaiVe;
     rp.Parameters["ToDay"].Value =DateTimeUtil.dateToString( DateTime.Now);
     rp.Parameters["TenHoiVien"].Value = "Khách lẻ";
     rp.Parameters["MaGYM"].Value = "Không có";
        // rp.CreateDocument();
     inPhieu();
 }
コード例 #2
0
 public static CODE_RESULT_RETURN Add(KhachLe k)
 {
     using (var db = DBContext.GetContext())
     {
         try
         {
             k.NhanVien = db.NhanVien.Find(k.NhanVien.MaNhanVien);
             if (k.GiamGia != null && k.GiamGia.MaGiamGia != "")
             {
                 k.GiamGia = db.GiamGia.Find(k.GiamGia.MaGiamGia);
             }
             db.KhachLe.Add(k);
             db.SaveChanges();
             return CODE_RESULT_RETURN.ThanhCong;
         }
         catch
         {
             return CODE_RESULT_RETURN.ThatBai;
         }
     }
 }
コード例 #3
0
ファイル: FrmKhachLe.cs プロジェクト: hynguyen2610/OlympicGym
        private void btnNhap_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            statusStrip1.Text = "";
            isValid = false;
            errorProvider1.Clear();
            int tien;
            var st = cbbSoTien.Text;
            if (cbbSoTien.Text == "")
            {
                errorProvider1.SetError(cbbSoTien, "Chưa nhập số tiền");
                cbbSoTien.Focus();
                return;
            }
            if (!int.TryParse(st, out tien) || tien <= 0 || tien % 500 != 0)
            {
                errorProvider1.SetError(cbbSoTien, "Tiền nhập vào không hợp lệ");
                cbbSoTien.Focus();
                return;
            }
            var gg = (GiamGia)cbbGiamGiaGYM.SelectedItem;
            tien = tien - tien * gg.PhanTramGiam / 100;
            khachLe = new KhachLe()
             {
                 ThoiGian = DateTime.Now,
                 SoTien = tien,
                 NhanVien = Login1.TaiKhoanHienTai,
                 IsGYM = rdChiGYM.Checked,

             };

            if (cbbGiamGiaGYM.SelectedIndex > 0)
            {
                khachLe.GiamGia = (GiamGia)cbbGiamGiaGYM.SelectedItem;
            }
            if (KhachLeController.Add(khachLe) == CODE_RESULT_RETURN.ThanhCong)
            {
                if (rdChiGYM.Checked)
                {
                    rdHisGym.Checked = true;
                }
                else if (rdChiSauna.Checked)
                {
                    rdHisSauna.Checked = true;
                }
                statusStrip1.Text = "Hoàn tất";
                cbbSoTien.Text = "";
                loadData();
                isValid = true;
            }
            else
            {
                MessageBox.Show("Có lỗi");
            }
        }