Пример #1
0
 public static bool Delete(int id, string curentUsername, string role)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         HDS_User obj = exMana.HDS_User.First(temp => temp.Usr_ID == id);
         if (curentUsername == obj.Usr_Username)
         {
             errMsg = "You can't to delete yourself !";
             return false;
         }
         if (!role.Equals("AdmExastExaor") || !role.Equals("Manager"))
         {
             errMsg = "You don't permission to delete this user !";
             return false;
         }
         exMana.DeleteObject(obj);
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
Пример #2
0
 public static bool checkLogin(string user, string pass, ref string role)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         role = exMana.HDS_User.First(temp => temp.Usr_Username == user && temp.Usr_Password == pass).Usr_Role;
         //role = NexMana.Employee.First(temp => temp.Username == user && temp.Password == pass).Role;
     }
     catch (Exception)
     {
         role = "";
         return false;
     }
     return true;
 }
 public static bool AddNew(HDS_TypeQuestion Typ)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         exMana.AddToHDS_TypeQuestion(Typ);
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
 public static bool AddNew(HDS_StandardRating Rat)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         exMana.AddToHDS_StandardRating(Rat);
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
 public static bool AddNew(HDS_InitExamDetail Iexd)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         exMana.AddToHDS_InitExamDetail(Iexd);
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
 public static bool Update(HDS_Employee Emp)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         HDS_Employee obj = exMana.HDS_Employee.First(temp => temp.Emp_ID == Emp.Emp_ID);
         obj.Emp_Name = Emp.Emp_Name;
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
 public static bool Update(HDS_TypeQuestion Typ)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         HDS_TypeQuestion obj = exMana.HDS_TypeQuestion.First(temp => temp.typ_ID == Typ.typ_ID);
         obj.Typ_Name = Typ.Typ_Name;
         obj.Typ_Description = Typ.Typ_Description;
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
Пример #8
0
 public static bool Update(HDS_Lever lev)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         HDS_Lever obj = exMana.HDS_Lever.First(temp => temp.Lev_ID == lev.Lev_ID);
         obj.Lev_Name = lev.Lev_Name;
         obj.Lev_Description = lev.Lev_Description;
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
 public static bool Update(HDS_ExamDetailAnswer Exda)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         HDS_ExamDetailAnswer obj = exMana.HDS_ExamDetailAnswer.First(temp => temp.Exda_ID == Exda.Exda_ID);
         obj.Exd_ID = Exda.Exd_ID;
         obj.Exda_Answer = Exda.Exda_Answer;
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
 public static bool Update(HDS_Category cat)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         HDS_Category obj = exMana.HDS_Category.First(temp => temp.Cat_ID == cat.Cat_ID);
         obj.Cat_Name = cat.Cat_Name;
         obj.Cat_Description = cat.Cat_Description;
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
 public static bool Update(HDS_InitExamDetail Iexd)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         HDS_InitExamDetail obj = exMana.HDS_InitExamDetail.First(temp => temp.Iex_ID == Iexd.Iex_ID);
         obj.Iex_ID = Iexd.Iex_ID;
         obj.Lev_ID = Iexd.Lev_ID;
         obj.Iexd_NumQuestion = Iexd.Iexd_NumQuestion;
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
Пример #12
0
 public static bool Update(HDS_Answer Ans)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         HDS_Answer obj = exMana.HDS_Answer.First(temp => temp.Ans_ID == Ans.Ans_ID);
         obj.Que_ID = Ans.Que_ID;
         obj.Ans_Answer = Ans.Ans_Answer;
         obj.Ans_IsTrue = Ans.Ans_IsTrue;
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
 public static bool Update(HDS_StandardRating Rat)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         HDS_StandardRating obj = exMana.HDS_StandardRating.First(temp => temp.Iex_ID == Rat.Iex_ID);
         obj.Iex_ID = Rat.Iex_ID;
         obj.Rat_FromMark = Rat.Rat_FromMark;
         obj.Rat_ToMark = Rat.Rat_ToMark;
         obj.Rat_Name = Rat.Rat_Name;
         obj.Rat_Description = Rat.Rat_Description;
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
Пример #14
0
 public static bool Update(HDS_Exam Exa)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         HDS_Exam obj = exMana.HDS_Exam.First(temp => temp.Exa_ID == Exa.Exa_ID);
         obj.Emp_ID = Exa.Emp_ID;
         obj.Exa_FromDate = Exa.Exa_FromDate;
         obj.Exa_ToDate = Exa.Exa_ToDate;
         obj.Res_rating = Exa.Res_rating;
         obj.Res_Result = Exa.Res_Result;
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
 public static bool Update(HDS_Question Que)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         HDS_Question obj = exMana.HDS_Question.First(temp => temp.Que_ID == Que.Que_ID);
         obj.Lev_ID = Que.Lev_ID;
         obj.Cat_ID = Que.Cat_ID;
         obj.Typ_ID = Que.Typ_ID;
         obj.Que_Title = Que.Que_Title;
         obj.Que_Description = Que.Que_Description;
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
 public static bool Delete(int id, string role)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         HDS_StandardRating obj = exMana.HDS_StandardRating.First(temp => temp.Rat_ID == id);
         if (!role.Equals("AdmRatstrator") || !role.Equals("Manager"))
         {
             errMsg = "You don't permission to delete this user !";
             return false;
         }
         exMana.DeleteObject(obj);
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
 public static bool Update(HDS_InitExam Ini)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         HDS_InitExam obj = exMana.HDS_InitExam.First(temp => temp.Iex_ID == Ini.Iex_ID);
         obj.Iex_Name = Ini.Iex_Name;
         obj.Iex_Description = Ini.Iex_Description;
         obj.Iex_Date = Ini.Iex_Date;
         obj.Lev_ID = Ini.Lev_ID;
         obj.Cat_ID = Ini.Cat_ID;
         obj.Typ_ID = Ini.Typ_ID;
         obj.Iex_NumQuestion = Ini.Iex_NumQuestion;
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
Пример #18
0
 public static bool Update(HDS_User Usr)
 {
     try
     {
         ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
         HDS_User obj = exMana.HDS_User.First(temp => temp.Usr_ID == Usr.Usr_ID);
         obj.Emp_ID = Usr.Emp_ID;
         obj.Usr_Username = Usr.Usr_Username;
         obj.Usr_Password = Usr.Usr_Password;
         obj.Usr_Role = Usr.Usr_Role;
         obj.Usr_Avata = Usr.Usr_Avata;
         exMana.SaveChanges();
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     errMsg = "";
     return true;
 }
 public static List<HDS_StandardRating> getAll()
 {
     ExamSystemManagerDBEntities ExMana = new ExamSystemManagerDBEntities();
     List<HDS_StandardRating> Lst = ExMana.HDS_StandardRating.ToList();
     return Lst;
 }
 public static List<HDS_Category> getAll()
 {
     ExamSystemManagerDBEntities ExMana = new ExamSystemManagerDBEntities();
     List<HDS_Category> catLst = ExMana.HDS_Category.ToList();
     return catLst;
 }
 public static List<HDS_InitExamDetail> getAll()
 {
     ExamSystemManagerDBEntities ExMana = new ExamSystemManagerDBEntities();
     List<HDS_InitExamDetail> Lst = ExMana.HDS_InitExamDetail.ToList();
     return Lst;
 }
Пример #22
0
 public static HDS_Lever getById(int id)
 {
     ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
     return exMana.HDS_Lever.First(temp => temp.Lev_ID == id);
 }
Пример #23
0
 public static List<HDS_Lever> getAll()
 {
     ExamSystemManagerDBEntities ExMana = new ExamSystemManagerDBEntities();
     List<HDS_Lever> Lst = ExMana.HDS_Lever.ToList();
     return Lst;
 }
Пример #24
0
 public static object getAll()
 {
     ExamSystemManagerDBEntities ExMana = new ExamSystemManagerDBEntities();
     return (from sc in ExMana.HDS_User.Include("HDS_Employee") select new { id = sc.Usr_ID, emp = sc.HDS_Employee.Emp_Name, username = sc.Usr_Username, pass = sc.Usr_Password, role = sc.Usr_Role, img = sc.Usr_Avata }).ToList();
 }
 public static HDS_TypeQuestion getById(int id)
 {
     ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
     return exMana.HDS_TypeQuestion.First(temp => temp.typ_ID == id);
 }
 public static List<HDS_TypeQuestion> getAll()
 {
     ExamSystemManagerDBEntities ExMana = new ExamSystemManagerDBEntities();
     List<HDS_TypeQuestion> Lst = ExMana.HDS_TypeQuestion.ToList();
     return Lst;
 }
Пример #27
0
 public static HDS_User getByUsername(string UserName)
 {
     ExamSystemManagerDBEntities exMana = new ExamSystemManagerDBEntities();
     return exMana.HDS_User.First(temp => temp.Usr_Username == UserName);
 }