public static List <SelectListModel> GetChequeNoByAccNo(int AccId, bool isAllCheque) { try { if (AccId > 0) { myshop = new MyshopDb(); var result = ( from bc in myshop.Gbl_Master_BankCheque.Where(pay => pay.IsDeleted == false && pay.BankAccId.Equals(AccId) && pay.ShopId == WebSession.ShopId) from cb in myshop.Gbl_Master_BankChequeDetails.Where(y => y.IsDeleted == false && (isAllCheque == true || y.IsUsed == false) && bc.ChequeId.Equals(y.ChequeBookId)) orderby cb.ChequeNo select new SelectListModel { Text = cb.ChequeNo.ToString(), Value = cb.ChequePageId } ).ToList(); var venList = myshop.Gbl_Master_BankCheque.Where(pay => pay.IsDeleted == false && pay.BankAccId.Equals(AccId) && pay.ShopId == WebSession.ShopId).ToList(); if (result.Count > 0) { return(result); } else { return(GlobalMethod.GetSingleSelectList()); } } else { throw new Exception(); } } catch (Exception ex) { return(GlobalMethod.GetSingleSelectList()); } finally { if (myshop != null) { myshop = null; } } }
public static List <SelectListModel> GetProUnit(int SubCatId) { try { myshop = new MyshopDb(); List <SelectListModel> list = new List <SelectListModel>(); var unitList = (from pro in myshop.Gbl_Master_Product.Where(pro => pro.ShopId.Equals(WebSession.ShopId) && pro.IsDeleted == false && pro.SubCatId == SubCatId) from unt in myshop.Gbl_Master_Unit.Where(un => un.UnitId.Equals(pro.UnitId)) orderby unt.UnitName select new SelectListModel { Text = unt.UnitName, Value = unt.UnitId } ).ToList(); if (unitList.Count > 0) { return(list); } else { return(GlobalMethod.GetSingleSelectList()); } } catch (Exception ex) { return(GlobalMethod.GetSingleSelectList()); } finally { if (myshop != null) { myshop = null; } } }