/// <summary> /// Create a new PMS_APPRAISAL_KPI object. /// </summary> /// <param name="id">Initial value of the ID property.</param> public static PMS_APPRAISAL_KPI CreatePMS_APPRAISAL_KPI(global::System.Int32 id) { PMS_APPRAISAL_KPI pMS_APPRAISAL_KPI = new PMS_APPRAISAL_KPI(); pMS_APPRAISAL_KPI.ID = id; return pMS_APPRAISAL_KPI; }
/// <summary> /// Deprecated Method for adding a new object to the PMS_APPRAISAL_KPI EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPMS_APPRAISAL_KPI(PMS_APPRAISAL_KPI pMS_APPRAISAL_KPI) { base.AddObject("PMS_APPRAISAL_KPI", pMS_APPRAISAL_KPI); }
public static bool UpdateAppraisalKPIsForAjax(List<PMS.Model.DTO.Appraisal.KPI> insertList, List<PMS.Model.DTO.Appraisal.KPI> updateList, List<PMS.Model.DTO.Appraisal.KPI> deleteList, out string message,out string newkpiids) { bool boo_success = false; message = string.Empty; int int_appraisal_id = 0; PMS.Model.Context.PMSEntities dc_pms = new PMS.Model.Context.PMSEntities(); newkpiids = string.Empty; StringBuilder sb_newkpiids=new StringBuilder(); try { if (!Lib.Utility.Common.IsNullOrEmptyList(deleteList)) { foreach (PMS.Model.DTO.Appraisal.KPI obj_kpi in deleteList) { foreach (PMS.Model.Context.PMS_APPRAISAL_KPI_COMMENT ent_comment in dc_pms.PMS_APPRAISAL_KPI_COMMENT.Where(rec => rec.ITEM_ID == obj_kpi.Id)) { dc_pms.PMS_APPRAISAL_KPI_COMMENT.DeleteObject(ent_comment); } Model.Context.PMS_APPRAISAL_KPI entity = dc_pms.PMS_APPRAISAL_KPI.Where(rec => rec.ID == obj_kpi.Id).Single(); dc_pms.PMS_APPRAISAL_KPI.DeleteObject(entity); //if (int_appraisal_id == 0) { int_appraisal_id = obj_kpi.Appraisal.Id; } } } PMS.Model.Context.PMS_APPRAISAL_KPI tempentity=new Context.PMS_APPRAISAL_KPI(); if (!Lib.Utility.Common.IsNullOrEmptyList(insertList)) { foreach (PMS.Model.DTO.Appraisal.KPI obj_kpi in insertList) { tempentity=Mappers.PMSMapper.MapAppraisalKPIDTOToEntity(obj_kpi); dc_pms.PMS_APPRAISAL_KPI.AddObject(tempentity); dc_pms.SaveChanges(); int_appraisal_id = obj_kpi.Appraisal.Id; sb_newkpiids.Append(tempentity.ID.ToString() + "-"); } } if (!Lib.Utility.Common.IsNullOrEmptyList(updateList)) { foreach (PMS.Model.DTO.Appraisal.KPI obj_kpi in updateList) { Model.Context.PMS_APPRAISAL_KPI entity = dc_pms.PMS_APPRAISAL_KPI.Where(rec => rec.ID == obj_kpi.Id).Single(); entity.DESCRIPTION = obj_kpi.Description; entity.TARGET = obj_kpi.Target; entity.LEVEL_1_SCORE = obj_kpi.Level1Score; entity.LEVEL_2_SCORE = obj_kpi.Level2Score; entity.SELF_SCORE = obj_kpi.SelfScore; entity.PRIORITY_MASTER_ID = obj_kpi.Priority.Id; if (int_appraisal_id == 0) { int_appraisal_id = obj_kpi.Appraisal.Id; } } } if (int_appraisal_id > 0) { Model.Context.PMS_APPRAISAL ent_appraisal = dc_pms.PMS_APPRAISAL.Where(rec => rec.ID == int_appraisal_id).Single(); if (ent_appraisal.STATUS_ID == Model.PMSConstants.STATUS_ID_NEW) { ent_appraisal.STATUS_ID = PMS.Model.PMSConstants.STATUS_ID_DRAFT; } } dc_pms.SaveChanges(); newkpiids = sb_newkpiids.ToString(); if(!string.IsNullOrEmpty(newkpiids)) newkpiids = newkpiids.Substring(0, newkpiids.Length-1); boo_success = true; } catch (Exception exc) { message = exc.Message; } finally { dc_pms.Dispose(); } return boo_success; }