SilverLight-Access:银光项目测试数据类列表
| ylbtech-SilverLight-Access:银光项目测试数据类列表 |
- 1.A, Product.cs 产品类
| 1.A, Product.cs 产品类返回顶部 |
using System; using System.Collections.Generic;
using System.Linq;
using System.ComponentModel.DataAnnotations;
namespace SLYlbtechApp.Access
{
/// <summary>
/// 产品类
/// </summary>
public class Product
{
int productId;
/// <summary>
/// 编号【PK】
/// </summary>
public int ProductId
{
get { return productId; }
set { productId = value; }
}
string productName;
/// <summary>
/// 产品名称
/// </summary>
public string ProductName
{
get
{
return productName;
}
set
{
if (value=="") throw new ArgumentException("不能为空");
productName = value;
}
}
string quantityPerUnit;
/// <summary>
/// 产品规格
/// </summary>
public string QuantityPerUnit
{
get { return quantityPerUnit; }
set { quantityPerUnit = value; }
}
/// <summary>
/// 单位价格
/// 注意 不要使用 decimal 类型,在 UserControl.Resounrce 资源绑定是引发类型转换异常
/// </summary>
double unitPrice;
[Display(Name="价格",Description="价格不能小于0")]
public double UnitPrice
{
get { return unitPrice; }
set
{
if (value < ) throw new ArgumentException("不能小于0");
unitPrice = value;
}
}
string description;
/// <summary>
/// 描述
/// </summary>
public string Description
{
get { return description; }
set { description = value; }
}
string productImagePath;
/// <summary>
/// 产品图片地址
/// </summary>
public string ProductImagePath
{
get { return productImagePath; }
set { productImagePath = value; }
}
string categoryName;
/// <summary>
/// 类别名称
/// </summary>
public string CategoryName
{
get { return categoryName; }
set { categoryName = value; }
}
DateTime addedDate;
/// <summary>
/// 添加日期
/// </summary>
public DateTime AddedDate
{
get { return addedDate; }
set { addedDate = value; }
} /// <summary>
/// 空参构造
/// </summary>
public Product()
{
AddedDate = new DateTime(, , ); //设置默认日期
}
/// <summary>
/// 全参构造
/// </summary>
/// <param name="productId"></param>
/// <param name="productName"></param>
/// <param name="quantityPerUnit"></param>
/// <param name="unitPrice"></param>
/// <param name="description"></param>
/// <param name="productImagePath"></param>
/// <param name="categoryName"></param>
public Product(int productId, string productName, string quantityPerUnit, double unitPrice, string description
, string productImagePath, string categoryName)
{
ProductId = productId;
ProductName=productName;
QuantityPerUnit=quantityPerUnit;
UnitPrice=unitPrice;
Description=description; ProductImagePath=productImagePath;
CategoryName=categoryName;
} /// <summary>
/// 获取全部产品
/// </summary>
/// <returns></returns>
public static IList<Product> GetAll()
{
IList<Product> dals = new List<Product>();
string categoryName = string.Empty;
string productImagePath = string.Empty;
string description = "嗟夫!草木无情,有时飘零。人为动物,惟物之灵。百忧感其心,万事劳其形,有动于中,必摇其精。而况思其力之所不及,忧其智之所不能,宜其渥然丹者为槁木,黟然黑者为星星。奈何以非金石之质,欲与草木而争荣?念谁为之戕贼,亦何恨乎秋声!";
#region Add Product #region 饮料
categoryName = "饮料";
productImagePath = "../Images/pencil.jpg"; dals.Add(new Product()
{
ProductId = ,
ProductName = "啤酒",
QuantityPerUnit = "1箱*6听",
UnitPrice = 10d,
CategoryName = categoryName
,
ProductImagePath = productImagePath,
Description = description
}); dals.Add(new Product()
{
ProductId = ,
ProductName = "绿茶",
QuantityPerUnit = "500ml",
UnitPrice = 3d,
CategoryName = categoryName
,
ProductImagePath = productImagePath,
Description = description
}); dals.Add(new Product()
{
ProductId = ,
ProductName = "红茶",
QuantityPerUnit = "500ml",
UnitPrice = 3d,
CategoryName = categoryName
,
ProductImagePath = productImagePath,
Description = description
});
dals.Add(new Product()
{
ProductId = ,
ProductName = "纯净水",
QuantityPerUnit = "500ml",
UnitPrice = 1.5d,
CategoryName = categoryName
,
ProductImagePath = productImagePath,
Description = description
});
#endregion #region 零食
categoryName = "零食";
productImagePath = "../Images/pencil2.jpg"; dals.Add(new Product()
{
ProductId = ,
ProductName = "奥利奥巧克力饼干",
QuantityPerUnit = "10 boxes x 20 bags",
UnitPrice = 30d,
CategoryName = categoryName
,
ProductImagePath = productImagePath,
Description = description
}); dals.Add(new Product()
{
ProductId = ,
ProductName = "玻璃 海苔",
QuantityPerUnit = "20g",
UnitPrice = 13d,
CategoryName = categoryName
,
ProductImagePath = productImagePath,
Description = description
}); dals.Add(new Product()
{
ProductId = ,
ProductName = "好丽友 薯片",
QuantityPerUnit = "100g",
UnitPrice = 3d,
CategoryName = categoryName
,
ProductImagePath = productImagePath,
Description = description
});
dals.Add(new Product()
{
ProductId = ,
ProductName = "统一 老坛酸菜面",
QuantityPerUnit = "1 盒",
UnitPrice = 8.5d,
CategoryName = categoryName
,
ProductImagePath = productImagePath,
Description = description
});
#endregion #endregion
return dals;
}
/// <summary>
/// GetModel
/// </summary>
/// <returns></returns>
public static Product GetModel()
{
Product dal = null; string categoryName = string.Empty;
string productImagePath = string.Empty;
string description = "嗟夫!草木无情,有时飘零。人为动物,惟物之灵。百忧感其心,万事劳其形,有动于中,必摇其精。而况思其力之所不及,忧其智之所不能,宜其渥然丹者为槁木,黟然黑者为星星。奈何以非金石之质,欲与草木而争荣?念谁为之戕贼,亦何恨乎秋声!"; categoryName = "饮料";
productImagePath = "Images/pencil.jpg";
dal = new Product()
{
ProductId = ,
ProductName = "啤酒",
QuantityPerUnit = "1箱*6听",
UnitPrice=3.5,
CategoryName = categoryName
,
ProductImagePath = productImagePath,
Description = description
};
//dal._unitPrice = 10d;
return dal;
}
/// <summary>
/// GetModel
/// </summary>
/// <param name="id">产品编号</param>
/// <returns></returns>
public static Product GetModel(int id)
{
Product dal = null;
IList<Product> dals = GetAll();
try
{
dal = dals.Single(p => p.ProductId == id);
}
catch { }
finally
{
dals = null;
}
return dal;
}
}
}
4,
| 1.B,返回顶部 |
| 1.C,返回顶部 |
| 1.D,返回顶部 |
![]() |
作者:ylbtech 出处:http://ylbtech.cnblogs.com/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 |
SilverLight-Access:银光项目测试数据类列表的更多相关文章
- java查看当前项目所有线程列表界面
java查看当前项目所有线程列表界面 1.TestThread(测试类) package com.isoftstone.pcis.isc.job.king.panel; public class Te ...
- java查看当前项目所有线程列表界面【转】
java查看当前项目所有线程列表界面 1.TestThread(测试类) package com.testdemo.pcis.isc.job.king.panel; public class Test ...
- Atitit.attilax的 case list 项目经验 案例列表
Atitit.attilax的 case list 项目经验 案例列表 1. Atian inputmethod 输入法3 2. Ati desktop engine桌面引擎3 3. Acc资金账户系 ...
- ACCESS数据库C#操作类(包含事务)
转自http://blog.csdn.net/allen3010/article/details/6336717 这个是针对ACCESS数据库操作的类,同样也是从SQLHELPER提取而来,分页程序的 ...
- springBoot项目启动类启动无法访问
springBoot项目启动类启动无法访问. 网上也查了一些资料,我这里总结.下不来虚的,也不废话. 解决办法: 1.若是maven项目,则找到右边Maven Projects --->Plug ...
- 项目实体类使用@Data注解,但是项目业务类中使用getA(),setA()方法报错,eclipse中配置lombok
@Data注解来源与Lombok,可以减少代码中大量的set get方法,大量减少冗余代码,但是今天部署项目时候,发现实体类使用@Data注解,但是项目业务类中使用getA(),setA()方法报错. ...
- phpcms替换类列表页,内容页,主页
phpcms替换类列表页,内容页,主页 利用phpcms制作企业站,首先要将静态的企业主页替换成后台可编辑的动态主页. 在phpcms/install_package/phpcms/templat ...
- Python基础 之 list类-列表
list类-列表 一.list类的基本属性 1. 列表格式 li = [1, 12, 9, ", 10], "even"], "root", True ...
- Laya 类列表加载优化
Laya 类列表加载优化 @author ixenos 类列表:在一个页面展示的大量的零散单元的集合(聊天面板.背包) 一.按展示优化1.展示内容少,即使大量数据,但用户只看到少量信息的时候,考虑按需 ...
随机推荐
- Pass Data Between ASP.NET Pages
There is the data to send in current page <asp:TextBox ID="DataToSendTextBox" runat=&qu ...
- html之表单标签
表单标签的属性: 用于向服务器传输数据 表单能够包含input元素,比如文本字段,复选框,单选框,提交按钮等等 表单还可以包含textarea(简介之类的),select(下拉),fieldset和l ...
- MQ、JMS以及ActiveMQ的了解和认识
新加入的公司中,架构用到了activeMq,对于以前只了解nginx.tomcat的我有点懵逼,所以在网上找点资料看看,了解下什么是MQ,activemq.具体作用是什么 MQ MQ简介: MQ全称为 ...
- nyoj 题目14 会场安排问题
会场安排问题 时间限制:3000 ms | 内存限制:65535 KB 难度:4 描述 学校的小礼堂每天都会有许多活动,有时间这些活动的计划时间会发生冲突,需要选择出一些活动进行举办.小刘的工 ...
- 使用CoreLocation进行定位(Swift版)
在应用开发中,很多情况需要我们获取到当前的位置和高度信息,方便搜索周边,查看周边相同应用等,一切与定位有关的都得使用CoreLocation库,而且,系统是不允许第三发定位的,当然可以使用第三方对其封 ...
- WF 18 A 想法
UPD:我理解错题意了. 考虑在时刻 $t$ 从站点 $u$ 出发的公交车,将这些车的集合记做 $B(u,t)$,$B(u,t)$ 是个随机变量. 令 $\mathrm{Pr}_{B(u,t)} = ...
- cf 843 B Interactive LowerBound [随机化]
题面: 传送门 思路: 这是一道交互题 比赛的时候我看到了直接跳过了...... 后来后面的题目卡住了就回来看这道题,发现其实比较水 实际上,从整个序列里面随机选1000个数出来询问,然后从里面找出比 ...
- 企鹅的游戏(penguin)
企鹅的游戏(penguin) 题目描述 Shiva养了一只小企鹅.小企鹅很聪明,她总是帮Shiva和他的好朋友想出很多很好玩的游 戏.其中有一个游戏特别经典,Shiva和他的小伙伴们百玩不厌. 游戏规 ...
- android在JNI_OnLoad入口函数下断点动态调试so库
一般来说,很多APK的校验代码,都会在程序运行的时候自动加载一些动态so库,然后执行这些库中的校验代码.所以为了能够通过程序的校验,我们必须在执行这些函数之前下断点——理想的方法就是在JNI_OnLo ...
- IntelliJ IDEA 学习--内存设置
小伙伴们经常会发现,在开发的时候,经常遇到内存被占满,导致异常卡顿,有时候提示内存溢出,这时可以通过设置xmx来改善.不过切记最好不要超过内存的1/4 打开 IDEA 安装目录,看到有一个 bin 目 ...
