Beispiel #1
0
 private void Loaddata()
 {
     if (frmDMLoaiDT.isAdd)
     {
         Reset();
         btnDelete.Enabled = false;
     }
     else
     {
         txtMaLoaiDT.Enabled = false;
         dm = DmLoaiDoiTuongDataProvider.GetListDmLoaiDTInfoFromOid(frmDMLoaiDT.Oid);
         txtTenLoaiDT.Text = dm.TenLoaiDT;
         txtMaLoaiDT.Text  = dm.MaLoaiDT;
         txtGhiChu.Text    = dm.GhiChu;
         txtNhomCha.Text   = Convert.ToString(dm.NhomCha);
         chkSuDung.Checked = dm.SuDung == 1;
     }
     if (frmDMLoaiDT.IsSync)
     {
         //không cho phép người dùng sửa, xóa các thông tin trên form.
         txtMaLoaiDT.Enabled  = false;
         txtTenLoaiDT.Enabled = false;
         btnDelete.Enabled    = false;
     }
 }
Beispiel #2
0
        internal void Delete(DmLoaiDoiTuongInfor DMLoaiDoiTuongInfor)
        {
            ExecuteCommand(Declare.StoreProcedureNamespace.spLoaiDoiTuongDelete,
                           DMLoaiDoiTuongInfor.IdLoaiDT);

            //CreateCommonCommand(Declare.StoreProcedureNamespace.spLoaiDoiTuongDelete);
            //Parameters.AddWithValue("@IdLoaiDT", DMLoaiDoiTuongInfor.IdLoaiDT);
            //ExecuteNoneQuery();
        }
Beispiel #3
0
        internal void Update(DmLoaiDoiTuongInfor DMLoaiDoiTuongInfor)
        {
            ExecuteCommand(Declare.StoreProcedureNamespace.spLoaiDoiTuongUpdate,
                           ParseToParams <DmLoaiDoiTuongInfor>(DMLoaiDoiTuongInfor));

            //CreateCommonCommand(Declare.StoreProcedureNamespace.spLoaiDoiTuongUpdate);
            //SetParams(DMLoaiDoiTuongInfor);
            //ExecuteNoneQuery();
        }
Beispiel #4
0
        internal List <DmLoaiDoiTuongInfor> Search(DmLoaiDoiTuongInfor DMLoaiDoiTuongInfor)
        {
            return(GetListCommand <DmLoaiDoiTuongInfor>(Declare.StoreProcedureNamespace.spLoaiDoiTuongSearch,
                                                        DMLoaiDoiTuongInfor.TenLoaiDT));

            //CreateGetListCommand(Declare.StoreProcedureNamespace.spLoaiDoiTuongSearch);
            ////Parameters.AddWithValue("@MaLoaiDT", DMLoaiDoiTuongInfor.MaLoaiDT);
            //Parameters.AddWithValue("@TenLoaiDT", DMLoaiDoiTuongInfor.TenLoaiDT);
            //return FillToList<DmLoaiDoiTuongInfor>();
        }
Beispiel #5
0
        internal int Insert(DmLoaiDoiTuongInfor DMLoaiDoiTuongInfor)
        {
            return(GetObjectCommand <int>(Declare.StoreProcedureNamespace.spLoaiDoiTuongInsert,
                                          ParseToParams <DmLoaiDoiTuongInfor>(DMLoaiDoiTuongInfor)));

            //CreateCommonCommand(Declare.StoreProcedureNamespace.spLoaiDoiTuongInsert);
            //SetParams(DMLoaiDoiTuongInfor);
            //Parameters["@IdLoaiDT"].Direction = ParameterDirection.Output;
            //ExecuteNoneQuery();

            //return Convert.ToInt32(Parameters["@IdLoaiDT"].Value.ToString());
        }
Beispiel #6
0
        private DmLoaiDoiTuongInfor SetDanhMuc()
        {
            DmLoaiDoiTuongInfor dm = new DmLoaiDoiTuongInfor();

            dm.TenLoaiDT = txtTenLoaiDT.Text.Trim();
            dm.MaLoaiDT  = txtMaLoaiDT.Text.Trim();
            dm.GhiChu    = txtGhiChu.Text.Trim();
            dm.NhomCha   = Convert.ToInt32(txtNhomCha.Text.Trim());
            dm.SuDung    = Convert.ToInt32(chkSuDung.Checked);
            dm.IdLoaiDT  = frmDMLoaiDT.Oid;
            return(dm);
        }
Beispiel #7
0
        internal bool Exist(DmLoaiDoiTuongInfor DMLoaiDoiTuongInfor)
        {
            return(GetObjectCommand <int>(Declare.StoreProcedureNamespace.spLoaiDoiTuongExist,
                                          DMLoaiDoiTuongInfor.IdLoaiDT,
                                          DMLoaiDoiTuongInfor.MaLoaiDT) > 0);

            //CreateCommonCommand(Declare.StoreProcedureNamespace.spLoaiDoiTuongExist);
            //Parameters.AddWithValue("@Count", 0).Direction = ParameterDirection.Output;
            //Parameters.AddWithValue("@IdLoaiDT", DMLoaiDoiTuongInfor.IdLoaiDT);
            //Parameters.AddWithValue("@MaLoaiDT", DMLoaiDoiTuongInfor.MaLoaiDT);
            //ExecuteNoneQuery();

            //return Convert.ToInt32(Parameters["@Count"].Value.ToString()) == 1;
        }
