public Sys_SupplierMaster_slm_Info GetRecord_Last() { Sys_SupplierMaster_slm_Info supplierMasterInfo = null; try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { IEnumerable <SupplierMaster_slm> query = db.SupplierMaster_slm.OrderByDescending(t => t.slm_iRecordID); if (query != null && query.Count() > 0) { SupplierMaster_slm supplierMaster = query.First(); if (supplierMaster != null) { supplierMasterInfo = Common.General.CopyObjectValue <SupplierMaster_slm, Sys_SupplierMaster_slm_Info>(supplierMaster); } } } } catch (Exception Ex) { throw Ex; } return(supplierMasterInfo); }
public Sys_SupplierMaster_slm_Info GetRecord_Previous(DataBaseCommandInfo commandInfo) { Sys_SupplierMaster_slm_Info supplierMasterInfo = null; if (commandInfo != null && commandInfo.KeyInfoList != null && commandInfo.KeyInfoList[0] != null && commandInfo.KeyInfoList[0].KeyValue != "") { try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { SupplierMaster_slm supplierMaster = (from t in db.SupplierMaster_slm where t.slm_iRecordID < Convert.ToInt32(commandInfo.KeyInfoList[0].KeyValue) orderby t.slm_iRecordID descending select t).FirstOrDefault(); if (supplierMaster != null) { supplierMasterInfo = Common.General.CopyObjectValue <SupplierMaster_slm, Sys_SupplierMaster_slm_Info>(supplierMaster); } } } catch (Exception Ex) { throw Ex; } } return(supplierMasterInfo); }
public Sys_SupplierMaster_slm_Info DisplayRecord(IModelObject KeyObject) { Sys_SupplierMaster_slm_Info displayInfo = null; Sys_SupplierMaster_slm_Info queryInfo = KeyObject as Sys_SupplierMaster_slm_Info; if (queryInfo != null) { try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { SupplierMaster_slm supplierMaster = db.SupplierMaster_slm.FirstOrDefault(t => t.slm_iRecordID == queryInfo.slm_iRecordID); if (supplierMaster != null) { displayInfo = Common.General.CopyObjectValue <SupplierMaster_slm, Sys_SupplierMaster_slm_Info>(supplierMaster); } } } catch (Exception Ex) { throw Ex; } } return(displayInfo); }
public bool DeleteRecord(IModelObject KeyObject) { bool isSuccess = false; if (KeyObject != null) { try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { SupplierMaster_slm supplierMaster = db.SupplierMaster_slm.FirstOrDefault(t => t.slm_iRecordID == (KeyObject as Sys_SupplierMaster_slm_Info).slm_iRecordID); if (supplierMaster != null) { db.SupplierMaster_slm.DeleteOnSubmit(supplierMaster); db.SubmitChanges(); isSuccess = true; } } } catch (Exception Ex) { throw Ex; } } return(isSuccess); }
public bool InsertRecord(Sys_SupplierMaster_slm_Info infoObject) { bool isSuccess = false; if (infoObject != null) { try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { SupplierMaster_slm supplierMaster = Common.General.CopyObjectValue <Sys_SupplierMaster_slm_Info, SupplierMaster_slm>(infoObject); db.SupplierMaster_slm.InsertOnSubmit(supplierMaster); db.SubmitChanges(); isSuccess = true; } } catch (Exception Ex) { throw Ex; } } return(isSuccess); }
public bool IsExistRecord(object KeyObject) { bool isExist = true; Sys_SupplierMaster_slm_Info supplierMasterInfo = KeyObject as Sys_SupplierMaster_slm_Info; try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { SupplierMaster_slm supplierMaster = db.SupplierMaster_slm.FirstOrDefault(t => t.slm_cClientNum == supplierMasterInfo.slm_cClientNum); if (supplierMaster != null) { isExist = true; } else { isExist = false; } } } catch (Exception Ex) { throw Ex; } return(isExist); }
public bool UpdateRecord(Sys_SupplierMaster_slm_Info infoObject) { bool isSuccess = false; if (infoObject != null) { try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { SupplierMaster_slm supplierMaster = db.SupplierMaster_slm.FirstOrDefault(t => t.slm_iRecordID == infoObject.slm_iRecordID); if (supplierMaster != null) { supplierMaster.slm_cChinaName = infoObject.slm_cChinaName; supplierMaster.slm_cEnglishName = infoObject.slm_cEnglishName; supplierMaster.slm_cTaxNumber = infoObject.slm_cTaxNumber; supplierMaster.slm_cLinkman = infoObject.slm_cLinkman; supplierMaster.slm_cAddress = infoObject.slm_cAddress; supplierMaster.slm_cPhone = infoObject.slm_cPhone; supplierMaster.slm_cFax = infoObject.slm_cFax; supplierMaster.slm_cWebSite = infoObject.slm_cWebSite; supplierMaster.slm_cRemark = infoObject.slm_cRemark; supplierMaster.slm_dLastDate = DateTime.Now; supplierMaster.slm_cLast = infoObject.slm_cLast; db.SubmitChanges(); isSuccess = true; } } } catch (Exception Ex) { throw Ex; } } return(isSuccess); }