public ActionResult PreviewNews() { var newsboardcomp = new NewBoardComponent(); var news = newsboardcomp.GetNewsCollection(); ViewBag.news = news; return(View()); }
public JsonResult GetNewsCollection() { List <NewsboardEntity> AccDetails = null; try { var objDtl = new NewBoardComponent(); AccDetails = objDtl.GetNewsCollection(); } catch (Exception ex) { return(null); } return(Json(AccDetails, JsonRequestBehavior.AllowGet)); }
public string AddNews(NewsboardEntity news) { string strResponse = string.Empty; var orgcomponent = new NewBoardComponent(); UserSessionInfo objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo; int _userID = objSessioninfo.UserId; news.CreatedBy = _userID; string imagename = string.Empty; if (Request.Files.Count > 0) { var file = Request.Files[0]; var fileName = "/uploadimages/Images/" + file.FileName; imagename = file.FileName; var imagepath = Server.MapPath(fileName); file.SaveAs(imagepath); } if (imagename == "") { news.Image = "newsDefault.jpg"; } else { news.Image = imagename; } int r = orgcomponent.AddNews(news); if (r > 0) { strResponse = "News Added successfully"; } else if (r == 0) { strResponse = "News already exists"; } else if (r < 0) { strResponse = "Error occured in Adding News"; } return(strResponse); }
public ActionResult DashBoard1() { UserSessionInfo info = new UserSessionInfo(); string rolename = info.RoleName; int accid = info.AccountId; int Mid = info.UserId; ViewBag.userid = Convert.ToInt32(Session["UserId"]); LeaveTypeComponent LeaveTypeComponent = new LeaveTypeComponent(); var projectslist = LeaveTypeComponent.GetAllProjects().Select(a => new SelectListItem() { Value = a.Proj_ProjectID.ToString(), Text = a.Proj_ProjectName, }); var newsboardcomp = new NewBoardComponent(); var news = newsboardcomp.GetNewsCollection(); ViewBag.news = news; ViewBag.projectslist = projectslist; EvolutyzCornerDataEntities db = new EvolutyzCornerDataEntities(); int accountcount = (from a in db.Accounts where a.Acc_AccountID != 502 && a.Acc_isDeleted == false select new DashboardMails { accountid = a.Acc_AccountID }).Count(); int userscount = (from a in db.Users where a.Usr_UserID != 501 && a.Usr_isDeleted == false && a.Usr_AccountID == accid select new DashboardMails { users = a.Usr_UserID }).Count(); int allusers = (from a in db.Users where a.Usr_UserID != 501 && a.Usr_isDeleted == false select new DashboardMails { users = a.Usr_UserID }).Count(); int projects = (from a in db.Projects where a.Proj_isDeleted == false && a.Proj_AccountID == accid select new DashboardMails { Proj_ProjectID = a.Proj_ProjectID }).Count(); int skillslist = (from a in db.Skills where a.Acc_AccountID == accid && a.Sk_isDeleted == false select new DashboardMails { SkillId = a.SkillId }).Count(); int timesheetscnt = (from t in db.TIMESHEETs join u in db.Users on t.UserID equals u.Usr_UserID join a in db.Accounts on u.Usr_AccountID equals a.Acc_AccountID where a.Acc_AccountID == accid select new DashboardMails { TimesheetID = t.TimesheetID }).Count(); //var getempsformangrs = (from up in db.UserProjects // where up.UProj_L1_ManagerId == Mid || up.UProj_L2_ManagerId == Mid // select new DashboardMails // { // UProj_UserID = up.UProj_UserID // }).ToList(); //var getempsformangrs = () var gettimesheetid = db.UserProjects.Where(a => a.UProj_UserID == info.UserId).Select(a => a.TimesheetMode).FirstOrDefault(); //foreach(var item in gettimesheetid) //{ //} TempData["gettimesheetid"] = gettimesheetid; ViewBag.timesheetscnt = timesheetscnt; ViewBag.skillslist = skillslist; ViewBag.projects = projects; ViewBag.users = userscount; ViewBag.allusers = allusers; ViewBag.acountcount = accountcount; ViewBag.username = rolename; int?userid = info.UserId; var userstatus = (from u in db.Users where u.Usr_UserID == userid select new UserEntity { Usr_ActiveStatus = u.Usr_ActiveStatus }).ToList(); bool?status = userstatus[0].Usr_ActiveStatus; if (status == false) { return(RedirectToAction("ChangePassword")); } else { return(View()); } }