public static bool GetListCom_PEMain(Sys_Customer cSys_Customer, out IList <Com_PEMain> listCom_PEMain) { listCom_PEMain = new List <Com_PEMain>(); try { listCom_PEMain = session.QueryOver <Com_PEMain>() .Where(x => x.sysCustomer == cSys_Customer) .List <Com_PEMain>(); if (listCom_PEMain == null) { MessageBox.Show("資料庫無此客戶料號"); return(false); } } catch (System.Exception ex) { MessageBox.Show("查找失敗,請檢查連線狀態"); return(false); } return(true); }
public static bool GetCom_PEMain(string cusName, string partName, string cusRev, string opRev, out Com_PEMain cCom_PEMain) { cCom_PEMain = new Com_PEMain(); try { Sys_Customer cSys_Customer = session.QueryOver <Sys_Customer>().Where(x => x.customerName == cusName).SingleOrDefault(); cCom_PEMain = session.QueryOver <Com_PEMain>() .Where(x => x.sysCustomer == cSys_Customer) .Where(x => x.partName == partName) .Where(x => x.customerVer == cusRev) .Where(x => x.opVer == opRev).SingleOrDefault(); if (cCom_PEMain == null) { MessageBox.Show("資料庫無此料號"); return(false); } } catch (System.Exception ex) { MessageBox.Show("查找失敗,請檢查連線狀態"); return(false); } return(true); }