public async Task <bool> CreateKid(string firstName, string lastName, int age, SchoolType schoolType, string nameClass, double pocketMonetValue) { try { if (String.IsNullOrEmpty(firstName) || String.IsNullOrEmpty(lastName) || String.IsNullOrEmpty(age.ToString()) || String.IsNullOrEmpty(schoolType.ToString()) || String.IsNullOrEmpty(nameClass.ToString()) || String.IsNullOrEmpty(pocketMonetValue.ToString())) { return(false); } else { Kid kid = new Kid() { Id = Guid.NewGuid(), FirstName = firstName, LastName = lastName, Age = age, SchoolType = schoolType, NameClass = nameClass, PocketMonetValue = pocketMonetValue }; _db.Kids.Add(kid); await _db.SaveChangesAsync(); return(true); } } catch (Exception) { return(false); } }
public Factory(SchoolType schoolType) { this.SchoolType = schoolType; switch (SchoolType) { case SchoolType.Academy: SchoolFactory = new AcademyFactory(); break; case SchoolType.School: SchoolFactory = new SchoolFactory(); break; default: throw new NotSupportedException(SchoolType.ToString()); } }
public Factory(SchoolType schoolType) { this.SchoolType = schoolType; switch (SchoolType) { case SchoolType.Academy: SchoolFactory = new AcademyFactory(); break; case SchoolType.School: SchoolFactory = new SchoolFactory(); break; default: throw new NotSupportedException(SchoolType.ToString()); } }
/// <summary> /// 透過學生類別取得 UDT 內設定加分比重 學生.ID,比重 /// </summary> /// <param name="StudTagRecList"></param> /// <param name="ST"></param> /// <returns></returns> public static Dictionary <string, decimal> GetStudentAddWeightFormUDTByStudentTag(List <StudentTagRecord> StudTagRecList, SchoolType ST) { Dictionary <string, decimal> retVal = new Dictionary <string, decimal>(); Dictionary <string, decimal> weight = new Dictionary <string, decimal>(); foreach (UserDefData_StudTypeWeight udd in UDTTransfer.GetDataFromUDT_StudTypeWeight().Where(x => x.SchoolType == ST.ToString())) { if (udd.AddWeight < 0) { continue; } if (!weight.ContainsKey(udd.StudentType)) { weight.Add(udd.StudentType, udd.AddWeight); } } foreach (StudentTagRecord StudTagRec in StudTagRecList) { if (weight.ContainsKey(StudTagRec.FullName)) { if (retVal.ContainsKey(StudTagRec.RefStudentID)) { // 當有2個以上,取其高 if (retVal[StudTagRec.RefStudentID] < weight[StudTagRec.FullName]) { retVal[StudTagRec.RefStudentID] = weight[StudTagRec.FullName]; } } else { retVal.Add(StudTagRec.RefStudentID, weight[StudTagRec.FullName]); } } } return(retVal); }
/// <summary> /// 透過學生類別取得 UDT 內設定不排名學生.ID /// </summary> /// <returns></returns> public static List <string> GetNonRankStudentIDFromUDTByStudentTag(List <StudentTagRecord> StudTagRecList, SchoolType ST) { List <string> TagNameList = new List <string>(); List <string> retVal = new List <string>(); TagNameList = (from data in UDTTransfer.GetDataFromUDT_StudTypeWeight() where data.CheckNonRank == true && data.SchoolType == ST.ToString() select data.StudentType).ToList(); foreach (StudentTagRecord StudTagRec in StudTagRecList) { if (TagNameList.Contains(StudTagRec.FullName)) { retVal.Add(StudTagRec.RefStudentID); } } return(retVal); }
/// <summary> /// 透過學生類別取得 UDT 內設定特種身分 學生.ID,特種身分 /// </summary> /// <param name="StudTagRecList"></param> /// <param name="ST"></param> /// <returns></returns> public static Dictionary <string, string> GetStudentSpcTypeFormUDTByStudentTag(List <StudentTagRecord> StudTagRecList, SchoolType ST) { Dictionary <string, UserDefData_StudTypeWeight> retVal = new Dictionary <string, UserDefData_StudTypeWeight>(); Dictionary <string, UserDefData_StudTypeWeight> weight = new Dictionary <string, UserDefData_StudTypeWeight>(); Dictionary <string, string> retVal1 = new Dictionary <string, string>(); foreach (UserDefData_StudTypeWeight udd in UDTTransfer.GetDataFromUDT_StudTypeWeight().Where(x => x.SchoolType == ST.ToString())) { if (udd.AddWeight < 0) { continue; } if (!weight.ContainsKey(udd.StudentType)) { weight.Add(udd.StudentType, udd); } } foreach (StudentTagRecord StudTagRec in StudTagRecList) { if (weight.ContainsKey(StudTagRec.FullName)) { if (retVal.ContainsKey(StudTagRec.RefStudentID)) { // 當有2個以上,取其高 if (retVal[StudTagRec.RefStudentID].AddWeight < weight[StudTagRec.FullName].AddWeight) { retVal[StudTagRec.RefStudentID] = weight[StudTagRec.FullName]; } } else { retVal.Add(StudTagRec.RefStudentID, weight[StudTagRec.FullName]); } } } foreach (KeyValuePair <string, UserDefData_StudTypeWeight> dd in retVal) { // 回傳特種身分 retVal1.Add(dd.Key, dd.Value.JoinStudType); } return(retVal1); }
private string crawlURLTemplate; // "http://support.renren.com/{0}/{1}.html"; public void Crawl(SchoolType st) { this.crawlURLTemplate = string.Format("http://support.renren.com/{0}/{1}.html", st.ToString().ToLower(), "{0}"); GetProvList(); if (this.provsList.Count > 0) { GetCityArrayPageInfo(); foreach (Prov prov in this.provsList) { GetCityList(prov); } } }
///// <summary> ///// Gets or sets the user's LEA's code. ///// </summary> //public string LocalEducationAgency { get; set; } ///// <summary> ///// Gets or sets the user's LEA's id. ///// </summary> //public int LocalEducationAgencyId { get; set; } /// <summary> /// Gets the School Id for the requested school type from the user profile (if defined), or if the type is /// not specified, returns the first configured School Id (looking first at high school, then middle school /// and finally elementary school). /// </summary> /// <param name="schoolType">The specific type of school Id being requested.</param> /// <returns>The corresponding school Id if found; otherwise <b>null</b>.</returns> public int GetSchoolId(SchoolType schoolType = SchoolType.Unspecified) { switch (schoolType) { case SchoolType.ElementarySchool: return ElementarySchoolId.Value; case SchoolType.MiddleSchool: return MiddleSchoolId.Value; case SchoolType.HighSchool: return HighSchoolId.Value; case SchoolType.Unspecified: var currentSchoolType = ScenarioContext.Current.GetSchoolType(); if (currentSchoolType != SchoolType.Unspecified) return GetSchoolId(currentSchoolType); var schoolId = HighSchoolId ?? MiddleSchoolId ?? ElementarySchoolId; if (schoolId == null) throw new Exception("There is no school in context, nor is there one defined for the current user profile."); return schoolId.Value; default: throw new NotSupportedException(schoolType.ToString()); } }
/// <summary> /// 透過學生類別取得 UDT 內設定不排名學生.ID /// </summary> /// <returns></returns> public static List<string> GetNonRankStudentIDFromUDTByStudentTag(List<StudentTagRecord> StudTagRecList,SchoolType ST) { List<string> TagNameList = new List<string>(); List<string> retVal = new List<string>(); TagNameList = (from data in UDTTransfer.GetDataFromUDT_StudTypeWeight() where data.CheckNonRank==true && data.SchoolType== ST.ToString () select data.StudentType).ToList(); foreach (StudentTagRecord StudTagRec in StudTagRecList) { if(TagNameList.Contains(StudTagRec.FullName )) retVal.Add(StudTagRec.RefStudentID ); } return retVal; }
/// <summary> /// 透過學生類別取得 UDT 內設定特種身分 學生.ID,特種身分 /// </summary> /// <param name="StudTagRecList"></param> /// <param name="ST"></param> /// <returns></returns> public static Dictionary<string, string> GetStudentSpcTypeFormUDTByStudentTag(List<StudentTagRecord> StudTagRecList, SchoolType ST) { Dictionary<string, DAL.UserDefData_StudTypeWeight> retVal = new Dictionary<string, DAL.UserDefData_StudTypeWeight>(); Dictionary<string, DAL.UserDefData_StudTypeWeight> weight = new Dictionary<string, DAL.UserDefData_StudTypeWeight>(); Dictionary<string, string> retVal1 = new Dictionary<string, string>(); foreach (DAL.UserDefData_StudTypeWeight udd in UDTTransfer.GetDataFromUDT_StudTypeWeight().Where(x => x.SchoolType == ST.ToString())) { if (udd.AddWeight < 0) continue; if (!weight.ContainsKey(udd.StudentType)) weight.Add(udd.StudentType,udd); } foreach (StudentTagRecord StudTagRec in StudTagRecList) { if (weight.ContainsKey(StudTagRec.FullName)) { if (retVal.ContainsKey(StudTagRec.RefStudentID)) { // 當有2個以上,取其高 if (retVal[StudTagRec.RefStudentID].AddWeight < weight[StudTagRec.FullName].AddWeight) retVal[StudTagRec.RefStudentID] = weight[StudTagRec.FullName]; } else retVal.Add(StudTagRec.RefStudentID, weight[StudTagRec.FullName]); } } foreach (KeyValuePair<string, DAL.UserDefData_StudTypeWeight> dd in retVal) { // 回傳特種身分 retVal1.Add(dd.Key, dd.Value.JoinStudType); } return retVal1; }
/// <summary> /// 透過學生類別取得 UDT 內設定加分比重 學生.ID,比重 /// </summary> /// <param name="StudTagRecList"></param> /// <param name="ST"></param> /// <returns></returns> public static Dictionary<string, decimal> GetStudentAddWeightFormUDTByStudentTag(List<StudentTagRecord> StudTagRecList, SchoolType ST) { Dictionary<string, decimal> retVal = new Dictionary<string, decimal>(); Dictionary<string, decimal> weight = new Dictionary<string, decimal>(); foreach (DAL.UserDefData_StudTypeWeight udd in UDTTransfer.GetDataFromUDT_StudTypeWeight().Where(x=>x.SchoolType == ST.ToString ())) { if(udd.AddWeight < 0) continue ; if(!weight.ContainsKey (udd.StudentType)) weight.Add(udd.StudentType,udd.AddWeight); } foreach (StudentTagRecord StudTagRec in StudTagRecList ) { if(weight.ContainsKey(StudTagRec.FullName )) { if (retVal.ContainsKey(StudTagRec.RefStudentID)) { // 當有2個以上,取其高 if(retVal[StudTagRec.RefStudentID]<weight[StudTagRec.FullName]) retVal[StudTagRec.RefStudentID]=weight[StudTagRec.FullName]; } else retVal.Add(StudTagRec.RefStudentID, weight[StudTagRec.FullName]); } } return retVal; }