//新增数据 /// <summary> /// 新增数据 /// </summary> /// <returns></returns> internal override bool Add() { EditEntity = null; pageViewMain.SelectedPage = pageEditData; UI.ClearUi(pageEditData, new List<string> { "ddlDictionaryCode" }); UI.ReadOnlyUi(pageEditData, false); return true; }
public static bool Delete(DictionaryItem dictionaryItem) { const string sql = @" DELETE FROM T_DICTIONARY_ITEM WHERE SYSID=@Sysid "; return(Dapper.Save(dictionaryItem, sql)); }
public static bool Delete(DictionaryItem dictionaryItem, SqlConnection conn, SqlTransaction trans) { const string sql = @" DELETE FROM T_DICTIONARY_ITEM WHERE SYSID=@Sysid "; return(Dapper.Save(dictionaryItem, sql, conn, trans)); }
public static bool Delete(DictionaryItem dictionaryItem) { const string sql = @" DELETE FROM T_DICTIONARY_ITEM WHERE SYSID=@Sysid "; return Dapper.Save(dictionaryItem, sql); }
public static bool Delete(DictionaryItem dictionaryItem, SqlConnection conn, SqlTransaction trans) { const string sql = @" DELETE FROM T_DICTIONARY_ITEM WHERE SYSID=@Sysid "; return Dapper.Save(dictionaryItem, sql, conn, trans); }
public static bool Insert(DictionaryItem dictionaryItem, SqlConnection conn, SqlTransaction trans) { const string sql = @" INSERT INTO T_DICTIONARY_ITEM(SYSID,DICTIONARY_CODE,CODE,NAME,SEQUENCE,WORKSHOP,STEP,REMARK,CREATED_ON,CREATED_BY,MODIFIED_ON,MODIFIED_BY,RECORD_STATUS,RESV01,RESV02,RESV03,RESV04,RESV05,RESV06,RESV07,RESV08,RESV09,RESV10) VALUES(@Sysid,@DictionaryCode,@Code,@Name,@Sequence,@Workshop,@Step,@Remark,CONVERT(NVARCHAR(50),GETDATE(),121),@CreatedBy,CONVERT(NVARCHAR(50),GETDATE(),121),@ModifiedBy,@RecordStatus,@Resv01,@Resv02,@Resv03,@Resv04,@Resv05,@Resv06,@Resv07,@Resv08,@Resv09,@Resv10) "; return(Dapper.Save(dictionaryItem, sql, conn, trans)); }
public static bool Insert(DictionaryItem dictionaryItem, SqlConnection conn, SqlTransaction trans) { const string sql = @" INSERT INTO T_DICTIONARY_ITEM(SYSID,DICTIONARY_CODE,CODE,NAME,SEQUENCE,WORKSHOP,STEP,REMARK,CREATED_ON,CREATED_BY,MODIFIED_ON,MODIFIED_BY,RECORD_STATUS,RESV01,RESV02,RESV03,RESV04,RESV05,RESV06,RESV07,RESV08,RESV09,RESV10) VALUES(@Sysid,@DictionaryCode,@Code,@Name,@Sequence,@Workshop,@Step,@Remark,CONVERT(NVARCHAR(50),GETDATE(),121),@CreatedBy,CONVERT(NVARCHAR(50),GETDATE(),121),@ModifiedBy,@RecordStatus,@Resv01,@Resv02,@Resv03,@Resv04,@Resv05,@Resv06,@Resv07,@Resv08,@Resv09,@Resv10) "; return Dapper.Save(dictionaryItem, sql, conn, trans); }
public static bool Update(DictionaryItem dictionaryItem, SqlConnection conn, SqlTransaction trans) { const string sql = @" UPDATE T_DICTIONARY_ITEM SET DICTIONARY_CODE=@DictionaryCode,CODE=@Code,NAME=@Name,SEQUENCE=@Sequence,WORKSHOP=@Workshop,STEP=@Step,REMARK=@Remark,CREATED_BY=@CreatedBy,MODIFIED_ON=CONVERT(NVARCHAR(50),GETDATE(),121),MODIFIED_BY=@ModifiedBy,RECORD_STATUS=@RecordStatus,RESV01=@Resv01,RESV02=@Resv02,RESV03=@Resv03,RESV04=@Resv04,RESV05=@Resv05,RESV06=@Resv06,RESV07=@Resv07,RESV08=@Resv08,RESV09=@Resv09,RESV10=@Resv10 WHERE SYSID=@Sysid "; return(Dapper.Save(dictionaryItem, sql, conn, trans)); }
public static bool InsertDictionaryItem(DictionaryItem dictionaryItem, out string msg) { var dictionaryItems = DictionaryItemDal.QueryMutileCodeInDictionary(dictionaryItem); if (dictionaryItems != null && dictionaryItems.Count > 0) { msg = string.Format("字典编号{0}、字典项编号{1}的记录已经存在", dictionaryItem.DictionaryCode, dictionaryItem.Code); return false; } if (!DictionaryItemDal.Insert(dictionaryItem)) { msg = "新增失败"; return false; } msg = "新增成功"; return true; }
public static bool InsertDictionaryItem(DictionaryItem dictionaryItem, out string msg) { var dictionaryItems = DictionaryItemDal.QueryMutileCodeInDictionary(dictionaryItem); if (dictionaryItems != null && dictionaryItems.Count > 0) { msg = string.Format("字典编号{0}、字典项编号{1}的记录已经存在", dictionaryItem.DictionaryCode, dictionaryItem.Code); return(false); } if (!DictionaryItemDal.Insert(dictionaryItem)) { msg = "新增失败"; return(false); } msg = "新增成功"; return(true); }
public static List <DictionaryItem> QueryMutileCodeInDictionary(DictionaryItem dictionaryItem) { const string sql = @" SELECT A.SYSID AS Sysid,A.DICTIONARY_CODE AS DictionaryCode,A.CODE AS Code ,A.NAME AS Name,A.SEQUENCE AS Sequence,A.WORKSHOP AS Workshop,A.STEP AS Step ,A.REMARK AS Remark,A.CREATED_ON AS CreatedOn,A.CREATED_BY AS CreatedBy ,A.MODIFIED_ON AS ModifiedOn,A.MODIFIED_BY AS ModifiedBy,A.RECORD_STATUS AS RecordStatus ,A.RESV01 AS Resv01,A.RESV02 AS Resv02,A.RESV03 AS Resv03,A.RESV04 AS Resv04 ,A.RESV05 AS Resv05,A.RESV06 AS Resv06,A.RESV07 AS Resv07,A.RESV08 AS Resv08 ,A.RESV09 AS Resv09,A.RESV10 AS Resv10 FROM T_DICTIONARY_ITEM AS A WITH(NOLOCK) WHERE 1 = 1 AND A.DICTIONARY_CODE = @DictionaryCode AND A.CODE = @Code "; return(Dapper.Query <DictionaryItem>(sql, dictionaryItem)); }
public static bool DeleteDictionaryItem(DictionaryItem dictionaryItem, out string msg) { if (dictionaryItem.DictionaryCode == DataDictionary.FunctionCommand.ToString()) { var commandsInRight = RightBll.QueryByCommandSysid(dictionaryItem.Sysid); if (commandsInRight != null && commandsInRight.Count > 0) { msg = "当前字典项被功能命令设置使用,不可进行删除操作"; return(false); } } if (DictionaryItemDal.Delete(dictionaryItem)) { msg = "删除成功"; return(true); } msg = "删除失败"; return(false); }
public static bool DeleteDictionaryItem(DictionaryItem dictionaryItem, out string msg) { if (dictionaryItem.DictionaryCode == DataDictionary.FunctionCommand.ToString()) { var commandsInRight = RightBll.QueryByCommandSysid(dictionaryItem.Sysid); if (commandsInRight != null && commandsInRight.Count > 0) { msg = "当前字典项被功能命令设置使用,不可进行删除操作"; return false; } } if (DictionaryItemDal.Delete(dictionaryItem)) { msg = "删除成功"; return true; } msg = "删除失败"; return false; }
public static bool UpdateDictionaryItem(DictionaryItem dictionaryItem, out string msg) { var dictionaryItems = DictionaryItemDal.QueryMutileCodeInDictionary(dictionaryItem); if (dictionaryItems != null && dictionaryItems.Count > 0) { if (dictionaryItems.FindAll(p => p.Sysid != dictionaryItem.Sysid).Count > 0) { msg = string.Format("字典编号{0}、字典项编号{1}的记录已经存在", dictionaryItem.DictionaryCode, dictionaryItem.Code); return false; } } if (!DictionaryItemDal.Update(dictionaryItem)) { msg = "修改失败"; return false; } msg = "修改成功"; return true; }
public static bool UpdateDictionaryItem(DictionaryItem dictionaryItem, out string msg) { var dictionaryItems = DictionaryItemDal.QueryMutileCodeInDictionary(dictionaryItem); if (dictionaryItems != null && dictionaryItems.Count > 0) { if (dictionaryItems.FindAll(p => p.Sysid != dictionaryItem.Sysid).Count > 0) { msg = string.Format("字典编号{0}、字典项编号{1}的记录已经存在", dictionaryItem.DictionaryCode, dictionaryItem.Code); return(false); } } if (!DictionaryItemDal.Update(dictionaryItem)) { msg = "修改失败"; return(false); } msg = "修改成功"; return(true); }
//删除数据 /// <summary> /// 删除数据 /// </summary> /// <returns></returns> internal override bool Delete() { if (EditEntity == null) { UI.ShowWarn("请选择待删除数据"); return false; } if (!UI.Confirm("确定要删除吗?")) return false; string msg; if (!DictionaryItemBll.DeleteDictionaryItem(EditEntity, out msg)) { UI.ShowError(msg); return false; } EditEntity = null; UI.ClearUi(pageEditData); return true; }
//设置选中的实体 /// <summary> /// 设置选中的实体 /// </summary> private void SetSelectedEntity() { if (grdQueryResult.SelectedRows == null || grdQueryResult.SelectedRows.Count <= 0) return; EditEntity = grdQueryResult.SelectedRows[0].DataBoundItem as DictionaryItem; InitEditForm(); }
public static bool Update(DictionaryItem dictionaryItem, SqlConnection conn, SqlTransaction trans) { const string sql = @" UPDATE T_DICTIONARY_ITEM SET DICTIONARY_CODE=@DictionaryCode,CODE=@Code,NAME=@Name,SEQUENCE=@Sequence,WORKSHOP=@Workshop,STEP=@Step,REMARK=@Remark,CREATED_BY=@CreatedBy,MODIFIED_ON=CONVERT(NVARCHAR(50),GETDATE(),121),MODIFIED_BY=@ModifiedBy,RECORD_STATUS=@RecordStatus,RESV01=@Resv01,RESV02=@Resv02,RESV03=@Resv03,RESV04=@Resv04,RESV05=@Resv05,RESV06=@Resv06,RESV07=@Resv07,RESV08=@Resv08,RESV09=@Resv09,RESV10=@Resv10 WHERE SYSID=@Sysid "; return Dapper.Save(dictionaryItem, sql, conn, trans); }
public static List<DictionaryItem> QueryMutileCodeInDictionary(DictionaryItem dictionaryItem) { const string sql = @" SELECT A.SYSID AS Sysid,A.DICTIONARY_CODE AS DictionaryCode,A.CODE AS Code ,A.NAME AS Name,A.SEQUENCE AS Sequence,A.WORKSHOP AS Workshop,A.STEP AS Step ,A.REMARK AS Remark,A.CREATED_ON AS CreatedOn,A.CREATED_BY AS CreatedBy ,A.MODIFIED_ON AS ModifiedOn,A.MODIFIED_BY AS ModifiedBy,A.RECORD_STATUS AS RecordStatus ,A.RESV01 AS Resv01,A.RESV02 AS Resv02,A.RESV03 AS Resv03,A.RESV04 AS Resv04 ,A.RESV05 AS Resv05,A.RESV06 AS Resv06,A.RESV07 AS Resv07,A.RESV08 AS Resv08 ,A.RESV09 AS Resv09,A.RESV10 AS Resv10 FROM T_DICTIONARY_ITEM AS A WITH(NOLOCK) WHERE 1 = 1 AND A.DICTIONARY_CODE = @DictionaryCode AND A.CODE = @Code "; return Dapper.Query<DictionaryItem>(sql, dictionaryItem); }
//用编辑框数据填充实体 /// <summary> /// 用编辑框数据填充实体 /// </summary> private void BuildEntity() { if (CurrentOperationStatus == OperationStatus.New) EditEntity = new DictionaryItem { Sysid = Sysid.NewId(""), CreatedBy = GloableData.Instance.UserId }; EditEntity.Sequence = UI.GetInt(txtSequence); EditEntity.Remark = UI.GetValue(txtRemark); EditEntity.Name = UI.GetValue(txtName); EditEntity.Code = UI.GetValue(txtCode); EditEntity.DictionaryCode = UI.GetValue(ddlDictionaryCode); EditEntity.ModifiedBy = GloableData.Instance.UserId; }