/// <summary> /// 模型数据改变 /// </summary> /// <param name="obj"></param> private void dataChanged(ProductInfoModel productInfoModel) { getPageData(pageRepuestParams.PageIndex, pageRepuestParams.PageSize); var tmpModel = ProductInfoList.FirstOrDefault(a => a.Id == productInfoModel.Id); this.ProductInfo = ProductInfoList.FirstOrDefault(); }
/// <summary> /// 是否可以执行打印命令 /// </summary> /// <returns></returns> private bool OnCanExecutePrintCommand() { if (Equals(ProductInfoList, null) || !ProductInfoList.Any()) { return(false); } else { return(true); } }
public ActionResult GetProductList(Newtonsoft.Json.Linq.JObject paging) { int start = Int32.Parse(paging.Value <string>("start")); int limit = Int32.Parse(paging.Value <string>("limit")); string filter = paging.Value <string>("filter"); ProductInfoList list = ProductInfoList.GetProductInfoList(start, limit); // temporary limit, have to inmplement a paging mechanism. return(this.Direct(new { totalCount = list.TotalCount, records = list })); }
/// <summary> /// 取得分页数据 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> private void getPageData(int pageIndex, int pageSize) { #if DEBUG System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start(); #endif pageRepuestParams.SortField = GlobalData.SortField; pageRepuestParams.SortOrder = GlobalData.SortOrder; pageRepuestParams.PageIndex = pageIndex; pageRepuestParams.PageSize = pageSize; //_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); //Console.WriteLine(await (await _httpClient.GetAsync("/api/service/EnterpriseInfo/Get?id='1'")).Content.ReadAsStringAsync()); var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult <PageResult <ProductInfoModel> > >(GlobalData.ServerRootUri + "ProductInfo/GetProductInfoList", Utility.JsonHelper.ToJson(pageRepuestParams)); #if DEBUG stopwatch.Stop(); Utility.LogHelper.Info("获取产品信息用时(毫秒):" + stopwatch.ElapsedMilliseconds); Utility.LogHelper.Info("产品信息内容:" + Utility.JsonHelper.ToJson(result)); #endif if (!Equals(result, null) && result.Successed) { Application.Current.Resources["UiMessage"] = result?.Message; LogHelper.Info(Application.Current.Resources["UiMessage"].ToString()); if (result.Data.Data.Any()) { //TotalCounts = result.Data.Total; //Messenger.Default.Send(LoginUser, MessengerToken.LoginSuccess); ProductInfoList = new ObservableCollection <ProductInfoModel>(result.Data.Data); TotalCounts = result.Data.Total; } else { ProductInfoList?.Clear(); TotalCounts = 0; Application.Current.Resources["UiMessage"] = "未找到数据"; } } else { //操作失败,显示错误信息 ProductInfoList = new ObservableCollection <ProductInfoModel>(); Application.Current.Resources["UiMessage"] = result?.Message ?? "查询产品信息失败,请联系管理员!"; } }
protected override void Refrescar() { base.Refrescar(); try { productInfoListBindingSource.DataSource = ProductInfoList.GetProductInfoList(); productInfoListBindingSource.ResetBindings(false); } catch (DataPortalException ex) { MessageBox.Show(ex.BusinessException.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void getPageData(int pageIndex, int pageSize) { #if DEBUG System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start(); #endif pageRepuestParams.SortField = "LastUpdatedTime"; pageRepuestParams.SortOrder = "desc"; pageRepuestParams.PageIndex = pageIndex; pageRepuestParams.PageSize = pageSize; var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult <PageResult <ProductInfoModel> > >(GlobalData.ServerRootUri + "ProductInfo/GetProductInfoList", Utility.JsonHelper.ToJson(pageRepuestParams)); #if DEBUG stopwatch.Stop(); Utility.LogHelper.Info("获取配方信息用时(毫秒):" + stopwatch.ElapsedMilliseconds); Utility.LogHelper.Info("配方信息内容:" + Utility.JsonHelper.ToJson(result)); #endif if (!Equals(result, null) && result.Successed) { Application.Current.Resources["UiMessage"] = result?.Message; LogHelper.Info(Application.Current.Resources["UiMessage"].ToString()); if (result.Data.Data.Any()) { //TotalCounts = result.Data.Total; //Messenger.Default.Send(LoginUser, MessengerToken.LoginSuccess); ProductInfoList = new ObservableCollection <ProductInfoModel>(result.Data.Data); TotalCounts = result.Data.Total; } else { ProductInfoList?.Clear(); TotalCounts = 0; Application.Current.Resources["UiMessage"] = "未找到数据"; } } else { //操作失败,显示错误信息 ProductInfoList = new ObservableCollection <ProductInfoModel>(); Application.Current.Resources["UiMessage"] = result?.Message ?? "查询配方类别信息失败,请联系管理员!"; } }
static void Main(string[] args) { ProductInfoList productInfoList = new ProductInfoList(); ProductInfo[] productInfoArray = new ProductInfo[] { new ProductInfo() { Id = 1, Description = "Producto 1", Price = 1.3 }, new ProductInfo() { Id = 2, Description = "Producto 2", Price = 2.4 } }; productInfoList.Values = productInfoArray; string connectionString = ConfigurationManager.ConnectionStrings["connectionStrings"].ConnectionString; OracleConnection con = new OracleConnection(); con.ConnectionString = connectionString; con.Open(); OracleCommand cmd = con.CreateCommand(); cmd.CommandText = "PKG_TEST_01.CREATE_PRODUCT"; cmd.CommandType = System.Data.CommandType.StoredProcedure; OracleParameter Oparameter1 = cmd.CreateParameter(); Oparameter1.Direction = ParameterDirection.Input; Oparameter1.ParameterName = "P_PRODUCTS"; Oparameter1.OracleDbType = OracleDbType.Array; Oparameter1.UdtTypeName = "PRODUCT_TABLE_UDT"; Oparameter1.Value = productInfoList; cmd.Parameters.Add(Oparameter1); cmd.ExecuteNonQuery(); Console.WriteLine("Presione una tecla para finalizar..."); Console.ReadLine(); }
public long Create(Category entity) { #region Parse UDT ProductInfoList productInfoList = new ProductInfoList(); ProductInfo[] productInfoArray = entity.Products.Select(x => new ProductInfo() { Id = x.Id, Description = x.Description, Price = x.Price }).ToArray(); productInfoList.Values = productInfoArray; #endregion OracleCommand cmd; ExecuteNonQuery(out cmd, "PKG_TEST_01.CREATE_CATEGORY", CreateParameter("P_DESCRIPTION", OracleDbType.Varchar2, entity.Description), CreateInputParamForUdtType("P_PRODUCTS", "PRODUCT_TABLE_UDT", productInfoList), CreateParameter("P_ID", OracleDbType.Long, null, 255, ParameterDirection.Output) ); object result = cmd.Parameters["P_ID"].Value; cmd.Dispose(); return(long.Parse(result.ToString())); }
/// <summary> /// 选中产品执行命令 /// </summary> private void OnExecuteproductSelectionChangedCommand() { var tmp = ProductInfoList.FirstOrDefault(a => a.Id == PlanOrderItemInfo.Product_Id); this.PlanOrderItemInfo.ProductCode = tmp.ProductCode; }
public override ProductInfoList _GetProducts() { ProductInfoList res = new ProductInfoList(); using (MySqlConnection conn = new MySqlConnection(GetConnectionString())) { using (MySqlCommand cmd = new MySqlCommand(QRY_GET_PRODUCTS, conn)) { using (MySqlDataAdapter da = new MySqlDataAdapter(cmd)) { DataTable tbl = new DataTable("product"); try { da.Fill(tbl); foreach (DataRow row in tbl.Rows) { long productId = Convert.ToInt64(row["product_id"]); string name = Convert.ToString(row["name"]); string description = Convert.ToString(row["description"]); int credits = Convert.ToInt32(row["credits"]); string extra = Convert.ToString(row["extra"]); string productPlan = Convert.ToString(row["product_plan"]); res.Add(new ProductInfo(productId, name, description, credits, extra, productPlan)); } } catch (MySqlException ex) { Logger.Instance.Write(LogLevel.Error, ex, "GetProducts<MySqlException>"); } finally { conn.Close(); } } } } return res; }
public ProductInfoList GetProducts() { ProductInfoList res = new ProductInfoList(); using (NpgsqlConnection conn = new NpgsqlConnection(GetConnectionString())) { using (NpgsqlCommand cmd = new NpgsqlCommand(QRY_GET_PRODUCTS, conn)) { using (NpgsqlDataAdapter da = new NpgsqlDataAdapter(cmd)) { DataTable tbl = new DataTable("product"); try { da.Fill(tbl); foreach (DataRow row in tbl.Rows) { int productId = Convert.ToInt32(row["product_id"]); string name = Convert.ToString(row["name"]); string description = Convert.ToString(row["description"]); int credits = Convert.ToInt32(row["credits"]); res.Add(new ProductInfo(productId, name, description, credits)); } } catch (NpgsqlException ex) { Logger.Instance.Write (TrackProtect.Logging.LogLevel.Error, ex, "GetProducts<NpgsqlException>"); } finally { conn.Close(); } } } } return res; }
public ProductInfoController() { _productInfoList = new ProductInfoList(); }
//////////////////////////////////////////////////////////// /// <summary> /// コンストラクタ /// </summary> //////////////////////////////////////////////////////////// internal ProductManager(ProductInfoList infoList) : base(infoList) { m_stockInfo = infoList; }