public int GetNewCorrelative(int idelement, short idmr_detail, int?idreactive_medium, int?idreactive_modif) { CSet_methods_calibFactory faSet_methods_calib = new CSet_methods_calibFactory(); List <CSet_methods_calib> lstSet_methods_calib = faSet_methods_calib.GetAll() .Where(c => c.Idelement == idelement && c.Idmr_detail == idmr_detail && (idreactive_medium == null || c.Idreactive_medium == idreactive_medium) && (idreactive_modif == null || c.Idreactive_modif == idreactive_modif)).ToList(); int num = 0; if (lstSet_methods_calib.Count > 0) { num = lstSet_methods_calib.Max(c => Convert.ToInt32(c.Order_set)); } return(num + 1); }
/// <summary> /// Este método obtiene las calibraciones de los métodos /// </summary> /// <param name="idelement"></param> /// <param name="idmr_detail"></param> /// <param name="idreactive_medium"></param> /// <param name="idreactive_modif"></param> /// <returns></returns> public CSet_methods_calib GetMethodCalib(int idelement, short idmr_detail, int?idreactive_medium, int?idreactive_modif) { CSet_methods_calibFactory faSet_methods_calib = new CSet_methods_calibFactory(); List <CSet_methods_calib> lstSet_methods_calib = faSet_methods_calib.GetAll() .Where(c => c.Idelement == idelement && c.Idmr_detail == idmr_detail && (idreactive_medium == null || c.Idreactive_medium == idreactive_medium) && (idreactive_modif == null || c.Idreactive_modif == idreactive_modif)).ToList(); if (lstSet_methods_calib.Count > 0) { return(lstSet_methods_calib.First()); } CSet_methods_calib oSet_methods_calib = new CSet_methods_calib(); oSet_methods_calib.Idelement = idelement; oSet_methods_calib.Idmr_detail = idmr_detail; oSet_methods_calib.Idreactive_medium = idreactive_medium; oSet_methods_calib.Idreactive_modif = idreactive_modif; return(oSet_methods_calib); }