Exemplo n.º 1
0
 public ActionResult ProjDiscLoad(int projId)
 {
     JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
     try
     {
         List<Proj_Discussion> list = ProjDiscussionService.GetList(projId);
         List<User> listUser = UserService.GetList();
         if (list != null && list.Count() > 0)
         {
             foreach (Proj_Discussion model in list)
             {
                 User user = listUser.Find(item => item.user_Id == model.Proj_Disc_User_Id);
                 if (user != null)
                     model.UserName = user.user_Name;
                 jsonDataGridResult.rows.Add(model);
             }
         }
     }
     catch (Exception ex)
     {
         jsonDataGridResult.result = false;
         jsonDataGridResult.message = ex.Message;
     }
     return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 2
0
        public ActionResult TeamList(int? page, int? rows, string status, string sort, string order, string queryWord)
        {
            #region Get paging condition
            Paging paging = new Paging();
            paging.SetPageSize(rows.HasValue ? rows.Value : Paging.DEFAULT_PAGE_SIZE); //pageRows;
            paging.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber;
            #endregion

            JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
            List<Team> list = null;
            try
            {
                SqlHelper.Initialization();
                list = DAL.TeamService.GetList(paging, sort, order, status, queryWord);
                if (list != null && list.Count() > 0)
                {
                    foreach (Team idea in list)
                    {
                        jsonDataGridResult.rows.Add(idea);
                    }
                    jsonDataGridResult.total = paging.GetRecordCount();
                }
            }
            catch (Exception ex)
            {
                jsonDataGridResult.result = false;
                jsonDataGridResult.message = ex.Message;
            }
            return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 3
0
        public ContentResult UserChangePassWordSave(User userModel)
        {
            JsonDataGridResult jsonResult = new JsonDataGridResult();
            try
            {
                string userName = User.Identity.Name.Split(',')[1];
                int userId = Convert.ToInt32(User.Identity.Name.Split(',')[0]);

                User user = UserService.GetModel(userId);
                if (SqlHelper.Fun_Secret(userModel.user_Password_Model) == user.user_Password)
                {
                    user.user_Password = SqlHelper.Fun_Secret(userModel.user_Password);
                    user.user_Update_Time = DateTime.Now;

                    UserService.Update(user);
                    jsonResult.result = true;
                    jsonResult.message = "";
                }
                else
                {
                    jsonResult.result = false;
                    jsonResult.message = "The Old Password is not match!";
                }
            }
            catch (Exception ex)
            {
                jsonResult.result = false;
                jsonResult.message = ex.Message;
            }
            string result = JsonConvert.SerializeObject(jsonResult);
            return Content(result);
        }
Exemplo n.º 4
0
 public ActionResult NewsDelete(int? news_Id)
 {
     JsonDataGridResult jsonResult = new JsonDataGridResult();
     try
     {
         if (news_Id.HasValue)
         {
             News model = NewsService.GetModel(news_Id.Value);
             NewsService.Delete(model);
             jsonResult.result = true;
             jsonResult.message = "";
         }
         else
         {
             jsonResult.result = false;
             jsonResult.message = "Id is null!";
         }
     }
     catch (Exception ex)
     {
         jsonResult.result = false;
         jsonResult.message = ex.Message;
     }
     return Json(jsonResult, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 5
0
 public ActionResult UserApprove(string idList)
 {
     JsonDataGridResult jsonResult = new JsonDataGridResult();
     try
     {
         if (!string.IsNullOrEmpty(idList))
         {
             List<User> list = UserService.GetList(idList);
             if (list != null && list.Count() > 0)
             {
                 foreach (User user in list)
                 {
                     user.user_Statue = true;
                 }
                 UserService.UpdateList(list);
                 jsonResult.result = true;
                 jsonResult.message = "";
             }
         }
         else
         {
             jsonResult.message = "IdList is null!";
         }
     }
     catch (Exception ex)
     {
         jsonResult.message = ex.Message;
     }
     return Json(jsonResult, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 6
0
        public ContentResult IdeaCommSave(Idea_Comment model, int ideaId)
        {
            JsonDataGridResult jsonResult = new JsonDataGridResult();
            try
            {
                //using()
                //{
                    Idea_Comment ideaComm = new Idea_Comment();
                    ideaComm.Idea_Comm_Idea_Id = ideaId;
                    ideaComm.Idea_Comm_Content = model.Idea_Comm_Content;
                    ideaComm.Idea_Comm_Time = DateTime.Now;
                    IdeaCommService.Save(ideaComm);

                    Idea idea = IdeaService.GetModel(ideaId);
                    idea.Idea_Status = 2;
                    IdeaService.Update(idea);

                    jsonResult.result = true;
                    jsonResult.message = "";
                //}
            }
            catch (Exception ex)
            {
                jsonResult.result = false;
                jsonResult.message = ex.Message;
            }
            string result = JsonConvert.SerializeObject(jsonResult);
            return Content(result);
        }
Exemplo n.º 7
0
 public ActionResult IdeaCommLoad(int ideaId)
 {
     JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
     try
     {
         List<Idea_Comment> list = IdeaCommService.GetList(ideaId);
         if (list != null && list.Count() > 0)
         {
             foreach (Idea_Comment model in list)
             {
                 jsonDataGridResult.rows.Add(model);
             }
         }
     }
     catch (Exception ex)
     {
         jsonDataGridResult.result = false;
         jsonDataGridResult.message = ex.Message;
     }
     return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 8
0
 public ContentResult ProjDiscSave(Proj_Discussion model, int projId)
 {
     JsonDataGridResult jsonResult = new JsonDataGridResult();
     try
     {
         Proj_Discussion projDisc = new Proj_Discussion();
         projDisc.Proj_Disc_Proj_Id = projId;
         projDisc.Proj_Disc_Content = model.Proj_Disc_Content;
         projDisc.Proj_Disc_Time = DateTime.Now;
         projDisc.Proj_Disc_User_Id =Convert.ToInt32(User.Identity.Name.Split(',')[0]);
         ProjDiscussionService.Save(projDisc);
         jsonResult.result = true;
         jsonResult.message = "";
     }
     catch (Exception ex)
     {
         jsonResult.result = false;
         jsonResult.message = ex.Message;
     }
     string result = JsonConvert.SerializeObject(jsonResult);
     return Content(result);
 }
Exemplo n.º 9
0
 public ActionResult GetNewsList()
 {
     JsonDataGridResult jsonDataGridResult = new JsonDataGridResult();
     List<News> list = null;
     try
     {
         SqlHelper.Initialization();
         list = DAL.NewsService.GetList("select top(5) * from PSS_News order by news_Id desc");//desc
         if (list != null && list.Count() > 0)
         {
             foreach (News model in list)
             {
                 jsonDataGridResult.rows.Add(model);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 10
0
 public ActionResult TeamDelete(int? id)
 {
     JsonDataGridResult jsonResult = new JsonDataGridResult();
     try
     {
         if (id.HasValue)
         {
             Team model = TeamService.GetModel(id.Value);
             TeamService.Delete(model);
             jsonResult.result = true;
             jsonResult.message = "";
         }
         else
         {
             jsonResult.message = "Id is null!";
         }
     }
     catch (Exception ex)
     {
         jsonResult.message = ex.Message;
     }
     return Json(jsonResult, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 11
0
        public ContentResult TeamSave(Team model, int? id)
        {
            JsonDataGridResult jsonResult = new JsonDataGridResult();
            try
            {
                Team team = null;
                if (id.HasValue)
                {
                    team = TeamService.GetModel(id.Value);
                }
                else
                {
                    team = new Team();
                }

                team.Team_User_Id = model.Team_User_Id;
                team.Team_Proj_Id = model.Team_Proj_Id;
                team.Team_Title = model.Team_Title;
                team.Team_Status = 0;
                team.Team_Update_Time = DateTime.Now;

                if (id.HasValue)
                {
                    TeamService.Update(team);
                }
                else
                {
                    TeamService.Save(team);
                }
                jsonResult.result = true;
                jsonResult.message = "";
            }
            catch (Exception ex)
            {
                jsonResult.result = false;
                jsonResult.message = ex.Message;
            }
            string result = JsonConvert.SerializeObject(jsonResult);
            return Content(result);
        }
Exemplo n.º 12
0
        public ContentResult UserSave(User userModel, int?id)
        {
            JsonDataGridResult jsonResult = new JsonDataGridResult();
            try
            {
                User user = null;
                if (id.HasValue)
                {
                    user = UserService.GetModel(id.Value);
                }
                else if(UserService.IsExistName(userModel.user_Name,userModel.user_Trimester_Id))
                {
                    jsonResult.result = false;
                    jsonResult.message = "There is already exist the name, please change a userName!";
                    return Content(JsonConvert.SerializeObject(jsonResult));
                }
                else
                {
                    user = new User();
                    user.user_Register_Time = DateTime.Now;
                    user.user_Log_Time = DateTime.Now;
                }

                user.user_Name = userModel.user_Name;
                user.user_Password =SqlHelper.Fun_Secret(userModel.user_Password);
                user.user_Email = userModel.user_Email;
                user.user_Telephone = userModel.user_Telephone;
                //user.user_Is_Teacher = userModel.user_Is_Teacher;
                user.user_Skill = userModel.user_Skill;
                user.user_Introduction = userModel.user_Introduction;
                user.user_Update_Time = DateTime.Now;
                user.user_Trimester_Id = userModel.user_Trimester_Id;
                user.user_Statue = true;

                if (id.HasValue)
                {
                    UserService.Update(user);
                }
                else
                {
                    UserService.Save(user);
                }
                jsonResult.result = true;
                jsonResult.message = "";
            }
            catch (Exception ex)
            {
                jsonResult.result = false;
                jsonResult.message = ex.Message;
            }
            string result = JsonConvert.SerializeObject(jsonResult);
            return Content(result);
        }
Exemplo n.º 13
0
        public ContentResult UserPersonalProfileSave(User userModel)
        {
            JsonDataGridResult jsonResult = new JsonDataGridResult();
            try
            {
                string userName = User.Identity.Name.Split(',')[1];
                int userId = Convert.ToInt32(User.Identity.Name.Split(',')[0]);

                User user = UserService.GetModel(userId);

                user.user_Email = userModel.user_Email;
                user.user_Telephone = userModel.user_Telephone;
                user.user_Skill = userModel.user_Skill;
                user.user_Introduction = base.Server.UrlDecode(userModel.user_Introduction);
                user.user_Update_Time = DateTime.Now;
                user.user_Trimester_Id = userModel.user_Trimester_Id;
                user.User_Email_Visiable = userModel.User_Email_Visiable;
                user.User_Telephone_Visiable = userModel.User_Telephone_Visiable;

                user.user_Update_Time = DateTime.Now;

                UserService.Update(user);
                jsonResult.result = true;
                jsonResult.message = "";
            }
            catch (Exception ex)
            {
                jsonResult.result = false;
                jsonResult.message = ex.Message;
            }
            string result = JsonConvert.SerializeObject(jsonResult);
            return Content(result);
        }
Exemplo n.º 14
0
        public ContentResult IdeaSave(Idea model, int? id)
        {
            JsonDataGridResult jsonResult = new JsonDataGridResult();
            try
            {
                Idea idea = null;
                if (id.HasValue)
                {
                    idea = IdeaService.GetModel(id.Value);
                }
                else
                {
                    idea = new Idea();
                    idea.Idea_Presenter = User.Identity.Name.Split(',')[1];
                }

                idea.Idea_Title = model.Idea_Title;
                idea.Idea_Staff_Contact = model.Idea_Staff_Contact;
                idea.Idea_Client_Contact = model.Idea_Client_Contact;
                idea.Idea_Client_Company = model.Idea_Client_Company;
                idea.Idea_Valid_Dates = model.Idea_Valid_Dates;
                idea.Idea_Students_Num = model.Idea_Students_Num;
                idea.Idea_Continuation = model.Idea_Continuation;
                idea.Idea_Description = model.Idea_Description;
                idea.Idea_Skills_Required = model.Idea_Skills_Required;
                idea.Idea_Context = model.Idea_Context;
                idea.Idea_Goals = model.Idea_Goals;

                idea.Idea_Features = model.Idea_Features;
                idea.Idea_Challenges = model.Idea_Challenges;
                idea.Idea_Opportunities = model.Idea_Opportunities;
                idea.Idea_Trimester_Id = model.Idea_Trimester_Id;
                idea.Idea_Update_Time = DateTime.Now;
                idea.Idea_Advisor_Contact = model.Idea_Advisor_Contact;
                idea.Idea_Status = model.Idea_Status;

                if (id.HasValue)
                {
                    IdeaService.Update(idea);
                }
                else
                {
                    IdeaService.Save(idea);
                }
                jsonResult.result = true;
                jsonResult.message = "";
            }
            catch (Exception ex)
            {
                jsonResult.result = false;
                jsonResult.message = ex.Message;
            }
            string result = JsonConvert.SerializeObject(jsonResult);
            return Content(result);
        }
Exemplo n.º 15
0
 public ContentResult ProjectImport(int trimesterId,string idList)
 {
     JsonDataGridResult jsonResult = new JsonDataGridResult();
     try
     {
         List<Project> listOld = ProjectService.GetList(idList);
         List<Project> listNew = new List<Project>();
         foreach (Project model in listOld)
         {
             model.Proj_Trimester_Id = trimesterId;
             listNew.Add(model);
         }
         if (listNew != null && listNew.Count() > 0)
         {
             ProjectService.SaveList(listNew);
             jsonResult.result = true;
             jsonResult.message = "";
         }
     }
     catch (Exception ex)
     {
         jsonResult.result = false;
         jsonResult.message = ex.Message;
     }
     string result = JsonConvert.SerializeObject(jsonResult);
     return Content(result);
 }
Exemplo n.º 16
0
        public ContentResult TrimesterSave(Trimester model, int? id)
        {
            JsonDataGridResult jsonResult = new JsonDataGridResult();
            try
            {
                Trimester trimester = null;
                if (id.HasValue)
                {
                    trimester = TrimesterService.GetModel(id.Value);
                }
                else
                {
                    trimester = new Trimester();
                }

                trimester.tri_Name = model.tri_Name;
                trimester.tri_IsOpen = model.tri_IsOpen;
                trimester.tri_StartDate = model.tri_StartDate;
                trimester.tri_EndDate = model.tri_EndDate;

                if (id.HasValue)
                {
                    TrimesterService.Update(trimester);
                }
                else
                {
                    TrimesterService.Save(trimester);
                }
                jsonResult.result = true;
                jsonResult.message = "";
            }
            catch (Exception ex)
            {
                jsonResult.result = false;
                jsonResult.message = ex.Message;
            }
            string result = JsonConvert.SerializeObject(jsonResult);
            return Content(result);
        }
Exemplo n.º 17
0
        public ContentResult NewsSave(News model, int? id)
        {
            JsonDataGridResult jsonResult = new JsonDataGridResult();
            try
            {
                News news = null;
                if (id.HasValue)
                {
                    news = NewsService.GetModel(id.Value);
                }
                else
                {
                    news = new News();
                }
                news.news_Title = model.news_Title;
                news.news_Content = base.Server.UrlDecode(model.news_Content);
                news.news_Update_Time = DateTime.Now;

                if (id.HasValue)
                {
                    NewsService.Update(news);
                }
                else
                {
                    NewsService.Save(news);
                }
                jsonResult.result = true;
                jsonResult.message = "";
            }
            catch (Exception ex)
            {
                jsonResult.result = false;
                jsonResult.message = ex.Message;
            }
            string result = JsonConvert.SerializeObject(jsonResult);
            return Content(result);
        }
Exemplo n.º 18
0
 public ContentResult IdeaDiscSave(Idea_Discussion model, int ideaId)
 {
     JsonDataGridResult jsonResult = new JsonDataGridResult();
     try
     {
         Idea_Discussion ideaDisc = new Idea_Discussion();
         ideaDisc.Idea_Disc_Idea_Id = ideaId;
         ideaDisc.Idea_Disc_Content = model.Idea_Disc_Content;
         ideaDisc.Idea_Disc_Time = DateTime.Now;
         ideaDisc.Idea_Disc_User_Id = Convert.ToInt32(User.Identity.Name.Split(',')[0]);
         IdeaDiscussionService.Save(ideaDisc);
         jsonResult.result = true;
         jsonResult.message = "";
     }
     catch (Exception ex)
     {
         jsonResult.result = false;
         jsonResult.message = ex.Message;
     }
     string result = JsonConvert.SerializeObject(jsonResult);
     return Content(result);
 }
Exemplo n.º 19
0
        public ContentResult ProjectSave(Project model, int? id)
        {
            JsonDataGridResult jsonResult = new JsonDataGridResult();
            try
            {
                Project project = null;
                if (id.HasValue)
                {
                    project = ProjectService.GetModel(id.Value);
                }
                else
                {
                    project = new Project();
                    project.Proj_Presenter = User.Identity.Name.Split(',')[1];
                }

                project.Proj_Title = model.Proj_Title;
                project.Proj_Staff_Contact = model.Proj_Staff_Contact;
                project.Proj_Client_Contact = model.Proj_Client_Contact;
                project.Proj_Client_Company = model.Proj_Client_Company;
                project.Proj_Valid_Dates = model.Proj_Valid_Dates;
                project.Proj_Students_Num = model.Proj_Students_Num;
                project.Proj_Continuation = model.Proj_Continuation;
                project.Proj_Description = model.Proj_Description;
                project.Proj_Skills_Required = model.Proj_Skills_Required;
                project.Proj_Context = model.Proj_Context;
                project.Proj_Goals = model.Proj_Goals;

                project.Proj_Features = model.Proj_Features;
                project.Proj_Challenges = model.Proj_Challenges;
                project.Proj_Opportunities = model.Proj_Opportunities;
                project.Proj_Trimester_Id = model.Proj_Trimester_Id;
                project.Proj_Update_Time = DateTime.Now;

                if (id.HasValue)
                {
                    ProjectService.Update(project);
                }
                else
                {
                    ProjectService.Save(project);
                }
                jsonResult.result = true;
                jsonResult.message = "";
            }
            catch (Exception ex)
            {
                jsonResult.result = false;
                jsonResult.message = ex.Message;
            }
            string result = JsonConvert.SerializeObject(jsonResult);
            return Content(result);
        }