/// <summary> /// 获取系统类型定义实体集合 /// </summary> /// <param name="FieldType">类型的类型(为null不作条件)</param> /// <param name="IsEnabled">是否启用(为null不作条件)</param> /// <param name="IsDefault">是否系统预定义类型(为null不作条件)</param> /// <returns>系统类型定义实体集合</returns> public virtual IList <Model.SystemStructure.SysField> GetSysFieldList(Model.SystemStructure.SysFieldType?FieldType, bool?IsEnabled , bool?IsDefault) { IList <EyouSoft.Model.SystemStructure.SysField> List = new List <EyouSoft.Model.SystemStructure.SysField>(); string strWhere = Sql_SysField_Select + " where 1 = 1 "; if (FieldType != null) { strWhere += string.Format(" and FieldType = {0} ", (int)FieldType); } if (IsEnabled != null) { strWhere += string.Format(" and IsEnabled = '{0}' ", (bool)IsEnabled ? 1 : 0); } if (IsDefault != null) { strWhere += string.Format(" and IsDefault = '{0}' ", (bool)IsDefault ? 1 : 0); } DbCommand dc = base.SystemStore.GetSqlStringCommand(strWhere); using (IDataReader dr = DbHelper.ExecuteReader(dc, base.SystemStore)) { EyouSoft.Model.SystemStructure.SysField model = null; while (dr.Read()) { model = new EyouSoft.Model.SystemStructure.SysField(); model.FieldName = dr["FieldName"].ToString(); if (!dr.IsDBNull(dr.GetOrdinal("FieldID"))) { model.FieldId = int.Parse(dr["FieldID"].ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("IsEnabled")) && dr["IsEnabled"].ToString() == "1") { model.IsEnabled = true; } else { model.IsEnabled = false; } if (!dr.IsDBNull(dr.GetOrdinal("IsDefault")) && dr["IsDefault"].ToString() == "1") { model.IsDefault = true; } else { model.IsDefault = false; } if (!dr.IsDBNull(dr.GetOrdinal("FieldType"))) { model.FieldType = (Model.SystemStructure.SysFieldType) int.Parse(dr["FieldType"].ToString()); } List.Add(model); } } return(List); }
/// <summary> /// 新增系统类型定义 /// </summary> /// <param name="model">系统类型定义实体</param> /// <returns>返回受影响行数</returns> public virtual int AddSysField(EyouSoft.Model.SystemStructure.SysField model) { if (model == null) { return(0); } DbCommand dc = base.SystemStore.GetSqlStringCommand(Sql_SysField_Add); base.SystemStore.AddInParameter(dc, "FieldName", DbType.String, model.FieldName); base.SystemStore.AddInParameter(dc, "FieldType", DbType.Byte, (int)model.FieldType); base.SystemStore.AddInParameter(dc, "IsEnabled", DbType.AnsiStringFixedLength, model.IsEnabled ? "1" : "0"); base.SystemStore.AddInParameter(dc, "IsDefault", DbType.AnsiStringFixedLength, model.IsDefault ? "1" : "0"); return(DbHelper.ExecuteSql(dc, base.SystemStore)); }
/// <summary> /// 新增系统类型定义 /// </summary> /// <param name="model">系统类型定义实体</param> /// <returns>0:Error;1:Success</returns> public int AddSysField(EyouSoft.Model.SystemStructure.SysField model) { if (model == null) { return(0); } int Result = dal.AddSysField(model); if (Result > 0) { RemoveCache(model.FieldType); return(1); } else { return(0); } }
private void Add(string CustomerName) { string strErr = ""; if (CustomerName == "") { strErr += "客户等级名称不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } EyouSoft.Model.SystemStructure.SysField Model = new EyouSoft.Model.SystemStructure.SysField(); Model.FieldName = CustomerName; Model.IsEnabled = true; Model.FieldType = EyouSoft.Model.SystemStructure.SysFieldType.客户等级; int reAddInt = EyouSoft.BLL.SystemStructure.SysField.CreateInstance().AddSysField(Model); //释放资源 Model = null; return; }
private void Add(string RounteName) { //新增 string strErr = ""; if (RounteName == "") { strErr += "线路主题名称不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } EyouSoft.Model.SystemStructure.SysField Model = new EyouSoft.Model.SystemStructure.SysField(); Model.FieldName = RounteName; Model.FieldType = EyouSoft.Model.SystemStructure.SysFieldType.线路主题; int reAddInt = EyouSoft.BLL.SystemStructure.SysField.CreateInstance().AddSysField(Model); //释放资源 Model = null; return; }