/// <summary> /// 把生肖,方向,季节转换成数字 /// </summary> /// <param name="key"></param> /// <param name="enumType"></param> /// <returns></returns> private int GetDictValue(string key, DictType enumType) { try { key = key.Trim().Replace(" ", ""); if (enumType == DictType.Animal) { return(AnimalDict[key]); } if (enumType == DictType.Direction) { return(DirectionDict[key]); } if (enumType == DictType.Season) { return(SeasonDict[key]); } return(0); } catch (Exception ee) { return(-1); } }
protected void btnSure_Click(object sender, EventArgs e) { DictType entity = new DictType(); WebFormHelper.GetDataFromForm(this, entity); if (entity.Id < 0) { if (SimpleOrmOperator.Create(entity)) { WebTools.Alert("添加成功!"); } else { WebTools.Alert("添加失败!"); } } else { if (SimpleOrmOperator.Update(entity)) { WebTools.Alert("修改成功!"); } else { WebTools.Alert("修改失败!"); } } }
/// <summary> /// 更新一条数据 /// </summary> public virtual void Update(DictType model) { using (var session = sessionFactory.OpenSession()) { session.SaveOrUpdate(model); session.Flush(); } }
public DictEntity GetByType(DictType dictType) { if (dictType != DictType.None) { return(GetByCode(dictType.ToString())); } return(null); }
/// <summary> /// 删除数据 /// </summary> public virtual void Delete(DictType model) { using (var session = sessionFactory.OpenSession()) { session.Delete(model); session.Flush(); } }
/// <summary> /// 增加一条数据 /// </summary> public virtual object Save(DictType model) { using (ISession session = sessionFactory.OpenSession()) { var id = session.Save(model); session.Flush(); return(id); } }
public IActionResult Edit(string Id) { var model = new DictType(); if (!string.IsNullOrEmpty(Id)) { model = _DictTypeService.Get(Id); } return(View(model)); }
/// <summary> /// 获取某个字典 /// </summary> /// <param name="DOMAINNAMEIDEN">字典设别</param> /// <param name="dicttype">字典类型(公共、业务)</param> /// <param name="ddnmParams"></param> /// <returns></returns> public override DataTable GetDicts(string DOMAINNAMEIDEN, DictType dicttype, DistributeDataNodeManagerParams ddnmParams) { DataSet ds = null; StringBuilder sbb = new StringBuilder(); string dictname = string.Empty; if (dicttype == DictType.BizDict) { dictname = "SSY_BIZ_DICT"; } else if (dicttype == DictType.FrameDict) { dictname = "SSY_FRAME_DICT"; } else { //throw new Exception("必须设置字典类型!"); throw new Exception(BaseServiceUtility.GetI18nLangItem("noticeinfo_setDictType", base.i18nXxxManageri18nLang)); } if (string.IsNullOrEmpty(DOMAINNAMEIDEN)) { //throw new Exception("必须设置字典设别!"); throw new Exception(BaseServiceUtility.GetI18nLangItem("noticeinfo_setDictIden", base.i18nXxxManageri18nLang)); } List <IDataParameter> parameters = new List <IDataParameter>(); try { sbb.AppendLine(string.Format(@" select * FROM {0}.{1} where DOMAINNAMEIDEN = {2}DOMAINNAMEIDEN", DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory.DbSchema, dictname, DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory.ParamSign())); parameters.Add(DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory. GetDataParameter("DOMAINNAMEIDEN", DbType.String, DOMAINNAMEIDEN)); ds = DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory.GetDataSet(sbb.ToString(), SqlExecType.SqlText, null); } catch (Exception ex) { return(null); } if (Common.Utility.DsHasData(ds)) { return(ds.Tables[0]); } else { return(null); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.Params["id"] != null) { DictType entity = SimpleOrmOperator.Query <DictType>(Convert.ToInt32(Request.Params["id"])); WebFormHelper.SetDataToForm(this, entity); } } }
public NGRPChunk(BinaryReader reader) : base(reader) { nodeId = reader.ReadInt32(); nodeAttributes = new DictType(reader); numChildNodes = reader.ReadInt32(); childNodeIds = new int[numChildNodes]; for (int i = 0; i < numChildNodes; i++) { childNodeIds[i] = reader.ReadInt32(); } }
static bool IsComplexType(this Type type) { type = type.GetNonNullableType(); if (type.IsEnum) { type = EnumType; } return (!PrimitiveWriterMethods.ContainsKey(type) || DictType.IsAssignableFrom(type) || ListType.IsAssignableFrom(type)); }
public NSHPChunk(BinaryReader reader) : base(reader) { nodeId = reader.ReadInt32(); nodeAttributes = new DictType(reader); numModels = reader.ReadInt32(); models = new Tuple <int, DictType> [numModels]; for (int i = 0; i < numModels; i++) { var modelId = reader.ReadInt32(); var modelAttributes = new DictType(reader); models[i] = Tuple.Create(modelId, modelAttributes); } }
/// <summary> /// 获取某个字典 /// </summary> /// <param name="DOMAINNAMEIDEN">字典设别</param> /// <param name="dicttype">字典类型(公共、业务)</param> /// <param name="ddnmParams"></param> /// <returns></returns> public List <Xxx.Entities.SSY_BIZ_DICT> GetDicts(string DOMAINNAMEIDEN, DictType dicttype, DistributeDataNodeManagerParams ddnmParams) { List <Xxx.Entities.SSY_BIZ_DICT> listReturn = new List <Xxx.Entities.SSY_BIZ_DICT>(); DataTable dt = this.comSomebiz.GetDicts(DOMAINNAMEIDEN, dicttype, ddnmParams); if (Common.Utility.DtHasData(dt)) { listReturn = Common.UtilitysForT <Xxx.Entities.SSY_BIZ_DICT> .GetListsObj(dt); } return(listReturn); }
/// <summary> /// 设置ComboBox数据源 /// </summary> /// <param name="cmb">ComboBox控件</param> /// <param name="dictType">字典类别</param> /// <param name="selectedTypeCode">设置要选中的子项</param> /// <param name="setSelect">是否设置选中项</param> /// <param name="needBlankItem">是否需要一个空项</param> public static void SetCmbSource(ComboBox cmb, DictType dictType, string selectedTypeCode = "", bool setSelect = true, bool needBlankItem = false) { if (cmb == null) { return; } var dicts = GetCmbSource(dictType); CmbModel model = new CmbModel(); model.Bind(dicts, selectedTypeCode, setSelect, needBlankItem); cmb.DataContext = model; }
public NTRNChunk(BinaryReader reader) : base(reader) { nodeId = reader.ReadInt32(); nodeAttributes = new DictType(reader); childNodeId = reader.ReadInt32(); reservedId = reader.ReadInt32(); layerId = reader.ReadInt32(); numFrames = reader.ReadInt32(); frames = new DictType[numFrames]; for (int i = 0; i < numFrames; i++) { frames[i] = new DictType(reader); } }
public static void Print(Expression e, StringBuilder sb) { actions[e.GetType()](e, sb); //if (e is DoubleExpression de) //{ // sb.Append(de.Value); //} //else if (e is AdditionExpression ae) //{ // sb.Append("("); // Print(ae.Left, sb); // sb.Append("+"); // Print(ae.RIght, sb); // sb.Append(")"); //} }
public JsonResult Edit(DictType request) { PageResponse reponse = new PageResponse(); _DictTypeService.Update(request); zTree ztree = new zTree() { id = request.Id, pId = "0", name = request.Name, open = true }; reponse.code = StatusCodeDefine.Success; reponse.status = 0; reponse.data = ztree; return(Json(reponse)); }
public JsonResult Edit(DictType request) { Json reponse = new Json(); _DictTypeIService.Update(request); zTree ztree = new zTree() { id = request.Id, pId = "0", name = request.Name, open = true }; reponse.code = 200; reponse.status = 0; reponse.data = ztree; return(Json(reponse)); }
public JsonResult Create(DictType request) { request.Id = Guid.NewGuid().GuidTo16String(); var id = _DictTypeIService.Save(request); zTree ztree = new zTree() { id = request.Id, pId = "0", name = request.Name, open = true }; Json reponse = new Json(); reponse.code = 200; reponse.status = 0; reponse.data = ztree; return(Json(reponse)); }
public JsonResult Create(DictType request) { request.Id = Guid.NewGuid().GuidTo16String(); var id = _DictTypeService.Add(request); zTree ztree = new zTree() { id = request.Id, pId = "0", name = request.Name, open = true }; PageResponse reponse = new PageResponse(); reponse.code = StatusCodeDefine.Success; reponse.status = 0; reponse.data = ztree; return(Json(reponse)); }
/// <summary> /// 获取当前字典类型 /// </summary> /// <param name="dictTypeStr"></param> /// <returns></returns> public static DictType GetDictType(string dictTypeStr) { DictType currType = DictType.BizDict; switch (dictTypeStr) { case "FrameDict": currType = DictType.FrameDict; break; case "BizDict": currType = DictType.BizDict; break; default: break; } return(currType); }
public static string GetDictName(DictType dictType, string DictNO) { if (dictType == DictType.GoodsType) { return(Common.Foundation.ReadObject("select TypeName from GoodsType where TypeNO=" + DictNO).ToString()); } else if (dictType == DictType.GoodsUnit) { return(Common.Foundation.ReadObject("select UnitName from GoodsUnit where UnitNO=" + DictNO).ToString()); } else if (dictType == DictType.Providers) { return(Common.Foundation.ReadObject("select ProviderName from Providers where ProviderNO=" + DictNO).ToString()); } else if (dictType == DictType.ProviderType) { return(Common.Foundation.ReadObject("select TypeDesc from ProviderType where TypeNO=" + DictNO).ToString()); } return(string.Empty); }
public DataType getSubscript(ArrayRef s, DataType vt, DataType st) { if (vt.isUnknownType()) { return(DataType.Unknown); } else if (vt is ListType) { return(getListSubscript(s, vt, st)); } else if (vt is TupleType) { return(getListSubscript(s, ((TupleType)vt).toListType(), st)); } else if (vt is DictType) { DictType dt = (DictType)vt; if (!dt.keyType.Equals(st)) { AddWarning(s, "Possible KeyError (wrong type for subscript)"); } return(((DictType)vt).valueType); } else if (vt == DataType.Str) { if (st != null && (st is ListType || st.isNumType())) { return(vt); } else { AddWarning(s, "Possible KeyError (wrong type for subscript)"); return(DataType.Unknown); } } else { return(DataType.Unknown); } }
private DictBinaryType GetDictType(DictType dict) { var data = dict.GetFieldData(); var subData = dict.ValueTypeGen.GetFieldData(); if (subData.HasTrigger) { return(DictBinaryType.SubTrigger); } else if (data.RecordType.HasValue) { return(DictBinaryType.Trigger); } else if (dict.Mode == DictMode.KeyValue && dict.KeyTypeGen is EnumType) { return(DictBinaryType.EnumMap); } else { throw new NotImplementedException(); } }
/// <summary> /// 修改 /// </summary> /// <param name="m_user"></param> /// <returns></returns> public void Update(DictType model) { dao.Update(model); }
public AttributeDict(DictType type) { this.type = type; }
static bool IsDictionaryType(this Type type) { return(DictType.IsAssignableFrom(type) || type.Name == "IDictionary`2"); }
/// <summary> /// 获取某个字典 /// </summary> /// <param name="DOMAINNAMEIDEN">字典设别</param> /// <param name="dicttype">字典类型(公共 业务)</param> /// <param name="ddnmParams"></param> /// <returns></returns> public abstract DataTable GetDicts(string DOMAINNAMEIDEN, DictType dicttype, DistributeDataNodeManagerParams ddnmParams);
public IActionResult Create() { var model = new DictType(); return(View(model)); }
public static void Print2(Expression e, StringBuilder sb) { actions[e.GetType()](e, sb); // alternative way, still breaks open-closed principle }
public static void Print(Expression e, StringBuilder sb) { actions[e.GetType()](e, sb); }
private DictType Register(DictType dictType) { dictType.Table.addSuper(analyzer.Builtins.BaseDict.Table); dictType.Table.Path = analyzer.Builtins.BaseDict.Table.Path; return dictType; }