public void Delete(DMLoaiTheKhachHangInfo dmLoaiTheKHInfor)
        {
            ExecuteCommand(Declare.StoreProcedureNamespace.spLoaiThe_KhachHangDelete,
                           dmLoaiTheKHInfor.IdLoaiThe);

            //CreateCommonCommand(Declare.StoreProcedureNamespace.spLoaiThe_KhachHangDelete);
            //Parameters.AddWithValue("@IdLoaiThe", dmLoaiTheKHInfor.IdLoaiThe);
            //ExecuteNoneQuery();
        }
        internal void Update(DMLoaiTheKhachHangInfo dmLoaiTheInfor)
        {
            ExecuteCommand(Declare.StoreProcedureNamespace.spLoaiThe_KhachHangUpdate,
                           ParseToParams <DMLoaiTheKhachHangInfo>(dmLoaiTheInfor));

            //CreateCommonCommand(Declare.StoreProcedureNamespace.spLoaiThe_KhachHangUpdate);
            //SetParams(dmLoaiTheInfor);
            //ExecuteNoneQuery();
        }
Example #3
0
 private bool Search(DMLoaiTheKhachHangInfo dmLoaitheInfo)
 {
     return((txtMaTheLoc.Text.Trim() == String.Empty || (txtMaTheLoc.Text.Trim() != String.Empty &&
                                                         dmLoaitheInfo.MaThe.ToLower().Contains(txtMaTheLoc.Text.Trim().ToLower()))) &&
            (txtTenTheLoc.Text.Trim() == String.Empty || (txtTenTheLoc.Text.Trim() != String.Empty &&
                                                          dmLoaitheInfo.TenThe.ToLower().Contains(txtTenTheLoc.Text.Trim().ToLower()))) &&
            (txtGhiChuLoc.Text.Trim() == String.Empty || (txtGhiChuLoc.Text.Trim() != String.Empty &&
                                                          dmLoaitheInfo.GhiChu.ToLower().Contains(txtGhiChuLoc.Text.Trim().ToLower()))));
 }
        internal List <DMLoaiTheKhachHangInfo> Search(DMLoaiTheKhachHangInfo dmLoaitheKHInfor)
        {
            return(GetListCommand <DMLoaiTheKhachHangInfo>(Declare.StoreProcedureNamespace.spLoaiThe_KhachHangSearch,
                                                           dmLoaitheKHInfor.TenThe,
                                                           dmLoaitheKHInfor.MaThe));

            //CreateGetListCommand(Declare.StoreProcedureNamespace.spLoaiThe_KhachHangSearch);
            //Parameters.AddWithValue("@TenTenThe", dmLoaitheKHInfor.TenThe);
            //Parameters.AddWithValue("@MaThe", dmLoaitheKHInfor.MaThe);
            //return FillToList<DMLoaiTheKhachHangInfo>();
        }
        internal int Insert(DMLoaiTheKhachHangInfo dmLoaiTheInfor)
        {
            return(GetObjectCommand <int>(Declare.StoreProcedureNamespace.spLoaiThe_KhachHangInsert,
                                          ParseToParams <DMLoaiTheKhachHangInfo>(dmLoaiTheInfor)));

            //CreateCommonCommand(Declare.StoreProcedureNamespace.spLoaiThe_KhachHangInsert);
            //SetParams(dmLoaiTheInfor);
            //Parameters["@IdLoaiThe"].Direction = ParameterDirection.Output;
            //ExecuteNoneQuery();

            //return Convert.ToInt32(Parameters["@IdLoaiThe"].Value.ToString());
        }
        internal bool Exist(DMLoaiTheKhachHangInfo dmLoaitheKHInfor)
        {
            return(GetObjectCommand <int>(Declare.StoreProcedureNamespace.spLoaiThe_KhachHangExist,
                                          dmLoaitheKHInfor.IdLoaiThe,
                                          dmLoaitheKHInfor.MaThe) > 0);

            //CreateCommonCommand(Declare.StoreProcedureNamespace.spLoaiThe_KhachHangExist);
            //Parameters.AddWithValue("@Count", 0).Direction = ParameterDirection.Output;
            //Parameters.AddWithValue("@IdLoaiThe", dmLoaitheKHInfor.IdLoaiThe);
            //Parameters.AddWithValue("@MaThe", dmLoaitheKHInfor.MaThe);
            //ExecuteNoneQuery();

            //return Convert.ToInt32(Parameters["@Count"].Value) == 1;
        }
        private DMLoaiTheKhachHangInfo SetLoaiThe()
        {
            DMLoaiTheKhachHangInfo dm = new DMLoaiTheKhachHangInfo();

            dm.GhiChu            = txtTinhNangKhac.Text.Trim();
            dm.MaThe             = txtMaThe.Text.Trim();
            dm.TenThe            = txtTenThe.Text.Trim();
            dm.ThoiGianHieuLuc   = Convert.ToInt32(txtHieuLuc.Text.Trim());
            dm.IsBHVang          = Convert.ToInt32(chkBaoHanhVang.Checked);
            dm.IsJointCourse     = Convert.ToInt32(chkThamGiaDaoTao.Checked);
            dm.IsSupport         = Convert.ToInt32(chkDuocTuVanHoTro.Checked);
            dm.IsTangQuaSN       = Convert.ToInt32(chkTangQuaSinhNhat.Checked);
            dm.IsUpdateSPNew     = Convert.ToInt32(chkCapNhatThongTinSanPhamMoi.Checked);
            dm.SuDung            = Convert.ToInt32(chkSuDung.Checked);
            dm.DK_GT_LanDau      = Convert.ToInt32(txtGiaTriMuaLanDau.Text.Trim());
            dm.DK_GT_TichLuy_Tu  = Convert.ToInt32(txtTichLuyTu.Text.Trim());
            dm.DK_GT_TichLuy_Den = Convert.ToInt32(txtTichLuyDen.Text.Trim());
            string sp = "";

            for (int i = 0; i < chkLstSanPham.Items.Count; i++)
            {
                if (chkLstSanPham.GetItemChecked(i))
                {
                    if (sp == "" || i == chkLstSanPham.Items.Count)
                    {
                        sp += ((DMSanPhamInfo)chkLstSanPham.Items[i]).TenSanPham;
                    }
                    else
                    {
                        sp += ((DMSanPhamInfo)chkLstSanPham.Items[i]).TenSanPham + ",";
                    }
                }
            }
            dm.DK_SP_KemTheo   = sp;
            dm.BaoLuuDiem      = Convert.ToInt32(txtBaoLuuDiem.Text.Trim());
            dm.DoUuTien        = Convert.ToInt32(cboDoUuTien.SelectedValue);
            dm.ThoiGianHieuLuc = Convert.ToInt32(txtHieuLuc.Text.Trim());
            return(dm);
        }
        public void TestThe07_DeleteSuccess()
        {
            TestThe05_InsertSuccess();
            List <DMLoaiTheKhachHangInfo> list  = DmLoaitheKhachHangProvider.GetListDmLoaiTheInfor();
            DMLoaiTheKhachHangInfo        infor = list.Find(delegate(DMLoaiTheKhachHangInfo match)
            {
                return(match.MaThe == "1111");
            });

            frmDM_The frm = new frmDM_The();

            frm.isAdd = false;
            frm.Oid   = infor.IdLoaiThe;
            frmChiTiet_The frmChiTietThe = new frmChiTiet_The(frm);

            frmChiTietThe.TestDelete();
            list  = DmLoaitheKhachHangProvider.GetListDmLoaiTheInfor();
            infor = list.Find(delegate(DMLoaiTheKhachHangInfo match)
            {
                return(match.MaThe == "1111");
            });
            Assert.AreEqual(infor, null);
        }
        public void TestThe03_MaTheHasExistedOnUpdate()
        {
            try
            {
                TestThe05_InsertSuccess();
                List <DMLoaiTheKhachHangInfo> list  = DmLoaitheKhachHangProvider.GetListDmLoaiTheInfor();
                DMLoaiTheKhachHangInfo        infor = list.Find(delegate(DMLoaiTheKhachHangInfo match)
                {
                    return(match.MaThe == "1111");
                });

                frmDM_The frm = new frmDM_The();
                frm.isAdd = false;
                frmChiTiet_The frmChiTietThe = new frmChiTiet_The(frm);
                frmChiTietThe.SetInput("Thẻ số 1 ", "12345", 100, 150, 555000, 55, 2, 3);
                frmChiTietThe.TestSave();
                list = DmLoaitheKhachHangProvider.GetListDmLoaiTheInfor();
                List <DMLoaiTheKhachHangInfo> listDuplicate = list.FindAll(delegate(DMLoaiTheKhachHangInfo match)
                {
                    return(match.MaThe == "12345");
                });
                frmChiTietThe.TestDelete();
                Assert.AreEqual(1, listDuplicate.Count);
            }
            catch (Exception ex)
            {
                if (ex.GetType() != typeof(AssertFailedException))
                {
                    Assert.AreEqual(ex.Message, "Mã thẻ đã tồn tại trong hệ thống !");
                }
                else
                {
                    throw;
                }
            }
        }
