public JsonResult ShowData(string fromDate, string toDate, int actions, int status = 1) { try { MISReports misReportsVM = new MISReports(); misReportsVM.GetUserDetails(); misReportsVM.GetUserActions(); misReportsVM.GetActions(); Actions action = new Actions(); if (Enum.IsDefined(typeof(Actions), actions)) { action = (Actions)actions; } operation = action.ToString(); if (actions == Convert.ToInt32(Actions.Modify) || actions == Convert.ToInt32(Actions.Delete)) { res = (from uaa in misReportsVM.lstUserActions join ua in misReportsVM.lstUserData on uaa.AuthID equals ua.UserID join uc in misReportsVM.lstUserData on uaa.CreatorID equals uc.UserID where uaa.CreatedDate >= Convert.ToDateTime(fromDate) && uaa.CreatedDate <= Convert.ToDateTime(toDate) && uaa.ActionID == actions select new usermngdata { UserName = uaa.UserName, CreatorName = uc.UserName, AuthName = ua.UserName, CreateDate = string.Format("{0:dd/MM/yyyy}", uaa.CreatedDate), ActionName = uaa.ActionID == 2 ? "Modify" : "Delete" }).ToList(); return(Json(res, JsonRequestBehavior.AllowGet)); } else { string statusflag = status == 1 ? "1" : "0"; res = (from a in misReportsVM.lstUserData join ua in misReportsVM.lstUserData on a.AuthID equals ua.UserID join u in misReportsVM.lstUserData on a.CreatorID equals u.UserID where u.CreatedDate >= Convert.ToDateTime(fromDate) && u.CreatedDate <= Convert.ToDateTime(toDate) && a.Active == statusflag select new usermngdata { CreatorName = u.UserName, AuthName = ua.UserName, UserName = u.UserName, CreateDate = string.Format("{0:dd/MM/yyyy}", u.CreatedDate), Status = a.Active == "1" ? "Active" : "InActive", ActionName = "Add" }).ToList(); return(Json(res, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { throw; } }
public JsonResult ShowData(string fromDate, string toDate, string actions, string status) { try { MISReports misReportsVM = new MISReports(); misReportsVM.GetUserDetails(); misReportsVM.GetUserActions(); misReportsVM.GetActions(); operation = actions; if (actions == "Modify" || actions == "Delete") { res = (from a in misReportsVM.lstActions join ua in misReportsVM.lstUserActions on a.ActionID equals ua.ActionID join u in misReportsVM.lstUserData on ua.UserID equals u.UserID join g in misReportsVM.lstUserData on u.AuthID equals g.UserID where u.CreatedDate >= Convert.ToDateTime(fromDate) && u.CreatedDate <= Convert.ToDateTime(toDate) && a.ActionName == actions select new usermngdata { CreatorName = u.UserName, AuthName = g.UserName, UserName = u.UserName, CreateDate = string.Format("{0:dd/MM/yyyy}", u.CreatedDate) }).ToList(); return(Json(res, JsonRequestBehavior.AllowGet)); } else { string statusflag = status == "Active" ? "1" : "0"; res = (from a in misReportsVM.lstActions join ua in misReportsVM.lstUserActions on a.ActionID equals ua.ActionID join u in misReportsVM.lstUserData on ua.UserID equals u.UserID join g in misReportsVM.lstUserData on u.AuthID equals g.UserID where u.CreatedDate >= Convert.ToDateTime(fromDate) && u.CreatedDate <= Convert.ToDateTime(toDate) && a.ActionName == actions && u.Active == statusflag select new usermngdata { CreatorName = u.UserName, AuthName = g.UserName, UserName = u.UserName, CreateDate = string.Format("{0:dd/MM/yyyy}", u.CreatedDate), Status = u.Active == "1" ? "Active" : "InActive" }).ToList(); return(Json(res, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { throw; } }
public ActionResult Index()//string actionName { try { string urlPart = @"/Client"; if (System.Web.HttpContext.Current.Request.UrlReferrer.ToString().IndexOf(urlPart) > 0) { Session["PreviousURL"] = System.Web.HttpContext.Current.Request.UrlReferrer; } operation = ""; selectdValueCopy = ""; byRegionCopy = ""; byApplicationCopy = ""; //actionName1 = actionName; misReportsViewModel.GetUserDetails(); misReportsViewModel.GetUserActions(); misReportsViewModel.GetActions(); misReportsViewModel.GetApplicationRegionDetails(); misReportsViewModel.GetAllDetails(); //var Actionlist = new SelectList(new[] //{ // new { ID = "1", Name = "Active" }, // new { ID = "0", Name = "Inactive" }, //}, // "ID", "Name", 1); //ViewData["list"] = Actionlist; //User Management misreportsList = ((IEnumerable <MISReports>) from u in misReportsViewModel.lstUserData join e in misReportsViewModel.lstUserData on u.CreatorID equals e.UserID join g in misReportsViewModel.lstUserData on u.AuthID equals g.UserID where u.Active == "1" select new MISReports { CreatorName = e.UserName, AuthName = g.UserName, UserName = u.UserName, CreateDate = u.CreatedDate, Status = Convert.ToBoolean(Convert.ToInt32(u.Active)) }).ToList(); dt = usermngdata.ToDataTable(misreportsList.Select(x => new usermngdata { UserName = x.UserName, AuthName = x.AuthName, CreatorName = x.CreatorName, CreateDate = string.Format("{0:dd/MM/yyyy}", x.CreateDate), Status = x.Status.ToString() == "True" ? "Active" : "InActive", ActionName = "Add" }).ToList()); ViewData["misReportsViewModel2"] = misreportsList; //Client Information misreportsList1 = ((IEnumerable <MISReports>) from g in misReportsViewModel.lstClients join h in misReportsViewModel.lstProjects on g.ClientID equals h.ClientId join i in misReportsViewModel.lstApplication on h.ProjectID equals i.ProjectId join j in misReportsViewModel.lstAppVersion on i.AppVersion equals j.Id join bp in misReportsViewModel.BankTypeList on i.BankType equals bp.Value join k in misReportsViewModel.lstRegion on h.RegionId equals k.Id select new MISReports { ClientName = g.ClientName, projectName = h.ProjectName, ApplicationName = i.ApplicationName, appVersion = j.AppVersion, BankTypeName = bp.Key, RegionName = k.Region }).ToList(); dt1 = usermngdata.ToDataTable(misreportsList1.Select(x => new clientInfo { ClientName = x.ClientName, ProjectName = x.projectName, ApplicationName = x.ApplicationName, AppVersion = x.appVersion, BankTypeName = x.BankTypeName, RegionName = x.RegionName }).ToList()); ViewData["misReportsViewModel1"] = misreportsList1; misReportsViewModel.RegionList = misReportsViewModel.lstRegion.Select(m => m.Region).Distinct().Select(i => new SelectListItem() { Text = i.ToString(), Value = i }).ToList(); ViewBag.applicationids = misReportsViewModel.lstApplication.Where(x => x.ApplicationID == 0).Select(m => m.ApplicationName).Distinct().Select(i => new SelectListItem() { Text = i.ToString(), Value = i }); return(View(misReportsViewModel)); } catch (Exception ex) { throw; } }