public int DeleteDataDictionary(string type, string id) { using (Entities db = new Entities()) { base_zds bzmodel = db.base_zds.FirstOrDefault(a => a.zd_type == type && a.zd_id == id); if (bzmodel != null) { bzmodel.status = 1; } return(db.SaveChanges()); } }
public int EditDataDictionary(DataDictionaryModel model) { using (Entities db = new Entities()) { base_zds bzmodel = db.base_zds.FirstOrDefault(a => a.zd_type == model.zd_type && a.zd_id == model.zd_id); if (bzmodel != null) { bzmodel.zd_name = model.zd_name; bzmodel.zd_seq = model.zd_seq; } return(db.SaveChanges()); } }
public Hashtable GetTypeById(string id, string type) { Hashtable ht = new Hashtable(); using (Entities db = new Entities()) { base_zds model = db.base_zds.FirstOrDefault(a => a.zd_type == type && a.zd_id == id); if (model != null) { ht.Add(id, model.zd_name); } } return(ht); }
/// <summary> /// 根据名称和类型获取ID /// </summary> /// <param name="name">名称</param> /// <param name="type">类型</param> /// <returns>ID</returns> public string GetIdByName(string name, string type) { using (Entities db = new Entities()) { base_zds model = db.base_zds.FirstOrDefault(a => a.zd_type == type && a.zd_name == name); if (model != null) { return(model.zd_id); } else { return(""); } } }
public int AddDataDictionary(DataDictionaryModel model) { using (Entities db = new Entities()) { base_zds bzmodel = new base_zds(); string sql = string.Format(@"select * from base_zds where zd_type='{0}' ORDER BY cast(zd_id as SIGNED INTEGER) DESC", model.zd_type); IEnumerable <DataDictionaryModel> queryable = db.Database.SqlQuery <DataDictionaryModel>(sql); DataDictionaryModel zdmodel = queryable.First(); bzmodel.zd_id = (int.Parse(zdmodel.zd_id) + 1).ToString(); bzmodel.zd_typename = zdmodel.zd_typename; bzmodel.zd_type = model.zd_type; bzmodel.zd_name = model.zd_name; bzmodel.zd_seq = model.zd_seq; bzmodel.status = 0; if (model.zd_type == "type_account" || model.zd_type == "type_accountname" || model.zd_type == "type_yhrw_wtxl") { bzmodel.remark = model.remark; bzmodel.parentid = model.parentid; } db.base_zds.Add(bzmodel); return(db.SaveChanges()); } }