public void MRemove(int mUniqueID) { LMaterialsDataContext tmpMC = new LMaterialsDataContext(); Table <TStudy> Materials = tmpMC.GetTable <TStudy>(); IQueryable <TStudy> tmpQ = from iter in Materials where iter.theUniqueID == mUniqueID select iter; TStudy tt = tmpQ.Where(x => x.theUniqueID == mUniqueID).Single(); Materials.DeleteOnSubmit(tt); tmpMC.SubmitChanges(); }
public int AddMaterials(ref CMaterials aMaterials) { LMaterialsDataContext tmpMC = new LMaterialsDataContext(); TStudy tmpMaterials = new TStudy(); tmpMaterials.theNumber = 0; tmpMaterials.theTitle = aMaterials.theTitle; tmpMaterials.theAttachFile = aMaterials.theAttachFile; //tmpMaterials.theAttachFile = "abc.hwp"; // tmpMaterials.theAttachFile = Request.Form["materials"]; //tmpMaterials.theFileName = aMaterials.theFile; //tmpMaterials.theFileName = "123.jpg"; tmpMaterials.theWriter = aMaterials.theWriter; tmpMaterials.theDate = DateTime.Now; tmpMaterials.theFileName = aMaterials.theFileName; // theNotices.Add(tmpNotice); tmpMC.TStudy.InsertOnSubmit(tmpMaterials); tmpMC.SubmitChanges(); aMaterials.theDate = DateTime.Now; return(1); }