partial void DeleteSys_FormMaster_fom(Sys_FormMaster_fom instance);
partial void UpdateSys_FormMaster_fom(Sys_FormMaster_fom instance);
partial void InsertSys_FormMaster_fom(Sys_FormMaster_fom instance);
public bool UpdateRecord(Sys_FormMaster_fom_Info infoObject) { using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext()) { Sys_FormMaster_fom frm = new Sys_FormMaster_fom(); try { frm = db.Sys_FormMaster_fom.SingleOrDefault(t => t.fom_iRecordID == infoObject.fom_iRecordID); for (int i = 0; i < frm.Sys_FormPurview_frp.Count; i++) { Sys_FormPurview_frp sta = frm.Sys_FormPurview_frp[i]; db.Sys_FormPurview_frp.DeleteOnSubmit(sta); } string sqlString = string.Empty; Sys_FormMaster_fom_Info info = new Sys_FormMaster_fom_Info(); info = Common.General.CopyObjectValue<Sys_FormMaster_fom, Sys_FormMaster_fom_Info>(frm); IEnumerable<Sys_FormMaster_fom_Info> IEfom = null; IEnumerable<Sys_FormPurview_frp_Info> IEfrp = null; sqlString += "UPDATE Sys_FormMaster_fom" + Environment.NewLine; sqlString += " SET fom_cFormNumber='" + infoObject.fom_cFormNumber + "'," + Environment.NewLine; sqlString += " fom_cFormDesc=N'" + infoObject.fom_cFormDesc + "'," + Environment.NewLine; sqlString += " fom_cExePath='" + infoObject.fom_cExePath + "'," + Environment.NewLine; sqlString += " fom_cShortCut='" + infoObject.fom_cShortCut + "'," + Environment.NewLine; if (!infoObject.fom_lIsPreOpen) { sqlString += " fom_lIsPreOpen=0," + Environment.NewLine; } else { sqlString += " fom_lIsPreOpen=1," + Environment.NewLine; } if (infoObject.fom_lIsPopForm) { sqlString += " fom_lIsPopForm=1, " + Environment.NewLine; } else { sqlString += " fom_lIsPopForm=0, " + Environment.NewLine; } sqlString += " fom_iParentID='" + infoObject.fom_iParentID + "'," + Environment.NewLine; sqlString += " fom_iIndex='" + infoObject.fom_iIndex + "'," + Environment.NewLine; sqlString += " fom_cLast='" + infoObject.fom_cLast + "'," + Environment.NewLine; sqlString += "fom_cRemark=N'" + infoObject.fom_cRemark + "'," + Environment.NewLine; sqlString += " fom_dLastDate='" + infoObject.fom_dLastDate.ToString(DefineConstantValue.gc_DateTimeFormat) + "'" + Environment.NewLine; sqlString += " WHERE fom_iRecordID='" + infoObject.fom_iRecordID + "'"; IEfom = db.ExecuteQuery<Sys_FormMaster_fom_Info>(sqlString, new object[] { }); sqlString = string.Empty; sqlString += "DELETE FROM Sys_FormPurview_frp WHERE frp_cFormNumber='" + infoObject.fom_cFormNumber + "'"; IEfrp = db.ExecuteQuery<Sys_FormPurview_frp_Info>(sqlString, new object[] { }); if (infoObject.functionMaster != null && infoObject.functionMaster.Count > 0) { for (int i = 0; i < infoObject.functionMaster.Count; i++) { sqlString = string.Empty; Sys_FunctionMaster_fum_Info fomInfo = infoObject.functionMaster[i]; string frp_code = fomInfo.fum_cFunctionNumber + infoObject.fom_cFormNumber; sqlString += "INSERT INTO Sys_FormPurview_frp" + Environment.NewLine; sqlString += "(frp_cPurviewCode, frp_cFunctionNumber, frp_cFormNumber)" + Environment.NewLine; sqlString += " VALUES " + Environment.NewLine; sqlString += "('" + frp_code + "','" + fomInfo.fum_cFunctionNumber + "','" + infoObject.fom_cFormNumber + "')"; IEfrp = db.ExecuteQuery<Sys_FormPurview_frp_Info>(sqlString, new object[] { }); } } return true; } catch (Exception Ex) { throw Ex; } } }
public bool IsExistRecord(object KeyObject) { using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext()) { 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_fom 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 InsertRecord(Sys_FormMaster_fom_Info infoObject) { using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext()) { Sys_FormMaster_fom frm = new Sys_FormMaster_fom(); try { frm = Common.General.CopyObjectValue<Sys_FormMaster_fom_Info, Sys_FormMaster_fom>(infoObject); if (infoObject.functionMaster != null && infoObject.functionMaster.Count > 0) { for (int i = 0; i < infoObject.functionMaster.Count; i++) { Sys_FunctionMaster_fum_Info usmInfo = infoObject.functionMaster[i]; Sys_FormPurview_frp item = new Sys_FormPurview_frp(); item.frp_cFunctionNumber = usmInfo.fum_cFunctionNumber; item.frp_cFormNumber = infoObject.fom_cFormNumber; item.frp_cPurviewCode = item.frp_cFunctionNumber + item.frp_cFormNumber; frm.Sys_FormPurview_frp.Add(item); } } db.Sys_FormMaster_fom.InsertOnSubmit(frm); db.SubmitChanges(); return true; } catch (Exception Ex) { throw Ex; } } }