public frmValueListManageEdit(EditMode para_em, EapValueList para_entity)
        {
            InitializeComponent();
            Func.FormatForm(this);

            em     = para_em;
            entity = para_entity;
        }
Beispiel #2
0
        /// <summary>
        /// 添加值列表数据
        /// </summary>
        /// <param name="add_entity">新增实体</param>
        /// <returns>错误消息,为空表示成功</returns>
        internal string AddValueList(EapValueList add_entity)
        {
            if (Config.GetConfig().DB_TYPE == "1")
            {
                return(DalOracle.GetDalOracle().AddValueList(add_entity));
            }

            return(string.Empty);
        }
Beispiel #3
0
        /// <summary>
        /// 修改值列表数据
        /// </summary>
        /// <param name="modify_entity">修改实体</param>
        /// <returns>错误消息,为空表示成功</returns>
        internal string ModifyValueList(EapValueList modify_entity)
        {
            if (Config.GetConfig().DB_TYPE == "1")
            {
                return(DalOracle.GetDalOracle().ModifyValueList(modify_entity));
            }

            return(string.Empty);
        }
Beispiel #4
0
        /// <summary>
        /// 查询值列表数据
        /// </summary>
        /// <param name="query_entity">查询条件实体</param>
        /// <param name="pageno">要查询的页</param>
        /// <param name="pagesize">页大小</param>
        /// <param name="icnt">结果记录条数</param>
        /// <returns>值列表数据清单</returns>
        internal List <EapValueList> QueryValueList(EapValueList query_entity, int pno, int psize, out int icnt)
        {
            if (Config.GetConfig().DB_TYPE == "1")
            {
                return(DalOracle.GetDalOracle().QueryValueList(query_entity, pno, psize, out icnt));
            }

            icnt = 0;
            return(null);
        }
Beispiel #5
0
        private void BindData()
        {
            EapValueList entity = new EapValueList();

            entity.VLIST_ID   = txtVListId.Text.Trim();
            entity.VLIST_NAME = txtVListName.Text.Trim();

            int icnt;
            List <EapValueList> list = Bll.GetBll().QueryValueList(entity, page.PageNo, page.PageSize, out icnt);

            page.RecordCount = icnt;

            dgvVList.DataSource = list;
        }
Beispiel #6
0
        /// <summary>
        /// 修改值列表数据
        /// </summary>
        /// <param name="modify_entity">修改实体</param>
        /// <returns>错误消息,为空表示成功</returns>
        internal string ModifyValueList(EapValueList modify_entity)
        {
            StringBuilder sql = new StringBuilder(100);
            sql.Append("update T_EAP_VALUE_LIST T set T.VLIST_NAME=:VLIST_NAME where T.VLIST_ID=:VLIST_ID");

            OracleParameter[] para = {
                new OracleParameter(":VLIST_ID", OracleType.VarChar),
                new OracleParameter(":VLIST_NAME", OracleType.VarChar)
            };
            para[0].Value = modify_entity.VLIST_ID;
            para[1].Value = modify_entity.VLIST_NAME;
            
            return Oracle.GetOracle().ExecSql(sql, para);
        }
Beispiel #7
0
        /// <summary>
        /// 添加值列表数据
        /// </summary>
        /// <param name="add_entity">新增实体</param>
        /// <returns>错误消息,为空表示成功</returns>
        internal string AddValueList(EapValueList add_entity)
        {
            StringBuilder sql = new StringBuilder(100);
            sql.Append("insert into T_EAP_VALUE_LIST T(T.VLIST_ID,T.VLIST_NAME) values(:VLIST_ID,:VLIST_NAME)");

            OracleParameter[] para = {
                new OracleParameter(":VLIST_ID", OracleType.VarChar),
                new OracleParameter(":VLIST_NAME", OracleType.VarChar)
            };
            para[0].Value = add_entity.VLIST_ID;
            para[1].Value = add_entity.VLIST_NAME;

            return Oracle.GetOracle().ExecSql(sql, para);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            EapValueList edit_entity = GetEditEntity();

            if (edit_entity == null)
            {
                return;
            }

            if (em == EditMode.Add)
            {
                string ret_add = Bll.GetBll().AddValueList(edit_entity);
                if (ret_add != string.Empty)
                {
                    if (ret_add.Split(':')[0] == "ORA-00001")
                    {
                        Func.ShowMessage(MessageType.Error, "数据添加失败,原因:值列表ID[" + edit_entity.VLIST_ID + "]已经存在");
                        return;
                    }

                    Func.ShowMessage(MessageType.Error, "数据添加失败,原因[" + ret_add + "]");
                    return;
                }
                //写日志
                Log.Write(MessageType.Information, "添加值列表数据成功,值列表ID[" + edit_entity.VLIST_ID + "]", Config.GetConfig().user.USER_ID);
                Func.ShowMessage(MessageType.Information, "数据添加成功!");
                this.Close();
            }
            else if (em == EditMode.Edit)
            {
                string ret_edit = Bll.GetBll().ModifyValueList(edit_entity);
                if (ret_edit != string.Empty)
                {
                    Func.ShowMessage(MessageType.Error, "数据修改失败,原因[" + ret_edit + "]");
                    return;
                }
                //写日志
                Log.Write(MessageType.Information, "修改值列表数据成功,值列表ID[" + edit_entity.VLIST_ID + "]", Config.GetConfig().user.USER_ID);
                Func.ShowMessage(MessageType.Information, "数据修改成功!");
                this.Close();
            }
        }
        private EapValueList GetEditEntity()
        {
            EapValueList ret_entity = new EapValueList();

            ret_entity.VLIST_ID = txtVListId.Text.Trim();
            if (Func.StringLength(ret_entity.VLIST_ID) == 0 || Func.StringLength(ret_entity.VLIST_ID) > 20)
            {
                Func.ShowMessage(MessageType.Warning, "值列表ID不能为空或长度超长!");
                return(null);
            }

            ret_entity.VLIST_NAME = txtVListName.Text.Trim();
            if (Func.StringLength(ret_entity.VLIST_NAME) == 0 || Func.StringLength(ret_entity.VLIST_NAME) > 50)
            {
                Func.ShowMessage(MessageType.Warning, "值列表名称不能为空或长度超长!");
                return(null);
            }

            return(ret_entity);
        }
