写入数据库时出现此错误:
ReferentialConstraint中的依赖属性映射到存储生成的列.栏目:'PaymentId'.
public bool PayForItem(int terminalId, double paymentAmount,
eNums.MasterCategoryEnum mastercategoryEnum, int CategoryId, int CategoryItemId)
{
using (var dbEntities = new DatabaseAccess.Schema.EntityModel())
{
int pinnumber = 0;
long pinid = 1; //getPinId(terminalId,ref pinnumber) ;
var payment = new DatabaseAccess.Schema.Payment();
payment.CategoryId = CategoryId;
payment.ItemCategoryId = CategoryItemId;
payment.PaymentAmount = (decimal)paymentAmount;
payment.TerminalId = terminalId;
payment.PinId = pinid;
payment.HSBCResponseCode = "";
payment.DateActivated = DateTime.Now;
payment.PaymentString = "Payment";
payment.PromotionalOfferId = 1;
payment.PaymentStatusId = (int)eNums.PaymentStatus.Paid;
//payment.PaymentId = 1;
dbEntities.AddToPayments(payment);
dbEntities.SaveChanges();
}
return true;
}
Run Code Online (Sandbox Code Playgroud)
架构是:

有人可以帮助解决以下错误:
可访问性不一致:属性类型"Test.Delivery"的可访问性低于属性"Test.Form1.thelivery"
private Delivery thedelivery;
public Delivery thedelivery
{
get { return thedelivery; }
set { thedelivery = value; }
}
Run Code Online (Sandbox Code Playgroud)
由于不一致的错误消息,我无法运行该程序.
这是我的交付课程:
namespace Test
{
class Delivery
{
private string name;
private string address;
private DateTime arrivalTime;
public string Name
{
get { return name; }
set { name = value; }
}
public string Address
{
get { return address; }
set { address = value; }
}
public DateTime ArrivlaTime
{
get { return arrivalTime; }
set …Run Code Online (Sandbox Code Playgroud) 我有一个WPF应用程序,每个窗口有多个控件,一些覆盖等,我需要的是一种让应用程序根据屏幕分辨率自动调整大小的方法.
有任何想法吗 ?
我需要从后面的代码动态创建一个WPF网格.这样做是可以的,我可以这样做,以便我设置内容宽度,但我需要做的是设置它们,以便当我调整窗口大小时,控件重新调整大小
var col = new ColumnDefinition();
col.Width = new System.Windows.GridLength(200);
grid1.ColumnDefinitions.Add(col);
Run Code Online (Sandbox Code Playgroud)
这将产生XAML
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"></ColumnDefinition>
</Grid.ColumnDefinitions>
Run Code Online (Sandbox Code Playgroud)
但我需要的是使用*或问号,即.
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
Run Code Online (Sandbox Code Playgroud)
但是从后面的代码创建时,WidthValue不支持*或问号a?
我有以下代码
<Window x:Class="Netspot.DigitalSignage.Client.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" WindowStyle="SingleBorderWindow"
WindowStartupLocation="CenterScreen"
WindowState="Normal" Closing="Window_Closing">
Run Code Online (Sandbox Code Playgroud)
任何获得高度/宽度的尝试都返回NaN或0.0
有谁能告诉我一个获得它的方法?
这两种方法不起作用
//Method1
var h = ((System.Windows.Controls.Panel)Application.Current.MainWindow.Content).ActualHeight;
var w = ((System.Windows.Controls.Panel)Application.Current.MainWindow.Content).ActualWidth;
//Method2
double dWidth = -1;
double dHeight = -1;
FrameworkElement pnlClient = this.Content as FrameworkElement;
if (pnlClient != null)
{
dWidth = pnlClient.ActualWidth;
dHeight = pnlClient.ActualWidth;
}
Run Code Online (Sandbox Code Playgroud)
该应用程序将不会全屏运行.
我有以下代码:
MyPlayPause.InputGestures.Add(new KeyGesture(Key.P, ModifierKeys.Control));
Run Code Online (Sandbox Code Playgroud)
我需要添加另一个gesure所以我可以移位+ CTRL + P但是当我添加选项时它会中断:
MyPlayPause.InputGestures.Add(new KeyGesture(Key.P, ModifierKeys.Control));
Run Code Online (Sandbox Code Playgroud)
转移选项.我收到此错误:'Shift+F' key and modifier combination is not supported for KeyGesture.
知道为什么吗?我需要复制Media Player快进按钮的功能.
我想设置一个事件,以便在WPF Canvas控件上更改可见性时运行.
canvas1.VisibileChanged += new EventHandler(canvas1_VisibleChanged);
Run Code Online (Sandbox Code Playgroud)
我已经尝试了上述但它不起作用任何人都知道如何做到这一点?
干杯
我有一个字符串
var string = "I have a a string \\nThis is a new line\\nThis is another";
Run Code Online (Sandbox Code Playgroud)
我想要的是什么
var string = "I have a a string \nThis is a new line\nThis is another";
Run Code Online (Sandbox Code Playgroud)
我用过
string.Replace("\\","\");
Newline in constant
Run Code Online (Sandbox Code Playgroud)
但得到错误消息"Newline in constant"
我想编写一个小程序,从左到右显示自动滚动的新闻收报机文本(使用 Tkinter?),或者至少是一些 GUI。
文本应来自文本 .txt 文件。
我还是Python的初学者,无法真正掌握如何做到这一点?比如如何控制每行显示的时间等?
调用每一行的循环是执行此操作的正确方法吗?
或者你会如何处理这个问题?所有帮助/链接将不胜感激
我有以下代码:
<StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" Margin="0,10,0,10" BackgroundColor="Green" Padding="5,5,5,5">
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" Margin="0,0,0,0" BackgroundColor="Blue">
<Label Text="SHOW COMPLETED TASKS" BackgroundColor="Red" Style="{StaticResource lblSubHeading_Black}" />
</StackLayout>
<Switch x:Name="CompletedJobsSwitch" Toggled="CompletedJobsSwitch_Toggled" HorizontalOptions="EndAndExpand" IsToggled="{Binding isOn}" BackgroundColor="Yellow"/>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)
这一切都很好加载,但当应用程序加载它显示,但Switch没有正确刷新.为什么?它真的很烦人,似乎真的不一致
我查看了http://forums.xamarin.com/discussion/21226/how-to-right-align-a-view-inside-a-list-item,但这对我不起作用.
有任何想法吗?
c# ×9
wpf ×5
xaml ×2
canvas ×1
code-behind ×1
events ×1
grid ×1
height ×1
linq-to-sql ×1
news-ticker ×1
properties ×1
python ×1
resize ×1
scroll ×1
string ×1
width ×1
xamarin ×1