You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
4.0 KiB
133 lines
4.0 KiB
3 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.ComponentModel;
|
||
|
using System.Drawing;
|
||
|
using System.Data;
|
||
|
using System.Text;
|
||
|
using System.Windows.Forms;
|
||
|
using Stone.WinBiz.BasicData;
|
||
|
using Stone.Common;
|
||
|
|
||
|
namespace Stone.WinModule.MyControl
|
||
|
{
|
||
|
public partial class MyBoardCell : UserControl
|
||
|
{
|
||
|
private DataSet dsData = null;
|
||
|
|
||
|
#region ����
|
||
|
[CategoryAttribute(""), DescriptionAttribute("��ȡ�����ÿؼ�ѡ����ֵ")]
|
||
|
public DataSet Data
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return dsData;
|
||
|
}
|
||
|
|
||
|
set
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
this.dsData = value;
|
||
|
ShowText();
|
||
|
ShowBgColor();
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region ����
|
||
|
private void ShowText()
|
||
|
{
|
||
|
if (dsData.Tables[0].Rows.Count > 0)
|
||
|
{
|
||
|
this.lblProductName.Text = "";
|
||
|
foreach (DataRow drData in dsData.Tables[0].Rows)
|
||
|
{
|
||
|
//this.lblProductName.Text += drData["ProductName"].ToString() + "\r\n";
|
||
|
this.lblProductName.Text += drData["CarModelName"].ToString() + "\r\n" + drData["ColorName"].ToString() + "\r\n";
|
||
|
this.lblProductName.Text += drData["Qty"].ToString() + " " + drData["Batch"].ToString();
|
||
|
this.lblProductName.Text += "\r\n";
|
||
|
if (drData["TrayCode"].ToString() != "")
|
||
|
this.lblProductName.Text += drData["TrayCode"].ToString() + "\r\n";
|
||
|
|
||
|
if (drData["StockQty"] is DBNull)
|
||
|
{ }
|
||
|
else
|
||
|
{
|
||
|
if (drData["StockQty"].ToString() != "0")
|
||
|
{
|
||
|
this.lblProductName.Text += "��������:" + drData["StockQty"].ToString() + "\r\n";
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.lblProductName.Text = "";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void ShowBgColor()
|
||
|
{
|
||
|
if (dsData != null & dsData.Tables[0].Rows.Count > 0)
|
||
|
{
|
||
|
string TrayCode = dsData.Tables[0].Rows[0]["TrayCode"].ToString();
|
||
|
if ( TrayCode == "")
|
||
|
{
|
||
|
if (Convert.ToInt32(dsData.Tables[0].Rows[0]["Qty"]) < Convert.ToInt32(dsData.Tables[0].Rows[0]["StockQty"]))
|
||
|
{
|
||
|
this.BackColor = Color.Yellow;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.BackColor = Color.Red;
|
||
|
this.lblProductName.ForeColor = Color.White;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.BackColor = Color.Red;
|
||
|
this.lblProductName.ForeColor = Color.White;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.BackColor = Color.Green;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region ��������
|
||
|
public MyBoardCell()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
|
||
|
this.Dock = DockStyle.Fill;
|
||
|
this.Padding = new Padding(0, 0, 0, 0);
|
||
|
}
|
||
|
|
||
|
private void MyBoardCell_Resize(object sender, EventArgs e)
|
||
|
{
|
||
|
this.lblProductName.Width = this.Width - this.lblProductName.Left;
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
private void lblProductName_MouseHover(object sender, EventArgs e)
|
||
|
{
|
||
|
ToolTip toolTip1 = new ToolTip();
|
||
|
toolTip1.AutoPopDelay = 5000;
|
||
|
toolTip1.InitialDelay = 1000;
|
||
|
toolTip1.ReshowDelay = 500;
|
||
|
toolTip1.ShowAlways = true;
|
||
|
toolTip1.SetToolTip(this.lblProductName, this.lblProductName.Text);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|