北京安通林JIS系统
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.

76 lines
2.3 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data;
using Stone.Entity;
using Gm_WMS.DataAccess.DataService;
using Stone.Common;
namespace Stone.WinBiz.BasicData
{
public class F_CarModel : F_Base
{
public F_CarModel()
{
this.type = "CarModel";
this.name = "基础资料_车型";
this.entity = new Entity_t_CarType();
this.entityView = new Entity_t_CarType();
}
public override void GetView(DataGridView dgv)
{
base.GetView(dgv);
dgv.Columns["Code"].HeaderText = "车型";
}
public override void Checking(DataRow drData, bool isNew)
{
if (drData["Code"].ToString().Trim() == "")
throw new Exception("车型 不能为空!");
if (isNew)
{
if (entity.GetData("", "Code='" + drData["Code"].ToString() + "'", "id asc").Tables[0].Rows.Count > 0)
throw new Exception("车型 " + drData["Code"].ToString() + " 已经存在!");
}
else
{
if (entity.GetData("", "[ID]<>" + drData["ID"].ToString() + " and Code='" + drData["Code"].ToString() + "'", "id asc").Tables[0].Rows.Count > 0)
throw new Exception("车型 " + drData["Code"].ToString() + " 已经存在!");
}
}
public override void InputData(DataSet dsData, LocalDBService db)
{
Entity_t_CarModel t_Input = new Entity_t_CarModel(db);
DataRow drInput = null;
foreach (DataRow drData in dsData.Tables[0].Rows)
{
drInput = t_Input.Table.NewRow();
drInput["Code"] = MyStrings.GetString(drData["车型"].ToString().Trim());
if (drInput["Code"].ToString().Trim() == "")
throw new Exception("车型 不能为空!");
if (t_Input.GetData("", "Code='" + drInput["Code"].ToString() + "'", "id asc").Tables[0].Rows.Count > 0)
throw new Exception("车型 " + drInput["Code"].ToString() + " 已经存在!");
t_Input.Add(drInput);
}
}
}
}