public static void Delete_ComplaintsFormalHearing(int hearingid) { using (ComplaintsDataContext cdc = new ComplaintsDataContext()) { TbL_Complaints_FormalHearing cmphearing = cdc.TbL_Complaints_FormalHearings.Where(c => c.Hearing_Id == hearingid).SingleOrDefault(); cdc.TbL_Complaints_FormalHearings.DeleteOnSubmit(cmphearing); cdc.SubmitChanges(); } }
public static int Complaint_FormalHearing_InsertValues(int hearingid, int cmpid, int perid, string hearingdate, string hearingtime, string isrepondent, bool tbd, int createdby, bool setteld, bool ignore, string count) { using (ComplaintsDataContext dbInsert = new ComplaintsDataContext()) { TbL_Complaints_FormalHearing cmphearing; if (hearingid == 0) { cmphearing = new TbL_Complaints_FormalHearing(); } else { cmphearing = dbInsert.TbL_Complaints_FormalHearings.Where(c => c.Hearing_Id == hearingid).SingleOrDefault(); } cmphearing.Hearing_Id = hearingid; cmphearing.Cmp_Id = cmpid; cmphearing.Person_ID = perid; if (hearingdate != "") { cmphearing.HearingDate = Convert.ToDateTime(hearingdate.ToString()); } cmphearing.HearingTime = hearingtime; cmphearing.IsRespondent = isrepondent; cmphearing.Hearing_Status = 0; cmphearing.IsContinued = true; cmphearing.HearingLocation = count; cmphearing.TBD = tbd; cmphearing.Settled = setteld; cmphearing.Ignore = ignore; if (hearingid == 0) { cmphearing.Create_User = createdby; cmphearing.Create_Date = DateTime.Now; } else { cmphearing.ModifiedBy = createdby; cmphearing.ModifiedDate = DateTime.Now; } if (hearingid == 0) { dbInsert.TbL_Complaints_FormalHearings.InsertOnSubmit(cmphearing); } dbInsert.SubmitChanges(); return(cmphearing.Hearing_Id); } }