Example #10
0
        private void LoadData()
        {
            if (frmThe.isAdd)
            {
                txtBaoLuuDiem.Text      = "";
                txtTinhNangKhac.Text    = "";
                txtTichLuyTu.Text       = "";
                txtTichLuyDen.Text      = "";
                txtTenThe.Text          = "";
                txtMaThe.Text           = "";
                txtHieuLuc.Text         = "";
                txtGiaTriMuaLanDau.Text = "";
                txtMaThe.Focus();
                btnXoa.Enabled = false;
            }
            else
            {
                dm      = DmLoaitheKhachHangProvider.GetListDmLoaiTheInfoFromIdLoaiThe(frmThe.Oid);
                dmtheQL = DmLoaitheQuyenLoiProvider.GetListLoaiTheQuyenLoiInfoFromOid(frmThe.Oid);
                dmTheUD = DmLoaitheUuDaiProvider.GetListDmLoaiTheUuDaiInfoFromOid(frmThe.Oid);

                txtMaThe.Text            = dm.MaThe;
                txtTenThe.Text           = dm.TenThe;
                txtTinhNangKhac.Text     = dm.GhiChu;
                txtTichLuyTu.Text        = dm.DK_GT_TichLuy_Tu.ToString();
                txtTichLuyDen.Text       = dm.DK_GT_TichLuy_Den.ToString();
                txtHieuLuc.Text          = dm.ThoiGianHieuLuc.ToString();
                txtGiaTriMuaLanDau.Text  = dm.DK_GT_LanDau.ToString();
                txtBaoLuuDiem.Text       = dm.BaoLuuDiem.ToString();
                cboDoUuTien.SelectedItem = dm.DoUuTien;
                if (dm.DK_SP_KemTheo != null)
                {
                    string[] sp = dm.DK_SP_KemTheo.Split(',');
                    for (int i = 0; i < sp.Length; i++)
                    {
                        for (int j = 0; j < liSP.Count; j++)
                        {
                            if (sp[i].ToString().ToUpper() == liSP[j].TenSanPham.ToUpper())
                            {
                                chkLstSanPham.SetItemChecked(j, true);
                            }
                        }
                    }
                }
                chkBaoHanhVang.Checked               = dm.IsBHVang == 1;
                chkThamGiaDaoTao.Checked             = dm.IsJointCourse == 1;
                chkSuDung.Checked                    = dm.SuDung == 1;
                chkDuocTuVanHoTro.Checked            = dm.IsSupport == 1;
                chkTangQuaSinhNhat.Checked           = dm.IsTangQuaSN == 1;
                chkThamGiaDaoTao.Checked             = dm.IsJointCourse == 1;
                chkBaoHanhVang.Checked               = dm.IsBHVang == 1;
                chkCapNhatThongTinSanPhamMoi.Checked = dm.IsUpdateSPNew == 1;
                dgvQuyenLoi.DataSource               = new BindingList <DmLoaiTheQuyenLoiInfo>(dmtheQL)
                {
                    AllowNew = true, AllowEdit = true, AllowRemove = true
                };
                dgvUuDai.DataSource = new BindingList <DmLoaiTheUuDaiInfo>(dmTheUD)
                {
                    AllowNew = true, AllowEdit = true, AllowRemove = true
                };
            }
            if (frmThe.IsSync)
            {
                //không cho phép người dùng sửa, xóa các thông tin trên form.
                txtMaThe.Enabled  = false;
                txtTenThe.Enabled = false;
                btnXoa.Enabled    = false;
            }
        }
Example #11
0
 public static List <DMLoaiTheKhachHangInfo> Search(DMLoaiTheKhachHangInfo match)
 {
     return(DMLoaiTheKhachHangDAO.Instance.Search(match));
 }
Example #12
0
 public static void Delete(DMLoaiTheKhachHangInfo dmLoaiTheKHInfo)
 {
     DMLoaiTheKhachHangDAO.Instance.Delete(dmLoaiTheKHInfo);
 }
Example #13
0
 public static int Insert(DMLoaiTheKhachHangInfo dmLoaiTheKHInfo)
 {
     return(DMLoaiTheKhachHangDAO.Instance.Insert(dmLoaiTheKHInfo));
 }
Example #14
0
 public static bool KiemTra(DMLoaiTheKhachHangInfo match)
 {
     return(DMLoaiTheKhachHangDAO.Instance.Exist(match));
 }