public void SERVICECHARGE() { StreamWriter Sc; try { Sc = File.AppendText("C:\\Users\\RON TAYLOR\\Desktop\\Computer Programing\\Company_Charge.txt"); //SERVICE_CHARGE = TOTAL_USAGE + (CURRENT_CONSUMPTION * 200); Sc.WriteLine(service_charge); Sc.WriteLine("Service charge:{0}", service_charge); Sc.Close(); } catch { Console.WriteLine(" file not writtten "); } Console.ReadLine(); StreamReader Ta; Ta = File.OpenText("C:\\Users\\RON TAYLOR\\Desktop\\Computer Programing\\Company_Charge.txt"); servicedisplay = Ta.ReadLine(); while (servicedisplay != null) { Console.WriteLine(servicedisplay); servicedisplay = Ta.ReadLine(); } Ta.Close(); }
public IActionResult EditTa(Ta model, string button) { if (button == "update") { if (model.Name != null) { _dbQueries.UpdateTa(Ta_Id, model.Name, ID, model.Course_Id); return(RedirectToAction("ShowTa", "Professor")); } else { TempData["Message2"] = "Name field cannot be empty"; } } else { _dbQueries.DeleteTa(model); return(RedirectToAction("ShowTa", "Professor")); } IEnumerable <Course> list = _dbQueries.returnAllProfessorCourse(ID); ViewBag.CourseList = new SelectList(list, "Id", "Name"); return(View(model)); }
public IActionResult EditTa(int id) { Ta_Id = id; Ta model = _dbQueries.GetTa(id); IEnumerable <Course> list = _dbQueries.returnAllProfessorCourse(ID); ViewBag.CourseList = new SelectList(list, "Id", "Name", model.Course_Id); return(View(model)); }
public IActionResult Home() { Ta ta = _dbQueries.GetTa(ID); CourseId = ta.Course_Id; ViewBag.courseId = ta.Course_Id; var model = _dbQueries.ReturnAllStudent(ta.Course_Id); return(View(model)); }
/// <summary> /// Returns true if PerformanceReport instances are equal /// </summary> /// <param name="other">Instance of PerformanceReport to be compared</param> /// <returns>Boolean</returns> public bool Equals(PerformanceReport other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( UpdateDate == other.UpdateDate || UpdateDate != null && UpdateDate.Equals(other.UpdateDate) ) && ( Ta == other.Ta || Ta != null && Ta.Equals(other.Ta) ) && ( Na == other.Na || Na != null && Na.Equals(other.Na) ) && ( Epsgr == other.Epsgr || Epsgr != null && Epsgr.Equals(other.Epsgr) ) && ( Roew == other.Roew || Roew != null && Roew.Equals(other.Roew) ) && ( Epsd == other.Epsd || Epsd != null && Epsd.Equals(other.Epsd) ) && ( Grgr == other.Grgr || Grgr != null && Grgr.Equals(other.Grgr) ) && ( Opgr == other.Opgr || Opgr != null && Opgr.Equals(other.Opgr) )); }
public void TaUpdate(Ta model) { var query = $@"UPDATE dbo.ta SET Name='{model.Name}', Password='******' WHERE Id = {model.Id}"; try { var ta = _dbContext.Ta .FromSqlRaw(query) .ToList(); } catch { } }
public IActionResult AddTa(Ta model) { if (model.Id > 0 && model.Name != null) { var result = _dbQueries.isProf(model.Id); var result2 = _dbQueries.isStudent(model.Id); var result3 = _dbQueries.isTa(model.Id); if (result || result2 || result3) { TempData["Message"] = "This Id is alredy exist"; } else { Ta ta = new Ta(); ta.Id = model.Id; ta.Name = model.Name; if (model.Password == null) { ta.Password = "******"; } else { ta.Password = model.Password; } ta.Prof_Id = ID; ta.Course_Id = model.Course_Id; _dbQueries.SaveTa(ta); return(RedirectToAction("ShowTa", "Professor")); } } else { if (model.Id <= 0) { TempData["Message"] = "Id field cannot be empty"; } if (model.Name == null) { TempData["Message2"] = "Name field cannot be empty"; } } IEnumerable <Course> list = _dbQueries.returnAllProfessorCourse(ID); ViewBag.CourseList = new SelectList(list, "Id", "Name"); return(View(model)); }
public IActionResult EditAccount(Ta model) { if (model.Password != null && model.Name != null) { model.Id = ID; _dbQueries.TaUpdate(model); TempData["SuccessMessage"] = "Account has been updated Successfully"; } if (model.Name == null) { TempData["message2"] = "Name cannot be null"; } if (model.Password == null) { TempData["message"] = "Password cannot be null"; } return(View(model)); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; // Suitable nullity checks etc, of course :) if (UpdateDate != null) { hashCode = hashCode * 59 + UpdateDate.GetHashCode(); } if (Ta != null) { hashCode = hashCode * 59 + Ta.GetHashCode(); } if (Na != null) { hashCode = hashCode * 59 + Na.GetHashCode(); } if (Epsgr != null) { hashCode = hashCode * 59 + Epsgr.GetHashCode(); } if (Roew != null) { hashCode = hashCode * 59 + Roew.GetHashCode(); } if (Epsd != null) { hashCode = hashCode * 59 + Epsd.GetHashCode(); } if (Grgr != null) { hashCode = hashCode * 59 + Grgr.GetHashCode(); } if (Opgr != null) { hashCode = hashCode * 59 + Opgr.GetHashCode(); } return(hashCode); } }
public void SaveTa(Ta model) { _dbContext.Add(model); _dbContext.SaveChanges(); }
public void DeleteTa(Ta model) { _dbContext.Remove(model); _dbContext.SaveChanges(); }
public IActionResult EditAccount() { Ta model = _dbQueries.GetTa(ID); return(View(model)); }