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_Feature : F_Base { public F_Feature() { this.type = "Feature"; this.name = "基础资料_匹配特征管理"; this.entity = new Entity_t_Feature(); } public override void GetView(DataGridView dgv) { base.GetView(dgv); dgv.Columns["Groups"].HeaderText = "分组"; dgv.Columns["Code"].HeaderText = "代码"; dgv.Columns["Name"].HeaderText = "名称"; dgv.Columns["MatchCode"].HeaderText = "匹配车型"; dgv.Columns["CarModelCode"].HeaderText = "车型代码"; dgv.Columns["PartsFamilyCode"].HeaderText = "零件类"; dgv.Columns["SupplyGroupCode"].HeaderText = "供应组"; dgv.Columns["Memo"].HeaderText = "备注"; } public override void Delete(int ID) { DataSet dsDel = entity.GetData("", ID); if (dsDel.Tables[0].Rows.Count == 0) throw new Exception("删除的记录不存在,请刷新界面"); entity.Del(ID); (new Entity_t_FeaturePart()).Del("[FeatureCode]='" + dsDel.Tables[0].Rows[0]["Code"].ToString() + "'"); //删除DataSet中的记录 DataRow[] drDatas = dsMain.Tables[0].Select("ID=" + ID); if (drDatas.Length > 0) { drDatas[0].Delete(); } } public override void Checking(DataRow drData, bool isNew) { base.Checking(drData, isNew); if (new Entity_t_CarModel().GetData("[Code]='" + drData["CarModelCode"].ToString() + "'").Tables[0].Rows.Count == 0) throw new Exception("车型代码 " + drData["CarModelCode"].ToString() + " 在系统中不存在"); if (new Entity_t_PartsFamily().GetData("[Code]='" + drData["PartsFamilyCode"].ToString() + "'").Tables[0].Rows.Count == 0) throw new Exception("Parts Family " + drData["PartsFamilyCode"].ToString() + " 在系统中不存在"); if (new Entity_t_SupplyGroup().GetData("[Code]='" + drData["SupplyGroupCode"].ToString() + "'").Tables[0].Rows.Count == 0) throw new Exception("Supply Group " + drData["SupplyGroupCode"].ToString() + " 在系统中不存在"); } public override void InputData(DataSet dsData, LocalDBService db) { } } }