Пример #1
0
        public IList <VnsChungTu> LoadBy(Guid LoaiCt, int Nam)
        {
            ICriteria isearch = NHibernateSession.CreateCriteria <VnsChungTu>();

            isearch.Add(Restrictions.Eq("LoaiCt", LoaiCt));


            isearch.Add(Restrictions.Le("NgayCt", VnsConvert.CEndOfDate(new DateTime(Nam, 12, 31))));
            isearch.Add(Restrictions.Ge("NgayCt", VnsConvert.CStartOfDate(new DateTime(Nam, 1, 1))));

            IList <VnsChungTu> lst = new List <VnsChungTu>();

            isearch.SetResultTransformer(Transformers.DistinctRootEntity);
            lst = isearch.List <VnsChungTu>();
            return(lst);
        }
Пример #2
0
        private void SetValue()
        {
            StartDate = StartTemp;
            EndDate   = EndTemp;
            string strMode = "";

            if (cmbSelectMode.SelectedIndex == 0)
            {
                Value_info.Tu_Ngay        = StartDate;
                Value_info.Den_Ngay       = EndDate;
                Value_info.ParameterValue = "-1";
                Value_info.Ten            = "Từ ngày: " + StartDate.Day.ToString() + "/" + StartDate.Month.ToString() + "/" + StartDate.Year.ToString();
                Value_info.Ten           += "   " + "Đến ngày: " + EndDate.Day.ToString() + "/" + EndDate.Month.ToString() + "/" + EndDate.Year.ToString();
            }
            else if (cmbSelectMode.SelectedIndex == 1)
            {
                Value_info.Tu_Ngay        = StartDate;
                Value_info.Den_Ngay       = EndDate;
                Value_info.ParameterValue = "-1";
                Value_info.Ten            = "Tháng: " + cmbMonth.SelectedItem.ToString() + "   " + "Năm: " + cmbYearMonth.SelectedItem.ToString();
            }
            else if (cmbSelectMode.SelectedIndex == 2)
            {
                Value_info.Tu_Ngay        = StartDate;
                Value_info.Den_Ngay       = EndDate;
                Value_info.ParameterValue = "-1";
                Value_info.Ten            = "Quý: " + cmbTerm.SelectedItem.ToString() + "   " + "Năm: " + cmbYearTerm.SelectedItem.ToString();
            }
            else if (cmbSelectMode.SelectedIndex == 3)
            {
                Value_info.Tu_Ngay        = StartDate;
                Value_info.Den_Ngay       = EndDate;
                Value_info.ParameterValue = "-1";
                Value_info.Ten            = "Năm: " + cmbYear.SelectedItem.ToString();
            }
            Value_info.Tu_Ngay  = VnsConvert.CStartOfDate((DateTime)Value_info.Tu_Ngay);
            Value_info.Den_Ngay = VnsConvert.CEndOfDate((DateTime)Value_info.Den_Ngay);
        }
Пример #3
0
        public IList <RpChiTietNganSach> GetBangKeChiTiet(DateTime TuNgay, DateTime DenNgay, String MaCt, Guid DonViId)
        {
            ICriteria isearch = NHibernateSession.CreateCriteria <VnsChungTu>().CreateAlias("LstGiaoDich", "d");

            if (!string.IsNullOrEmpty(MaCt))
            {
                isearch.Add(Restrictions.Eq("MaCt", MaCt));
            }

            isearch.Add(Restrictions.Le("NgayCt", VnsConvert.CEndOfDate(DenNgay)));
            isearch.Add(Restrictions.Ge("NgayCt", VnsConvert.CStartOfDate(TuNgay)));

            if (!VnsCheck.IsNullGuid(DonViId))
            {
                isearch.Add(Restrictions.Eq("DonViId", DonViId));
            }

            isearch.AddOrder(new Order("NgayCt", true));

            IList <VnsChungTu> lst = new List <VnsChungTu>();

            isearch.SetResultTransformer(Transformers.DistinctRootEntity);
            lst = isearch.List <VnsChungTu>();
            IList <RpChiTietNganSach> lstRp = new List <RpChiTietNganSach>();

            foreach (VnsChungTu tmph in lst)
            {
                foreach (VnsGiaoDich tmpd in tmph.LstGiaoDich)
                {
                    RpChiTietNganSach rp = new RpChiTietNganSach(tmph, tmpd);
                    lstRp.Add(rp);
                }
            }

            return(lstRp);
        }