public IList<MBType> GetMBTypeList() { IList<MBType> ret = new List<MBType>(); IMiscRepository iMiscRepository = RepositoryFactory.GetInstance().GetRepository<IMiscRepository>(); try { ConstValueTypeInfo condition = new ConstValueTypeInfo(); condition.type = "SmallBoardMBType"; IList<ConstValueTypeInfo> constValueList = iMiscRepository.GetData<IMES.Infrastructure.Repository._Metas.ConstValueType, ConstValueTypeInfo>(condition); constValueList = constValueList.OrderBy(x => x.description).ToList(); foreach (ConstValueTypeInfo item in constValueList) { MBType value = new MBType(); value.Descr = item.description; value.Value = item.value; ret.Add(value); } } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } return ret; }
/// <summary> /// 增加一条ConstValue的记录数据(update/insert) /// </summary> /// <param name="obj">增加ConstValueInfo结构</param> public void InsertConstValueType(ConstValueTypeInfo info) { try { IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>(); itemRepository.InsertConstValueType(info); } catch (Exception) { throw; } }
/// <summary> /// 保存一条ConstValue的记录数据(update/insert) /// </summary> /// <param name="obj">更新ConstValueInfo结构</param> public void UpdateConstValueType(ConstValueTypeInfo obj) { try { IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>(); ConstValueTypeInfo tempConstValue = new ConstValueTypeInfo(); tempConstValue.id = obj.id; if (tempConstValue.id > 0) { itemRepository.UpdateConstValueType(obj); } else { itemRepository.InsertConstValueType(obj); } //tempConstValue.type = obj.type; //tempConstValue.value = obj.value; //tempConstValue.description = obj.description; //IList<ConstValueTypeInfo> exists = itemRepository.GetConstValueTypeList(tempConstValue.type); //if (exists != null && exists.Count > 0) //{ // foreach (ConstValueTypeInfo s in exists) // { // if (s.value == tempConstValue.value && s.description == tempConstValue.description) // { itemRepository.UpdateConstValueType(obj); // } // } // string a = ""; //} //else //{ // itemRepository.InsertConstValueType(obj); //} } catch (Exception) { throw; } }
protected void btnDelete_ServerClick(Object sender, EventArgs e) { //string oldCode = this.dOldCode.Value.Trim(); string type = selecttype.Value; string value = ""; ConstValueTypeInfo item = new ConstValueTypeInfo(); item.type = selecttype.Value; if (this.HidValueList.Value.Trim() == "" || this.HidValueList.Value.Trim() == null) { value = this.dValue.Text.Trim(); } else { value = this.HidValueList.Value.Trim(); } try { if (this.hidSelectId.Value != "") { string SelectID = this.hidSelectId.Value.Substring(0, this.hidSelectId.Value.Length - 1); IList<string> idList = SelectID.Split(',').Where(x => x != "").ToList(); iConstValueType.RemoveConstValueType(idList); } else { if (this.HidValueList.Value == "" || this.HidValueList.Value == null) { int id = Convert.ToInt32(this.HidID.Value); iConstValueType.RemoveConstValueType(id); } else { iConstValueType.RemoveMultiConstValueType(type, value); this.HidValueList.Value = ""; } } } catch (FisException ex) { showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { //show error showErrorMessage(ex.Message); return; } ShowListByType(); ShowTypeDescriptionByType(); this.updatePanel2.Update(); ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "DeleteComplete();DealHideWait();", true); }
protected void btnSave_ServerClick(Object sender, EventArgs e) { ConstValueTypeInfo item = new ConstValueTypeInfo(); item.type = selecttype.Value; IList<string> TypeList = new List<string>(); if (this.dValue.Text.Trim() == "" || this.dValue.Text.Trim() == null) { item.value = this.HidValueList.Value.Trim(); TypeList = this.HidValueList.Value.Split(','); } else { item.value = this.dValue.Text.Trim(); } item.description = this.dDescr.Text.Trim(); item.editor = this.HiddenUserName.Value; IList<ConstValueTypeInfo> dataList = iConstValueType.GetConstValueTypeList(item.type); string[] strarray = item.value.Split(','); var Query = (from p in dataList where strarray.Contains(p.value) && p.description == item.description select new ConstValueTypeInfo { id = p.id, type = p.type, value = p.value ,description = p.description }).ToList<ConstValueTypeInfo>(); if (Query.Count != 0) { string msg = ""; foreach (ConstValueTypeInfo s in Query) { msg += s.value+","; } msg = msg.Substring(0, msg.Length - 1); showErrorMessage(msg + Environment.NewLine + pmtMessage6); return; } try { if (this.HidValueList.Value == "" || this.HidValueList.Value == null) { if (this.HidID.Value != "" && this.HidID.Value != null) { item.id = Convert.ToInt32(this.HidID.Value); } iConstValueType.UpdateConstValueType(item); } else { iConstValueType.InsertMultiConstValueType(item.type, TypeList, item.description, item.editor); this.HidValueList.Value = ""; } } catch (FisException ex) { showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { showErrorMessage(ex.Message); return; } ShowListByType(); ShowTypeDescriptionByType(); this.updatePanel2.Update(); ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "DealHideWait();", true); }
public void RemoveConstValueType(IList<string> ids) { try { IMiscRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IMiscRepository>(); IUnitOfWork uow = new UnitOfWork(); foreach (string id in ids) { ConstValueTypeInfo item = new ConstValueTypeInfo(); item.id = int.Parse(id); itemRepository.DeleteDataDefered<IMES.Infrastructure.Repository._Metas.ConstValueType, ConstValueTypeInfo>(uow, item); } uow.Commit(); } catch (Exception) { throw; } }