public IEnumerable <GetModel> GetModels() { List <GetModel> models = new List <GetModel>(); using (var cn = new SqlConnection(Settings.GetConnectionString())) { SqlCommand cmd = new SqlCommand("GetModels", cn); cmd.CommandType = CommandType.StoredProcedure; cn.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { GetModel model = new GetModel(); model.ModelId = (int)dr["ModelId"]; model.ModelName = dr["Model"].ToString(); model.DateAdded = DateTime.Parse(dr["DateAdded"].ToString()); model.UserId = dr["UserId"].ToString(); model.UserName = dr["UserName"].ToString(); models.Add(model); } } } return(models); }
public string GetSuanLiList(HttpContext context) { //string User = context.Request["UserID"]; string UserCode = context.Request["UserCode"]; if (string.IsNullOrEmpty(UserCode) || UserCode.Trim() == string.Empty) { return(ResultJson(ResultType.error, "请输入用户账号", "")); } AllCore AC = new AllCore(); long UserID = AC.userBLL.GetUserID(UserCode); if (UserID <= 0) { return(ResultJson(ResultType.error, "账号不存在!", "")); } var model = AC.userBLL.GetModel(UserID); GetModel getModel = new GetModel(); getModel.Emoney = model.Emoney; getModel.StockMoney = model.StockMoney; getModel.BonusAccount = model.BonusAccount; getModel.AllBonusAccount = model.AllBonusAccount; getModel.User001 = model.User001; return(ResultJson(ResultType.success, "", getModel)); }
public async Task <IActionResult> Get([FromQuery] GetModel model) { var userFilter = _mapper.Map <User>(model); var users = await _userService.GetAsync(userFilter); var outModel = _mapper.Map <List <UserModel> >(users); return(OkOptionalContent <UserModel>(outModel)); }
private void RemoveElement(int id) { RemovedElement?.Invoke(id); if (GetModel.VertexOfEdgesById.ContainsKey(id)) { GetModel.VertexOfEdgesById[id].ForEach(RemoveElement); } GetModel.RemoveById(id); }
public async Task <GetResponseModel> GetAsync(GetModel value) { var validationResult = _getValidation.Validate(value); if (!validationResult.IsSuccess) { return(await Task.FromResult((GetResponseModel)validationResult)); } try { var dynamoObject = ConvertToDynamoKey(value.PartitionKey, value.SortKey); var getItemResponse = await Client.GetItemAsync(new GetItemRequest { TableName = value.TableName, Key = dynamoObject }); var items = new List <DynamoField>(); foreach (var field in value.FieldsToRetrieve) { var dynamoField = getItemResponse.Item[field.ColumnName]; items.Add(new DynamoField(field.ColumnName, field.ColumnType, GetAttributeValue(dynamoField, field.ColumnType))); } return(new GetResponseModel { HttpStatusCode = getItemResponse.HttpStatusCode, Items = new List <List <DynamoField> > { items } }); } catch (AmazonDynamoDBException exception) { return(new GetResponseModel { HttpStatusCode = exception.StatusCode, ErrorCode = exception.ErrorCode, ErrorMessage = exception.Message }); } catch (Exception exception) { return(new GetResponseModel { ErrorMessage = exception.ToString() }); } }
private bool AddVertex(Vertex v) { if (GetModel.ContainsVerticies(v.Id)) { return(false); } GetModel.AddVertex(v); AddedVertex?.Invoke(v); return(true); }
public IActionResult GetDifference([FromBody] GetModel differenceName) { var difference = context.Differences .Where(b => b.Name.Contains(differenceName.Name)).ToList(); if (difference == null) { return(NotFound()); } return(Ok(difference)); }
public override IEnumerable <dynamic> Get([FromUri] GetModel model) { if (model?.FilterKey == null) { return(Products.All()); } var filter = Filters.Get(model.FilterKey.Value); return(Products.Find(filter["Name"].ToString(), filter["Category"].ToString())); }
public static void PrintSet(System.Windows.Forms.DataGridView dgv, string title, string strSum) { if (dgv.DataSource == null) { MessageBox.Show("没有数据,无法选择输出格式", "提示"); return; } model = GetModel.getMode(dgv, title, strSum);//获得打印参数 Frm_Print_Set cs = new Frm_Print_Set(model, title); cs.ShowDialog(); }
public static void Print(System.Windows.Forms.DataGridView dgv, string title, string strSum) { if (dgv.DataSource == null) { MessageBox.Show("没有数据,无法打印", "提示"); return; } model = GetModel.getMode(dgv, title, strSum);//获得打印参数 FormPrint print = new FormPrint(model); print.CallPrintForm(dgv, title, strSum); }
/// <summary> /// Insert a Edge into the graph /// </summary> /// <param name="e">the Edge</param> /// <returns>status</returns> private bool AddEdge(Edge e) { if (GetModel.ContainsEdges(e.Id)) { return(false); } GetModel.AddEdge(e); GetModel.GetVertex(e.FromId).EdgesId.Add(e.Id); GetModel.GetVertex(e.ToId).EdgesId.Add(e.Id); AddedEdge?.Invoke(e); return(true); }
public static void PrintSet128(DataGridViewKJ128 dgv, string title, string strSum) { if (dgv.DataSource == null) { MessageBox.Show("没有数据,无法选择输出格式", "提示"); return; } DataGridView dgvs = dgv; model = GetModel.getMode(dgvs, title, strSum);//获得打印参数 Frm_Print_Set cs = new Frm_Print_Set(model, title); cs.ShowDialog(); }
public static void Print(DataGridViewKJ128 dgv, string title) { if (dgv.DataSource == null) { MessageBox.Show("没有数据,无法打印", "提示"); return; } DataGridView dgvs = dgv; model = GetModel.getMode(dgvs, title, "");//获得打印参数 FormPrint print = new FormPrint(model); print.CallPrintForm(dgv, title, ""); }
public void ChangePosition(Point p) { SelectedElements.ForEach(v => { if (!GetModel.ContainsVerticies(v)) { return; } var vc = GetModel.GetVertex(v); vc.PositionX = p.X; vc.PositionY = p.Y; }); Changed = true; }
public IActionResult PostCalculConfiguration([FromBody] GetModel model) { try { IProductDirector director = Director.GetDirector(model.type); var product = director.Parse(model.data); return(Ok(director.Get(product))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public IActionResult Get( [FromServices] IDataAccessObject <ReadModel.Movie> suggestionsDataAccessObject, [FromServices] IMapper mapper, string id) { GetModel result = suggestionsDataAccessObject.Where(d => d.Id == id) .ProjectTo <GetModel>(mapper.ConfigurationProvider) .FirstOrDefault(); if (result == null) { return(NotFound()); } return(Ok(result)); }
public GetModel UserAuthentication(string loginName, string loginPassword) { GetModel getmodel = null; try { var userList = masuserRepository.Get(exp => exp.UserLoginId == loginName && exp.UserPassword == loginPassword); getmodel = new GetModel(); getmodel.UserId = userList.UserId; getmodel.UserName = userList.UserName; getmodel.Emproll = "Admin"; return(getmodel); } finally { getmodel = null; } }
public async Task <IActionResult> Get([FromServices] IDataAccessObject <ReadModel.Suggestion> suggestionsDataAccessObject, string id) { GetModel result = await suggestionsDataAccessObject.Where(d => d.MovieId == id) .Select(d => new GetModel { Id = d.MovieId, Affinity = d.Affinity, }).FirstOrDefaultAsync(); if (result == null) { return(NotFound()); } return(Ok(result)); }
public IActionResult Get( [FromServices] IDataAccessObject <Part.ReadModel.Part> partDataAccessObject, [FromServices] IMapper mapper, string code) { GetModel result = partDataAccessObject.Where(d => d.Code == code) .ProjectTo <GetModel>(mapper.ConfigurationProvider) .FirstOrDefault(); if (result == null) { return(NotFound()); } return(Ok(result)); }
public async Task <IActionResult> Get(GetModel model) { var product = await db.GetProductAsync(model.Id); // Set custom values description model.Values = ReflectionHelper.GetCharacteristics(product.Description); // Set standart (ProductInfo) values description model.StandartValues = ReflectionHelper.GetCharacteristics(product.ProductInfo); // Set image field model.Image = product.ProductInfo.Image; // Set can vote field if (TempData.ContainsKey("id")) { model.CanVote = !await db.IsCommentedAsync((int)TempData.Peek("id"), model.Id); } // Set comments var comments = await db.GetCommentsAsync(model.Id); bool isLiked = false; foreach (var comment in comments) { var user = await db.GetUserAsync(comment.UserId); if (TempData.ContainsKey("id")) { isLiked = await db.CanLikeAsync((int)TempData.Peek("id"), comment.Id); } var vote = await db.GetVoteAsync(model.Id, comment.UserId); model.Comments.Add(Tuple.Create(comment, user.Email, isLiked, vote)); } var id = model.Id; var ids = (await db.GetRelationsAsync()) .Where(r => r.LesserId == id || r.BiggerId == id) .OrderByDescending(r => r.Count) .Select(r => r.LesserId == id ? r.BiggerId : r.LesserId) .Take(4); var products = new List <ProductInfo>(); foreach (var productId in ids) { products.Add(await db.GetProductInfoAsync(productId)); } model.RelatedProducts = products; return(View(model)); }
public async Task GetValidOperation_Success() { var model = new GetModel { TableName = TableName, PartitionKey = new DynamoField("id", ColumnType.Number, "1"), FieldsToRetrieve = new List <DynamoFieldSchema> { new DynamoFieldSchema("id", ColumnType.Number), new DynamoFieldSchema("test", ColumnType.String), }, }; var response = await _operations.GetAsync(model); Assert.True(response.IsSuccess); }
public async Task GetNoPrimaryKey_Failure() { var model = new GetModel { TableName = TableName, FieldsToRetrieve = new List <DynamoFieldSchema> { new DynamoFieldSchema { ColumnName = "test", ColumnType = ColumnType.String }, }, }; var response = await _operations.GetAsync(model); Assert.False(response.IsSuccess); Assert.Equal("The Primary Partition Key is required", response.ErrorMessage); }
// [Authorize] public List <People> Get() { var peoples = DbContext.Peoples.AsQueryable(); var model = new GetModel(); if (model.Skip != 0) { peoples = peoples.Skip(model.Skip); } if (model.Take != 0) { peoples = peoples.Take(model.Take); } return(peoples.ToList()); }
public static string printtestHas_getWLName(string id, string zfj, string erweima, bool iscd, string getWLName, string getWLName123) { GetModel getmodel = new GetModel(); var print = px_PrintBLL.Querypx_PrintList().Where(s => s.PXID.Equals(erweima)).ToList(); if (print.Count > 0) { List <GetIndex> pxlist = new List <GetIndex>(); foreach (var item in print) { GetIndex gi = new GetIndex(); gi.订单号 = item.orderid; gi.车身号 = item.orderid; gi.主副驾 = item.XF; gi.等级 = item.cartype; gi.零件号 = item.LingjianHao; gi.零件号描述 = item.ordername; pxlist.Add(gi); } bool flag = CallPrint.PrintM(pxlist, erweima, getWLName123, getWLName, false); if (flag) { return("1"); } return("0"); } else { List <GetIndex> pxlist = getmodel.GetIndexWJ(id, zfj); List <GetIndex> searchlist = new List <GetIndex>(); searchlist = pxlist.Where(s => s.mg_partorder_ordertype == 4).ToList(); searchlist.AddRange(pxlist.ToList()); pxlist = searchlist; bool flag = CallPrint.PrintM(pxlist, erweima, zfj + id, getWLName); if (flag) { return("1"); } return("0"); } }
public User GetUser(GetModel <User> repositoryModel) { if (repositoryModel.Id != null) { //repositoryModel.Where = CanLogIn(repositoryModel.Where.And(x => x.Id == repositoryModel.Id)); } var dbSet = _applicationDbContext.Users.Where(repositoryModel.Where); if (repositoryModel.Includes.Any()) { dbSet = repositoryModel.Includes.Aggregate(dbSet, (current, include) => current.Include(include)); } if (!repositoryModel.OrderBys.Any()) { return(dbSet.FirstOrDefault()); } return(dbSet.FirstOrDefault()); }
public async Task InsertNoTableName_Failure() { var model = new GetModel { PartitionKey = new DynamoField("id", ColumnType.Number, "1"), FieldsToRetrieve = new List <DynamoFieldSchema> { new DynamoFieldSchema { ColumnName = "id", ColumnType = ColumnType.Number }, new DynamoFieldSchema { ColumnName = "test", ColumnType = ColumnType.String }, }, }; var response = await _operations.GetAsync(model); Assert.False(response.IsSuccess); Assert.Equal("Table name cannot be empty", response.ErrorMessage); }
public async Task <string> GetModuleTree() { return(await Task.Run(() => { SearchCondition search = new SearchCondition(); search.AddCondition("F_IsApp", true, SqlOperator.Equal); KgmApiResultEntity result = new KgmApiResultEntity(); List <GetModel> getModels = new List <GetModel>(); var moduleList = BLLFactory <Sys_Module> .Instance.Find(BuilderConditionStr(search)); for (int i = 0; i < moduleList.Count(); i++) { GetModel model = new GetModel(); model.icon = moduleList[i].F_Icon; model.src = moduleList[i].F_UrlAddress; model.title = moduleList[i].F_FullName; model.parent = "inStock"; getModels.Add(model); } return JsonAppHelper.ToJson(new { result = true, message = getModels }); })); }
public async Task <string> GetAsync([FromQuery] GetModel model) { string GETUSER_URL = String.Format("https://dummyapi.io/data/api/user?page={0}&limit={1}", model.Page, model.Limit); const string appId = "60630884ce28c8d3a5d836e3"; using var getUsers = new HttpClient(); getUsers.DefaultRequestHeaders.Add("app-id", appId); var result = await getUsers.GetStringAsync(GETUSER_URL); dynamic json = JsonConvert.DeserializeObject(result); var data = json.data; List <User> users = new List <User>(); foreach (var values in data) { User user = new User(values.lastName, values.firstName, values.email); users.Add(user); } string output = JsonConvert.SerializeObject(users, Formatting.Indented); return(output); }
public async void GetModel( EStatusCode expectedStatus, GetModel query ) { var model = null as Model; if (expectedStatus != EStatusCode.NotFound) { model = EntitiesFactory.NewModel(id: query.Id).Save(); } var(status, result) = await Request.Get <QueryResultOneTest <ModelDetail> >(new Uri($"{Uri}/{query.Id}"), query); Assert.Equal(expectedStatus, status); if (expectedStatus == EStatusCode.Success) { var modelResult = result.Data; Assert.NotNull(modelResult); Assert.Equal(model.Id, modelResult.Id); Assert.Equal(model.Name, modelResult.Name); } }
/// <summary> /// 获取父菜单 /// </summary> /// <param name="pid"></param> /// <returns></returns> private List <GetModel> ListPMenu(string pid) { List <GetModel> list = new List <GetModel>(); List <Menu> listMenu = new List <Menu>(); listMenu = menuhandler.GetParentNodes(); if (listMenu != null && listMenu.Count > 0) { foreach (var item in listMenu) { GetModel table = new GetModel(); table.name = item.name; table.pid = item.pid.ToString(); //list.Add(select); list.Add(table); } if (string.IsNullOrEmpty(pid)) { ViewData["Value"] = new SelectList(list, "pid", "name"); } else { //List<GetModel> list = ListPMenu(); ViewData["Value"] = new SelectList(list, "pid", "name", pid); } } else { GetModel table = new GetModel(); table.name = ""; table.pid = ""; //list.Add(select); list.Add(table); } return(list); }