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; namespace Stone.WinBiz.BasicData { public class F_SupplyGroup : F_Base { public F_SupplyGroup() { this.type = "SupplyGroup"; this.name = "基础资料_供应组管理"; this.entity = new Entity_t_SupplyGroup(); this.entityView = new Entity_v_SupplyGroup(); } public override void GetView(DataGridView dgv) { base.GetView(dgv); dgv.Columns["Code"].HeaderText = "代码"; dgv.Columns["Name"].HeaderText = "名称"; dgv.Columns["PartsFamilyCode"].HeaderText = "零件类代码"; dgv.Columns["PartsFamilyName"].HeaderText = "零件类名称"; dgv.Columns["CarModelCode"].HeaderText = "车型"; dgv.Columns["PrintGroup"].HeaderText = "打印组"; dgv.Columns["Memo"].HeaderText = "备注"; } public override void Checking(DataRow drData, bool isNew) { base.Checking(drData, isNew); if (new Entity_t_PartsFamily().GetData("[Code]='" + drData["PartsFamilyCode"].ToString() + "'").Tables[0].Rows.Count == 0) throw new Exception("Parts Family代码 " + drData["PartsFamilyCode"].ToString() + " 在系统中不存在"); } public override void InputData(DataSet dsData, LocalDBService db) { Entity_t_SupplyGroup t_Input = new Entity_t_SupplyGroup(db); DataRow drInput = null; foreach (DataRow drData in dsData.Tables[0].Rows) { drInput = t_Input.Table.NewRow(); drInput["Code"] = drData["代码"].ToString().Trim(); drInput["Name"] = drData["名称"].ToString().Trim(); drInput["PartsFamilyCode"] = drData["Parts Family代码"].ToString().Trim(); drInput["PrintGroup"] = drData["打印组"].ToString(); drInput["Memo"] = 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() + " 已经存在!"); if (new Entity_t_PartsFamily().GetData("[Code]='" + drInput["PartsFamilyCode"].ToString() + "'").Tables[0].Rows.Count == 0) throw new Exception("Parts Family代码 " + drInput["PartsFamilyCode"].ToString() + " 在系统中不存在"); t_Input.Add(drInput); } } } }