public VegetableSpeciesMaster_vsm_Info GetRecord_Previous(Model.Base.DataBaseCommandInfo commandInfo) { VegetableSpeciesMaster_vsm_Info vegetableSpeciesMasterInfo = null; if (commandInfo != null && commandInfo.KeyInfoList != null && commandInfo.KeyInfoList[0] != null && commandInfo.KeyInfoList[0].KeyValue != "") { try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { VegetableSpeciesMaster_vsm vegetableSpecies = (from t in db.VegetableSpeciesMaster_vsm where t.vsm_iSeq < Convert.ToInt32(commandInfo.KeyInfoList[0].KeyValue) orderby t.vsm_iSeq descending select t).FirstOrDefault(); if (vegetableSpecies != null) { vegetableSpeciesMasterInfo = Common.General.CopyObjectValue <VegetableSpeciesMaster_vsm, VegetableSpeciesMaster_vsm_Info>(vegetableSpecies); } } } catch (Exception Ex) { throw Ex; } } return(vegetableSpeciesMasterInfo); }
public Model.SysMaster.DepartmentMaster_dpm_Info DisplayRecord(Model.IModel.IModelObject KeyObject) { Model.SysMaster.DepartmentMaster_dpm_Info dpm = new Model.SysMaster.DepartmentMaster_dpm_Info(); Model.SysMaster.DepartmentMaster_dpm_Info info = new Model.SysMaster.DepartmentMaster_dpm_Info(); dpm = KeyObject as Model.SysMaster.DepartmentMaster_dpm_Info; try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { IQueryable <DepartmentMaster_dpm> taQuery = (from dpms in db.DepartmentMaster_dpms where dpms.dpm_iRecordID == dpm.dpm_iRecordID //orderby dpms.dpm_iRecordID ascending select dpms).Take(1); if (taQuery != null) { foreach (var t in taQuery) //foreach (DepartmentMaster_dpm t in taQuery) { info = Common.General.CopyObjectValue <DepartmentMaster_dpm, model.DepartmentMaster_dpm_Info>(t); } } return(info); } } catch (Exception Ex) { throw Ex; } }
public Model.SysMaster.DepartmentMaster_dpm_Info GetRecord_Previous(Model.Base.DataBaseCommandInfo commandInfo) { Model.SysMaster.DepartmentMaster_dpm_Info info = null; try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { string iRecordId = string.Empty; foreach (var id in commandInfo.KeyInfoList) { iRecordId = id.KeyValue; break; } IQueryable <DepartmentMaster_dpm> taQuery = (from dpms in db.DepartmentMaster_dpms where dpms.dpm_iRecordID < Convert.ToInt32(iRecordId) orderby dpms.dpm_iRecordID descending select dpms).Take(1); if (taQuery.Count() > 0) { foreach (var t in taQuery) { info = Common.General.CopyObjectValue <DepartmentMaster_dpm, model.DepartmentMaster_dpm_Info>(t); } } return(info); } } catch (Exception Ex) { return(info); } }
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 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 Model.Management.Master.SchoolMaster_scm_Info GetRecord_Last() { IQueryable <SchoolMaster_scm> taQuery = null; Model.Management.Master.SchoolMaster_scm_Info tab = null; try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { taQuery = (from ta in db.SchoolMaster_scm orderby ta.scm_iRecordID descending select ta).Take(1); foreach (SchoolMaster_scm t in taQuery) { tab = Common.General.CopyObjectValue <SchoolMaster_scm, Model.Management.Master.SchoolMaster_scm_Info>(t); break; } } } catch (Exception Ex) { throw Ex; } return(tab); }
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 Sys_UserPurview_usp_Info GetRecord_Last() { try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { IQueryable <Sys_UserPurview_usp> taQuery = (from ta in db.Sys_UserPurview_usps orderby ta.usp_iRecordID descending select ta).Take(1); Sys_UserPurview_usp_Info info = new Sys_UserPurview_usp_Info(); if (taQuery.Count() > 0) { foreach (var t in taQuery) { info = Common.General.CopyObjectValue <Sys_UserPurview_usp, Sys_UserPurview_usp_Info>(t); FindUser(info); FindRole(info); FindFunction(info); } } return(info); } } catch (Exception Ex) { throw Ex; } }
public bool InsertRecord(Sys_UserPurview_usp_Info infoObject) { Sys_UserPurview_usp_Info uspInfo = new Sys_UserPurview_usp_Info(); Sys_FormMaster_fom_Info formInfo = new Sys_FormMaster_fom_Info(); Sys_UserMaster_usm_Info userInfo = null; Sys_RoleMaster_rlm_Info roleInfo = null; using (VPMSDBDataContext db = new VPMSDBDataContext()) { try { formInfo = infoObject.formMasterList[0]; DelUserPurview(infoObject); for (int i = 0; i < infoObject.userMasterList.Count; i++) { for (int j = 0; j < infoObject.userMasterList[i].functionMasterList.Count; j++) { Sys_UserPurview_usp uspUser = new Sys_UserPurview_usp(); uspUser = Common.General.CopyObjectValue <Sys_UserPurview_usp_Info, Sys_UserPurview_usp>(infoObject); userInfo = new Sys_UserMaster_usm_Info(); userInfo = infoObject.userMasterList[i]; uspUser.usp_cUserLoginID = userInfo.usm_cUserLoginID; uspUser.usp_cPurviewCode = infoObject.userMasterList[i].functionMasterList[j].fum_cFunctionNumber + formInfo.fom_cFormNumber; uspUser.usp_cAdd = infoObject.usp_cAdd; uspUser.usp_cLast = infoObject.usp_cLast; uspUser.usp_dAddDate = infoObject.usp_dAddDate.Value; uspUser.usp_dLastDate = infoObject.usp_dLastDate.Value; db.Sys_UserPurview_usps.InsertOnSubmit(uspUser); } } for (int i = 0; i < infoObject.roleMasterList.Count; i++) { for (int j = 0; j < infoObject.roleMasterList[i].functionMasterList.Count; j++) { Sys_UserPurview_usp uspUser = new Sys_UserPurview_usp(); uspUser = Common.General.CopyObjectValue <Sys_UserPurview_usp_Info, Sys_UserPurview_usp>(infoObject); roleInfo = new Sys_RoleMaster_rlm_Info(); roleInfo = infoObject.roleMasterList[i]; uspUser.usp_cRoleID = roleInfo.rlm_cRoleID; uspUser.usp_cPurviewCode = infoObject.roleMasterList[i].functionMasterList[j].fum_cFunctionNumber + formInfo.fom_cFormNumber; uspUser.usp_cAdd = infoObject.usp_cAdd; uspUser.usp_cLast = infoObject.usp_cLast; uspUser.usp_dAddDate = infoObject.usp_dAddDate.Value; uspUser.usp_dLastDate = infoObject.usp_dLastDate.Value; db.Sys_UserPurview_usps.InsertOnSubmit(uspUser); } } db.SubmitChanges(); return(true); } catch (Exception Ex) { throw Ex; } } }
public Model.Management.Master.SiteMaster_stm_Info DisplayRecord(Model.IModel.IModelObject KeyObject) { SiteMaster_stm_Info stm = new SiteMaster_stm_Info(); SiteMaster_stm_Info info = new SiteMaster_stm_Info(); stm = KeyObject as SiteMaster_stm_Info; try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { IQueryable <SiteMaster_stm> taQuery = (from stms in db.SiteMaster_stms where stms.stm_iRecordID == stm.stm_iRecordID //orderby dpms.dpm_iRecordID ascending select stms).Take(1); if (taQuery != null) { //foreach (var t in taQuery) foreach (SiteMaster_stm t in taQuery) { info = Common.General.CopyObjectValue <SiteMaster_stm, SiteMaster_stm_Info>(t); } } return(info); } } catch (Exception Ex) { throw Ex; } }
public Model.Management.Master.SiteMaster_stm_Info GetRecord_Last() { try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { IQueryable <SiteMaster_stm> taQuery = (from stms in db.SiteMaster_stms orderby stms.stm_iRecordID descending select stms).Take(1); SiteMaster_stm_Info info = new SiteMaster_stm_Info(); if (taQuery.Count() > 0) { foreach (var t in taQuery) { info = Common.General.CopyObjectValue <SiteMaster_stm, model.SiteMaster_stm_Info>(t); } } return(info); } } catch (Exception Ex) { throw Ex; } }
public bool UpdateRecord(Model.Management.Master.SiteMaster_stm_Info infoObject) { using (VPMSDBDataContext db = new VPMSDBDataContext()) { SiteMaster_stm stm = new SiteMaster_stm(); try { stm = db.SiteMaster_stms.SingleOrDefault(t => t.stm_iRecordID == infoObject.stm_iRecordID); if (stm != null) { stm.stm_cBuildingNumber = infoObject.stm_cBuildingNumber; stm.stm_cName = infoObject.stm_cName; stm.stm_cNumber = infoObject.stm_cNumber; stm.stm_cRemark = infoObject.stm_cRemark; stm.stm_cLast = infoObject.stm_cLast; stm.stm_dLastDate = infoObject.stm_dLastDate.Value; db.SubmitChanges(); } return(true); } catch (Exception Ex) { throw Ex; } } }
public bool IsExistRecord(object KeyObject) { using (VPMSDBDataContext db = new VPMSDBDataContext()) { SiteMaster_stm_Info stm = new SiteMaster_stm_Info(); try { stm = KeyObject as SiteMaster_stm_Info; //stm = Common.General.CopyObjectValue<object, SiteMaster_stm_Info>(KeyObject); IQueryable <SiteMaster_stm> taQuery = (from stms in db.SiteMaster_stms where stms.stm_cNumber == stm.stm_cNumber select stms); if (taQuery.Count() > 0) { return(true); } else { return(false); } } catch (Exception Ex) { throw Ex; } } }
public Model.Management.Master.SiteMaster_stm_Info GetRecord_Next(Model.Base.DataBaseCommandInfo commandInfo) { SiteMaster_stm_Info info = null; try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { string iRecordId = string.Empty; foreach (var id in commandInfo.KeyInfoList) { iRecordId = id.KeyValue; break; } IQueryable <SiteMaster_stm> taQuery = (from stms in db.SiteMaster_stms where stms.stm_iRecordID > Convert.ToInt32(iRecordId) orderby stms.stm_iRecordID ascending select stms).Take(1); if (taQuery.Count() > 0) { foreach (var t in taQuery) { info = Common.General.CopyObjectValue <SiteMaster_stm, SiteMaster_stm_Info>(t); } } return(info); } } catch (Exception Ex) { return(info); } }
public Sys_UserMaster_usm_Info FindPermission(Model.IModel.IModelObject KeyObject) { Sys_UserMaster_usm_Info usm = new Sys_UserMaster_usm_Info(); Sys_UserMaster_usm_Info info = new Sys_UserMaster_usm_Info(); usm = KeyObject as Sys_UserMaster_usm_Info; try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { IQueryable <Sys_UserMaster_usm> taQuery = (from ta in db.Sys_UserMaster_usms where ta.usm_cUserLoginID == usm.usm_cUserLoginID && ta.usm_cPasswork == usm.usm_cPasswork //orderby dpms.dpm_iRecordID ascending select ta).Take(1); if (taQuery != null) { foreach (Sys_UserMaster_usm t in taQuery) { info = Common.General.CopyObjectValue <Sys_UserMaster_usm, Sys_UserMaster_usm_Info>(t); FindForm(info); FindFunction(info); } } return(info); } } catch { throw; } }
public Sys_FormMaster_fom_Info GetRecord_Next(Model.Base.DataBaseCommandInfo commandInfo) { Sys_FormMaster_fom_Info info = null; try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { string iRecordId = string.Empty; foreach (var id in commandInfo.KeyInfoList) { iRecordId = id.KeyValue; break; } IQueryable <Sys_FormMaster_fom> taQuery = (from ta in db.Sys_FormMaster_foms where ta.fom_iRecordID > Convert.ToInt32(iRecordId) orderby ta.fom_iRecordID ascending select ta).Take(1); if (taQuery.Count() > 0) { foreach (var t in taQuery) { info = Common.General.CopyObjectValue <Sys_FormMaster_fom, Sys_FormMaster_fom_Info>(t); FindFormPurview(info); } } return(info); } } catch (Exception Ex) { return(info); } }
public bool UpdateRecord(Model.Management.Master.SchoolMaster_scm_Info infoObject) { SchoolMaster_scm tab = new SchoolMaster_scm(); bool isSuccess = false; try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { tab = db.SchoolMaster_scm.SingleOrDefault(t => t.scm_cNumber == infoObject.scm_cNumber); if (tab != null) { tab.scm_cName = infoObject.scm_cName; tab.scm_cRemark = infoObject.scm_cRemark; tab.scm_cLast = infoObject.scm_cLast; tab.scm_dLastDate = infoObject.scm_dLastDate; //tab=Common.General.SetDataToLingQEntity(tab, infoObject); } db.SubmitChanges(); isSuccess = true; } } catch (Exception Ex) { throw Ex; } return(isSuccess); }
public bool IsExistRecord(object KeyObject) { using (VPMSDBDataContext db = new VPMSDBDataContext()) { Sys_FormMaster_fom frm = new Sys_FormMaster_fom(); try { frm = Common.General.CopyObjectValue <object, Sys_FormMaster_fom>(KeyObject); IQueryable <Sys_FormMaster_fom> taQuery = (from ta in db.Sys_FormMaster_foms where ta.fom_cFormNumber == frm.fom_cFormNumber select ta); if (taQuery.Count() > 0) { return(true); } else { return(false); } } catch (Exception Ex) { throw Ex; } } }
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 DeleteRecord(Model.IModel.IModelObject KeyObject) { Sys_FormMaster_fom_Info info = null; try { info = KeyObject as Sys_FormMaster_fom_Info; using (VPMSDBDataContext db = new VPMSDBDataContext()) { Sys_FormMaster_fom frm = db.Sys_FormMaster_foms.Single <Sys_FormMaster_fom>(i => i.fom_iRecordID == info.fom_iRecordID); for (int i = 0; i < frm.Sys_FormPurview_frps.Count; i++) { Sys_FormPurview_frp sta = frm.Sys_FormPurview_frps[i]; db.Sys_FormPurview_frps.DeleteOnSubmit(sta); } db.Sys_FormMaster_foms.DeleteOnSubmit(frm); db.SubmitChanges(); return(true); } } catch (Exception Ex) { throw Ex; } }
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 Sys_FormMaster_fom_Info GetRecord_Last() { Sys_FormMaster_fom_Info info = null; try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { IQueryable <Sys_FormMaster_fom> taQuery = (from ta in db.Sys_FormMaster_foms orderby ta.fom_iRecordID descending select ta).Take(1); //Sys_FormMaster_frm_Info info = new Sys_FormMaster_frm_Info(); if (taQuery.Count() > 0) { foreach (var t in taQuery) { info = Common.General.CopyObjectValue <Sys_FormMaster_fom, Sys_FormMaster_fom_Info>(t); FindFormPurview(info); } } return(info); } } catch (Exception Ex) { throw Ex; } }
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_FormMaster_fom_Info DisplayRecord(Model.IModel.IModelObject KeyObject) { Sys_FormMaster_fom_Info frm = new Sys_FormMaster_fom_Info(); Sys_FormMaster_fom_Info info = new Sys_FormMaster_fom_Info(); frm = KeyObject as Sys_FormMaster_fom_Info; try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { IQueryable <Sys_FormMaster_fom> taQuery = (from ta in db.Sys_FormMaster_foms where ta.fom_iRecordID == frm.fom_iRecordID //orderby dpms.dpm_iRecordID ascending select ta).Take(1); if (taQuery != null) { //foreach (var t in taQuery) foreach (Sys_FormMaster_fom t in taQuery) { info = Common.General.CopyObjectValue <Sys_FormMaster_fom, Sys_FormMaster_fom_Info>(t); FindFormPurview(info); } } return(info); } } catch (Exception Ex) { throw Ex; } }
public bool IsExistRecord(object KeyObject) { using (VPMSDBDataContext db = new VPMSDBDataContext()) { DepartmentMaster_dpm dpm = new DepartmentMaster_dpm(); try { dpm = Common.General.CopyObjectValue <object, DepartmentMaster_dpm>(KeyObject); IQueryable <DepartmentMaster_dpm> taQuery = (from dpms in db.DepartmentMaster_dpms where dpms.dpm_cNumber == dpm.dpm_cNumber select dpms); if (taQuery.Count() > 0) { return(true); } else { return(false); } } catch (Exception Ex) { throw Ex; } } }
public List <Sys_FormMaster_fom_Info> GetWebTreeNode(Sys_FormMaster_fom_Info info) { List <Sys_FormMaster_fom_Info> retunList = new List <Sys_FormMaster_fom_Info>(); try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { IQueryable <Sys_FormMaster_fom> list = from t in db.Sys_FormMaster_foms where t.fom_iWebForm == true && t.fom_iParentID == info.fom_iRecordID select t; if (list.Count() > 0) { foreach (Sys_FormMaster_fom t in list) { Sys_FormMaster_fom_Info temp = new Sys_FormMaster_fom_Info(); temp = Common.General.CopyObjectValue <Sys_FormMaster_fom, Sys_FormMaster_fom_Info>(t); retunList.Add(temp); } } } } catch (Exception Ex) { throw Ex; } return(retunList); }
public Model.SysMaster.DepartmentMaster_dpm_Info GetRecord_Last() { try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { IQueryable <DepartmentMaster_dpm> taQuery = (from dpms in db.DepartmentMaster_dpms orderby dpms.dpm_iRecordID descending select dpms).Take(1); Model.SysMaster.DepartmentMaster_dpm_Info info = new Model.SysMaster.DepartmentMaster_dpm_Info(); if (taQuery.Count() > 0) { foreach (var t in taQuery) { info = Common.General.CopyObjectValue <DepartmentMaster_dpm, model.DepartmentMaster_dpm_Info>(t); } } return(info); } } catch (Exception Ex) { throw Ex; } }
private Sys_UserMaster_usm_Info FindAllFunction(Sys_UserMaster_usm_Info info) { string sqlString = string.Empty; sqlString += "SELECT * " + Environment.NewLine; sqlString += "FROM Sys_FunctionMaster_fum " + Environment.NewLine; IEnumerable <Sys_FunctionMaster_fum_Info> infos = null; List <Sys_FunctionMaster_fum_Info> infoList = null; try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { infos = db.ExecuteQuery <Sys_FunctionMaster_fum_Info>(sqlString, new object[] { }); if (infos != null) { infoList = infos.ToList <Sys_FunctionMaster_fum_Info>(); } foreach (Sys_FunctionMaster_fum_Info t in infoList) { info.functionMasterList.Add(t); } return(info); } } catch (Exception Ex) { throw Ex; } }
public Model.IModel.IModelObject SaveUserSkin(Model.IModel.IModelObject Entity) { UserSkin_urs_Info info = new UserSkin_urs_Info(); try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { info = Entity as UserSkin_urs_Info; UserSkin_ur query = db.UserSkin_urs.SingleOrDefault(t => t.urs_cUserID == info.urs_cUserID); if (query != null) { query.urs_cSkinName = info.urs_cSkinName; } else { UserSkin_ur newTab = new UserSkin_ur(); newTab.urs_cUserID = info.urs_cUserID; newTab.urs_cSkinName = info.urs_cSkinName; db.UserSkin_urs.InsertOnSubmit(newTab); } db.SubmitChanges(); } } catch (Exception Ex) { throw Ex; } return(info); }
public bool DeleteRecord(Model.IModel.IModelObject KeyObject) { bool isSuccess = false; VegetableSpeciesMaster_vsm_Info keyObject = KeyObject as VegetableSpeciesMaster_vsm_Info; if (keyObject != null) { try { using (VPMSDBDataContext db = new VPMSDBDataContext()) { VegetableSpeciesMaster_vsm vegetableSpeciesMaster = db.VegetableSpeciesMaster_vsm.FirstOrDefault(t => t.vsm_RecordID == keyObject.vsm_RecordID); if (vegetableSpeciesMaster != null) { db.VegetableSpeciesMaster_vsm.DeleteOnSubmit(vegetableSpeciesMaster); db.SubmitChanges(); isSuccess = true; } } } catch (Exception Ex) { throw Ex; } } return(isSuccess); }