public async Task <ActionResult> Modify(int _unitId, [FromBody] ProductUnitModel _model) { string link = URI_API.PRODUCT_UNIT_MODIFY.Replace("{id}", $"{_unitId}"); ResponseConsult <bool> response = await PutAsJsonAsync <bool>(link, _model); return(Ok(response)); }
public async Task <ActionResult> Add([FromBody] ProductUnitModel _model) { string link = URI_API.PRODUCT_UNIT_ADD; ResponseConsult <int> response = await PostAsJsonAsync <int>(link, _model); return(Ok(response)); }
public ProductUnitForm() { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _productUnitService = kernel.GetService(typeof(ProductUnitService)) as ProductUnitService; _productUnit = new ProductUnitModel(); }
public async Task <bool> Modify(int _id, ProductUnitModel _model) { ProductUnit entity = await svcProductUnit.GetDetail(_id); if (entity == null) { return(false); } entity = iMapper.Map(_model, entity); return(await svcProductUnit.Modify(entity)); }
/// <summary> /// 更新指定产品单位信息 /// </summary> /// <param name="productUnit">产品单位模型</param> /// <returns>返回更新指定产品单位信息所影响的行数</returns> public static int UpdProductUnitByID(ProductUnitModel productUnit) { SqlParameter[] sparams = new SqlParameter[] { new SqlParameter("@productUnitID", SqlDbType.Int), new SqlParameter("@productUnitName", SqlDbType.VarChar, 50), new SqlParameter("@productUnitDescr", SqlDbType.VarChar, 50) }; sparams[0].Value = productUnit.ProductUnitID; sparams[1].Value = productUnit.ProductUnitName; sparams[2].Value = productUnit.ProductUnitDescr; return(DBHelper.ExecuteNonQuery("UpdProductUnitByID", sparams, CommandType.StoredProcedure)); }
/// <summary> /// 向产品状态单位表中插入记录 /// </summary> /// <param name="tran">Transaction</param> /// <param name="productUnit">产品单位模型</param> /// <param name="id">Id</param> /// <returns>返回向产品状态单位表中插入记录所影响的行数</returns> public static int AddProductUnit(SqlTransaction tran, ProductUnitModel productUnit, out int id) { int addCount = 0; SqlParameter[] sparams = new SqlParameter[] { new SqlParameter("@productUnitName", SqlDbType.VarChar, 50), new SqlParameter("@productUnitDescr", SqlDbType.VarChar, 50), new SqlParameter("@identityId", SqlDbType.Int) }; sparams[0].Value = productUnit.ProductUnitName; sparams[1].Value = productUnit.ProductUnitDescr; sparams[2].Value = ParameterDirection.Output; addCount = DBHelper.ExecuteNonQuery(tran, "AddProductUnit", sparams, CommandType.StoredProcedure); id = Convert.ToInt32(sparams[2].Value); return(addCount); }
private void LoadFormWithData() { if (_productUnitList == null || _productUnitList.Count <= 0) { _isAddNewMode = true; return; } _productUnit = _productUnitList[_currentIndex]; txtProductUnitId.Text = Convert.ToString(_productUnit.Id); txtProductUnitName.Text = _productUnit.ProductUnitName; txtDescription.Text = _productUnit.Description; chkIsActive.Checked = _productUnit.IsActive; dgvProductUnitList.Rows[_currentIndex].Selected = true; dgvProductUnitList.CurrentCell = dgvProductUnitList.Rows[_currentIndex].Cells[0]; _isChanged = false; _isAddNewMode = false; }
/// <summary> /// 查询产品单位 /// </summary> /// <param name="productUnitID"></param> /// <returns></returns> public static ProductUnitModel GetProductUnitItem(int productUnitID) { string cmd = "select ProductUnitID,ProductUnitName,ProductUnitDescr from ProductUnit where ProductUnitID=@ProductUnitID"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@ProductUnitID", productUnitID) }; SqlDataReader dr = DBHelper.ExecuteReader(cmd, param, CommandType.Text); dr.Read(); ProductUnitModel psm = new ProductUnitModel(); psm.ProductUnitID = Convert.ToInt32(dr["ProductUnitID"]); psm.ProductUnitName = dr["ProductUnitName"].ToString(); psm.ProductUnitDescr = dr["ProductUnitDescr"].ToString(); dr.Close(); return(psm); }
/// <summary> /// 更新指定产品单位信息 /// </summary> /// <param name="productUnit">产品单位模型</param> /// <returns>返回更新指定产品单位信息所影响的行数</returns> public static int UpdProductUnitByID(ProductUnitModel productUnit) { return(ProductUnitDAL.UpdProductUnitByID(productUnit)); }
/// <summary> /// 向产品状态单位表中插入记录 /// </summary> /// <param name="tran">Transaction</param> /// <param name="productUnit">产品单位模型</param> /// <param name="id">Id</param> /// <returns>返回向产品状态单位表中插入记录所影响的行数</returns> public static int AddProductUnit(SqlTransaction tran, ProductUnitModel productUnit, out int id) { return(ProductUnitDAL.AddProductUnit(tran, productUnit, out id)); }
public async Task <int> Add(ProductUnitModel _model) { ProductUnit entity = iMapper.Map <ProductUnit>(_model); return(await svcProductUnit.Add(entity)); }
public async Task <IActionResult> Modify(int _id, [FromBody] ProductUnitModel _model) { var result = await busProductUnit.Modify(_id, _model); return(Ok(context.WrapResponse(result))); }
public async Task <IActionResult> Add([FromBody] ProductUnitModel _model) { var result = await busProductUnit.Add(_model); return(Ok(context.WrapResponse(result))); }