我希望你们能给我一些好的建议.我在想如何为C#开发建立一个好的架构.我正在尽力解释情景,因为我不擅长英语:
1)两个类:Blue Bank和Red Bank
2)第三类:验证规则
3)蓝色和红色银行有几个字段(值),如AccountNumber,Amount,InvoicePeriod等......这里的示例(xml):
蓝银行
<AccountNumber>Maria 5987593457</AccountNumber>
<Amount>200.00</Amount>
<InvoicePeriod>1</InvoicePeriod>
Run Code Online (Sandbox Code Playgroud)
红银行
<AccountNumber>8529458</AccountNumber>
<Amount>300.00</Amount>
<InvoicePeriod>0</InvoicePeriod>
Run Code Online (Sandbox Code Playgroud)
红色/蓝色银行具有一些相同的验证规则,例如必须是数字的金额字段.但Red/Blue Banks有不同的验证规则 - AccountNumber字段在Blue Bank中必须是alphanumberic,而AccountNumber必须在Red Bank中是numberic,否则将失败.InvoicePeriod字段在Red Bank中必须为默认值1,而在Blue Bank中必须为默认值0,否则将失败.
我的想法是:
我想为不同的验证规则创建每个类的Red/Blue Bank,然后我还为Blue/Red银行所具有的相同规则创建验证类规则.
我的代码在这里:
蓝银班:
红银班:
RulesOfValidation类
这些课程如何与dictonary <,>一起使用?或者您的示例代码有什么更好的建议吗?
非常感谢您的帮助.
这个布局我有2个问题:
.feature_content
(灰色背景)使其高度和宽度适应不同的屏幕尺寸.现在,在大屏幕.feature_content
上远离页脚.我想:适应.feature_content
剩余的高度并移除水平滚动条.
这是一个FIDDLE
我的代码:
HTML:
<div id="container">
<div id="header">Header added just for demonstration purposes</div>
<div id="content">Your content goes here
<div class="featured_content"></div>
</div>
</div>
<div id="footer">Footer here</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
* {
padding: 0;
margin: 0;
border: 0;
outline: 0;
}
body, html {
width:100%;
min-height: 100%;
}
div {
height:100%;
width:100%;
border:5px solid black;
}
#header {
background-color:orange;
}
#container {
background:blue;
margin: 0 auto;
position: relative; …
Run Code Online (Sandbox Code Playgroud) 我知道我必须使用Substring来删除,但我不知道该怎么做.我需要删除这样的字符串结尾
从
"C:\\Users\\myname\\Pictures\\shoeImage.jpg"
Run Code Online (Sandbox Code Playgroud)
至
"C:\\Users\\myname\\Pictures"
Run Code Online (Sandbox Code Playgroud) 我已经阅读了规范模式的一些示例,但很难理解如何使用此模式实现.
我正在为客户开发一个庞大的程序.我需要从特定的银行导入XML文件,然后对每个文件进行验证.分类帐代码有不同的方法(subs,bo,rcc).因此,当文件读取SUBS时,它应该发送到SUBS方法.
这里的例子:
接口:
分类帐代码:
结果:
你能给出一些示例代码或指出我正确的方向吗?
我在Image
数据库表的列中有二进制映像,但列中有一些null
值Image
.所以抛出异常,
byte [] data =(byte [])ds.Tables [0] .Rows [0] [0]`因为null.
怎么办呢?
异常消息,
无法将类型为"System.DBNull"的对象强制转换为"System.Byte []".
我的代码,
using (var sqlConn = new SqlConnection(connstr))
{
sqlConn.Open();
ds = new DataSet();
SqlDataAdapter sqa = new SqlDataAdapter("Select Image from Templates where Shoe='" + selectedShoe + "'", sqlConn);
sqa.Fill(ds);
//i got error here
byte[] data = (byte[])ds.Tables[0].Rows[0][0];
.....
Run Code Online (Sandbox Code Playgroud) 我知道这个值应该使用Substring但我不知道如何在C#中这样做.您的代码非常感谢.谢谢!
我想改变这个:
"C:\\TFS\\Deployment\\files\\1.0.1.1\\test\\test00.xml"
Run Code Online (Sandbox Code Playgroud)
新价值:
"C:\\TFS\\Deployment\\files\\1.0.1.1"
Run Code Online (Sandbox Code Playgroud) 怎么解决这个?
我想改变这个:
C:\文件\队伍\企业\ dev的\来源\系统\推广\目标\ 1.0.1.1 \
新价值:
value ="1.0.11";