protected void btnSave_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtDicName.Text.Trim())) { int DicCateID = DataConverter.CLng(this.HdnDicID.Value); if (DicCateID > 0) { M_Dictionary info = B_DataDictionary.GetModel(DicCateID); info.DicName = this.txtDicName.Text.Trim(); B_DataDictionary.Update(info); } else { M_Dictionary info = new M_Dictionary(); info.DicID = 0; info.DicCate = DataConverter.CLng(this.HdnDicCateID.Value); info.DicName = this.txtDicName.Text.Trim(); info.IsUsed = true; B_DataDictionary.AddDic(info); } this.txtDicName.Text = ""; this.HdnDicID.Value = "0"; this.btnSave.Text = "添加"; DataBind(); } }
/// <summary> /// 根据表名来得到管理库字典数据(有效数据) /// </summary> /// <param name="tableName"></param> /// <returns></returns> private List <M_Dictionary> GetManagerDictioinary(string Conn) { M_Dictionary info; List <M_Dictionary> list = new List <M_Dictionary>(); StringBuilder strSQL = new StringBuilder(); strSQL.Append(" select ID,Name,SN,IsActive from " + m_TableName + " "); strSQL.Append(" where IsActive=1 order by SN"); try { using (DataSet ds = SqlHelper.ExecuteDataSet(Conn, CommandType.Text, strSQL.ToString(), null)) { foreach (DataRow dr in ds.Tables[0].Rows) { info = new M_Dictionary(); info.ID = DBConvert.ConvertStringToString(dr["ID"]); info.Name = DBConvert.ConvertStringToString(dr["Name"]); info.SN = Convert.ToInt32(dr["SN"]); info.IsActive = Convert.ToBoolean(dr["IsActive"]); list.Add(info); } return(list); } } catch (Exception) { //Log4Net.LogError("DictionaryDAL/GetDictionary", ex.Message); return(null); } }
//新增字典信息,ID为TypeID和最大TypeID数量+1的拼出结果。 public ActionResult AddDictionary() { string TDictionaryType = Request.Form["TDictionaryType"].ToString(); int maxID = new TDictionaryBLL().GetMaxDictionaryID(TDictionaryType, "M_Dictionary"); string newID = TDictionaryType + "-" + (maxID).ToString(); int newSN = int.Parse(Request.Form["SN"]); string newName = Request.Form["DinctionaryName"].ToString(); M_Dictionary dic = new M_Dictionary(); dic.ID = newID; dic.Name = newName; dic.TypeID = TDictionaryType; dic.SN = newSN; dic.IsActive = true; if (new M_DictionaryBLL().Add(dic) > 0) { return(this.JsonResult(Utility.E_JsonResult.OK, "新增字典信息成功!", null, null)); } else { return(this.JsonResult(Utility.E_JsonResult.Error, "新增字典信息失败!", null, null)); } }
private List <M_Dictionary> GetDictionary(string Conn, string code) { M_Dictionary info; List <M_Dictionary> list = new List <M_Dictionary>(); StringBuilder strSQL = new StringBuilder(); if (m_TableName == "TStation") { strSQL.Append(" select 编码,名称,顺序号,是否有效 from " + m_TableName + " "); strSQL.Append(" where 是否有效=1 "); WhereClauseUtility.AddIntEqual("中心编码", Convert.ToInt32(code), strSQL); strSQL.Append(" order by 顺序号"); } else if (m_TableName == "TAmbulance") { strSQL.Append(" select 编码=车辆编码,名称=实际标识,顺序号=1,是否有效 from " + m_TableName + " "); strSQL.Append(" where 是否有效=1 "); WhereClauseUtility.AddStringEqual("分站编码", code, strSQL); strSQL.Append(" order by 实际标识"); } else if (m_TableName == "TPerson") { strSQL.Append(" select 编码,名称=姓名,顺序号,是否有效 from " + m_TableName + " "); strSQL.Append(" where 是否有效=1 and 类型编码=2 order by 姓名"); } else { strSQL.Append(" select 编码,名称,顺序号,是否有效 from " + m_TableName + " "); strSQL.Append(" where 是否有效=1 order by 顺序号"); } try { using (DataSet ds = SqlHelper.ExecuteDataSet(Conn, CommandType.Text, strSQL.ToString(), null)) { foreach (DataRow dr in ds.Tables[0].Rows) { info = new M_Dictionary(); info.ID = DBConvert.ConvertStringToString(dr["编码"]); info.Name = DBConvert.ConvertStringToString(dr["名称"]); info.SN = Convert.ToInt32(dr["顺序号"]); info.IsActive = Convert.ToBoolean(dr["是否有效"]); list.Add(info); } return(list); } } catch (Exception) { //Log4Net.LogError("DictionaryDAL/GetDictionary", ex.Message); return(null); } }
protected void Egv_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Del") { string Id = e.CommandArgument.ToString(); dictBll.Del(DataConverter.CLng(Id)); DataBind(); } if (e.CommandName == "Edit1") { string Id = e.CommandArgument.ToString(); M_Dictionary info = B_DataDictionary.GetModel(DataConverter.CLng(Id)); this.txtDicName.Text = info.DicName; this.HdnDicID.Value = Id; this.btnSave.Text = "修改"; } }
public ActionResult updataActive() { string DictionaryID = Request.Form["DID"].ToString(); bool isActive = Convert.ToBoolean(Request.Form["isActive"]); M_Dictionary dic = new M_Dictionary(); dic.ID = DictionaryID; dic.IsActive = isActive; if (new M_DictionaryBLL().Modify(dic, "IsActive") > 0) { return(this.JsonResult(Utility.E_JsonResult.OK, "修改字典信息成功!", null, null)); } else { return(this.JsonResult(Utility.E_JsonResult.Error, "修改字典信息失败!", null, null)); } }
public List <M_Dictionary> GetDictionaries() { var entities = new List <M_Dictionary>(); using (var rdr = SqlHelper.ExecuteReader(this._databaseConnectionString, CommandType.Text, SqlCommands_Sc.Sql_M_Dictionary_Repository_GetDictionaries, null)) { while (rdr.Read()) { var entity = new M_Dictionary(); entity.Id = SqlTypeConverter.DBNullInt32Handler(rdr["Id"]); entity.Name = SqlTypeConverter.DBNullStringHandler(rdr["Name"]); entity.ValuesJson = SqlTypeConverter.DBNullStringHandler(rdr["ValuesJson"]); entity.ValuesBinary = SqlTypeConverter.DBNullBytesHandler(rdr["ValuesBinary"]); entity.LastUpdatedDate = SqlTypeConverter.DBNullDateTimeHandler(rdr["LastUpdatedDate"]); entities.Add(entity); } } return(entities); }
//修改 public ActionResult EditDictionary() { string DictionaryID = Request.Form["DID"].ToString(); string DictionaryName = Request.Form["DictionaryName"].ToString(); int SN = int.Parse(Request.Form["SN"]); M_Dictionary dic = new M_Dictionary(); dic.ID = DictionaryID; dic.Name = DictionaryName; dic.SN = SN; if (new M_DictionaryBLL().Modify(dic, "Name", "SN") > 0) { return(this.JsonResult(Utility.E_JsonResult.OK, "修改字典信息成功!", null, null)); } else { return(this.JsonResult(Utility.E_JsonResult.Error, "修改字典信息失败!", null, null)); } }
public M_Dictionary GetDictionary(int id) { SqlParameter[] parms = { new SqlParameter("@Id", SqlDbType.Int) }; parms[0].Value = id; M_Dictionary entity = null; using (var rdr = SqlHelper.ExecuteReader(this._databaseConnectionString, CommandType.Text, SqlCommands_Sc.Sql_M_Dictionary_Repository_GetDictionary, parms)) { if (rdr.Read()) { entity = new M_Dictionary(); entity.Id = SqlTypeConverter.DBNullInt32Handler(rdr["Id"]); entity.Name = SqlTypeConverter.DBNullStringHandler(rdr["Name"]); entity.ValuesJson = SqlTypeConverter.DBNullStringHandler(rdr["ValuesJson"]); entity.ValuesBinary = SqlTypeConverter.DBNullBytesHandler(rdr["ValuesBinary"]); entity.LastUpdatedDate = SqlTypeConverter.DBNullDateTimeHandler(rdr["LastUpdatedDate"]); } } return(entity); }
public ContentResult DicItem_API() { string action = GetParam("action"); string ids = GetParam("ids"); switch (action) { case "del": dItemBll.DelByIds(ids); break; case "save": { string name = GetParam("name"); if (string.IsNullOrEmpty(name)) { return(Content(Failed.ToString())); } M_Dictionary info = new M_Dictionary(); if (Mid > 0) { info = B_DataDictionary.GetModel(Mid); } info.DicName = name; if (info.DicID < 1) { info.DicCate = CateID; info.IsUsed = true; B_DataDictionary.AddDic(info); } else { B_DataDictionary.Update(info); } } break; } return(Content(Success.ToString())); }
public List <M_Dictionary> GetMSDictionaryInfos(string typeCode, string isPatient) { M_Dictionary info; List <M_Dictionary> list = new List <M_Dictionary>(); StringBuilder sbSQL = new StringBuilder(); sbSQL.Append(" select td.ID,td.Name,td.TypeID,Type=tdt.Description,td.SN,td.IsActive "); //SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(SqlHelper.ConnectionPatientRecordTransaction);//取管理库的链接字符串 //是病历字典表 if (isPatient == "1") { sbSQL.Append(" from dbo.M_Dictionary td "); sbSQL.Append(" left join dbo.M_DictionaryType tdt on tdt.TypeID=td.TypeID "); sbSQL.Append(" where td.IsActive=1 "); WhereClauseUtility.AddStringInSelectQuery("td.TypeID", typeCode, sbSQL);//20150723修改为允许一次查询多个类 } else { sbSQL.Append(" from dbo.TDictionary td "); sbSQL.Append(" left join dbo.TDictionaryType tdt on tdt.TypeID=td.TypeID "); sbSQL.Append(" where td.IsActive=1 ");//具体再修改 WhereClauseUtility.AddStringEqual("td.TypeID", typeCode, sbSQL); } sbSQL.Append("order by td.SN "); using (DataSet ds = SqlHelper.ExecuteDataSet(SqlHelper.MainConnectionString, CommandType.Text, sbSQL.ToString(), null)) { foreach (DataRow dr in ds.Tables[0].Rows) { info = new M_Dictionary(); info.ID = DBConvert.ConvertStringToString(dr["ID"]); info.Name = DBConvert.ConvertStringToString(dr["Name"]); info.TypeID = DBConvert.ConvertStringToString(dr["TypeID"]); info.SN = Convert.ToInt32(dr["SN"]); info.IsActive = Convert.ToBoolean(dr["IsActive"]); list.Add(info); } return(list); } }
/// <summary> /// 更新 /// </summary> /// <param name="info"></param> /// <returns></returns> public static bool Update(M_Dictionary model) { return(Sql.UpdateByIDs(model.TbName, model.PK, model.DicID.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters())); }
/// <summary> /// 添加数据字典项目 /// </summary> /// <param name="info"></param> /// <returns></returns> public static bool AddDic(M_Dictionary model) { return(Sql.insertID(model.TbName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model)) > 0); }
/// <summary> /// 更新 /// </summary> /// <param name="info"></param> /// <returns></returns> public static bool Update(M_Dictionary model) { return(DBCenter.UpdateByID(model, model.DicID)); }
/// <summary> /// 添加数据字典项目 /// </summary> /// <param name="info"></param> /// <returns></returns> public static bool AddDic(M_Dictionary model) { return(DBCenter.Insert(model) > 0); }