/// <summary> /// Create parameters with ViewData cache /// </summary> /// <param name="parameters"></param> /// <param name="viewData"></param> /// <returns></returns> internal static object[] CreateParameters(ParameterInfo[] parameters, ViewData viewData) { object[] parameterValues = new object[parameters.Length]; string requestMethod = WebAppContext.Request.ServerVariables["REQUEST_METHOD"].ToUpper(); bool isPost = (requestMethod == "POST"); object value; for (int i = 0; i < parameters.Length; i++) { string key = parameters[i].Name; Type parameterType = parameters[i].ParameterType; if (viewData.TryGetValue(key, out value)) { if (value.GetType() != parameterType) { value = GetClientValue(key, parameterType, isPost); viewData[key] = value; } } else { value = GetClientValue(key, parameterType, isPost); viewData.Add(key, value); } parameterValues[i] = value; } return parameterValues; }
public override void CargarViewData(EstadoABMC estado) { var entidades = ServiceLocator.Current.GetInstance <IEntidadesGeneralesRules>(); var tiposCargo = ServiceLocator.Current.GetInstance <ITipoCargoRules>(); string idProvincia = ConfigurationManager.AppSettings.Get("IdProvincia"); ViewData.Add(ViewDataKey.ASIGNATURA.ToString(), entidades.GetAsignaturaAll()); ViewData.Add(ViewDataKey.DEPARTAMENTO_PROVINCIAL.ToString(), entidades.GetDepartamentoProvincialByProvincia(idProvincia)); ViewData.Add(ViewDataKey.DIRECCION_NIVEL.ToString(), entidades.GetDireccionDeNivelAll()); ViewData.Add(ViewDataKey.NIVEL_EDUCATIVO.ToString(), entidades.GetNivelEducativoAll()); ViewData.Add(ViewDataKey.LOCALIDAD.ToString(), entidades.GetLocalidadByProvincia(idProvincia)); ViewData.Add(ViewDataKey.TIPO_CARGO.ToString(), tiposCargo.FiltroBusquedaTipoCargo(null, null, null, null, null, EstadoTipoCargoEnum.VIGENTE)); ViewData.Add(ViewDataKey.TIPO_INSTRUMENTO_LEGAL.ToString(), entidades.GetTipoInstrumentoLegalAll()); ViewData.Add(ViewDataKey.TIPO_DOCUMENTO.ToString(), entidades.GetTipoDocumentoAll()); ViewData.Add(ViewDataKey.TITULO.ToString(), entidades.GetTituloAll()); ViewData.Add(ViewDataKey.SITUACION_REVISTA.ToString(), entidades.GetSituacionRevistaAll()); ViewData.Add(ViewDataKey.SUCURSAL_BANCARIA.ToString(), entidades.GetSucursalBancariaAll()); ViewData.Add(ViewDataKey.MOTIVO_BAJA.ToString(), entidades.GetMotivoBajaAgenteAll()); }
public ActionResult Index(string[] groups) { var exclude = new[] { "Настройки почтового сервера", "Настройки для 1С", "Настройки для изображений", "Настройки оформления заказа", "Настройки для квитанций", "Настройки онлайн-чата", "Общие настройки каталога", "Настройки шапки сайта" }; var list = db.SiteSettings.Where(x => !exclude.Contains(x.GroupName)).OrderBy(x => x.OrderNum); if (groups != null && groups.Any()) { list = list.Where(x => groups.Contains(x.GroupName)) .OrderBy(x => x.OrderNum); } foreach (var setting in list) { ViewData.Add(setting.Setting, setting.oValue); } ViewBag.TitleBlock = "Общие настройки"; return(View(list)); }
public ActionResult Edit(int id, FormCollection collection) { var model = this.IDKLManagerService.SelectDevice(id); ViewData.Add("CheckState", new SelectList(EnumHelper.GetItemValueList <EnumCheckState>(), "Key", "Value")); if (model != null) { try { this.TryUpdateModel <DeviceModel>(model); this.IDKLManagerService.UpDateDevice(model); } catch (Exception ex) { return(Back(ex.Message)); } } return(this.RefreshParent()); }
public ActionResult ElencoTitoliViaggio(decimal idTitoliViaggio) { try { using (dtTitoliViaggi dttv = new dtTitoliViaggi()) { List <ElencoTitoliViaggioModel> ltvm = new List <ElencoTitoliViaggioModel>(); var atv = dttv.GetUltimaAttivazioneTitoliViaggio(idTitoliViaggio); decimal idAttivazioneTitoliViaggio = atv.IDATTIVAZIONETITOLIVIAGGIO; if (idAttivazioneTitoliViaggio > 0) { ltvm = dttv.ElencoTitoliViaggio(idTitoliViaggio); } using (dtTrasferimento dtt = new dtTrasferimento()) { var t = dtt.GetTrasferimentoByIdTitoloViaggio(idTitoliViaggio); EnumStatoTraferimento statoTrasferimento = t.idStatoTrasferimento; ViewData.Add("statoTrasferimento", statoTrasferimento); } bool richiestaEseguita = dttv.richiestaEseguita(idTitoliViaggio); ViewData.Add("richiestaEseguita", richiestaEseguita); ViewData.Add("idTitoliViaggio", idTitoliViaggio); ViewData.Add("idAttivazioneTitoliViaggio", idAttivazioneTitoliViaggio); return(PartialView(ltvm)); } } catch (Exception ex) { return(PartialView("ErrorPartial", new MsgErr() { msg = ex.Message })); } }
/// <summary> /// GET: Feedbacks/Create /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <ActionResult> Create(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var reservation = await context.Reservations.SingleOrDefaultAsync(r => r.Reservation_Id == id); if (reservation != null && reservation.Passenger != null && reservation.Feedback == null) { ViewData.Add("Passenger", reservation.User_Passenger.Username); } else { return(HttpNotFound()); } ViewData.Add("Driver", reservation.User_Driver.Username); return(View()); }
public ActionResult ExportAreaMap(int year = 0, int month = 0, DateTime?begin = null, DateTime?end = null) { MapChartDataModel <decimal> orderCounts = new MapChartDataModel <decimal>(); MapChartDataModel <decimal> orderAmounts = new MapChartDataModel <decimal>(); var title = string.Empty; if (begin.HasValue && end.HasValue) { orderCounts = StatisticApplication.GetAreaOrderChart(SaleDimension.Count, begin.Value, end.Value); orderAmounts = StatisticApplication.GetAreaOrderChart(SaleDimension.Amount, begin.Value, end.Value); title = string.Format("区域统计_{0}至{1}", begin.Value.ToString("yyyy-MM-dd"), end.Value.ToString("yyyy-MM-dd")); } else { if (year == 0) { year = DateTime.Now.Year; } if (month == 0) { month = DateTime.Now.Month; } orderCounts = StatisticApplication.GetAreaOrderChart(SaleDimension.Count, year, month); orderAmounts = StatisticApplication.GetAreaOrderChart(SaleDimension.Amount, year, month); title = string.Format("区域统计_{0}年{1}月", year, month); } var list = new List <AreaMapExportSubModel>(); for (int i = 0; i < orderCounts.Data.Count; i++) { list.Add(new AreaMapExportSubModel { RegionName = orderCounts.Data[i].Name, OrderCount = (int)orderCounts.Data[i].Value, OrderAmount = orderAmounts.Data[i].Value }); } ViewData.Model = list; ViewData.Add("Title", title); string viewHtml = RenderPartialViewToString(this, "ExportAreaMap"); return(File(System.Text.Encoding.UTF8.GetBytes(viewHtml), "application/ms-excel", title + ".xls")); }
public ActionResult Edit(int id) { var model = new ProjectWholeInfoViewModel(); model.projectBasicinfo = this.IDKLManagerService.GetProjectInfo(id); if (model.projectBasicinfo != null) { string fileName = CreateBarCode(model.projectBasicinfo.ProjectNumber); if (fileName != null) { string filePath = fileName.Substring(fileName.IndexOf("Upload") - 1); ViewData.Add("ProjectBarCodeImg", filePath); } model.projectBasicImgFile = this.IDKLManagerService.GetProjectFile(model.projectBasicinfo.ProjectNumber); model.projectConsultBasicinfo = this.IDKLManagerService.GetConsultBasicInfo(model.projectBasicinfo.ProjectNumber); } this.RenderMyViewData(model); return(View(model)); }
public IActionResult Index() { var user = HttpContext.User; ViewData["User"] = user; //CALL API var httpClient = PrepareAuthenticatedClient().GetAwaiter().GetResult(); var resultApi = GetTest(httpClient).GetAwaiter().GetResult(); ViewData.Add("ResultApi", resultApi); //CALL API GRAPH var resultApiGraph = GetTestGraph(httpClient).GetAwaiter().GetResult(); ViewData.Add("ResultApiGraph", resultApiGraph); return(View()); }
// GET: UserManage public ActionResult Index() { log.Info("index"); userService.getAllRole(); ViewData.Add("roles", userService.userManageModels.sysRole); SelectList roles = new SelectList(userService.userManageModels.sysRole, "ROLE_ID", "ROLE_NAME"); ViewBag.roles = roles; //將資料存入TempData 減少不斷讀取資料庫 TempData.Remove("roles"); TempData.Add("roles", userService.userManageModels.sysRole); //DepartmentManage DepartmentManage ds = new DepartmentManage(); SelectList dep_code = new SelectList(ds.getDepartmentOrg(1), "DEPT_CODE", "DEPT_NAME"); ViewBag.dep_code = dep_code; return(View()); }
public ActionResult DocHistory(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Project project = db.Projects.Find(id); if (project == null) { return(HttpNotFound()); } var events = db.Events.Where(t => t.ProjectID.Equals(project.ID)); //ViewBag.Events = events.OrderByDescending(t => t._Date).Take(1000); ViewData.Add("Events", events); return(View(project)); }
public IActionResult Index() { string savePath = configuration.GetValue <string>("SavePath"); DirectoryInfo di = new DirectoryInfo(savePath); var files = di.GetFiles(); List <FileDetail> fileDetails = new List <FileDetail>(); foreach (var file in files) { fileDetails.Add( new FileDetail { FileName = file.Name, FilePath = file.FullName } ); } ViewData.Add("fileDetails", fileDetails); return(View()); }
public async Task <ActionResult> EditarEnquete(int enqueteId) { var enquete = await this.service.RetornarEnquetePorId(enqueteId); var respostas = enquete.Pergunta.Resposta; if (respostas != null && respostas.Any()) { ViewData.Add("Respostas", AutoMapper.Mapper.Map <ICollection <RespostaViewModel> >(respostas)); } var categorias = await this.serviceUsuario.RetornarCategoriasDisponniveis(); var cats = enquete.EnqueteCategoria.Select(x => x.CategoriaId).ToList(); ViewData.Add("CategoriasForSelectList", PreparaParaListaDeCategorias(categorias, cats)); return(View(AutoMapper.Mapper.Map <EnqueteViewModel>(enquete))); }
public ActionResult ExportProductStatistic(DateTime startDate, DateTime endDate) { ProductStatisticQuery query = new ProductStatisticQuery { PageSize = int.MaxValue, PageNo = 1, StartDate = startDate, EndDate = endDate }; var model = StatisticApplication.GetProductSales(query); ViewData.Model = model.Models; string Title = startDate.ToString("yyyy-MM-dd") + "至" + endDate.ToString("yyyy-MM-dd") + "商品统计数据"; ViewData.Add("Title", Title); string viewHtml = RenderPartialViewToString(this, "ExportProductStatistic"); return(File(System.Text.Encoding.UTF8.GetBytes(viewHtml), "application/ms-excel", "商品销售情况.xls")); }
} //下载合同 public ActionResult ReadProjectFiles(int id) { var model = this.IDKLManagerService.GetProjectInfo(id); var list = this.IDKLManagerService.GetProjectFilesByProjectNumber(model.ProjectNumber); var selectListTemp = list.Select(c => c.FilePath).Distinct().ToList(); List <string> selectlist = new List <string>(); int laseIndex = 0; foreach (var item in selectListTemp) { laseIndex = item.LastIndexOf("\\"); selectlist.Add(item.Substring(laseIndex + 1, item.Length - laseIndex - 1)); laseIndex = 0; } FilePaths = list.Select(u => u.FilePath).ToList(); ViewData.Add("FilesName", new SelectList(selectlist.Distinct())); return(View()); } //阅览审核报告
// GET: Endpoints/Details/5 public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var endpoint = await _context.Endpoints .SingleOrDefaultAsync(m => m.Id == id); if (endpoint == null) { return(NotFound()); } ViewData.Add("State", _stateService.GetStatus(endpoint.Id)); return(View(endpoint.ToEndpointViewModel())); }
public ActionResult PdfToPdfAConverter(string Browser, string conformance, HttpPostedFileBase file = null) { if (file != null && file.ContentLength > 0) { //Load an existing PDF. PdfLoadedDocument doc = new PdfLoadedDocument(file.InputStream); if (conformance == "PDF/A-1b") { //Create a new document with PDF/A standard. doc.Conformance = PdfConformanceLevel.Pdf_A1B; } else if (conformance == "PDF/A-2b") { //Create a new document with PDF/A standard. doc.Conformance = PdfConformanceLevel.Pdf_A2B; } else if (conformance == "PDF/A-3b") { //Create a new document with PDF/A standard. doc.Conformance = PdfConformanceLevel.Pdf_A3B; } string[] fileName = file.FileName.Split(new string[] { ".pdf" }, StringSplitOptions.RemoveEmptyEntries); //Stream the output to the browser. if (Browser == "Browser") { return(doc.ExportAsActionResult(fileName[0] + "_A.pdf", HttpContext.ApplicationInstance.Response, HttpReadType.Open)); } else { return(doc.ExportAsActionResult(fileName[0] + "_A.pdf", HttpContext.ApplicationInstance.Response, HttpReadType.Save)); } } else { ViewBag.lab = "Choose a valid PDF file."; ViewData.Add("conformance", new SelectList(new string[] { "PDF/A-1b", "PDF/A-2b", "PDF/A-3b" })); return(View()); } }
public IActionResult SaveStory(StoryModel storyModel) { StoryDAO dao = new StoryDAO(_connection); string editMode = Request.Form["editMode"]; int i = 0; if (ModelState.IsValid) { if (editMode == "insert") { i = dao.InsertStory(storyModel); } else { i = dao.UpdateStoryByKey(storyModel); } } if (i > 0) { ViewData["alertType"] = "alert alert-success"; ViewData["MSG"] = "更新成功"; } else { ViewData["alertType"] = "alert alert-danger"; ViewData["MSG"] = "更新失敗"; } //EditStory頁面所需資料 List <StoryModel> storyList = dao.GetStoryList(); ViewData.Add("StoryList", storyList); if (editMode == "insert" && i <= 0) { ViewData["EditMode"] = "insert";//新增失敗時保持新增模式 } else { ViewData["EditMode"] = "update";//新增成功時轉為更新模式 } return(View("~/Views/Story/EditStory.cshtml", storyModel)); }
public async Task <IActionResult> OnGetAsync(long?id) { if (id == null) { return(NotFound()); } if (_accountManage.IsLoggedIn != true || _accountManage.User.UserType != UserType.Admin) { return(RedirectToPage("/LoginPage")); } ViewData["User_Name"] = _accountManage.User.Name; ViewData.Add("ProfileImg", _accountManage.User.ProfileImageSrc); Department = await _db.Departments.Include(d => d.Designation).FirstOrDefaultAsync(d => d.Id == id); if (Department == null) { return(NotFound()); } DepartmentName = Department.Name; Designations = new List <DesignationModel>(); if (Department.Designation != null) { if (Department.Designation.Count > 0) { foreach (var item in Department.Designation) { Designations.Add(new DesignationModel() { Id = item.Id, Name = item.Name }); } } } return(Page()); }
protected override void OnActionExecuted(ActionExecutedContext filterContext) { if (User != null) { var context = new ApplicationDbContext(); var username = User.Identity.Name; if (!string.IsNullOrEmpty(username)) { var user = context.Users.SingleOrDefault(u => u.UserName == username); int cuenta = user.SaldoCuenta; //int preguntasOJO = (from p // in context.Pregunta // where p.UsuarioId == user.Id // && p.MejorUsuarioRespuestaId == null // && DateTime.Now <= DbFunctions.AddDays(p.Fechapregunta,10) // && DateTime.Now >= DbFunctions.AddDays(p.Fechapregunta, 5) // select p).Count(); if (user.Foto != null) { byte[] foto = user.Foto; string imreBase64Data = Convert.ToBase64String(foto); string imgDataURL = string.Format("data:image/png;base64,{0}", imreBase64Data); System.Diagnostics.Debug.WriteLine(imgDataURL); ViewData.Add("Foto", imgDataURL); } else { ViewData.Add("Foto", "https://img.icons8.com/color/user"); } ViewData.Add("Puntaje", cuenta); } } base.OnActionExecuted(filterContext); }
public ActionResult CadastroUsuario() { try { ViewBag.MensagemBodyController = ""; ViewBag.MensagemBodyAction = ""; ViewBag.MensagemBody = ""; CarregarDadosUsuarioParaTela(); if ((ViewData["idUsuario"] != null) && ((int)ViewData["idUsuario"] != 0)) { if ((int)ViewData["flUsuarioI"] == 1) { ViewData["Title"] = "Cadastro Usuário"; var viewModel = new CadastroUsuarioModel(); viewModel.usuario = new Models.Usuario.CadastroUsuarioModel.DadosLogin(); viewModel.permissoes = new Models.Usuario.CadastroUsuarioModel.DadosPermissoes(); viewModel.pessoa = new Models.Usuario.CadastroUsuarioModel.DadosPessoais(); return(View(viewModel)); } else { HttpContext.Session.SetString("MensagemTitle", "Erro"); HttpContext.Session.SetString("MensagemBody", "O usuário " + ViewData["nome"] + " não tem acesso a página: 'Usuario/CadastroUsuario'"); return(RedirectToAction("Index", "Home")); } } else { ViewData.Add("ReturnUrl", ((object[])this.ControllerContext.RouteData.Values.Values)[0] + "/" + ((object[])this.ControllerContext.RouteData.Values.Values)[1]); HttpContext.Session.SetString("MensagemBody", "Você não está logado no sistema! Realize o Login antes de acessar essa a página: '" + ViewData["ReturnUrl"] + "' !"); return(RedirectToAction("Signin", "Login", new { ReturnUrl = ViewData["ReturnUrl"] })); } } catch (Exception ex) { ViewBag.MensagemTitle = "Erro"; ViewBag.MensagemBodyController = "Controller: UsuarioController"; ViewBag.MensagemBodyAction = "Action: CadastroUsuario - GET"; ViewBag.MensagemBody = "Exceção: " + ex.Message; return(View()); } }
public BaseController(IConfiguracionRepository _configuracionRepository, IMensajeRepository _mensajeRepository, ILoggerService _loggerService) { configuracionRepository = _configuracionRepository; mensajeRepository = _mensajeRepository; loggerService = _loggerService; try { ViewData.Add("URL_TARJETAS_CREDITO_WEB", configuracionRepository.ObtenerConfiguracionPorClave(URL_TARJETAS_CREDITO_WEB).Valor); ViewData.Add("URL_INDIVIDUOS_WEB", GetBaseUrl()); System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); ViewData.Add("VERSION", fvi.ProductVersion); var url560wsBancor = configuracionRepository.ObtenerValorPorClave("URL_560_wsBancor_Seguridad"); var wsBancorSeg = new wsBancorSeguridad._560_wsBancor_Seguridad(url560wsBancor, Int32.MaxValue); var CanalId = 0; var CanalCodigo = 0; if (System.Web.HttpContext.Current.Session["CanalId"] == null && System.Web.HttpContext.Current.Session["CanalCodigo"] == null) { wsBancorSeg.TipoDeUsuarioAvanzado(SisId, UserId, ref CanalId, ref CanalCodigo); System.Web.HttpContext.Current.Session["CanalId"] = CanalId.ToString(); System.Web.HttpContext.Current.Session["CanalCodigo"] = CanalCodigo.ToString(); } if (System.Web.HttpContext.Current.Session["Usuario"] == null) { var Usuario = wsBancorSeg.LeeUsuario_ByID(UserId); System.Web.HttpContext.Current.Session["Usuario"] = Usuario; } } catch (Exception ex) { loggerService.ErrorLog(ex); } }
public ActionResult EditClient(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var client = new ClientInfoViewModel { Client = _context.Clients.Find(id), Price = _context.ClientPrices.AsEnumerable().LastOrDefault(p => p.ClientId == id) }; if (client == null) { return(HttpNotFound()); } ViewBag.Title = "Edit Client"; ViewBag.Message = "Edit Client"; if (client.Price == null) { ViewData.Add("Price.PerHourId", new SelectList(_context.PricePerHours.Where(p => p.Public == true).Select( p => new { Id = p.Id, Description = p.Description + " " + p.Price }), "Id", "Description")); } else { ViewData.Add("Price.PerHourId", new SelectList(_context.PricePerHours.Where(p => p.Public == true || p.ClientId == id).Select( p => new { Id = p.Id, Description = p.Description + " " + p.Price }), "Id", "Description", client.Price.PerHourId)); } return(View("NewClient", client)); }
public ActionResult NewVideo(MaterialModel model) { if (ModelState.IsValid) { var material = new JL.Core.Models.Material(); material.Title = model.Title; material.MaterialType = (int)MaterialType.Video; material.Description = model.Description; material.Status = model.Status ? 0 : 1; material.AddTime = model.AddTime ?? DateTime.Now; // 生成缩略图 // picture if (Request.Files != null && Request.Files.Count > 0 && Request.Files[0].ContentLength > 0) { string picture, filename; var success = FileHelper.SaveMaterial(Request.Files[0], material.MaterialType, out filename, out picture); if (success) { material.Picture = picture; material.FileName = filename; material.Url = model.FileName; } //for show model.Picture = picture; model.FileName = filename; model.Url = filename; } jlService.AddMaterial(material); ViewData.Add("ResultObject", ResultObject.Succeed()); } return(View()); }
// // GET: /DKLManager/Lab/ public ActionResult Index(ProjectInfoRequest request) { var userb = this.AccountService.GetUserListF(10).Select(c => new { Id = c.ID, Name = c.Name }); ViewData.Add("Person", new SelectList(userb, "Name", "Name")); request.SampleStates = (int)EnumSampleStates.NewSample; var results = this.IDKLManagerService.GetProjectInfoListP(request); if (results != null) { foreach (var r in results) { if (r.ProjectCategory == 5) { //var resuls = this.IDKLManagerService.GetSampleRegisterTableList(request); var usera = this.AccountService.GetUserListF(10).Select(c => new { Id = c.ID, Name = c.Name }); ViewData.Add("PersonW", new SelectList(usera, "Name", "Name")); request.SampleStates = (int)EnumSampleStates.NewSample; var resuls = this.IDKLManagerService.GetSampleRegisterTableList(request.userName, request); var users = this.AccountService.GetUser(this.LoginInfo.LoginName); request.UserAccountType = users.AccountType; request.userName = users.Name; ViewData.Add("ProjectPersonCategory", new SelectList(EnumHelper.GetItemValueList <EnumProjectPersonCategory>(), "Key", "Value")); return(View("WaterIndex", resuls)); } //else //{ // var userv = this.AccountService.GetUserListF(10).Select(c => new { Id = c.ID, Name = c.Name }); // ViewData.Add("Person", new SelectList(userv, "Name", "Name")); // request.SampleStates = (int)EnumSampleStates.NewSample; //} } } var user = this.AccountService.GetUser(this.LoginInfo.LoginName); request.UserAccountType = user.AccountType; request.userName = user.Name; var parameNew = this.IDKLManagerService.GetSampleRegisterTableList(request.userName, request); return(View(parameNew)); }
// GET: ShoppingCart public ActionResult detail() { var cookie = Request.Cookies[FormsAuthentication.FormsCookieName]; if (cookie == null) { return(RedirectToAction("Login", "Login")); } var ticket = FormsAuthentication.Decrypt(cookie.Value); var customer_service = new CustomerService(); var shopping_service = new ShoppingcartDetailsService(); var product_service = new ProductsService(); var photo_service = new ProductPhotoService(); var user = customer_service.FindByCustomerAccount(ticket.Name); var items = shopping_service.FindByCustomer(user.CustomerID); var result = new List <ShppingCartModel>(); foreach (var item in items) { ShppingCartModel model = new ShppingCartModel(); model.Image = photo_service.FindById(item.ProductID).First().PhotoPath; model.ProductID = item.ProductID; model.ProductName = product_service.FindByID(item.ProductID).ProductName; model.Color = product_service.FindByID(item.ProductID).Color; model.Size = product_service.FindByID(item.ProductID).Size; model.Amount = item.Quantity; model.UnitPrice = product_service.FindByID(item.ProductID).UnitPrice; model.Total = product_service.FindByID(item.ProductID).UnitPrice *item.Quantity; result.Add(model); } ViewData.Add("list", result); return(View()); }
public async Task <IActionResult> OnPostChangePassword() { OldPasswordDidntMatch = false; NewPasswordDidntMatch = false; if (_accountManage.User.Password == OldPassword) { if (NewPassword != "" && NewPassword2 != "" && NewPassword != null && NewPassword2 != null) { if (NewPassword == NewPassword2) { var user = await _db.Users.FindAsync(_accountManage.User.Id); user.Password = NewPassword; _accountManage.User.Password = NewPassword; await _db.SaveChangesAsync(); return(RedirectToPage()); } else { NewPasswordDidntMatch = true; ViewData["User_Name"] = _accountManage.User.Name; ViewData.Add("ProfileImg", _accountManage.User.ProfileImageSrc); return(Page()); } } else { ViewData["User_Name"] = _accountManage.User.Name; ViewData.Add("ProfileImg", _accountManage.User.ProfileImageSrc); return(Page()); } } else { OldPasswordDidntMatch = true; ViewData["User_Name"] = _accountManage.User.Name; ViewData.Add("ProfileImg", _accountManage.User.ProfileImageSrc); return(Page()); } }
public ActionResult Index(int?PageIndex, int?PageSize, string qTitle, string qAccount, int?orderCol) { if ((_crud & Zippy.SaaS.Entity.CRUD.Read) != Zippy.SaaS.Entity.CRUD.Read) { return(RedirectToAction("NoPermission", "Error")); } System.Text.StringBuilder sbMenu = new System.Text.StringBuilder(); if ((_crud & Zippy.SaaS.Entity.CRUD.Create) == Zippy.SaaS.Entity.CRUD.Create) { sbMenu.AppendLine("<a href='/" + _ContollerName + "/Edit?ReturnUrl=" + System.Web.HttpUtility.UrlEncode("/" + _ContollerName + "/?PageSize=" + PageSize) + "' class='btn img'><i class='icon i_create'></i>添加<b></b></a>"); } if ((_crud & Zippy.SaaS.Entity.CRUD.Read) == Zippy.SaaS.Entity.CRUD.Read) { sbMenu.AppendLine("<a href='javascript:;' class='btn list img' id='search'><i class='icon i_search'></i>查询<b></b></a>"); } if ((_crud & Zippy.SaaS.Entity.CRUD.Delete) == Zippy.SaaS.Entity.CRUD.Delete) { sbMenu.AppendLine("<a href='javascript:;' class='btn img' id='bDelete'><i class='icon i_delete'></i>删除<b></b></a>"); } if ((_crud & Zippy.SaaS.Entity.CRUD.Update) == Zippy.SaaS.Entity.CRUD.Update) { sbMenu.AppendLine("<a href='/" + _ContollerName + "/Sort/0' class='btn img' id='bDelete'><i class='icon i_sort'></i>排序<b></b></a>"); } sbMenu.AppendLine("<a href='javascript:;' class='btn img' id='bReload'><i class='icon i_refresh'></i>刷新<b></b></a>"); ViewData["TopMenu"] = sbMenu.ToString(); ViewData.Add("db", db); ViewData.Add("PageSize", PageSize ?? 10); int currentPageSize = PageSize ?? 10; int currentPageIndex = PageIndex ?? 1; Hashtable hs = new Hashtable(); hs.Add("qTitle", qTitle); hs.Add("qAccount", qAccount); PaginatedList <Z01Bank> result = Z01BankHelper.Query(db, _tenant.TenantID.Value, currentPageSize, currentPageIndex, hs, orderCol); result.QueryParameters = hs; return(View(result)); }
// GET: Employees/Edit/5 public async Task <ActionResult> Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Employee employee = await db.Employee.FindAsync(id); if (!User.IsInRole("SystemAdministrator") && employee.Client != db.Employee.Where(c => c.Email == User.Identity.Name).FirstOrDefault().Client) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Cannot access requested client due to invalid administrator role")); } if (employee == null) { return(HttpNotFound()); } if (!User.IsInRole("SystemAdministrator")) { ViewBag.Client = new SelectList(db.Client.Where(x => x.ID == db.Employee.Where(c => c.Email == User.Identity.Name).FirstOrDefault().Client), "ID", "Name"); } else { ViewBag.Client = new SelectList(db.Client, "ID", "Name"); } ViewBag.OIB = new SelectList(db.Person, "OIB", "PersonDetail", employee.OIB); var userr = UserManager.FindByName(employee.Email); if (UserManager.IsInRole(userr.Id, "SystemAdministrator")) { ViewData.Add("Admin", "disabled checked value=true"); } else if (UserManager.IsInRole(userr.Id, "ClientAdministrator")) { ViewData.Add("Admin", "checked value=true"); } else { ViewData.Add("Admin", "value=false"); } return(View(employee)); }
public ActionResult AddMaterial(int id) { List <Material> mList = this.BasisDataService.GetMaterialList(new MaterialRequest()).ToList(); var mslist = this.BasisDataService.GetMaterialSupplierList(new MaterialSupplierRequest() { SupplierID = id }); //List<Material> l1 = mList.ToList(); //List<Material> l2=new List<Material>(); ViewData["BasisDataService"] = this.BasisDataService; List <int> l1 = new List <int>(); ////this.ViewBag.Tags = this.CmsService.GetTagList(new TagRequest() { Top = 20, Orderby = Orderby.Hits }); //var model = new Supplier();, mList); ViewData.Add("material", mList); ViewData.Add("materialSupplier", mslist); return(View(id)); }
public ActionResult Create(FormCollection collection) { try { var model = new DetectionParamenterView(); var models = new SampleRegisterTable(); var users = this.AccountService.GetUserList(3).Select(c => new { Id = c.ID, Name = c.Name }); ViewData.Add("AnalyzePeople", new SelectList(users, "Name", "Name")); SaveOrderInfo(); var result = this.IDKLManagerService.GetSampleRegisterTableList(); AddDataToView(); return(View("Index", result)); } catch (Exception e) { return(Back(e.Message)); } }