static private ErrorCode SetPpcStatusIds(IPTV2Entities context, string startSerial, string endSerial, PpcStatusId statusId, int prefixLength) { string prefix = startSerial.Substring(0, prefixLength); if (endSerial.StartsWith(prefix)) { int start = Convert.ToInt32(startSerial.Substring(prefixLength)); int end = Convert.ToInt32(endSerial.Substring(prefixLength)); if (start <= end) { var ppcList = context.Ppcs.Where(p => (p.SerialNumber.CompareTo(startSerial) >= 0) && (p.SerialNumber.CompareTo(endSerial) <= 0)); foreach (var thisPpc in ppcList) { thisPpc.StatusId = (int)statusId; } context.SaveChanges(); } else { return (ErrorCode.StartSerialShouldBeLessThanEndSerial); } } else { return (ErrorCode.PrefixOfStartAndEndingSerialDoNotMatch); } return (ErrorCode.Success); }
static private ErrorCode SetPpcStatusIds(IPTV2Entities context, string startSerial, string endSerial, PpcStatusId statusId) { return (SetPpcStatusIds(context, startSerial, endSerial, statusId, _prefixLength)); }