本文整理汇总了C#中LinqToSQLModel.MainDBDataContext类的典型用法代码示例。如果您正苦于以下问题:C# MainDBDataContext类的具体用法?C# MainDBDataContext怎么用?C# MainDBDataContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MainDBDataContext类属于LinqToSQLModel命名空间,在下文中一共展示了MainDBDataContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAllRecords
public List<SysMonitoring> GetAllRecords()
{
try
{
using (MainDBDataContext db = new MainDBDataContext())
{
return (from Sysm in db.SystemMonitoring_sym
select new SysMonitoring
{
sym_MACAddress = Sysm.sym_MACAddress,
sym_iSystemID = Sysm.sym_iSystemID,
sym_cSystemType = Sysm.sym_cSystemType,
sym_cSystemName = Sysm.sym_cSystemName,
sym_cSystemIP = Sysm.sym_cSystemIP,
sym_dStartTime = Sysm.sym_dStartTime,
sym_iStatus = Sysm.sym_iStatus,
sym_dUpdateTime = Sysm.sym_dUpdateTime,
sym_cVersion = Sysm.sym_cVersion,
sym_cProcessName = Sysm.sym_cProcessName,
sym_lIsPLCConnection = Sysm.sym_lIsPLCConnection,
sym_dMarkTime = Sysm.sym_dMarkTime,
sym_dAddTime = Sysm.sym_dAddTime,
sym_dLastTime = Sysm.sym_dLastTime,
sym_cMachineID = Sysm.sym_cMachineID,
sym_cSoftwareNo = Sysm.sym_cSoftwareNo
}).ToList();
}
}
catch
{
throw;
}
}
示例2: DeleteList
public bool DeleteList(List<MachineStopReasonProfile_msrp_Info> DeleteList)
{
//throw new NotImplementedException();
bool isSuccess = false;
try
{
using (MainDBDataContext db = new MainDBDataContext())
{
// List<MachineStopReasonProfile_msrp> uItems = db.MachineStopReasonProfile_msrp.Where(w => w.msrp_iSRPFID == ReasonID).ToList();
if (DeleteList != null)
{
foreach (MachineStopReasonProfile_msrp_Info item in DeleteList)
{
//item.mpit_lIsDeleted = true;
//item.mpit_dUpdateTime = DateTime.Now;
MachineStopReasonProfile_msrp delitem = db.MachineStopReasonProfile_msrp.SingleOrDefault(w => w.msrp_iMSRPID == item.msrp_iMSRPID );
db.MachineStopReasonProfile_msrp.DeleteOnSubmit(delitem);
}
}
db.SubmitChanges();
isSuccess = true;
}
}
catch (Exception Ex)
{
throw Ex;
}
return isSuccess;
}
示例3: Delete
public ReturnValueInfo Delete(SysMonitoring objInfo)
{
ReturnValueInfo returnInfo = new ReturnValueInfo(false);
try
{
using (MainDBDataContext db = new MainDBDataContext())
{
var delTab = db.SystemMonitoring_sym.Where(t => t.sym_MACAddress == objInfo.sym_MACAddress);
if (delTab != null)
{
foreach (var item in delTab)
{
db.SystemMonitoring_sym.DeleteOnSubmit(item);
}
db.SubmitChanges();
returnInfo.boolValue = true;
}
}
}
catch (Exception Ex)
{
returnInfo.messageText = Ex.Message;
}
return returnInfo;
}
示例4: DeleteRecord
public ReturnValueInfo DeleteRecord(Guid ntoID)
{
List<NoticeToMachine> listReturn = new List<NoticeToMachine>();
try
{
using (MainDBDataContext db = new MainDBDataContext())
{
var ret_notm = from notm in db.NoticeMachine_notm where notm.notm_NOTID == ntoID select notm;
if (ret_notm.Count() > 0)
{
db.NoticeMachine_notm.DeleteAllOnSubmit(ret_notm);
db.SubmitChanges();
}
DeleteNoticeList(ntoID);
var ret_not = from not in db.NoticeManage_not where not.not_RecordID == ntoID select not;
if (ret_not.Count() > 0)
{
db.NoticeManage_not.DeleteAllOnSubmit(ret_not);
db.SubmitChanges();
}
}
}
catch (Exception Ex)
{
throw Ex;
}
return null;
}
示例5: DeleteRecord
public bool DeleteRecord(Model.IModel.IModelObject KeyObject)
{
Sys_FunctionMaster_fum_Info info = null;
try
{
info = KeyObject as Sys_FunctionMaster_fum_Info;
using (MainDBDataContext db = new MainDBDataContext())
{
Sys_FunctionMaster_fum fum = db.Sys_FunctionMaster_fum.Single<Sys_FunctionMaster_fum>(i => i.fum_iRecordID == info.fum_iRecordID);
for (int i = 0; i < fum.Sys_FormPurview_frp.Count; i++)
{
Sys_FormPurview_frp sta = fum.Sys_FormPurview_frp[i];
db.Sys_FormPurview_frp.DeleteOnSubmit(sta);
}
db.Sys_FunctionMaster_fum.DeleteOnSubmit(fum);
db.SubmitChanges();
return true;
}
}
catch (Exception Ex)
{
throw Ex;
}
}
示例6: DeleteListByMachie
public bool DeleteListByMachie(string MachineID)
{
bool isSuccess = false;
try
{
using (MainDBDataContext db = new MainDBDataContext())
{
List<MachineStopReasonProfile_msrp> uItems = db.MachineStopReasonProfile_msrp.Where(w => w.msrp_cMachineID.ToUpper().Trim() == MachineID.ToUpper().Trim()).ToList();
if (uItems != null)
{
db.MachineStopReasonProfile_msrp.DeleteAllOnSubmit(uItems);
}
db.SubmitChanges();
isSuccess = true;
}
}
catch (Exception Ex)
{
throw Ex;
}
return isSuccess;
}
示例7: DeleteRecord
public bool DeleteRecord(Model.IModel.IModelObject KeyObject)
{
bool isSuccess = false;
AheadOfOffDuty_aod_Info info = new AheadOfOffDuty_aod_Info();
info = KeyObject as AheadOfOffDuty_aod_Info;
try
{
using (MainDBDataContext db = new MainDBDataContext())
{
//AheadOfOffDuty_aod delTab = db.AheadOfOffDuty_aod.SingleOrDefault(t => t.aod_iRecordID == info.aod_iRecordID && t.aod_lIsDeleted == false);
AheadOfOffDuty_aod delTab = db.AheadOfOffDuty_aod.SingleOrDefault(t => t.aod_RecordID == info.aod_RecordID && t.aod_lIsAtive == true);
if (delTab != null)
{
//delTab.aod_lIsDeleted = true;
db.AheadOfOffDuty_aod.DeleteOnSubmit(delTab);
delTab.aod_lIsAtive = false;
db.SubmitChanges();
isSuccess = true;
}
}
}
catch (Exception Ex)
{
throw Ex;
}
return isSuccess;
}
示例8: DeleteRecord
public ReturnValueInfo DeleteRecord(ProjectStopReason_pjsr_Info reasonInfo)
{
ReturnValueInfo returnInfo = new ReturnValueInfo(false);
if (reasonInfo != null)
{
try
{
using (MainDBDataContext db = new MainDBDataContext())
{
ProjectStopReason_pjsr deleteData = db.ProjectStopReason_pjsr.FirstOrDefault(t => t.pjsr_RecordID == reasonInfo.pjsr_RecordID);
if (deleteData != null)
{
db.ProjectStopReason_pjsr.DeleteOnSubmit(deleteData);
db.SubmitChanges();
returnInfo.boolValue = true;
}
}
}
catch (Exception Ex)
{
returnInfo.messageText = Ex.Message;
}
}
return returnInfo;
}
示例9: DeleteListByMachie
public bool DeleteListByMachie(string MachineID)
{
bool isSuccess = false;
try
{
using (MainDBDataContext db = new MainDBDataContext())
{
List<MachinePrepareItem_mpit> uItems = db.MachinePrepareItem_mpit.Where(w => w.mpit_cDCMPID.ToUpper().Trim() == MachineID.ToUpper().Trim()).ToList();
if (uItems != null)
{
foreach (MachinePrepareItem_mpit item in uItems)
{
//item.mpit_lIsDeleted = true;
//item.mpit_dUpdateTime = DateTime.Now;
db.MachinePrepareItem_mpit.DeleteOnSubmit(item);
}
}
db.SubmitChanges();
isSuccess = true;
}
}
catch (Exception Ex)
{
throw Ex;
}
return isSuccess;
}
示例10: DeleteRecord
public bool DeleteRecord(Model.IModel.IModelObject KeyObject)
{
bool isSuccess = false;
VacationMaster_vcm_Info delInfo = KeyObject as VacationMaster_vcm_Info;
try
{
using (MainDBDataContext db = new MainDBDataContext())
{
VacationMaster_vcm delTab = db.VacationMaster_vcm.SingleOrDefault(t => t.vcm_RecordID == delInfo.vcm_RecordID );
if (delTab != null)
{
//delTab.vcm_lIsDeleted = true;
db.VacationMaster_vcm.DeleteOnSubmit(delTab);
//delTab.vcm_lIsAtive = false;
db.SubmitChanges();
isSuccess = true;
}
}
}
catch(Exception Ex)
{
throw Ex;
}
return isSuccess;
}
示例11: DeleteRecord
public bool DeleteRecord(Model.IModel.IModelObject KeyObject)
{
bool isSuccess = false;
Model.HBPMS.Master.StaffInfoMaster_sim_Info info = new Model.HBPMS.Master.StaffInfoMaster_sim_Info();
info = KeyObject as Model.HBPMS.Master.StaffInfoMaster_sim_Info;
try
{
using (MainDBDataContext db = new MainDBDataContext())
{
LinqToSQLModel.StaffInfoMaster_sim delTab = db.StaffInfoMaster_sim.SingleOrDefault(t => t.sim_iRecordID == info.sim_iRecordID);
if (delTab != null)
{
db.StaffInfoMaster_sim.DeleteOnSubmit(delTab);
db.SubmitChanges();
isSuccess = true;
}
}
}
catch (Exception Ex)
{
throw Ex;
}
return isSuccess;
}
示例12: CboShiftType
public List<ShiftTypeMaster_stm_Info> CboShiftType()
{
//Add by peizhiwu
List<ShiftTypeMaster_stm_Info> list = new List<ShiftTypeMaster_stm_Info>();
string strSQL = string.Empty;
strSQL = " SELECT stm_iRecordID,stm_cShiftName,stm_cBeginTime,stm_cEndTime,stm_lIsAtive,stm_cAdd,stm_dAddDate,stm_cLast,stm_dLastDate " + Environment.NewLine;
strSQL += " FROM ShiftTypeMaster_stm WHERE stm_lIsAtive = 1 " + Environment.NewLine;
IEnumerable<ShiftTypeMaster_stm_Info> infos = null;
try
{
using (MainDBDataContext db = new MainDBDataContext())
{
infos = db.ExecuteQuery<ShiftTypeMaster_stm_Info>(strSQL, new object[] { });
if (infos != null)
{
list = infos.ToList<ShiftTypeMaster_stm_Info>();
}
}
}
catch (Exception Ex)
{
throw Ex;
}
return list;
}
示例13: GetRecord_First
public Sys_RoleMaster_rlm_Info GetRecord_First()
{
try
{
using (MainDBDataContext db = new MainDBDataContext())
{
IQueryable<Sys_RoleMaster_rlm> taQuery =
(from ta in db.Sys_RoleMaster_rlm
orderby ta.rlm_iRecordID ascending
select ta).Take(1);
Sys_RoleMaster_rlm_Info info = new Sys_RoleMaster_rlm_Info();
if (taQuery.Count() > 0)
{
foreach (var t in taQuery)
{
info = Common.General.CopyObjectValue<Sys_RoleMaster_rlm, Sys_RoleMaster_rlm_Info>(t);
FindUserRole(info);
}
}
return info;
}
}
catch (Exception Ex)
{
throw Ex;
}
}
示例14: DeleteRecord
public bool DeleteRecord(IModelObject KeyObject)
{
bool isSuccess = false;
MixMaterialDetail_mmdl_Info info = new MixMaterialDetail_mmdl_Info();
info = KeyObject as MixMaterialDetail_mmdl_Info;
using (MainDBDataContext db = new MainDBDataContext())
{
MixMaterialDetail_mmdl delTab = null;
if (info.mmdl_Id != new Guid())
{
delTab = db.MixMaterialDetail_mmdl.SingleOrDefault(t => t.mmdl_Id == info.mmdl_Id);
if (delTab != null)
{
db.MixMaterialDetail_mmdl.DeleteOnSubmit(delTab);
}
}
else
{
var del = db.MixMaterialDetail_mmdl.Where(t =>
(info.mmdl_cMaterialCode != null ? t.mmdl_cMaterialCode == info.mmdl_cMaterialCode : true)
&& (info.mmdl_cMaterialGroupNo != null ? t.mmdl_cMaterialGroupNo == info.mmdl_cMaterialGroupNo : true)
);
db.MixMaterialDetail_mmdl.DeleteAllOnSubmit(del);
}
//if (info.mmdl_cMaterialGroupNo != null)
//{
// var del = db.MixMaterialDetail_mmdl.Where(c => c.mmdl_cMaterialGroupNo == info.mmdl_cMaterialGroupNo);
// db.MixMaterialDetail_mmdl.DeleteAllOnSubmit(del);
//}
db.SubmitChanges();
isSuccess = true;
}
return isSuccess;
}
示例15: DeleteRecord
public bool DeleteRecord(Model.IModel.IModelObject KeyObject)
{
bool isSuccess = false;
DinnerScheduleMaster_dsm_Info info = new DinnerScheduleMaster_dsm_Info();
info = KeyObject as DinnerScheduleMaster_dsm_Info;
try
{
using (MainDBDataContext db = new MainDBDataContext())
{
DinnerScheduleMaster_dsm delTab = db.DinnerScheduleMaster_dsm.SingleOrDefault(t => t.dsm_RecordID == info.dsm_RecordID);
if (delTab != null)
{
db.DinnerScheduleMaster_dsm.DeleteOnSubmit(delTab);
db.SubmitChanges();
isSuccess = true;
}
}
}
catch (Exception ex)
{
mLoger.Error("run DinnerScheduleMasterDA.DeleteRecord", ex);
throw ex;
}
return isSuccess;
}