Beispiel #10
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            if (dgvVList.SelectedCells.Count == 0)
            {
                Func.ShowMessage(MessageType.Warning, "没有选中删除数据!");
                return;
            }

            if (!Func.ShowQuestion("确认要删除该记录数据?"))
            {
                return;
            }

            EapValueList del_entity = new EapValueList();
            int          iRowIdex   = dgvVList.CurrentCell.RowIndex;

            del_entity.VLIST_ID   = dgvVList.Rows[iRowIdex].Cells["VLIST_ID"].Value.ToString();
            del_entity.VLIST_NAME = dgvVList.Rows[iRowIdex].Cells["VLIST_NAME"].Value.ToString();

            string str = Bll.GetBll().DelValueList(del_entity.VLIST_ID);

            if (str != string.Empty)
            {
                if (str.Split(':')[0] == "ORA-02292")
                {
                    Func.ShowMessage(MessageType.Error, "删除值列表数据失败!原因:值列表ID[" + del_entity.VLIST_ID + "]存在明细列表数据,无法删除");
                    return;
                }

                Func.ShowMessage(MessageType.Error, "删除值列表数据失败!原因[" + str + "]");
            }
            else
            {
                //写日志
                Log.Write(MessageType.Information, "删除值列表数据成功,值列表ID[" + del_entity.VLIST_ID + "],值列表名称[" + del_entity.VLIST_NAME + "]", Config.GetConfig().user.USER_ID);
                Func.ShowMessage(MessageType.Information, "值列表数据删除成功");

                page.PageNo = 1;
                BindData();
            }
        }
Beispiel #11
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (dgvVList.SelectedCells.Count == 0)
            {
                Func.ShowMessage(MessageType.Warning, "没有选中值列表数据");
                return;
            }

            EapValueList entity = new EapValueList();

            int iRowIndex = dgvVList.CurrentCell.RowIndex;

            entity.VLIST_ID   = dgvVList.Rows[iRowIndex].Cells["VLIST_ID"].Value.ToString();
            entity.VLIST_NAME = dgvVList.Rows[iRowIndex].Cells["VLIST_NAME"].Value.ToString();

            frmValueListManageEdit frm = new frmValueListManageEdit(EditMode.Edit, entity);

            frm.MdiParent   = this.MdiParent;
            frm.WindowState = FormWindowState.Maximized;
            frm.Show();
        }
Beispiel #12
0
        /// <summary>
        /// 查询值列表数据
        /// </summary>
        /// <param name="query_entity">查询条件实体</param>
        /// <param name="pageno">要查询的页</param>
        /// <param name="pagesize">页大小</param>
        /// <param name="icnt">结果记录条数</param>
        /// <returns>值列表数据清单</returns>
        internal List<EapValueList> QueryValueList(EapValueList query_entity, int pno, int psize, out int icnt)
        {
            int para_count = 0;
            StringBuilder sql = new StringBuilder(200);
            sql.Append("select T.VLIST_ID,T.VLIST_NAME from T_EAP_VALUE_LIST T where 1=1");
            if (query_entity.VLIST_ID != string.Empty)
            {
                sql.Append(" and T.VLIST_ID like '%'||:VLIST_ID||'%'");
                para_count++;
            }
            if (query_entity.VLIST_NAME != string.Empty)
            {
                sql.Append(" and T.VLIST_NAME like '%'||:VLIST_NAME||'%'");
                para_count++;
            }
            sql.Append(" order by T.VLIST_ID");


            OracleParameter[] para = new OracleParameter[para_count];

            for (int i = 0; i < para_count; i++)
            {
                if (query_entity.VLIST_ID != string.Empty)
                {
                    para[i] = new OracleParameter(":VLIST_ID", OracleType.VarChar);
                    para[i].Value = query_entity.VLIST_ID;
                    query_entity.VLIST_ID = string.Empty;
                    continue;
                }
                if (query_entity.VLIST_NAME != string.Empty)
                {
                    para[i] = new OracleParameter(":VLIST_NAME", OracleType.VarChar);
                    para[i].Value = query_entity.VLIST_NAME;
                    query_entity.VLIST_NAME = string.Empty;
                    continue;
                }
            }

            return Oracle.GetOracle().QueryToPage<EapValueList>(sql, para, pno, psize, out icnt);
        }