Пример #1
0
        //新增数据
        /// <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;
        }
Пример #2
0
        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);
        }
Пример #3
0
        public static bool Delete(DictionaryItem dictionaryItem, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
            DELETE FROM T_DICTIONARY_ITEM
            WHERE [email protected]

            ";

            return Dapper.Save(dictionaryItem, sql, conn, trans);
        }
Пример #4
0
        public static bool Delete(DictionaryItem dictionaryItem)
        {
            const string sql = @"
            DELETE FROM T_DICTIONARY_ITEM
            WHERE [email protected]

            ";

            return Dapper.Save(dictionaryItem, sql);
        }
Пример #5
0
 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;
 }
Пример #6
0
 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;
 }
Пример #7
0
 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;
 }
Пример #8
0
        public static bool Update(DictionaryItem dictionaryItem, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
            UPDATE T_DICTIONARY_ITEM
            SET [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],MODIFIED_ON=CONVERT(NVARCHAR(50),GETDATE(),121),[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
            WHERE [email protected]

            ";

            return Dapper.Save(dictionaryItem, sql, conn, trans);
        }
Пример #9
0
        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);
        }
Пример #10
0
        //设置选中的实体
        /// <summary>
        /// 设置选中的实体
        /// </summary>
        private void SetSelectedEntity()
        {
            if (grdQueryResult.SelectedRows == null ||
                grdQueryResult.SelectedRows.Count <= 0)
                return;

            EditEntity = grdQueryResult.SelectedRows[0].DataBoundItem as DictionaryItem;

            InitEditForm();
        }
Пример #11
0
        //用编辑框数据填充实体
        /// <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;
        }
Пример #12
0
 //删除数据
 /// <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;
 }