public JsonResult UpdateTeacherProfile(EditProfileTeacher Data) { ResultInfo <string> ResultInfo = new ResultInfo <string>() { Status = false, Description = "Failed|Login" }; if (Data != null) { Hod PageObj = new Hod(); // Data.JoiningDate = Convert.ToDateTime(Data.JoiningDate); ResultInfo.Info = PageObj.UpdateTeacherProfile(Data); if (ResultInfo.Info.Split('!')[0] == "Success") { ResultInfo.Description = "Success!Update Successfull"; ResultInfo.Status = true; } else { ResultInfo.Description = "Failed!Process Failed"; ResultInfo.Status = false; } } return(Json(ResultInfo, JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> PutHod(int id, Hod hod) { if (id != hod.Id) { return(BadRequest()); } _context.Entry(hod).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BuildingExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public JsonResult GetTimeTable(long ID) { ResultInfo <TimeTableDetails> ResultInfo = new ResultInfo <TimeTableDetails>() { Status = false, Description = "Failed|Login", ErrorCode = 400, }; try { TimeTableDetails temp = new TimeTableDetails(); Hod obj = new Hod(); temp.WeekList = obj.GetAllWeekdays(); temp.PeriodList = obj.GetAllperiods(); temp.TimeTableList = obj.GetAllTimeTableList(ID); ResultInfo.Info = temp; if (ResultInfo.Info != null) { ResultInfo.Description = "Success| Get time table details"; ResultInfo.Status = true; ResultInfo.ErrorCode = 200; } } catch (Exception ex) { } return(Json(ResultInfo, JsonRequestBehavior.AllowGet)); }
public ActionResult AddHOD(Hod hod) { string ImgUrl = "/Images/HOD/default.svg"; try { string uniqueFileName = Guid.NewGuid().ToString() + "_" + hod.Image.FileName; if (hod.Image != null) { string path = Server.MapPath("/Images/HOD/"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } hod.Image.SaveAs(path + uniqueFileName); ImgUrl = "/Images/HOD/" + uniqueFileName; } } catch { ImgUrl = "/Images/HOD/default.svg"; } hod.ImgUrl = ImgUrl; PrinciUtil princiUtil = new PrinciUtil(); if (princiUtil.AddHod(hod)) { Session["Notification"] = 1; } else { Session["Notification"] = 2; } return RedirectToAction("HOD"); }
private void UpCount() { if (focHod) { if (++Hod > 23) { Hod = 0; } tbHod.Text = Hod.ToString().PadLeft(2, '0'); } if (focMin) { if (++Min > 50) { Min = 0; } tbMin.Text = Min.ToString().PadLeft(2, '0'); } if (focSec) { if (++Sec > 59) { Sec = 0; } tbSec.Text = Sec.ToString().PadLeft(2, '0'); } }
private void DnCount() { if (focHod) { if (--Hod < 0) { Hod = 23; } tbHod.Text = Hod.ToString().PadLeft(2, '0'); } if (focMin) { if (--Min < 0) { Min = 59; } tbMin.Text = Min.ToString().PadLeft(2, '0'); } if (focSec) { if (--Sec < 0) { Sec = 59; } tbSec.Text = Sec.ToString().PadLeft(2, '0'); } }
public JsonResult TeachersPlanner(long ID) { ResultInfo <TeacherPlan> ResultInfo = new ResultInfo <TeacherPlan>() { Status = false, Description = "Failed|Login", ErrorCode = 400, }; try { TeacherPlan temp = new TeacherPlan(); Hod obj = new Hod(); temp.TopicCoverDate = obj.GetAllTeacherTopics(ID); temp.AssignmentDueDate = obj.GetAssignmentDetails(ID); temp.TestDueDate = obj.GetAllTestDueDate(ID); ResultInfo.Info = temp; if (ResultInfo.Info != null) { ResultInfo.Description = "Success| Get Topic Cover"; ResultInfo.Status = true; ResultInfo.ErrorCode = 200; } } catch (Exception ex) { } return(Json(ResultInfo, JsonRequestBehavior.AllowGet)); }
internal Hod GetHodByID(int id) { DataTable td = new DataTable(); Hod obj = new Hod(); try { string sqlquery = "SELECT * FROM hod where hodid = @hodid"; SqlCommand cmd = new SqlCommand(sqlquery, Conn); cmd.Parameters.Add(new SqlParameter("hodid", id)); SqlDataAdapter adp = new SqlDataAdapter(cmd); Conn.Open(); adp.Fill(td); Conn.Close(); obj.ID = Convert.ToInt32(td.Rows[0]["hodid"]); obj.Name = Convert.ToString(td.Rows[0]["name"]); obj.Email = Convert.ToString(td.Rows[0]["email"]); obj.Mobile = Convert.ToString(td.Rows[0]["mobile"]); obj.DeptID = Convert.ToInt32(td.Rows[0]["deptid"]); obj.Subject = Convert.ToString(td.Rows[0]["subject"]); obj.Education = Convert.ToString(td.Rows[0]["education"]); obj.Experience = Convert.ToString(td.Rows[0]["experience"]); obj.ImgUrl = Convert.ToString(td.Rows[0]["imgurl"]); obj.Password = Convert.ToString(td.Rows[0]["password"]); obj.DeptName = GetDeptByID(Convert.ToInt32(td.Rows[0]["deptid"])).Name; } catch (Exception) { } return(obj); }
public async Task <string> SaveGame(string victory, string historysave) { Game game = new Game(); game.Victory = Convert.ToInt32(victory); game.dt = DateTime.Now; db.Games.Add(game); if (historysave != "") { string[] masstrhod = historysave.Split('|'); int count = masstrhod.Length; // Количество сделанных ходов for (int i = 0; i < count; i++) { string[] mashod = masstrhod[i].Split('/'); //mas[Convert.ToInt32(mashod[1]), Convert.ToInt32(mashod[2])] = Convert.ToInt32(mashod[0]); Hod hod = new Hod(); hod.Player = Convert.ToInt32(mashod[0]); hod.Row = Convert.ToInt32(mashod[1]); hod.Col = Convert.ToInt32(mashod[2]); hod.Game = game; db.Hods.Add(hod); } } await db.SaveChangesAsync(); return(""); }
public async Task <ActionResult <Hod> > PostHod(Hod hod) { _context.Hods.Add(hod); await _context.SaveChangesAsync(); return(RedirectToAction("GetHod", new { id = hod.Id })); }
public TimePicker(int minutes) { InitializeComponent(); Hod = minutes / 60; Min = minutes % 60; tbHod.Text = Hod.ToString().PadLeft(2, '0'); tbMin.Text = Min.ToString().PadLeft(2, '0'); }
internal bool UpdateHod(Hod model) { bool result = false; try { string query; if (model.ImgUrl == "noupdate") { query = "UPDATE hod SET name = @name, email = @email, mobile = @mobile, deptid = @deptid, subject = @subject, education = @education, experience = @experience WHERE hodid = @id"; } else { query = "UPDATE hod SET name = @name, email = @email, mobile = @mobile, deptid = @deptid, subject = @subject, education = @education, experience = @experience, imgurl = @imgurl WHERE hodid = @id"; } SqlCommand cmd = new SqlCommand(query, Conn); cmd.Parameters.Add(new SqlParameter("name", model.Name)); cmd.Parameters.Add(new SqlParameter("email", model.Email)); cmd.Parameters.Add(new SqlParameter("mobile", model.Mobile)); cmd.Parameters.Add(new SqlParameter("deptid", model.DeptID)); cmd.Parameters.Add(new SqlParameter("subject", model.Subject)); cmd.Parameters.Add(new SqlParameter("education", model.Education)); cmd.Parameters.Add(new SqlParameter("experience", model.Experience)); cmd.Parameters.Add(new SqlParameter("imgurl", model.ImgUrl)); cmd.Parameters.Add(new SqlParameter("id", model.ID)); Conn.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { result = true; } } catch (Exception) { throw; } finally { Conn.Close(); } return(result); }
public ActionResult Settings(Hod hod) { SetHodDetails(); hod.ID = HodDetails.ID; hod.DeptID = HodDetails.DeptID; hod.Subject = HodDetails.Subject; string ImgUrl; try { string uniqueFileName = Guid.NewGuid().ToString() + "_" + hod.Image.FileName; if (hod.Image != null) { string path = Server.MapPath("/Images/HOD/"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } hod.Image.SaveAs(path + uniqueFileName); ImgUrl = "/Images/HOD/" + uniqueFileName; } else { ImgUrl = "noupdate"; } } catch { ImgUrl = "noupdate"; } hod.ImgUrl = ImgUrl; PrinciUtil princiUtil = new PrinciUtil(); if (princiUtil.UpdateHod(hod)) { Session["Notification"] = 1; } else { Session["Notification"] = 2; } return(RedirectToAction("Settings")); }
public JsonResult GetTeacherNotes(long TeacherID_FK) { ResultInfo <List <TeacherNote> > ResultInfo = new ResultInfo <List <TeacherNote> >() { Status = false, Description = "Failed|Login" }; Hod PageObj = new Hod(); ResultInfo.Info = PageObj.GetTeacherNotes(TeacherID_FK); if (ResultInfo.Info != null) { ResultInfo.Description = "Success| Get Notes By StudentID"; ResultInfo.Status = true; } return(Json(ResultInfo, JsonRequestBehavior.AllowGet)); }
public JsonResult InsertTeacherNote(TeacherNote Info) { ResultInfo <string> ResultInfo = new ResultInfo <string>() { Status = false, Description = "Failed|Login" }; if (Info != null) { Hod PageObj = new Hod(); ResultInfo.Info = PageObj.InsertTeacherNote(Info); if (ResultInfo.Info.Split('!')[0] == "Success") { ResultInfo.Description = "Success| Inserted"; ResultInfo.Status = true; } } return(Json(ResultInfo, JsonRequestBehavior.AllowGet)); }
public JsonResult RemoveTeacherNote(long TeacherID_FK, long NoteID) { ResultInfo <string> ResultInfo = new ResultInfo <string>() { Status = false, Description = "Failed|Login" }; if (TeacherID_FK > 0 && NoteID > 0) { Hod PageObj = new Hod(); ResultInfo.Info = PageObj.RemoveTeacherNote(TeacherID_FK, NoteID); if (ResultInfo.Info.Split('!')[0] == "Success") { ResultInfo.Description = "Success| Deleted"; ResultInfo.Status = true; } } return(Json(ResultInfo, JsonRequestBehavior.AllowGet)); }
public JsonResult EditProfile(long TID) { ResultInfo <EditProfileTeacher> ResultInfo = new ResultInfo <EditProfileTeacher>() { Status = false, Description = "Failed|Login" }; Hod PageObj = new Hod(); ResultInfo.Info = PageObj.EditProfile(TID); if (ResultInfo.Info != null) { ResultInfo.Description = "Success| Get Details "; ResultInfo.Status = true; } return(Json(ResultInfo, JsonRequestBehavior.AllowGet)); }
internal List <Hod> AllHods() { DataTable td = new DataTable(); List <Hod> list = new List <Hod>(); try { string sqlquery = "SELECT * FROM hod ORDER BY hodid DESC"; SqlCommand cmd = new SqlCommand(sqlquery, Conn); SqlDataAdapter adp = new SqlDataAdapter(cmd); Conn.Open(); adp.Fill(td); Conn.Close(); foreach (DataRow row in td.Rows) { Hod obj = new Hod { ID = Convert.ToInt32(row["hodid"]), Name = Convert.ToString(row["name"]), Email = Convert.ToString(row["email"]), Mobile = Convert.ToString(row["mobile"]), DeptID = Convert.ToInt32(row["deptid"]), Subject = Convert.ToString(row["subject"]), Education = Convert.ToString(row["education"]), Experience = Convert.ToString(row["experience"]), ImgUrl = Convert.ToString(row["imgurl"]), DeptName = GetDeptByID(Convert.ToInt32(row["deptid"])).Name }; list.Add(obj); } } catch (Exception) { } return(list); }
/* Departments operations ends here */ /* HOD operations starts here */ internal bool AddHod(Hod model) { bool result = false; try { string query = "INSERT INTO hod (name, email, mobile, deptid, subject, education, experience, imgurl, password) VALUES(@name, @email, @mobile, @deptid, @subject, @education, @experience, @imgurl, @password)"; SqlCommand cmd = new SqlCommand(query, Conn); cmd.Parameters.Add(new SqlParameter("name", model.Name)); cmd.Parameters.Add(new SqlParameter("email", model.Email)); cmd.Parameters.Add(new SqlParameter("mobile", model.Mobile)); cmd.Parameters.Add(new SqlParameter("deptid", model.DeptID)); cmd.Parameters.Add(new SqlParameter("subject", model.Subject)); cmd.Parameters.Add(new SqlParameter("education", model.Education)); cmd.Parameters.Add(new SqlParameter("experience", model.Experience)); cmd.Parameters.Add(new SqlParameter("imgurl", model.ImgUrl)); cmd.Parameters.Add(new SqlParameter("password", model.Password)); Conn.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { result = true; } } catch (Exception exp) { } finally { Conn.Close(); } return(result); }
private void SetHodDetails() { PrinciUtil princiUtil = new PrinciUtil(); HodDetails = princiUtil.GetHodByID(Convert.ToInt32(Session["HodID"])); }