/// <summary> /// Get the Last New Student# based on the program type /// </summary> /// <param name="program"></param> /// <returns></returns> public int CalculateNextProviderNumber(string program) { bool error = false; var programKey = string.Empty; switch (program.ToUpper()) { case "AUTISM": programKey = "Autism Provider Last New#"; break; case "JPSN": programKey = "JPSN Provider Last New#"; break; default: error = true; break; } if (error) { throw new Exception("Program Type = " + program + "Not Implemented"); } //Get the Last New Student# from filename - RunTimeData.xml var lastNewStudent = RunTimeData.GetKeyConfigSectionData(programKey); var nextStudentNumber = Int32.Parse(lastNewStudent); nextStudentNumber++; //Save the Next Student# back to the xml file RunTimeData.UpdateKeyConfigSectionData(programKey, nextStudentNumber.ToString()); return(nextStudentNumber); }
/// <summary> /// Get the Last New Student SSID# based on the program type /// Last New Student SSID# are unique acress all programs /// </summary> /// <param name="program"></param> /// <returns></returns> public string CalculateNextStudentSSID(string program) { bool error = false; string ssidKey = string.Empty; switch (program.ToUpper()) { case "AUTISM": ssidKey = "Autism Last SSID#"; break; case "JPSN": ssidKey = "JPSN Last SSID#"; break; case "EDCHOICE": ssidKey = "EdChoice Last SSID#"; break; default: error = true; break; } if (error) { throw new Exception("The Program Type = " + program + "Is Not Valid Name"); } //Get the Last New (9)-char SSID# from filename - RunTimeData.xml var lastNewSSID = RunTimeData.GetKeyConfigSectionData(ssidKey); //get first (2)-char prefix var prefix = lastNewSSID.Substring(0, 2); var lastNumber = lastNewSSID.Substring(2, 7); var nextNumber = Int32.Parse(lastNumber); nextNumber++; //Format nextStudentSSID = (7)-digits var nextStudentSSID = prefix + nextNumber.ToString("0000000"); //Save the Next SSID# back to the xml file RunTimeData.UpdateKeyConfigSectionData(ssidKey, nextStudentSSID); return(lastNewSSID); }
/// <summary> /// Get the Last New Student SSN# based on the program type /// </summary> /// <param name="program"></param> /// <returns></returns> public string CalculateNextSSNNumber(string program) { bool error = false; var programKey = string.Empty; switch (program.ToUpper()) { case "AUTISM": programKey = "Autism Last SS#"; break; case "JPSN": programKey = "JPSN Last SS#"; break; case "EDCHOICE": programKey = "EdChoice Last SS#"; break; default: error = true; break; } if (error) { throw new Exception("Program Type = " + program + "Not Implemented"); } //Get the Last New Student SSN# from filename - RunTimeData.xml var lastStudentSSN = RunTimeData.GetKeyConfigSectionData(programKey); var nextStudentSSN = Int32.Parse(lastStudentSSN); nextStudentSSN++; string ssnNumber = nextStudentSSN.ToString(); //Save the Next Student SS# back to the xml file RunTimeData.UpdateKeyConfigSectionData(programKey, ssnNumber); return(lastStudentSSN); }