Exemple #1
0
        public List <EXPBankVoucherDtl> GetVouchertemList(long BVID)
        {
            using (var context = new BLC_DEVEntities())
            {
                var Data = (from vd in context.EXP_BankVoucherDtl
                            where vd.BVID == BVID

                            join c in context.Sys_Currency on(vd.Currency == null ? null : vd.Currency) equals c.CurrencyID into Currencies
                            from c in Currencies.DefaultIfEmpty()

                            join ec in context.Sys_Currency on(vd.ExchangeCurrency == null ? null : vd.ExchangeCurrency) equals ec.CurrencyID into ExchangeCurrencies
                            from ec in ExchangeCurrencies.DefaultIfEmpty()

                            join th in context.Sys_TransHead on(vd.TransHead == null ? null : vd.TransHead) equals th.HeadID into TransHeads
                            from th in TransHeads.DefaultIfEmpty()

                            join ci in context.EXP_CI on(vd.CIID == null ? null : vd.CIID) equals ci.CIID into CIs
                            from ci in CIs.DefaultIfEmpty()


                            select new EXPBankVoucherDtl
                {
                    BVDTLID = vd.BVDTLID,
                    TransSL = vd.TransSL,
                    Narration = vd.Narration,
                    HeadID = vd.TransHead,
                    HeadName = (th == null ? null : th.HeadName),
                    BVDRAmt = vd.BVDRAmt,
                    BVCRAmt = vd.BVCRAmt,
                    CurrencyName = (c == null ? null : c.CurrencyName),
                    ExchangeCurrencyName = (ec == null ? null : ec.CurrencyName),
                    ExchangeRate = vd.ExchangeRate,
                    ExchangeAmount = vd.ExchangeAmount,
                    CIID = vd.CIID,
                    CIRefNo = ci == null ? "" : ci.CIRefNo
                }).ToList();

                return(Data);
            }
        }