protected void UpdateTag(TBL_ALARM_TEMP def, MVCxGridViewBatchUpdateValues <TBL_ALARM_TEMP, int> updateValues)
 {
     //try
     //{
     //    alarmDefinitionService.UpdateAlarmDefinition(def);
     //    alarmDefinitionService.SaveAlarmDefinition();
     //}
     //catch (Exception e)
     //{
     //    updateValues.SetErrorText(def, e.Message);
     //}
 }
 protected void InsertTag(TBL_ALARM_TEMP tag, MVCxGridViewBatchUpdateValues <TBL_ALARM_TEMP, int> updateValues)
 {
     try
     {
         //tag.CREATED_DATE = DateTime.Now;
         //tag.UPDATE_USER = User.Identity.GetUserId();
         //alarmDefinitionService.CreateAlarmDefinition(tag);
         //alarmDefinitionService.SaveAlarmDefinition();
     }
     catch (Exception e)
     {
         updateValues.SetErrorText(tag, e.Message);
     }
 }
        public ActionResult GridUpdateTemp(MVCxGridViewBatchUpdateValues <TBL_ALARM_TEMP, int> updateValues)
        {
            //object curObj;
            try
            {
                string curUserId = User.Identity.GetUserId();
                foreach (TBL_ALARM_TEMP tag in updateValues.Insert)
                {
                    if (updateValues.IsValid(tag))
                    {
                        DB.AlarmTemplate.Add(tag);
                    }
                }
                foreach (TBL_ALARM_TEMP tag in updateValues.Update)
                {
                    if (updateValues.IsValid(tag))
                    {
                        TBL_ALARM_TEMP ent = DB.AlarmTemplate.FirstOrDefault(x => x.ID == tag.ID);
                        ent.UPDATED_DATE = DateTime.Now;
                        ent.UPDATE_USER  = curUserId;
                        ent.NAME         = tag.NAME;
                    }
                }
                DB.SaveChanges();
                foreach (var tagIg in updateValues.DeleteKeys)
                {
                    DB.AlarmTemplate.Where(x => x.ID == tagIg)
                    .Update(x => new TBL_ALARM_TEMP()
                    {
                        IS_DELETED = true
                    });
                }

                return(PartialView("AlarmTempGridPartial"));
            }
            catch (Exception ex)
            {
                //updateValues.SetErrorText( curObj, ex.Message);
                return(PartialView("AlarmTempGridPartial"));
            }
        }