public Maticsoft.Model.Ms.RegionRec DataRowToModel(DataRow row) { Maticsoft.Model.Ms.RegionRec rec = new Maticsoft.Model.Ms.RegionRec(); if (row != null) { if ((row["ID"] != null) && (row["ID"].ToString() != "")) { rec.ID = int.Parse(row["ID"].ToString()); } if ((row["RegionId"] != null) && (row["RegionId"].ToString() != "")) { rec.RegionId = int.Parse(row["RegionId"].ToString()); } if (row["RegionName"] != null) { rec.RegionName = row["RegionName"].ToString(); } if ((row["DisplaySequence"] != null) && (row["DisplaySequence"].ToString() != "")) { rec.DisplaySequence = int.Parse(row["DisplaySequence"].ToString()); } if ((row["Type"] != null) && (row["Type"].ToString() != "")) { rec.Type = int.Parse(row["Type"].ToString()); } } return rec; }
public int AddEx(int regionId, int type) { Maticsoft.Model.Ms.Regions model = new Maticsoft.BLL.Ms.Regions().GetModel(regionId); Maticsoft.Model.Ms.RegionRec rec = new Maticsoft.Model.Ms.RegionRec(); this.Delete(regionId, type); if (model != null) { rec.RegionId = model.RegionId; rec.RegionName = model.RegionName; rec.Type = type; rec.DisplaySequence = 0; return this.dal.Add(rec); } return -1; }