public void DeleteAlarmDefinition(int AlarmId, string userId) { TBL_ALARM_DEF comp = AlarmDefinitionRepository.GetById(AlarmId); comp.UPDATE_USER = userId; comp.IS_DELETED = true; AlarmDefinitionRepository.Update(comp); }
public ActionResult GridUpdateTemDet(MVCxGridViewBatchUpdateValues <TBL_ALARM_DEF, int> updateValues, int templateId) { //object curObj; try { string curUserId = User.Identity.GetUserId(); foreach (TBL_ALARM_DEF tag in updateValues.Insert) { if (updateValues.IsValid(tag)) { tag.TEMPLATE_ID = templateId; DB.AlarmDefinitions.Add(tag); } } foreach (TBL_ALARM_DEF tag in updateValues.Update) { if (updateValues.IsValid(tag)) { TBL_ALARM_DEF ent = DB.AlarmDefinitions.FirstOrDefault(x => x.ID == tag.ID); ent.UPDATED_DATE = DateTime.Now; ent.UPDATE_USER = curUserId; ent.ALARM_TYPE = tag.ALARM_TYPE; ent.IS_ALARM = tag.IS_ALARM; ent.DESC = tag.DESC; ent.OP = tag.OP; ent.STATUS_NO = tag.STATUS_NO; ent.TAG_ID = tag.TAG_ID; ent.VALUE = tag.VALUE; } } foreach (var tagIg in updateValues.DeleteKeys) { TBL_ALARM_DEF ent = DB.AlarmDefinitions.FirstOrDefault(x => x.ID == tagIg); ent.IS_DELETED = true; ent.UPDATED_DATE = DateTime.Now; ent.UPDATE_USER = curUserId; } DB.SaveChanges(); return(PartialView("AlarmDefinitionGridPartial", templateId)); } catch (Exception ex) { //updateValues.SetErrorText( curObj, ex.Message); return(PartialView("AlarmDefinitionGridPartial", templateId)); } }
public void CreateAlarmDefinition(TBL_ALARM_DEF Alarm) { AlarmDefinitionRepository.Add(Alarm); }
//public bool IsAlarmExist(TBL_ALARM_LOG Alarm) //{ // return AlarmRepository.Get(x => x.IS_DELETED == false && x.NAME.ToUpper() == Alarm.NAME.ToUpper()) == null ? false : true; //} //public static IQueryable<TBL_ALARM_LOG> GetAlarmsAsQuery(Expression<Func<TBL_ALARM_LOG, bool>> where) //{ // return AlarmRepository.GetAllQuery(where); //} //public List<TBL_ALARM_LOG> GetAlarms(Expression<Func<TBL_ALARM_LOG, bool>> where) //{ // return AlarmRepository.GetMany(where); //} public void UpdateAlarmDefinition(TBL_ALARM_DEF Alarm) { AlarmDefinitionRepository.Update(Alarm); }