Beispiel #8
0
        private void LoadLoaiDT()
        {
            liLoaiDT = DmLoaiDoiTuongDataProvider.GetListLoaiDoiTuongInfor();

            if (liLoaiDT.Count > 0)
            {
                cboCurrentLoaiDT.DataSource    = liLoaiDT;
                cboCurrentLoaiDT.DisplayMember = "TenLoaiDT";
                cboCurrentLoaiDT.ValueMember   = "IdLoaiDT";
                cboCurrentLoaiDT.SelectedValue = Declare.IdLoaiKhachHang;
                if (cboCurrentLoaiDT.SelectedIndex >= 0)
                {
                    LoaiDTSelected = liLoaiDT[cboCurrentLoaiDT.SelectedIndex];
                }
            }
            else
            {
                cboCurrentLoaiDT.DataSource = null;
            }
        }
Beispiel #9
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (ValidData())
            {
                if (bteTrungTam.Tag != null)
                {
                    TTamSelected = (DMTrungTamInfor)bteTrungTam.Tag;
                }
                if (bteKhoXuat.Tag != null)
                {
                    KhoSelected = (DMKhoInfo)bteKhoXuat.Tag;
                }
                if (cboCurrentLoaiDT.SelectedIndex != -1)
                {
                    LoaiDTSelected = liLoaiDT[cboCurrentLoaiDT.SelectedIndex];
                }
                if (bteKhachHang.Tag != null)
                {
                    KHangSelected = (DMDoiTuongInfo)bteKhachHang.Tag;
                }
                if (bteTruongCa.Tag != null)
                {
                    TruongCaSelected = (DMNhanVienInfo)bteTruongCa.Tag;
                }
                if (bteThuNgan.Tag != null)
                {
                    ThuNganSelected = (DMNhanVienInfo)bteThuNgan.Tag;
                }
                if (bteThoiHanThanhToan.Tag != null)
                {
                    ThoiHanTTSelected = (DMLoaiThuChiInfor)bteThoiHanThanhToan.Tag;
                }

                if (TypeReset == 1 || TypeReset == 2)
                {
                    if (TTamSelected != null)
                    {
                        Declare.IdTrungTam  = TTamSelected.IdTrungTam;
                        Declare.TenTrungTam = TTamSelected.TenTrungTam;
                    }
                    if (KhoSelected != null)
                    {
                        Declare.IdKho  = KhoSelected.IdKho;
                        Declare.TenKho = KhoSelected.TenKho;
                    }
                    if (LoaiDTSelected != null)
                    {
                        Declare.IdLoaiKhachHang = LoaiDTSelected.IdLoaiDT;
                    }
                    if (KHangSelected != null)
                    {
                        Declare.IdKHMacDinh  = KHangSelected.IdDoiTuong;
                        Declare.TenKhachHang = KHangSelected.TenDoiTuong;
                    }
                    Declare.IdThuNgan          = ThuNganSelected != null ? ThuNganSelected.IdNhanVien : 0;
                    Declare.IdTruongCa         = TruongCaSelected != null ? TruongCaSelected.IdNhanVien : 0;
                    Declare.IdThoiHanThanhToan = ThoiHanTTSelected != null ? ThoiHanTTSelected.IdThuChi : 0;
                    Declare.NgayLamViec        = dtNgayLamViec.Value;

                    DateTime now = CommonProvider.Instance.GetSysDate();
                    if (KhoSelected.NgayDuDau.CompareTo(now) > 0)
                    {
                        Declare.NgayDuDau = KhoSelected.NgayDuDau;
                    }
                    else
                    {
                        Declare.NgayDuDau = now;
                    }
                }
                if (TypeReset == 2)
                {
                    string formMacDinh = "";
                    if (choseForm && lueFormMacDinh.EditValue != null)
                    {
                        formMacDinh = lueFormMacDinh.EditValue.ToString();
                    }

                    NguoiDungDataProvider.SetKhoMacDinh(Declare.IdTrungTam, Declare.IdKho, Declare.IdLoaiKhachHang,
                                                        Declare.IdKHMacDinh, Declare.IdTruongCa,
                                                        Declare.IdThuNgan, Declare.IdThoiHanThanhToan,
                                                        nguoiDung.IdNguoiDung, formMacDinh);
                }
                if (this.frmParent != null)
                {
                    foreach (Form frm in frmParent.MdiChildren)
                    {
                        frm.Close();
                    }
                }
                this.DialogResult = DialogResult.OK;
            }
        }
Beispiel #10
0
 public static List<DmLoaiDoiTuongInfor> Search(DmLoaiDoiTuongInfor match)
 {
     return DmLoaiDoiTuongDAO.Instance.Search(match);
 }
Beispiel #11
0
 public static bool KiemTra(DmLoaiDoiTuongInfor DMLoaiDoiTuongInfor)
 {
     return DmLoaiDoiTuongDAO.Instance.Exist(DMLoaiDoiTuongInfor);
 }
Beispiel #12
0
 internal static void Update(DmLoaiDoiTuongInfor DMLoaiDoiTuongInfor)
 {
     DmLoaiDoiTuongDAO.Instance.Update(DMLoaiDoiTuongInfor);
 }
Beispiel #13
0
 public static void Delete(DmLoaiDoiTuongInfor DMLoaiDoiTuongInfor)
 {
     DmLoaiDoiTuongDAO.Instance.Delete(DMLoaiDoiTuongInfor);
 }
Beispiel #14
0
 internal static void Insert(DmLoaiDoiTuongInfor DMLoaiDoiTuongInfor)
 {
     DmLoaiDoiTuongDAO.Instance.Insert(DMLoaiDoiTuongInfor);
 }